Class CUDAEnsemble

Nested Relationships

Nested Types

Class Documentation

class CUDAEnsemble

Manager for automatically executing multiple copies of a model simultaneously This can be used to conveniently execute parameter sweeps and batch validation runs

Public Functions

explicit CUDAEnsemble(const ModelDescription &model, int argc = 0, const char **argv = nullptr)

Initialise CUDA Ensemble If provided, you can pass runtime arguments to this constructor, to automatically call initialise() This is not required, you can call initialise() manually later, or not at all.

Parameters
  • model – The model description to initialise the runner to execute

  • argc – Runtime argument count

  • argv – Runtime argument list ptr

~CUDAEnsemble()

Inverse operation of constructor

unsigned int simulate(const RunPlanVector &plan)

Execute the ensemble of simulations. This call will normally block until all simulations have completed, however may exit early if an error occurs with the error_level configuration set to Fast

Parameters

plan – The plan of individual runs to execute during the ensemble

Returns

0 on success, otherwise the number of runs which reported errors and failed

inline EnsembleConfig &Config()
Returns

A mutable reference to the ensemble configuration struct

inline const EnsembleConfig &getConfig() const
Returns

An immutable reference to the ensemble configuration struct

void initialise(int argc, const char **argv)
void setStepLog(const StepLoggingConfig &stepConfig)

Configure which step data should be logged

Note

This must be for the same model description hierarchy as the CUDAEnsemble

Parameters

stepConfig – The step logging config for the CUDAEnsemble

void setExitLog(const LoggingConfig &exitConfig)

Configure which exit data should be logged

Note

This must be for the same model description hierarchy as the CUDAEnsemble

Parameters

exitConfig – The logging config for the CUDAEnsemble

inline double getEnsembleElapsedTime() const

Get the duration of the last call to simulate() in milliseconds.

const std::vector<RunLog> &getLogs()

Return the list of logs collected from the last call to simulate()

struct EnsembleConfig

Execution config for running a CUDAEnsemble

Public Types

enum ErrorLevel

Values:

enumerator Off
enumerator Slow
enumerator Fast

Public Members

std::string out_directory = ""

Directory to store output data (primarily logs) Defaults to “” (the working directory, no subdirectory)

std::string out_format = "json"

Output format This must be a supported format e.g.: “json” or “xml” Defaults to “json”

unsigned int concurrent_runs = 4

The maximum number of concurrent runs Defaults to 4

std::set<int> devices

The CUDA device ids of devices to be used If this is left empty, all available devices will be used Defaults to empty set (all available devices)

flamegpu::Verbosity verbosity = Verbosity::Default

If true progress logging to stdout will be suppressed Defaults to false

bool silence_unknown_args = false

Suppresses warning for unknown arguments passed to the CUDAEnsemble during initialisation. Useful for when arguments are passed to user defined models but should not be considered by the FLAME GPU API.

bool timing = false

If true, the total runtime for the ensemble will be printed to stdout at completion This is independent of the EnsembleConfig::quiet Defaults to false

ErrorLevel error_level = Slow

Off: Runs which fail do not cause an exception to be raised. Failed runs must be probed manually via checking the return value of calls to CUDAEnsemble::simulate() Slow: If any runs fail, an EnsembleException will be raised after all runs have been attempted, before CUDAEnsemble::simulate() returns. Fast: An EnsembleException will be raised as soon as a failed run is detected, cancelling remaining runs. Defaults to Slow

bool truncate_log_files = false

If true, all log files created will truncate any existing files with the same name If false, an exception will be raised when a log file already exists

const bool block_standby = false

Prevents the computer from entering standby whilst the ensemble is running

Note

This feature is currently only supported by Windows builds.