3
GPU-accelerated micromagnetic simulator
Install / Use
/learn @mumax/3README
mumax³
GPU-accelerated micromagnetism.
Paper on the design and verification of MuMax3: http://scitation.aip.org/content/aip/journal/adva/4/10/10.1063/1.4899186
<!-- [](https://travis-ci.org/mumax/3) -->Downloads and documentation
👉 Pre-compiled binaries, examples, and documentation are available on the mumax³ homepage.
Documentation of several tools, like mumax3-convert, is available here.
Contributing
Contributions are gratefully accepted. To contribute code, fork our GitHub repo and send a pull request.
Building from source
Consider downloading a pre-compiled mumax³ binary.
If you want to compile nevertheless, 4 essential components will be required to build mumax³: an NVIDIA driver, Go, CUDA (≤12.9) and C.
- If they are not yet present on your system: install them as detailed below.
- If they are already installed: check if they work correctly by running the check for each component written below.
Click on the arrows below to expand the installation instructions:<br><sub><sup>These instructions were made for Windows 10 and Ubuntu 22.04 (but should be applicable to all Debian systems). Your mileage may vary.</sup></sub>
<details><summary><b><i>Install an NVIDIA driver</i></b></summary>-
Windows: Find a suitable driver here.
-
Linux: Install the NVIDIA proprietary driver. <!-- version 440.44 recommended --><details><summary>Troubleshooting Linux →click here←</summary> If the following error occurs, proceed as follows:
nvidia-smi has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running-
Check for existing NVIDIA drivers.
- Run
dpkg -l | grep nvidiato see if any NVIDIA drivers are installed. - If it shows some drivers, you might want to uninstall them before proceeding with the clean installation:
sudo apt-get --purge remove '*nvidia*'
- Run
-
Update system packages. Make sure your system is up to date with
sudo apt updateandsudo apt upgrade. -
(Optional but recommended:) Add the official NVIDIA PPA to ensure you have access to the latest NVIDIA drivers with
sudo add-apt-repository ppa:graphics-drivers/ppaandsudo apt update. -
Install the recommended driver. Ubuntu can automatically detect and recommend the right NVIDIA driver for your system with the command
ubuntu-drivers devices. This will list the available drivers for your GPU and mark the recommended one. <br> To install the recommended NVIDIA driver, usesudo apt install nvidia-driver-<version>(replace<version>with the number of the recommended driver e.g., nvidia-driver-535) -
Reboot your system with
sudo rebootto apply the changes. -
Verify the installation with
nvidia-smi. This returns something like this, which shows you the driver version in the top center:
</details>+-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 552.22 Driver Version: 552.22 CUDA Version: 12.4 | |-----------------------------------------+------------------------+----------------------+ | GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA GeForce RTX 3080 ... WDDM | 00000000:01:00.0 Off | N/A | | N/A 53C P8 9W / 115W | 257MiB / 8192MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ +-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | 0 N/A N/A 28420 C+G ...Programs\Microsoft VS Code\Code.exe N/A | | 0 N/A N/A 31888 C+G ...les\Microsoft OneDrive\OneDrive.exe N/A | +-----------------------------------------------------------------------------------------+ -
-
WSL: Follow the instructions and troubleshooting for Linux above. If you encounter issues/errors during that process, see the troubleshooting section below: <details><summary>Troubleshooting WSL →click here←</summary> When using Windows Subsystem for Linux, your graphics card might not be recognized. If an error occurs after running the command:
-
If
ubuntu-drivers devicesthrows the errorCommand 'ubuntu-drivers' not found: run the commandsudo apt install ubuntu-drivers-common.ERROR:root:aplay command not found: run the commandsudo apt install alsa-utils.
-
If
sudo apt install nvidia-driver-<version>throws the errorE: Unable to locate package nvidia-driver-<version>: run the commandssudo apt install software-properties-gtk sudo add-apt-repository universe sudo add-apt-repository multiverse sudo apt update sudo apt install nvidia-driver-<version> -
If
nvidia-smithrows the errornvidia: command not found: the controller is probably not using the correct interface (sudo lshw -c displayshould show NVIDIA). To solve this, follow these steps. If adocker: permission deniederror occurs: close and re-open WSL.
-
👉 Check NVIDIA driver installation with: nvidia-smi
- Windows: Download an installer from the CUDA website.
- ⚠️ To be on the safe side, it is recommended to install CUDA in a directory without spaces, like
C:\cuda. Spaces should not cause issues when runningdeploy_windows.ps1, but this is not guaranteed.
- ⚠️ To be on the safe side, it is recommended to install CUDA in a directory without spaces, like
- Linux: Use
sudo apt-get install nvidia-cuda-toolkit, or download an installer.-
Pick the default installation path. If this is not
usr/local/cuda/, create a symlink to that path. -
Match the version shown in your driver (see top right in
nvidia-smioutput). -
When prompted what to install: do not install the driver again, only the CUDA toolkit.
-
Add the CUDA
binandlib64paths to yourPATHandLD_LIBRARY_PATHby adding the following lines at the end of your shell profile file (usually.bashrcfor Bash):export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATHApply the changes with
source ~/.bashrc.
-
👉 Check CUDA installation with: nvcc --version
- Download and install from the Go website.
- The
GOPATHenvironment variable should have been set automatically (note: the folder it points to probably doesn't exist yet).<br>Check withgo env GOPATH. <details><summary><i>Click here to setGOPATHmanually if it does not exist.</i></summary>-
On Windows:
%USERPROFILE%/gois often used, e.g.C:/Users/<name>/go. See this guide if you are unfamiliar with environment variables. -
On Linux:
~/gois often used. Open or create the~/.bashrcfile and add the following lines.export GOPATH=$HOME/go export PATH=$GOPATH/bin:$PATHAfter editing the file, apply the changes by running
</details>source ~/.bashrc.
-
👉 Check Go installation with: go version
- Linux:
sudo apt-get install gcc- ⚠️ each CUDA version has a maximum supported
gccversion. 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>.
- ⚠️ each CUDA version has a maximum supported
- Windows:
- CUDA does not support the
gcccompiler on Windows, so download and install 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. - To compile Go, on the other hand,
gccis needed. Usually this is included in the Go installation, but if not it can be downloaded and installed from w64devkit.
- CUDA does not support the
👉 Check C installation with: gcc --version on Linux and where.exe cl.exe on Windows.
