A versatile and extensible GPU-accelerated micromagnetic simulator written in C++ and CUDA with a Python interface. This project is in development alongside its popular predecessor mumax³. If you have any questions, feel free to use the mumax mailing list.
Documentation, tutorials and examples can be found on the mumax⁺ website.
mumax⁺ is described in the following paper:
mumax+: extensible GPU-accelerated micromagnetics and beyond
Please cite this paper if you would like to cite mumax⁺. All demonstrations in the paper were simulated using version v1.1.0 of the code. The scripts used to generate the data can be found in the paper2025 directory under the paper2025 tag.
You should install the following tools yourself. Click the arrows for more details.
CUDA Toolkit (version 10.0 or later)
- Windows: Download an installer from the CUDA website.
- Linux: Use
sudo apt-get install nvidia-cuda-toolkit
, or download an installer.
⚠️ Make especially sure that everything CUDA-related (likenvcc
) can be found inside your PATH. On Linux, for instance, this can be done by editing your~/.bashrc
file and adding the following lines:# add CUDA export PATH="/usr/local/cuda/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda/> lib64:$LD_LIBRARY_PATH"The paths may differ if the CUDA Toolkit was installed in a different location.
👉 Check CUDA installation with: nvcc --version
A C++ compiler which supports C++17
- Linux:
sudo apt-get install gcc
⚠️ each CUDA version has a maximum supportedgcc
version. This StackOverflow answer lists the maximum supportedgcc
version for each CUDA version. If necessary, usesudo apt-get install gcc-<min_version>
instead, with the appropriate<min_version>
.
- Windows:
- CUDA does not support the
gcc
compiler on Windows, so download and install Microsoft Visual Studio with the "Desktop development with C++" workload. After installing, check if the path tocl.exe
was added to yourPATH
environment variable (i.e., check whetherwhere cl.exe
returns an appropriate path likeC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64
). If not, add it manually.
- CUDA does not support the
👉 Check C installation with: gcc --version
on Linux and where.exe cl.exe
on Windows.
Git
- Windows: Download and install.
- Linux:
sudo apt install git
👉 Check Git installation with: git --version
CPython (version ≥ 3.8 recommended), pip and miniconda/anaconda
All these Python-related tools should be included in a standard installation of Anaconda or Miniconda.
👉 Check installation with python --version
, pip --version
and conda --version
.
First, clone the mumax⁺ Git repository. The --recursive
flag is used in the following command to get the pybind11 submodule, which is needed to build mumax⁺.
git clone --recursive https://github.com/mumax/plus.git mumaxplus
cd mumaxplus
We recommend to install mumax⁺ in a clean conda environment as follows. You could also skip this step and use your own conda environment instead if preferred.
Click to show tools automatically installed in the conda environment
- cmake 4.0.0
- Python 3.13
- pybind11 v2.13.6
- NumPy
- matplotlib
- SciPy
- Sphinx
conda env create -f environment.yml
conda activate mumaxplus
Finally, build and install mumax⁺ using pip.
pip install .
Tip
If changes are made to the code, then pip install -v .
can be used to rebuild mumax⁺, with the -v
flag enabling verbose debug information.
If you want to change only the Python code, without needing to reinstall after each change, pip install -ve .
can also be used.
Tip
The source code can also be compiled with double precision, by changing FP_PRECISION
in CMakeLists.txt
from SINGLE
to DOUBLE
before rebuilding.
add_definitions(-DFP_PRECISION=DOUBLE) # FP_PRECISION > should be SINGLE or DOUBLE
- (Windows) If you encounter the error
No CUDA toolset found
, try copying the files inNVIDIA GPU Computing Toolkit/CUDA/<version>/extras/visual_studio_integration/MSBuildExtensions
toMicrosoft Visual Studio/<year>/<edition>/MSBuild/Microsoft/VC/<version>/BuildCustomizations
. See these instructions for more details.
Documentation for mumax⁺ can be found at http://mumax.github.io/plus.
It follows the NumPy style guide and is generated using Sphinx. You can build it yourself by running the following command in the docs/
directory:
make html
The documentation can then be found at docs/_build/html/index.html
.
Lots of example codes are located in the examples/
directory. They are either simple Python scripts, which can be executed inside said directory like any Python script
python standardproblem4.py
or they are interactive notebooks (.ipynb
files), which can be run using Jupyter.
Several automated tests are located inside the test/
directory. Type pytest
inside the terminal to run them. Some are marked as slow
, such as test_mumax3_standardproblem5.py
. You can deselect those by running pytest -m "not slow"
. Tests inside the test/mumax3/
directory require external installation of mumax³. They are marked by mumax3
and can be deselected in the same way.
Contributions are gratefully accepted. To contribute code, fork our repo on GitHub and send a pull request.