Skip to content

FLAMEGPU/FLAMEGPU2_python_sugarscape_tutorial

Repository files navigation

FLAME GPU 2 Sugarscape Tutorial (Python 3)

This repository provides a Tutorial on using the Python 3 interface for FLAME GPU 2.

Tutorial

The tutorial is a Jupyter notebook which uses a Sugarscape model to demonstrate how models can be described and implemented using FLAME GPU 2's python interface, and then simulated to visualise the emergent behaviour of the model.

A number of exercises are presented to change and extend the behaviour of the model and observe the differences. Solutions are provided.

Instructor-led Tutorials

Instructor-led delivery of this tutorial will typically use hosted Jupyter solutions, such as cloud instances on InstanceHub or through Google Colab.

Please refer to the instructions provided during by the instructor(s) on how to access the tutorial in this case.

If you are interested in an instructor-led delivery of this tutorial, please contact us.

This tutorial was previously delivered at:

Self-paced Tutorials

If you wish to follow this tutorial at your own pace, you can run this tutorial locally.

Google Colab

You can launch the notebook in Colab using the link below. Some additional steps are required within the notebook which are described.

Running this Tutorial Locally

Note: The notebook currently assumes you are using python 3.10-3.14, with CUDA 12.0-12.9 on a Linux x86_64 machine.

To run this tutorial locally you will require:

  • Python >= 3.10
  • CUDA >= 12.0 and a Compute Capability >= 5.0 NVIDIA GPU
  • Linux with glibc >= 2.28
    • Windows support/instructions will be introduced at a later date
  • An x86_64 CPU
    • Including NVRTC
    • If you wish to run this tutorial on an ppc64le or arm64-sbsa based-system, you will need to build pyflamegpu from source. Please see the main FLAMEGPU/FLAMEGPU2 repository for instructions on building from source.
  • NodeJS installed to support interactive plotting
  1. Clone the repository if you have not already done so

  2. Create a new python venv or conda environment and activate it

    # I.e. if using a venv on linux
    python3 -m venv venv
    source venv/bin/activate
  3. Install Jupyterlab (or jupyter notebook)

    # I.e. if using a venv and pip
    python3 -m pip install -U jupyterlab matplotlib ipympl notebook
  4. Launch jupyter lab or the legacy jupyter notebook interface and open FLAME_GPU_2_python_tutorial.ipynb

    # Using jupyter lab
    jupyter lab FLAMEGPU-tutorial.ipynb
    # Using jupyter notebook
    jupyter notebook FLAMEGPU-tutorial.ipynb

Known Issues

Ipympl backend

Colab also has a known bug with ipympl which is used for interactive plotting of the results. Support for ipympl is planned in a future release. For now a work-around is included which requires restarting the kernel.

About

Sugarscape tutorial in pyflamegpu

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published