FLAMEGPU / FLAMEGPU2

FLAME GPU 2 is a GPU accelerated agent based modelling framework for CUDA C++ and Python
https://flamegpu.com
MIT License
105 stars 20 forks source link

Mutable / simulation-owned communication specialisation properties #710

Open ptheywood opened 2 years ago

ptheywood commented 2 years ago

Specialised communication patterns currently have properties which are fixed for a given model at simulation (/ensemble) construction time, such as the number of buckets, the min/max bounds and communcation radii for spatial communication.

This has 2 downsides:

  1. Independent simulations within an ensemble must all use the same communication bounds / bucket counts
    • Harming performance for some models within an ensemble which use not fit for purpose comm radii
  2. The communcation bounds must be the same for the lifetime of the simulation.
    • For simulations which may grow over time this may be sub optimial for performance (initially, or if the communicaiton bounds are set too low)

Ensembles

Ensembles are a practical solution for optimising device utilsiaton when many simulations are required, with different parameters.

I.e. boids wiht different environment scales or communciation radii.

The current workaround is for the communication bounds / radii to be defined as the largest required by the ensemble. Individual simulations which use smaller communication radii must iterate all the messages in the larger bin, and the agent functions must include a a distance check to ensure only the relevant messages for that simulation are required.

This will have a significant performance impact where the change in radii is sigcant.

Bounds over simualtion lifetime

The construction PBOs or similar messaging data structures once messages have been output can be expensive for large numbers of bins, which is wasted effort / time if a lot of the space is currently empty.

For instrance, a cell simulation where iniitally only a small portion of the total potential volume is occupuied a significant number of bins will be empty, leading to expensive scans / iteration of empty bins.

If the number of bins were to change over the duration of the simulation, would improve performance.

Feature Request(s)


edit

This may also require adding the ability to query the message properties at runtime (i.e. get the bounds / radius).

If changing shape is allowed during model execution, this would either need clearly documenting that the current message data is purged, otherwise pbm reconstruction would be requried (for spatial) which is not free.

Robadob commented 2 years ago

Jack A was trying to do something which required this.