Configuring NeuralMag#
The config object#
NeuralMag features a config object that holds the following global configurations and defaults:
Config Variable |
Description |
Default |
|---|---|---|
config.backend |
Backend for NeuralMag (“jax”/”torch”) |
jax |
config.dtype |
Default dtype (“float32”/”float64”) |
float32 |
config.device |
Default device (only torch backend) |
|
config.torch[“compile”] |
Use torch.compile on autogenerated code (True/False) |
True |
config.jax[“jit”] |
Use jax.jit on autogenerated code (True/False) |
True |
config.fem[“n_gauss”] |
Default quadrature order for FEM integrals |
3 |
Environment Variables#
NeuralMag reads the following environment variables for global configuration
Variable |
Description |
Default |
|---|---|---|
NM_BACKEND |
Backend for NeuralMag (jax/torch) |
|
NM_CACHEDIR |
Cache directory for autogenerated FEM code |
$HOME/.cache/neuralmag/ |