Flame

Overview

FLAME is a flexible and generic agent-based modelling platform that can be used to develop models and simulations for complex system applications in many areas such as economics, biology and social sciences, to name a few. It generates a complete agent-based application that can be compiled and deployed on many computing systems ranging from laptops to distributed high performance super computing environments.

Flame consists of an executable app named xparser and a library named libmboard. The xparser app is used to generate C source code from your model description. You code is then compiled and linked against the libmboard library.

Version 0.17.1 of xparser (a component of flame) is installed on the CSF and this is the number we use to version flame.
Version 0.3.1 of libmboard (the other component of flame) is installed. Serial and parallel (MPI) versions of this are available.

Restrictions on use

There are no restrictions on accessing flame on the CSF.

Set up procedure

We now recommend loading modulefiles within your jobscript so that you have a full record of how the job was run. See the example jobscript below for how to do this. Alternatively, you may load modulefiles on the login node and let the job inherit these settings.

Load one of the following modulefiles:

# The flame modulefile will set up xparser and libmboard

module load apps/gcc/flame/0.17.1           # Serial version of libmboard
module load apps/gcc/flame/0.17.1-mpi       # Serial and parallel versions of libmboard

Running the application

Please do not run flame simulations on the login node. You may run the xparser command and gcc compiler to generate your simulation executable. Jobs should be submitted to the compute nodes via batch.

Compiling your model

The following commands show how to compile a model before running it as a batch job (see below). We use one of the FLAME tutorial models that have already been downloaded. You can run the following commands on the login node:

# Work in scratch
mkdir ~/scratch/flame
cd ~/scratch/flame

# Load the MPI modulefile that supports serial and parallel usage
module load apps/gcc/flame/0.17.1-mpi

# Copy the already-downloaded tutorials to your current directory
cp -r $FLAME_TUTORIALS .
cd tutorial_models/model_01/

# Generate the serial (1-core) final production (non-debug) source code, then compile (make)
xparser -s -f model_01.xml
make

# To compile the parallel version you would use
xparser -p -f model_01.xml
make

# You will now have an executable application named 'main'
ls -l main

You can now run the main application in a CSF job – please see below.

Serial batch job submission

The following examples assume you have compiled your FLAME model and therefore have an executable named main in the current directory.

Create a batch submission script (which will load the modulefile in the jobscript), for example:

#!/bin/bash --login
#$ -cwd             # Job will run from the current directory
                    # NO -V line - we load modulefiles in the jobscript

# This is the serial-only version of flame
module load apps/gcc/flame/0.17.1

# Here we run 100 iterations with an initial state described in 0.xml
# using geometric (-g) rather than round-robin (-r) partitioning and we
# output every 10 iterations
./main 100 0.xml -g -f 10

Submit the jobscript using:

qsub scriptname

where scriptname is the name of your jobscript.

Single-node parallel batch job submission

You must have generate the parallel version of the model using xparser -p (see earlier).

Create a batch submission script (which will load the modulefile in the jobscript), for example:

#!/bin/bash --login
#$ -pe smp.pe 8     # 8 cores (can be 2--32) is also the number of FLAME partitions
#$ -cwd             # Job will run from the current directory
                    # NO -V line - we load modulefiles in the jobscript

# This is the serial and parallel version of flame
module load apps/gcc/flame/0.17.1-mpi

# Here we run 100 iterations with an initial state described in 0.xml
# using geometric (-g) rather than round-robin (-r) partitioning and we
# output every 10 iterations.
# We will use $NSLOTS partitions, where $NSLOTS is automatically set to the number of
# cores requested above. You must use $NSLOTS cores, no more!!
mpirun -np $NSLOTS ./main 100 0.xml -g -f 10

Submit the jobscript using:

qsub scriptname

where scriptname is the name of your jobscript.

Multi-node parallel batch job submission

You must have generate the parallel version of the model using xparser -p (see earlier).

Create a batch submission script (which will load the modulefile in the jobscript), for example:

#!/bin/bash --login
#$ -pe mpi-24-ib.pe 48     # 48 cores (48 or more in multiples of 24) - the number of FLAME partitions
#$ -cwd                    # Job will run from the current directory
                           # NO -V line - we load modulefiles in the jobscript

# This is the serial and parallel version of flame
module load apps/gcc/flame/0.17.1

# Here we run 100 iterations with an initial state described in 0.xml
# using geometric (-g) rather than round-robin (-r) partitioning and we
# output every 10 iterations.
# We will use $NSLOTS partitions, where $NSLOTS is automatically set to the number of
# cores requested above. You must use $NSLOTS cores, no more!!
mpirun -np $NSLOTS ./main 100 0.xml -g -f 10

Submit the jobscript using:

qsub scriptname

where scriptname is the name of your jobscript.

Further info

Updates

None.

Last modified on March 16, 2021 at 3:38 pm by George Leaver