A more 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.
mumax⁺ is described in the following paper:
mumax+: extensible GPU-accelerated micromagnetics and beyond
https://arxiv.org/abs/2411.18194
Please cite this paper if you would like to cite mumax⁺.
You should install these yourself
- CUDA Toolkit 10.0 or later
- A C++ compiler which supports C++17, such as GCC
- On Windows (good luck): MSVC 2019
These will be installed automatically within the conda environment
- cmake 3.16
- Python 3.8
- pybind11 v2.5
- NumPy
- matplotlib
- SciPy
- Sphinx
As of now, we are stuck with Python 3.8, because newer versions of pybind11 do not work well with CUDA. We are working on a (clean) way around this issue.
Make sure that the following applications and build tools are installed:
- C++ compiler which supports c++17, such as GCC
- CPython (version 3.8 recommended) and pip
- CUDA Toolkit (version 10.0 or later)
- git
- miniconda or anaconda
Make especially sure that everything CUDA-related (like nvcc
) can be found inside your path. 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 might differ if CUDA Toolkit has been installed in a different location. If successful, a command such as nvcc --version
should work.
Clone the mumax⁺ git repository. The --recursive
flag is used here 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. You could also skip this step and use your own conda environment instead if preferred.
conda env create -f environment.yml
conda activate mumaxplus
Then build and install mumax⁺ using pip.
pip install -ve .
If changes are made to the C++ code, then pip install -ve .
can be used to rebuild mumax⁺.
These instructions are old and worked at some point (2021), but not today. If you are brave enough to try Windows and you manage to get it working, please let us know!
- Install Visual Studio 2019 and the desktop development with C++ workload
- Install CUDA Toolkit 10.x
- Install cmake
- Download the pybind11 submodule with git
git submodule init
git submodule update
- Install Python packages using conda
conda env create -f environment.yml
- Build
mumaxplus
usingsetuptools
activate mumaxplus
python setup.py develop
or conda
conda activate mumaxplus
conda develop -b .
Documentation for mumax⁺ follows the NumPy style guide and can be generated using Sphinx. Run the following command in the docs/
directory to let Sphinx build the HTML documentation pages:
make html
The documentation can now 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.