Skip to content
class

Determinism

Determinism

Process-wide determinism control for the op dispatcher.

All methods are static: there is no instance state — the class is a namespace-style holder over a single std::atomic<bool> defined in Determinism.cpp. Reads and writes are atomic and thread-safe but unordered with respect to each other.

See Also

lucid.use_deterministic_algorithms — Python wrapper. Generator — companion RNG state required for full reproducibility.

Notes

The default value at process startup is false (non-deterministic kernels are permitted). Reproducibility-sensitive callers should explicitly set_enabled(true) together with seeding the default Generator.

Static methods

2
static

is_enabled

→bool
bool is_enabled()

Returns whether deterministic-mode is currently active.

Returns

bool

true when the dispatcher must reject non-deterministic ops, false when they are allowed.

Notes

Reading the flag is a single relaxed atomic load with no fence; the value may have changed by the time the caller acts on it.

static

set_enabled

void set_enabled(bool value)

Sets the process-wide determinism flag.

Parameters

valuebool
true to require deterministic-only execution (subsequent non-deterministic ops will raise LucidError), false to permit all ops.

Notes

The write is atomic but unfenced with respect to ops already in flight on other threads — those ops continue with whichever value they observed at dispatch time. Setting determinism while other threads are mid-dispatch is therefore racy by design and not recommended: configure the flag at process startup, before launching training threads.