A versatile and extensible GPU-accelerated micromagnetic simulator written in C++ and CUDA with a Python interface. This project is in development alongside mumax³. If you have any questions, feel free to use the mumax⁺ GitHub Discussions.
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.
mumax⁺ should work on any NVIDIA GPU. To get started you should install the following tools yourself. Click the arrows for more details.
CUDA Toolkit
To see which CUDA Toolkit works for your GPU's Compute Capability, check this Stack Overflow post.
- 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~/.bashrcfile 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 supportedgccversion. This StackOverflow answer lists the maximum supportedgccversion 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
gcccompiler on Windows, so download and install Microsoft Visual Studio with the "Desktop development with C++" workload. After installing, check if the path tocl.exewas added to yourPATHenvironment variable (i.e., check whetherwhere cl.exereturns 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 mumaxplusWe 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 mumaxplusFinally, 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 DOUBLETo check if you successfully compiled mumax⁺, we recommend you to run some examples from the examples/ directory
or to run the tests in the test/ directory.
- (Windows) If you encounter the error
No CUDA toolset found, try copying the files inNVIDIA GPU Computing Toolkit/CUDA/<version>/extras/visual_studio_integration/MSBuildExtensionstoMicrosoft 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 htmlThe 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.pyor 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.