stim::environment_description struct

Initialization parameters for stim::environment.

Public variables

environment_flags flags
System environment flags.
buffer_view buffer
The main buffer used by simulations sharing this environment.
log_interface* log
The log_interface output used by simulations sharing this environment.
cache_interface* cache
The cache_interface used by simulations sharing this environment.
executor_interface* executor
The executor_interface used by simulations sharing this environment.

Variable documentation

environment_flags stim::environment_description::flags

System environment flags.

buffer_view stim::environment_description::buffer

The main buffer used by simulations sharing this environment.

Once simulation initialization is complete the library goes to great lengths to not perform any additional per-frame allocations, instead making use of a large pre-allocated central buffer. You may control the initialization of this buffer in a few different ways:

Letting the library decide (default)

stim::environment_description desc{};
// the lib will allocate a buffer of dynamically-determined size

Specifying the size of the buffer only

constexpr size_t buf_size = 1024 * 1024 * 64;

stim::environment_description desc{};
desc.buffer = { nullptr, buf_size }; // the lib will manage the allocation internally

Managing the allocation yourself

constexpr size_t buf_size = 1024 * 1024 * 64;
auto buf = malloc(buf_size); // or whatever you prefer

stim::environment_description desc{};
desc.buffer = { buf, buf_size };

log_interface* stim::environment_description::log

The log_interface output used by simulations sharing this environment.

cache_interface* stim::environment_description::cache

The cache_interface used by simulations sharing this environment.

executor_interface* stim::environment_description::executor

The executor_interface used by simulations sharing this environment.