Configuration Options#

NetKet exposes a few configuration options which can be set through environment variables by doing something like

# without exporting it
NETKET_DEBUG=1 python ...

# by exporting it
export NETKET_DEBUG=1
python ...

# by setting it within python
python
>>> import os
>>> os.environ["NETKET_DEBUG"] = "1"
>>> import netket as nk
>>> print(netket.config.netket_debug)
True

Some configuration options can also be changed at runtime by setting it as:

>>> import netket as nk
>>> nk.config.netket_debug = True
>>> ...

You can always query the value of an option by accessing the nk.config module:

>>> import netket as nk
>>> print(nk.config.netket_debug)
False
>>> nk.config.netket_debug = True
>>> print(nk.config.netket_debug)
True

Please note that not all configurations can be set at runtime, and some will raise an error.

Options are used to activate experimental or debug functionalities or to disable some parts of netket. Please keep in mind that all options related to experimental or internal functionalities might be removed in a future release.

List of configuration options#

Netket Debug#

Type:

bool

Default Value:

False

Configuration String:

netket.config.'netket_debug'

Environment Variable:

NETKET_DEBUG

Enable debug logging in many netket functions.

Netket Enable X64#

Type:

bool

Default Value:

True

Configuration String:

netket.config.'netket_enable_x64'

Environment Variable:

NETKET_ENABLE_X64

Enables double-precision for Jax. Equivalent to JAX_ENABLE_X64 but defaults to True instead of False, as it is required throughout NetKet. By setting this flag to False NetKet will run without double-precision everywhere.

Netket Experimental#

Type:

bool

Default Value:

False

Configuration String:

netket.config.'netket_experimental'

Environment Variable:

NETKET_EXPERIMENTAL

Enable experimental features.

Netket Experimental Disable Ode Jit#

Type:

bool

Default Value:

True

Configuration String:

netket.config.'netket_experimental_disable_ode_jit'

Environment Variable:

NETKET_EXPERIMENTAL_DISABLE_ODE_JIT

Deprecated: jax does not support reentrant callbacks anymore.

Disables the jitting of the whole ode solver, mainly used within TDVP solvers. The jitting is sometimes incompatible with GPU-based calculations, and on large calculations it gives negligible speedups so it might be beneficial to disable it.

Netket Experimental Fft Autocorrelation#

Type:

bool

Default Value:

False

Configuration String:

netket.config.'netket_experimental_fft_autocorrelation'

Environment Variable:

NETKET_EXPERIMENTAL_FFT_AUTOCORRELATION

The integrated autocorrelation time $ au_c$ is computed separately for each chain $c$. To summarize it for the user, Stats.tau_corr is changed to contain the average over all chains and a new field Stats.tau_corr_max is added containing the maximum autocorrelation among all chains (which helps to identify outliers). Using the average $ au$ over all chains seems like a good choice as it results in a low-variance estimate (see [here](https://emcee.readthedocs.io/en/stable/tutorials/autocorr/#autocorr) for a good discussion).

Netket Experimental Sharding#

Type:

bool

Default Value:

True

Configuration String:

netket.config.'netket_experimental_sharding'

Environment Variable:

NETKET_EXPERIMENTAL_SHARDING

Enables highly expermiental support of netket for running on multiple jax devices.

Supports both multiple local devices, as well as global ones in a multi-process environment. See https://jax.readthedocs.io/en/latest/multi_process.html#initializing-the-cluster for how to initialize the latter. Distributes chains and samples equally among all available devices.

Netket Experimental Sharding Cpu#

Type:

int

Default Value:

0

Configuration String:

netket.config.'netket_experimental_sharding_cpu'

Environment Variable:

NETKET_EXPERIMENTAL_SHARDING_CPU

Set to >=1 to force JAX to use multiple threads as separate devices on cpu. Sets the XLA_FLAGS=’–xla_force_host_platform_device_count=#’ environment variable. Disabled by default.

Netket Experimental Sharding Fast Serialization#

Type:

bool

Default Value:

False

Configuration String:

netket.config.'netket_experimental_sharding_fast_serialization'

Environment Variable:

NETKET_EXPERIMENTAL_SHARDING_FAST_SERIALIZATION

If True (Defaults False) does not gather data on the master process when using flax.serialization methods. This allows to use orbax-checkpoint with higher efficiency.

Netket Random State Fallback Warning#

Type:

bool

Default Value:

True

Configuration String:

netket.config.'netket_random_state_fallback_warning'

Environment Variable:

NETKET_RANDOM_STATE_FALLBACK_WARNING

Print a warning every time you use a fallback that could never stop running when using random_state of constrained hilbert spaces with custom constraints.

Netket Sphinx Build#

Type:

bool

Default Value:

True

Configuration String:

netket.config.'netket_sphinx_build'

Environment Variable:

NETKET_SPHINX_BUILD

Set to True when building documentation with Sphinx. Disables some decorators.

Netket Spin Ordering Warning#

Type:

bool

Default Value:

True

Configuration String:

netket.config.'netket_spin_ordering_warning'

Environment Variable:

NETKET_SPIN_ORDERING_WARNING

If True (Defaults True) warns if the ordering of spins in the Hilbert space is not declared.

Netket Use Plain Rhat#

Type:

bool

Default Value:

False

Configuration String:

netket.config.'netket_use_plain_rhat'

Environment Variable:

NETKET_USE_PLAIN_RHAT

By default, NetKet uses the split-RΜ‚ Gelman-Rubin diagnostic in netket.stats.statistics, which detects non-stationarity in the MCMC chains (in addition to the classes of chain-mixing failures detected by plain R) since version 3.4. Enabling this flag restores the previous behavior of using plain (non-split) Rhat.

``