Configuration Options¶
This page lists all environment variables available in neuraLQX.
Each variable allows you to modify the runtime behaviour of the package, enable optional features, or adjust numerical and parallelisation settings.
Note
Startup-only options (marked No in the Runtime Mutable column) must be set as environment variables before Python starts. They are read once at import time and cannot be changed afterwards.
Runtime-mutable options (marked Yes) can be changed after import using
cfg.update() (see Runtime Editable Configurations below).
Example (works for all options):
export NQX_LOG_LEVEL=DEBUG
export NQX_ENABLE_X64=false
python your_script.py
Warning
Setting os.environ inside Python (e.g. os.environ['NQX_EXPERIMENTAL'] = '1')
is not reliable for any neuraLQX configuration variable.
The configuration system reads all environment variables once when neuralqx is first
imported; any os.environ write that happens after that import is ignored.
For runtime-mutable options, use nqx.cfg.update() instead.
For startup-only options, set the variable in your shell before launching Python.
Environment Variables¶
Name |
Value Type |
Possible Values |
Default |
Description |
Runtime Mutable |
|---|---|---|---|---|---|
|
|
|
|
Enable or disable debugging mode throughout various parts of neuraLQX |
Yes |
|
|
|
|
Enable profiling in neuraLQX. |
No |
|
|
|
|
Enable nvidia-smi profiling in neuraLQX. |
No |
|
|
|
|
Enable profiling telemetry (CPU/memory + GPU via NVML when available). |
No |
|
|
|
|
Enable Perfetto UI traces in neuraLQX. |
No |
|
|
|
|
Enable device-accurate timing (forces synchronisation and can slow execution). |
No |
|
|
Any valid path |
|
Override the directory where profiling artifacts are written. |
No |
|
|
Any string |
|
Optional fixed profiling run id; outputs are written under |
No |
|
|
|
|
Enable JAX trace annotations for profiling sections. |
No |
|
|
|
|
Enable JAX profiler trace capture in the profiling output folder. |
No |
|
|
|
|
Telemetry sampling period in seconds when |
No |
|
|
Positive integer |
|
Maximum in-memory trace events before export. |
No |
|
|
|
|
Aggregate profiling summaries across ranks at exit (can block on slow ranks). |
No |
|
|
|
|
Enable deep Python call tracing for profiled wrappers/calls (high overhead). |
No |
|
|
Comma-separated module prefixes |
|
Include filter for deep Python call tracing. |
No |
|
|
Comma-separated module prefixes |
|
Exclude filter for deep Python call tracing. |
No |
|
|
Integer ( |
|
Max nested Python call depth captured by deep tracing. |
No |
|
|
|
|
Enable or disable Rich console printing. |
Yes |
|
|
|
|
Set the logging level for the neuraLQX logger hierarchy. |
Yes |
|
|
|
|
Enable experimental functions throughout the neuralqx and netket packages. |
Yes |
|
|
|
|
Enable the experimental bi-covariance gradient path for non-Hermitian operators that expose |
Yes |
|
|
|
|
Relax some neuraLQX features for testing purposes. |
Yes |
|
|
|
|
Enable caching when possible. |
No |
|
|
|
|
Enable fused sequence kernels in VQS expectation/forces/gradient paths. |
Yes |
|
|
|
|
Enable x64 precision throughout neuraLQX, NetKet and JAX. Falls back to
|
No |
Important
neuraLQX also has profiling specific configurations options. For that, please see the profiling page.
Runtime Editable Configurations¶
Options marked Yes in the Runtime Mutable column can be changed after import using
the cfg singleton. Do not write directly to
os.environ at runtime, that bypasses hooks, validation, and is silently ignored.
Persistent update, change the value for the remainder of the process:
from neuralqx import cfg
cfg.update('VERBOSE', False) # or: cfg.VERBOSE = False
Temporary patch, restore the original value automatically on exit:
from neuralqx import cfg
with cfg.patch('LOG_LEVEL', 'DEBUG'):
# DEBUG logging active only inside this block
...
# original LOG_LEVEL is restored here
Thread-local override, affects only the calling thread:
from neuralqx import cfg
with cfg.thread_local_override('DEBUG', True):
# DEBUG mode active only in this thread
...
See also
The full configuration API, including hooks, fingerprinting, and introspection
helpers, is documented in neuralqx.configs.
Enabling experimental mode¶
NQX_EXPERIMENTAL deserves special attention because of how the experimental namespace
is guarded. neuralqx.experimental checks the flag at import time. This means the flag must be True before you import neuralqx.experimental, but
it does not have to be set before import neuralqx itself. The recommended pattern is:
import neuralqx as nqx
nqx.cfg.update("EXPERIMENTAL", True) # set before importing experimental
import neuralqx.experimental as nqxx # now works
Alternatively, set NQX_EXPERIMENTAL=1 in your shell before launching Python, this is
the preferred approach for batch jobs and HPC scripts because it is visible in run logs:
NQX_EXPERIMENTAL=1 python your_script.py
Warning
os.environ["NQX_EXPERIMENTAL"] = "1" inside Python looks correct but is unreliable.
The configuration singleton reads all environment variables once when neuralqx
is first imported. In Jupyter kernels and IPython the package is often already imported
before your cell runs, so the write is silently ignored.
Always use nqx.cfg.update("EXPERIMENTAL", True) for in-process enablement.
Experimental non-Hermitian gradient path¶
NQX_EXPERIMENTAL_GRAD enables the experimental exact bi-covariance path for
non-Hermitian gradients in neuralqx.vqs.MCState.expect_and_grad().
It does not unlock neuralqx.experimental imports by itself; namespace access
remains guarded only by NQX_EXPERIMENTAL.
When both NQX_EXPERIMENTAL=1 and NQX_EXPERIMENTAL_GRAD=1 are enabled,
neuraLQX attempts to evaluate
for operators (or operator sequences) that implement .adjoint.
If an adjoint is unavailable, neuraLQX emits a warning and falls back to the
generic non-Hermitian VJP path.
The experimental path also warns and falls back when:
the operator (or any operator in a sequence) has a complex dtype (excluding
Squaredterms, which are real-valued objectives by construction),a complex-parameter model is detected as non-holomorphic by NetKet’s
is_probably_holomorphicdiagnostic.
This option is runtime-mutable, so it can be toggled with cfg.update or
temporarily scoped with cfg.patch.
Unused Configurations¶
neuraLQX will warn you if it finds any environment variables which start with the NQX_ prefix
when you import it. This is to help quickly recognise any typos that might have been made (e.g. in
a huge batch job on the HPC, you want to disable Rich printing but you accidentally
specified NQX_VERBOSW = False instead of NQX_VERBOSE = False in your script).
Note that the warning is not fatal, your code will continue, but it will be printed to you.