Class SimRunner

Inheritance Relationships

Base Type

Class Documentation

class SimRunner : public flamegpu::detail::AbstractSimRunner

A thread class which executes RunPlans on a single GPU

This class is used by CUDAEnsemble, it creates one SimRunner instance per GPU, each executes in a separate thread. There may be multiple instances per GPU, if running small models on large GPUs.

Public Functions

SimRunner(const std::shared_ptr<const ModelData> _model, std::atomic<unsigned int> &_err_ct, std::atomic<unsigned int> &_next_run, const RunPlanVector &_plans, std::shared_ptr<const StepLoggingConfig> _step_log_config, std::shared_ptr<const LoggingConfig> _exit_log_config, int _device_id, unsigned int _runner_id, flamegpu::Verbosity _verbosity, bool _fail_fast, std::map<unsigned int, RunLog> &run_logs, std::queue<unsigned int> &log_export_queue, std::mutex &log_export_queue_mutex, std::condition_variable &log_export_queue_cdn, std::vector<ErrorDetail> &err_detail, unsigned int _total_runners, bool _isSWIG)

Constructor, creates and initialise a new SimRunner

Parameters:
  • _model – A copy of the ModelDescription hierarchy for the RunPlanVector, this is used to create the CUDASimulation instances.

  • _err_ct – Reference to an atomic integer for tracking how many errors have occurred

  • _next_run – Atomic counter for safely selecting the next run plan to execute across multiple threads

  • _plans – The vector of run plans to be executed by the ensemble

  • _step_log_config – The config of which data should be logged each step

  • _exit_log_config – The config of which data should be logged at run exit

  • _device_id – The GPU that all runs should execute on

  • _runner_id – A unique index assigned to the runner

  • _verbosity – Verbosity level (Verbosity::Quiet, Verbosity::Default, Verbosity::Verbose)

  • _fail_fast – If true, the SimRunner will kill other runners and throw an exception on error

  • run_logs – Reference to the vector to store generate run logs

  • log_export_queue – The queue of logs to exported to disk

  • log_export_queue_mutex – This mutex must be locked to access log_export_queue

  • log_export_queue_cdn – The condition is notified every time a log has been added to the queue

  • err_detail – Structure to store error details on fast failure for main thread rethrow

  • _total_runners – Total number of runners executing

  • _isSWIG – Flag denoting whether it’s a Python build of FLAMEGPU

virtual void main() override

SimRunner loop with shared next_run atomic