Docsity

STriTuVaD UISS FLAME GPU Simulator: Model, Implementation, and Running Instructions, Study notes of Computer Graphics

Partial preview of the text

Download STriTuVaD UISS FLAME GPU Simulator: Model, Implementation, and Running Instructions and more Study notes Computer Graphics in PDF only on Docsity!

STriTuVaD UISS FLAME GPU

Nov 19, 2019

ii

STriTuVaD UISS FLAME GPU

This is the public facing documentation for the FLAME GPU 1.5 implementation of the UISS 6 simulator, as part of

the STriTuVaD H2020 project.

Contents: 1

CHAPTER 1

Model and Implementation

The model is based on UISS 6.0, developed and provided by Francesco Pappalardo et Al. at the University of Catania.

The current implementation is built using a modified version of FLAME GPU 1.5, which imposes some restrictions on

how much of the original model can be directly reproduced (to be addressed with a FLAME GPU 2 implementation).

1.1 Model

The model contains agents located at discrete locations within a toroidal, hexagonal lattice. Each lattice site contains

quantities of chemicals, and some lattice-site behaviours occur (such as diffusion).

The agents include:

  • BCell
  • THelper
  • TCytotoxic
  • DendricCell
  • EpiteliaCell
  • MCell
  • PlasmaCell
  • NKCell
  • ICList
  • AntibodyList
  • AntigenList

STriTuVaD UISS FLAME GPU

1.2 Implementation

The current implementation is based on UISS 6.0, using a modified version of FLAME GPU 1.5.

1.2.1 FLAME GPU

FLAME GPU is a high performance Graphics Processing Unit (GPU) extension to the FLAME framework for Agent

Based Modelling (ABM). It provides a mapping between a formal agent specifications with C based scripting and

optimised CUDA code.

Users formally describe the model using the XMLModelFile (following provided XML Schema) and implement be-

haviours in CUDA C, using the pragmatically generated API. This abstracts the complexities of GPU programming

away from the modeller.

FLAME GPU is open source, and can be found on github at FLAMEGPU/FLAMEGPU.

Documentation is also host both on github at FLAMEGPU/docs and online at http://docs.flamegpu.com/en/master/.

Modifications

To enable the model to be implemented using FLAME GPU, modifications were made to FLAME GPU to enable

certain behaviours not previously required by FLAME GPU models.

Currently these are implemented in a branch of a separate repository (uiss-6 branch in ptheywood/flamegpu), as they

are not yet ready for general purpose use.

1.2.2 XMLModelFile

The XMLModelFile.xml in the source repository is the formal definition of the model. It contains:

  • Parameters of the Model
  • Agent descriptions
  • Message List definitions
  • Agent behaviour descriptions
  • Directed Acyclic Graph (DAG) of per-iteration behaviour

1.2.3 Functions Files

As the model is complex, rather than using a single CUDA C file, functions.c, for all agent behaviour implementation,

it is split across several implementation files (.h, .c, .cuh, .cu), in the src/model/ directory. Further information can be

found in the source repository.

1.2.4 Input File

FLAME GPU simulations expect and XML file describing the initial state of the simulation as an input file.

For the UISS implementation, this is an XML formatted version of the UISS 6 input file format. This can be converted

automatically using one of the provided tools·

4 Chapter 1. Model and Implementation

STriTuVaD UISS FLAME GPU

6 Chapter 1. Model and Implementation

CHAPTER 2

Running the Simulator

To run the FLAME GPU UISS simulator, the code must first be compiled to be executed on an NVIDIA GPU.

See the source repository contains more precise requirements and instructions.

2.1 Requirements (Linux)

  • CUDA 8.0 or greater
  • GCC 7 or greater
  • xsltproc
  • xmllint
  • make
  • git

To run FLAME GPU simulations a Compute Capability 3.0 or greater Nvidia GPU is required, with an appropriate

CUDA driver.

2.2 Compilation

To build the executable, navigate into the relevant source directory and run make console.

Other options are available, as described in the source repository.

2.3 Running the Simulator

FLAME GPU Console mode simulations take several arguments as follows:

CHAPTER 3

Troubleshooting

The source code for the FLAME GPU implementation can be found on github at StrituvadModelling/strituvad-

uiss-flamegpu. This is a private repository, if you do not have access please contact [email protected] or

[email protected].

3.1 Bugs Reports and Feature Requests

As with all software you may encounter crashes, bugs or missing features.

Bugs, Feature Requests and source-related discussion should happen using the github issue tracker.

An issue can then be created via New issue, adding an appropriate title and a description of the problem. To improve

the chances that we can address the issue, please include:

  • The input file (you can attach files to issues)
  • The relevant commands used to launch the executable
  • Observed behaviour
  • Expected behaviour

STriTuVaD UISS FLAME GPU

10 Chapter 3. Troubleshooting

STriTuVaD UISS FLAME GPU

4.2 Input File Mutation Script

As the UISS model is highly stochastic, many runs using different RNG seeds are required.

To avoid doing this by hand, a script was developed to automate this process.

Usage is as follows:

python3 gendat.py --help usage: gendat.py [-h] [-f FILENAME] [-p PARAMETER [PARAMETER ...]] [-o OUTPUT] [--list-parameters] [-v]

UISS Datafile modifier / Randomiser

optional arguments: -h, --help show this help message and exit -o OUTPUT, --output OUTPUT Directory for output files. Defaults to . --list-parameters list the parameters of the program -v, --verbose print verbose output

required arguments: -f FILENAME, --filename FILENAME template for the parameter file

Note: This may be extended in the future to simplify parameter sweeps.

4.3 Output File Visualisation Script

Along side the existing gnuplot script for visualising populations, a python script was developed to support the visual-

isations of many runs, and view the range of outputs capture.

Usage is as follows:

python3 uiss-plot.py --help usage: uiss-plot.py [-h] [-f FILES [FILES ...]] [-s MIN MAX] [-o OUTPUT] [--verbose]

Tool to plot one or more UISS output files as figure(s)

optional arguments: -h, --help show this help message and exit -f FILES [FILES ...], --files FILES [FILES ...] Files to plot. One graph per passed argument -s MIN MAX, --shade MIN MAX Min, max value pairs for shaded regions. -o OUTPUT, --output OUTPUT path to output file --verbose Verbose output

12 Chapter 4. Tools

STriTuVaD UISS FLAME GPU

4.4 TUOS HPC Job Submission Scripts

Batch job submission scripts are used to submit jobs to HPC systems, such as ShARC and Bessemer at the university

of Sheffield.

Example submission scripts are provided for each job submission system.

4.4.1 SGE (ShARC)

ShARC (and Iceberg) at the University of Sheffield use the SGE job submission system.

The tools sub-repository contains example job submissions scripts to compiler the FLAME GPU UISS implementa-

tion, and run the 5 example datafiles.

Alternatively it is possible to use interactive sessions.

Compilation via SGE

Compilation via SGE can occur using the tools/sge/compile.sharc.sh job submissions script.

Navgate to the tools/sge directory

cd strituvad-uiss-flamegpu/tools/sge/

Submit the batch job to compile the code

qsub compile.sharc.sh

Ensure that the job has finished before running the model

qstat

Alternatively this can be ran within an interactive sesssion.

Get an interactive session, no GPU required

qrshx

Navgate to the tools/sge directory

cd strituvad-uiss-flamegpu/tools/sge/

Run the compilation script

./compile.sharc.sh

Note: Compilation does not require a GPU.

Execution via SGE

To run an example, once the executable has been compiled (see above) the appropriate job submission script can be

submit.

I.e. for the datafile_1 example, with a single invocation of a single seed

Navgate to the tools/sge directory

cd strituvad-uiss-flamegpu/tools/sge/

Submit the batch job to compile the code

qsub datafile_1.sharc.sh

Alternatively this can be executed in a GPU interactive session, although this is not reccomended.

4.4. TUOS HPC Job Submission Scripts 13

STriTuVaD UISS FLAME GPU

Note: Compilation does not require a GPU.

Execution via Slurm

To run an example, once the executable has been compiled (see above) the appropriate job submission script can be

submit.

I.e. for the datafile_1 example, with a single invocation of a single seed

Navgate to the tools/slurm directory

cd strituvad-uiss-flamegpu/tools/slurm/

Submit the batch job to compile the code

sbatch datafile_1.bessemer.sh

Alternatively this can be executed in a GPU interactive session, although this is not reccomended.

Get a GPU interactive session

srun --pty bash -i --gres=gpu:1 --partition=gpu

Navigate to the slurm directory

cd strituvad-uiss-flamegpu/tools/slurm/

Run the appropriate script (or runs the commands contained within manually)

./datafile_1.bessemer.sh

This will place generated .out files in the iterations/datafile_1 directory, which can be retrieved using

scp.

From your local machine, replacing $CICS_USERNAME with your cics username

scp -r [email protected]:~/strituvad-uiss-flamegpu/simulator/ ˓→iterations/datafile_1/ * .dat path/to/local/destination

Checking job progress on Slurm

To check the progress of your jobs via slurm, use the squeue command

squeue -u $USER

4.4. TUOS HPC Job Submission Scripts 15

STriTuVaD UISS FLAME GPU

16 Chapter 4. Tools