DQCsim
|
Wrapper class for configuring a simulation. More...
Public Member Functions | |
SimulationConfiguration (HandleIndex handle) noexcept | |
Wraps the given simulation configuration handle. More... | |
SimulationConfiguration () | |
Creates a new simulation configuration. | |
SimulationConfiguration (const SimulationConfiguration &)=delete | |
void | operator= (const SimulationConfiguration &)=delete |
SimulationConfiguration (SimulationConfiguration &&)=default | |
Default move constructor. | |
SimulationConfiguration & | operator= (SimulationConfiguration &&)=default |
Default move assignment. | |
void | add_plugin (PluginConfiguration &&plugin) |
Appends a plugin to a simulation configuration. More... | |
SimulationConfiguration && | with_plugin (PluginConfiguration &&plugin) |
Appends a plugin to a simulation configuration (builder pattern). More... | |
void | set_seed (uint64_t seed) |
Configures the random seed that the simulation should use. More... | |
SimulationConfiguration && | with_seed (uint64_t seed) |
Configures the random seed that the simulation should use (builder pattern). More... | |
uint64_t | get_seed () const noexcept |
Returns the configured random seed. More... | |
void | set_reproduction_style (PathStyle style) |
Sets the path style used when writing reproduction files. More... | |
SimulationConfiguration && | with_reproduction_style (PathStyle style) |
Sets the path style used when writing reproduction files (builder pattern). More... | |
PathStyle | get_reproduction_style () const |
Returns the path style used when writing reproduction files. More... | |
void | disable_reproduction () |
Disables the reproduction logging system. More... | |
SimulationConfiguration && | without_reproduction () |
Disables the reproduction logging system (builder pattern). More... | |
void | set_dqcsim_verbosity (Loglevel level) |
Configures the logging verbosity for DQCsim's own messages. More... | |
SimulationConfiguration && | with_dqcsim_verbosity (Loglevel level) |
Configures the logging verbosity for DQCsim's own messages (builder pattern). More... | |
Loglevel | get_dqcsim_verbosity () const |
Returns the configured verbosity for DQCsim's own messages. More... | |
void | set_stderr_verbosity (Loglevel level) |
Configures the stderr sink verbosity for a simulation. More... | |
SimulationConfiguration && | with_stderr_verbosity (Loglevel level) |
Configures the stderr sink verbosity for a simulation (builder pattern). More... | |
Loglevel | get_stderr_verbosity () const |
Returns the configured stderr sink verbosity for a simulation. More... | |
void | log_tee (Loglevel verbosity, const std::string &filename) |
Configures DQCsim to also output its log messages to a file. More... | |
SimulationConfiguration && | with_log_tee (Loglevel verbosity, const std::string &filename) |
Configures DQCsim to also output its log messages to a file (builder pattern). More... | |
void | set_log_callback (Loglevel verbosity, const callback::Log &data) |
Configures DQCsim to also output its log messages to callback function. More... | |
void | set_log_callback (Loglevel verbosity, callback::Log &&data) |
Configures DQCsim to also output its log messages to callback function. More... | |
template<typename... Args> | |
void | set_log_callback (Loglevel verbosity, Args... args) |
Configures DQCsim to also output its log messages to callback function. More... | |
SimulationConfiguration && | with_log_callback (Loglevel verbosity, const callback::Log &data) |
Configures DQCsim to also output its log messages to callback function (builder pattern). More... | |
SimulationConfiguration && | with_log_callback (Loglevel verbosity, callback::Log &&data) |
Configures DQCsim to also output its log messages to callback function (builder pattern). More... | |
template<typename... Args> | |
SimulationConfiguration && | with_log_callback (Loglevel verbosity, Args... args) |
Configures DQCsim to also output its log messages to callback function (builder pattern). More... | |
Simulation | build () |
Constructs the DQCsim simulation from this configuration object. More... | |
Simulation | run () |
Constructs the DQCsim simulation from this configuration object, and runs a program on the simulated accelerator without an argument. More... | |
Simulation | run (ArbData &&data) |
Constructs the DQCsim simulation from this configuration object, and runs a program on the simulated accelerator with the given ArbData argument (passed by move). More... | |
Simulation | run (const ArbData &data) |
Constructs the DQCsim simulation from this configuration object, and runs a program on the simulated accelerator with the given ArbData argument (passed by copy). More... | |
Public Member Functions inherited from dqcsim::wrap::Handle | |
Handle () noexcept | |
Constructs an empty wrapper. More... | |
Handle (HandleIndex handle) noexcept | |
Wraps the given raw handle. More... | |
virtual | ~Handle () noexcept |
Delete the handle and its wrapper. | |
void | free () |
Explicitly delete the handle, allowing errors to be caught. More... | |
bool | is_valid () const noexcept |
Returns whether this wrapper (still) contains a valid handle. More... | |
HandleIndex | get_handle () const noexcept |
Returns the raw handle without relinquishing ownership. More... | |
HandleIndex | take_handle () noexcept |
Returns the raw handle and relinquishes ownership. More... | |
Handle (const Handle &)=delete | |
void | operator= (const Handle &)=delete |
Handle (Handle &&src) | |
Move constructor; simply moves ownership of the handle from the source object to the constructed object. More... | |
Handle & | operator= (Handle &&src) |
Move constructor; simply moves ownership of the handle from the source object to the assignment target. More... | |
std::string | dump () const |
Returns a string containing a debug dump of the handle. More... | |
HandleType | type () const |
Returns the type of this handle. More... | |
Additional Inherited Members | |
Protected Attributes inherited from dqcsim::wrap::Handle | |
HandleIndex | handle |
The wrapped handle. | |
|
inlinenoexcept |
|
inline |
Appends a plugin to a simulation configuration.
Frontend and backend plugins will automatically be inserted at the front and back of the pipeline when the simulation is created. Operators are inserted in front to back order. This function does not provide safeguards against multiple frontends/backends; such errors will only be reported when the simulation is started.
plugin | The plugin configuration object. If not constructed in-place, this must be std::move() d into this method. |
std::runtime_error | When the simulation or plugin configuration handle is invalid for some reason. |
|
inline |
Appends a plugin to a simulation configuration (builder pattern).
plugin | The plugin configuration object. If not constructed in-place, this must be std::move() d into this method. |
&self
, to continue building. std::runtime_error | When the simulation or plugin configuration handle is invalid for some reason. |
|
inline |
|
inline |
Configures the random seed that the simulation should use (builder pattern).
Note that the seed is randomized by default.
seed | The random seed to use. |
&self
, to continue building. std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inlinenoexcept |
|
inline |
Sets the path style used when writing reproduction files.
By default, the generated reproduction file will specify the plugin executable and script paths as they were generated or specified. However, depending on how you intend to reproduce the simulation later, you may want purely relative or purely absolute paths instead. This function sets the style used.
style | The path style to use. |
std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Sets the path style used when writing reproduction files (builder pattern).
By default, the generated reproduction file will specify the plugin executable and script paths as they were generated or specified. However, depending on how you intend to reproduce the simulation later, you may want purely relative or purely absolute paths instead. This function sets the style used.
style | The path style to use. |
&self
, to continue building. std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
|
inline |
|
inline |
Disables the reproduction logging system (builder pattern).
Calling this will disable the warnings printed when a simulation that cannot be reproduced is constructed.
&self
, to continue building. std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
|
inline |
Configures the logging verbosity for DQCsim's own messages (builder pattern).
level | The verbosity level for DQCsim's own messages. |
&self
, to continue building. std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
|
inline |
Configures the stderr sink verbosity for a simulation.
That is, the minimum loglevel that a messages needs to have for it to be printed to stderr.
level | The verbosity level to set. |
std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Configures the stderr sink verbosity for a simulation (builder pattern).
That is, the minimum loglevel that a messages needs to have for it to be printed to stderr.
level | The verbosity level to set. |
&self
, to continue building. std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Returns the configured stderr sink verbosity for a simulation.
That is, the minimum loglevel that a messages needs to have for it to be printed to stderr.
std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
|
inline |
Configures DQCsim to also output its log messages to a file (builder pattern).
verbosity | The logging verbosity for the tee file. |
filename | The name of the file to log to. |
&self
, to continue building. std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Configures DQCsim to also output its log messages to callback function.
verbosity
specifies the minimum importance of a message required for the callback to be called. data
is the callback information object, taken by copy by this function. Refer to callback::Log
for more information.
verbosity | The minimum loglevel needed for a log message for the callback to be called. |
data | The wrapper object for the log callback. |
std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Configures DQCsim to also output its log messages to callback function.
verbosity
specifies the minimum importance of a message required for the callback to be called. data
is the callback information object, taken by move by this function. Refer to callback::Log
for more information.
verbosity | The minimum loglevel needed for a log message for the callback to be called. |
data | The wrapper object for the log callback. |
std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Configures DQCsim to also output its log messages to callback function.
verbosity
specifies the minimum importance of a message required for the callback to be called. The callback information object is constructed in place from the remaining arguments. Refer to callback::Log
for more information.
verbosity | The minimum loglevel needed for a log message for the callback to be called. |
args | Any valid argument list for constructing callback::Log . |
std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Configures DQCsim to also output its log messages to callback function (builder pattern).
verbosity
specifies the minimum importance of a message required for the callback to be called. data
is the callback information object, taken by copy by this function. Refer to callback::Log
for more information.
verbosity | The minimum loglevel needed for a log message for the callback to be called. |
data | The wrapper object for the log callback. |
&self
, to continue building. std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Configures DQCsim to also output its log messages to callback function (builder pattern).
verbosity
specifies the minimum importance of a message required for the callback to be called. data
is the callback information object, taken by move by this function. Refer to callback::Log
for more information.
verbosity | The minimum loglevel needed for a log message for the callback to be called. |
data | The wrapper object for the log callback. |
&self
, to continue building. std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Configures DQCsim to also output its log messages to callback function (builder pattern).
verbosity
specifies the minimum importance of a message required for the callback to be called. The callback information object is constructed in place from the remaining arguments. Refer to callback::Log
for more information.
verbosity | The minimum loglevel needed for a log message for the callback to be called. |
args | Any valid argument list for constructing callback::Log . |
&self
, to continue building. std::runtime_error | When the simulation configuration handle is invalid for some reason. |
|
inline |
Constructs the DQCsim simulation from this configuration object.
build()
, the behavior of every other member function is undefined.std::runtime_error | When the simulation configuration handle is invalid for some reason, or initializing the simulation fails. |
|
inline |
Constructs the DQCsim simulation from this configuration object, and runs a program on the simulated accelerator without an argument.
This is simply a shorthand for build()
followed by Simulation::run()
. The accelerator return value is discarded in favor of returning the simulation object, which you can then call write_reproduction_file()
on.
std::runtime_error | When the simulation configuration handle is invalid for some reason, or running the simulation fails. |
|
inline |
Constructs the DQCsim simulation from this configuration object, and runs a program on the simulated accelerator with the given ArbData
argument (passed by move).
This is simply a shorthand for build()
followed by Simulation::run()
. The accelerator return value is discarded in favor of returning the simulation object, which you can then call write_reproduction_file()
on.
data | The ArbData object to pass to the frontend's run callback. |
std::runtime_error | When the simulation configuration handle is invalid for some reason, or running the simulation fails. |
|
inline |
Constructs the DQCsim simulation from this configuration object, and runs a program on the simulated accelerator with the given ArbData
argument (passed by copy).
This is simply a shorthand for build()
followed by Simulation::run()
. The accelerator return value is discarded in favor of returning the simulation object, which you can then call write_reproduction_file()
on.
data | The ArbData object to pass to the frontend's run callback. |
std::runtime_error | When the simulation configuration handle is invalid for some reason, or running the simulation fails. |