{"id":13493474,"url":"https://github.com/mumax/3","last_synced_at":"2025-06-23T18:01:50.895Z","repository":{"id":37587951,"uuid":"12974128","full_name":"mumax/3","owner":"mumax","description":"GPU-accelerated micromagnetic simulator","archived":false,"fork":false,"pushed_at":"2024-10-17T16:22:19.000Z","size":15064,"stargazers_count":457,"open_issues_count":31,"forks_count":151,"subscribers_count":54,"default_branch":"master","last_synced_at":"2024-10-19T13:24:05.449Z","etag":null,"topics":["cuda","finite-difference-time-domain","go","micromagnetics","scientific-computing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mumax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-09-20T13:32:01.000Z","updated_at":"2024-10-17T10:38:07.000Z","dependencies_parsed_at":"2024-10-20T13:30:23.252Z","dependency_job_id":null,"html_url":"https://github.com/mumax/3","commit_stats":{"total_commits":5025,"total_committers":35,"mean_commits":"143.57142857142858","dds":"0.39681592039800995","last_synced_commit":"f85407fd59b19373c8d8304cf0e97ba5e15e3be6"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mumax%2F3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mumax%2F3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mumax%2F3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mumax%2F3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mumax","download_url":"https://codeload.github.com/mumax/3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246021454,"owners_count":20710940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","finite-difference-time-domain","go","micromagnetics","scientific-computing"],"created_at":"2024-07-31T19:01:15.580Z","updated_at":"2025-06-23T18:01:50.868Z","avatar_url":"https://github.com/mumax.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable MD033 --\u003e\n\n# mumax³\n\n**GPU-accelerated micromagnetism.**\n\nPaper on the design and verification of MuMax3: \u003chttp://scitation.aip.org/content/aip/journal/adva/4/10/10.1063/1.4899186\u003e\n\n\u003c!-- [![Build Status](https://travis-ci.org/mumax/3.svg?branch=master)](https://travis-ci.org/mumax/3) --\u003e\n\n## Downloads and documentation\n\n👉 Pre-compiled binaries, examples, and documentation are available on the [mumax³ homepage](https://mumax.github.io).\n\nDocumentation of several tools, like `mumax3-convert`, is available [here](https://godoc.org/github.com/mumax/3/cmd).\n\n## Contributing\n\nContributions are gratefully accepted. To contribute code, fork our GitHub repo and send a pull request.\n\n## Building from source\n\nConsider downloading a [pre-compiled mumax³ binary](https://mumax.github.io/download.html).\n\nIf you want to compile nevertheless, 4 essential components will be required to build mumax³: an ***NVIDIA driver***, ***Go***, ***CUDA*** and ***C***.\n\n* *If they are not yet present on your system*: install them as detailed below.\n* *If they are already installed*: check if they work correctly by running the *check* for each component written below.\n\nClick on the arrows below to expand the installation instructions:\u003cbr\u003e\u003csub\u003e\u003csup\u003eThese instructions were made for Windows 10 and Ubuntu 22.04 (but should be applicable to all Debian systems). Your mileage may vary.\u003c/sup\u003e\u003c/sub\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ci\u003eInstall an NVIDIA driver\u003c/i\u003e\u003c/b\u003e\u003c/summary\u003e\n\n* **Windows**: Find a suitable driver [here](https://www.nvidia.com/en-us/drivers/).\n* **Linux**: [Install the NVIDIA proprietary driver](https://www.nvidia.com/en-us/drivers/unix/). \u003c!-- version 440.44 recommended --\u003e\u003cdetails\u003e\u003csummary\u003eTroubleshooting Linux \u0026rarr;click here\u0026larr;\u003c/summary\u003e\n  If the following error occurs, proceed as follows:\n\n  ```batch\n  nvidia-smi has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running\n  ```\n\n  1) Check for existing NVIDIA drivers.\n      * Run `dpkg -l | grep nvidia` to see if any NVIDIA drivers are installed.\n      * If it shows some drivers, you might want to uninstall them before proceeding with the clean installation: `sudo apt-get --purge remove '*nvidia*'`\n  2) Update system packages. Make sure your system is up to date with `sudo apt update` and `sudo apt upgrade`.\n  3) (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/ppa` and `sudo apt update`.\n  4) 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. \u003cbr\u003e To install the recommended NVIDIA driver, use `sudo apt install nvidia-driver-\u003cversion\u003e` (replace `\u003cversion\u003e` with the number of the recommended driver e.g., nvidia-driver-535)\n  5) Reboot your system with `sudo reboot` to apply the changes.\n\n  6) Verify the installation with `nvidia-smi`. This returns something like this, which shows you the driver version in the top center:\n\n  ```bash\n      +-----------------------------------------------------------------------------------------+\n      | NVIDIA-SMI 552.22                 Driver Version: 552.22         CUDA Version: 12.4     |\n      |-----------------------------------------+------------------------+----------------------+\n      | GPU  Name                     TCC/WDDM  | Bus-Id          Disp.A | Volatile Uncorr. ECC |\n      | Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |\n      |                                         |                        |               MIG M. |\n      |=========================================+========================+======================|\n      |   0  NVIDIA GeForce RTX 3080 ...  WDDM  |   00000000:01:00.0 Off |                  N/A |\n      | N/A   53C    P8              9W /  115W |     257MiB /   8192MiB |      0%      Default |\n      |                                         |                        |                  N/A |\n      +-----------------------------------------+------------------------+----------------------+\n\n      +-----------------------------------------------------------------------------------------+\n      | Processes:                                                                              |\n      |  GPU   GI   CI        PID   Type   Process name                              GPU Memory |\n      |        ID   ID                                                               Usage      |\n      |=========================================================================================|\n      |    0   N/A  N/A     28420    C+G   ...Programs\\Microsoft VS Code\\Code.exe      N/A      |\n      |    0   N/A  N/A     31888    C+G   ...les\\Microsoft OneDrive\\OneDrive.exe      N/A      |\n      +-----------------------------------------------------------------------------------------+\n  ```\n\n  \u003c/details\u003e\n* **WSL**: Follow the instructions and troubleshooting for Linux above. If you encounter issues/errors during that process, see the troubleshooting section below: \u003cdetails\u003e\u003csummary\u003eTroubleshooting WSL \u0026rarr;click here\u0026larr;\u003c/summary\u003e\n    When using Windows Subsystem for Linux, your graphics card might not be recognized. If an error occurs after running the command:\n\n    1) If `ubuntu-drivers devices` throws the error\n        * `Command 'ubuntu-drivers' not found`: run the command `sudo apt install ubuntu-drivers-common`.\n        * `ERROR:root:aplay command not found`: run the command `sudo apt install alsa-utils`.\n    2) If `sudo apt install nvidia-driver-\u003cversion\u003e` throws the error `E: Unable to locate package nvidia-driver-\u003cversion\u003e`: run the commands\n\n        ```bash\n        sudo apt install software-properties-gtk\n        sudo add-apt-repository universe\n        sudo add-apt-repository multiverse\n        sudo apt update\n        sudo apt install nvidia-driver-\u003cversion\u003e \n        ```\n\n    3) If `nvidia-smi` throws the error `nvidia: command not found`: the controller is probably not using the correct interface (`sudo lshw -c display` should show NVIDIA). To solve this, follow [these steps](https://learn.microsoft.com/en-us/windows/wsl/tutorials/gpu-compute). If a `docker: permission denied` error occurs: close and re-open WSL.\n\n  \u003c/details\u003e\n\n👉 *Check NVIDIA driver installation with: `nvidia-smi`*\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ci\u003eInstall CUDA\u003c/i\u003e\u003c/b\u003e - ⚠️Install in a directory without spaces⚠️\u003c/summary\u003e\n\n* **Windows**: Download an installer from [the CUDA website](https://developer.nvidia.com/cuda-downloads).\n  * ⚠️ **To avoid common issues, the installation directory should not contain spaces. If possible, install in `C:\\cuda`.** Spaces should not cause issues when running `deploy_windows.ps1`, but this is not guaranteed.\n* **Linux**: Use `sudo apt-get install nvidia-cuda-toolkit`, or [download an installer](https://developer.nvidia.com/cuda-downloads).\n  * Pick the default installation path. **If this is not `usr/local/cuda/`, create a symlink to that path.**\n  * Match the version shown in your driver (see top right in `nvidia-smi` output).\n  * When prompted what to install: do not install the driver again, only the CUDA toolkit.\n  * Add the CUDA `bin` and `lib64` paths to your `PATH` and `LD_LIBRARY_PATH` by adding the following lines at the end of your shell profile file (usually `.bashrc` for Bash):\n\n    ```bash\n    export PATH=/usr/local/cuda/bin:$PATH\n    export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH\n    ```\n\n    Apply the changes with `source ~/.bashrc`.\n\n👉 *Check CUDA installation with: `nvcc --version`*\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ci\u003eInstall Go\u003c/i\u003e\u003c/b\u003e\u003c/summary\u003e\n\n* Download and install from [the Go website](https://go.dev/doc/install).\n* The `GOPATH` environment variable should have been set automatically (note: the folder it points to probably doesn't exist yet).\u003cbr\u003e*Check with `go env GOPATH`.* \u003cdetails\u003e\u003csummary\u003e\u003ci\u003eClick here to set `GOPATH` manually if it does not exist.\u003c/i\u003e\u003c/summary\u003e\n  * On **Windows:** `%USERPROFILE%/go` is often used, e.g. `C:/Users/\u003cname\u003e/go`. See [this guide](https://www.wikihow.com/Change-the-PATH-Environment-Variable-on-Windows) if you are unfamiliar with environment variables.\n  * On **Linux:** `~/go` is often used. Open or create the `~/.bashrc` file and add the following lines.\n\n    ```bash\n    export GOPATH=$HOME/go\n    export PATH=$PATH:$GOPATH/bin\n    ```\n\n    After editing the file, apply the changes by running `source ~/.bashrc`.\n    \u003c/details\u003e\n\n👉 *Check Go installation with: `go version`*\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ci\u003eInstall a C compiler\u003c/i\u003e\u003c/b\u003e\u003c/summary\u003e\n\n* **Linux:** `sudo apt-get install gcc`\n  * ⚠️ each CUDA version has a maximum supported `gcc` version. [This StackOverflow answer](https://stackoverflow.com/a/46380601) lists the maximum supported `gcc` version for each CUDA version. If necessary, use `sudo apt-get install gcc-\u003cmin_version\u003e` instead, with the appropriate `\u003cmin_version\u003e`.\n* **Windows:**\n  * CUDA does not support the `gcc` compiler on Windows, so download and install [Visual Studio](https://visualstudio.microsoft.com/downloads/) with the C/C++ extension pack. After installing, check if the path to `cl.exe` was added to your `PATH` environment variable. If not, add it manually, e.g. `C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64`.\n  * To compile Go, on the other hand, `gcc` is needed. Usually this is included in the Go installation, but if not it can be downloaded and installed from [w64devkit](https://github.com/skeeto/w64devkit/releases).\n\n👉 *Check C installation with: `gcc --version` on Linux and `where.exe cl.exe` on Windows.*\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e(Optional: \u003cb\u003e\u003ci\u003einstall git\u003c/i\u003e\u003c/b\u003e to contribute to mumax³)\u003c/summary\u003e\n\n\u003csub\u003e\u003csup\u003eIf you don't have a GitHub profile yet, make one [here](https://github.com/join).\u003c/sup\u003e\u003c/sub\u003e\n\n* **Windows:** [Download](https://git-scm.com/downloads) and install.\n  \u003c!-- If Git shows many changed .go files, but the files do not have any visible changes, this is likely due to a different line ending being used. Run `git config core.autocrlf input` in the `mumax/3` directory to avoid changing the line ending. --\u003e\n* **Linux:** `sudo apt install git`\n* [Set up your username in Git](https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git) and [setup an SSH key for your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).\n\n👉 *Check Git installation with: `git –version`*\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e(Optional: \u003cb\u003e\u003ci\u003einstall gnuplot\u003c/i\u003e\u003c/b\u003e for pretty graphs)\u003c/summary\u003e\n\n* **Windows:** [Download]((http://www.gnuplot.info/download.html)) and install.\n* **Linux:** `sudo apt-get install gnuplot`\n\n👉 *Check gnuplot installation with: `gnuplot -V`*\n\n\u003c/details\u003e\n\nWith these tools installed, you can build mumax³ yourself.\n\n* Within your `GOPATH` folder, create the subfolders `src/github.com/mumax`.\n* Clone the GitHub repository by running `git clone https://github.com/mumax/3.git` in that newly created `mumax` folder.\n  * If you don't have git, you can manually fetch the source [here](https://github.com/mumax/3/releases) and unzip it into `$GOPATH/src/github.com/mumax/3`.\n* Initialize a Go module by moving to the newly created folder with `cd 3/` and running `go mod init github.com/mumax/3`, followed by `go mod tidy`.\n* Query the compute capability of your GPU using the command `nvidia-smi --query-gpu=compute_cap --format=csv`. Based on this, set the environment variable `CUDA_CC`: if your compute capability is e.g., 8.9, then set the value `CUDA_CC=89`.\n* You can now compile mumax³ ...\n  * ... **on Linux:**\n\n    ```bash\n    make realclean\n    make\n    ```\n\n    Your binary is now at `$GOPATH/bin/mumax3`.\n\n    Note: each CUDA version has a maximum supported GCC version. If your default GCC compiler is too recent, you can use a different GCC compiler by instead running `make NVCC_CCBIN=\u003cpath_to_gcc\u003e` where `\u003cpath_to_gcc\u003e` is a less recent GCC. [Check the version compatibility here](https://stackoverflow.com/a/46380601). Alternatively, setting the `NVCC_CCBIN` environment variable achieves the same thing, allowing you to run `make` as usual.\n\n  * ... **on Windows:**\n    The `Makefile`s may experience issues with whitespaces. Instead, we recommend to use the `deploy/deploy_windows.ps1` script: this generates the Windows executables for the [mumax³ download page](https://mumax.github.io/download.html), but can also be used to build a single mumax³ executable for yourself by making the following adjustments:\n    1) Change the `$VS2022` variable to point to your Visual Studio executable. If you wish to compile for CUDA versions below v11.6, also set `$VS2017`. Example: if `where.exe cl.exe` returns `foo\\bar\\cl.exe`, then set `$VS2022 = \"foo\\bar\"`.\n    2) (Not strictly necessary, but check this anyway) Throughout the file there are several `switch ( $CUDA_VERSION )` blocks. If these do not address your installed CUDA version, add your version. Consult nearby comments when in doubt.\n\n    Now you can compile mumax³ by opening Powershell in the `/deploy` directory and running\n\n    ```bat\n    ./deploy_windows.ps1 -CUDA_VERSIONS \u003cyour_cuda_version\u003e -CUDA_CC \u003cyour_compute_capability\u003e\n    ```\n\n    where e.g. `\u003cyour_cuda_version\u003e` is `12.6` and `\u003cyour_compute_capability\u003e` is `86`, if you have installed CUDA v12.6 and your GPU's compute capability is 8.6.\n\n    Your executable will be created in the `deploy/build` directory.\n\n* *Check installation with: `which mumax3` on **Linux** or `where.exe mumax3.exe` on **Windows**, followed by `mumax3 -test`.* \u003cdetails\u003e\u003csummary\u003eTroubleshooting: `cuda.h` or `curand.h` not found: \u0026rarr;click here\u0026larr;\u003c/summary\u003e\n  This usually means that the `CGO_CFLAGS` and `CGO_LDFLAGS` environment variables are not found or point to the wrong path. To fix this, either define them in the script you are using to build mumax³, or define them in the terminal before running the script.\n  * On **Windows:** say your CUDA is installed in `%CUDA_PATH%` (e.g. `C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.1`), then run these two lines in Powershell before running `deploy_windows.ps1`:\n\n    ```powershell\n    $env:CGO_CFLAGS = '-I \"%CUDA_PATH%\\include\"'\n    $env:CGO_LDFLAGS = '-L \"%CUDA_PATH%\\lib\\x64\"'\n    ```\n\n  \u003c/details\u003e\n  \u003cdetails\u003e\u003csummary\u003eTroubleshooting: `mumax3.exe` is not generated: \u0026rarr;click here\u0026larr;\u003c/summary\u003e\n\n  If, during the build process of mumax³, everything runs smoothly until you get the error that the `mumax3.exe` executable can not be found, try setting the `CGO_ENABLED` environment variable to `1` in your build script.\n\n  \u003c/details\u003e\n  \u003cdetails\u003e\u003csummary\u003eTroubleshooting: `vcvars64.bat` not found or could not initialise VC environment: \u0026rarr;click here\u0026larr;\u003c/summary\u003e\n\n  CUDA requires Visual Studio to compile, which tries to set various environment variables.\n  If Visual Studio fails to do so automatically, you can open a new shell, manually run the `vcvars64.bat` file there (the error message should contain the path to this Batch file), and then compile mumax using that shell.\n\n  \u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmumax%2F3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmumax%2F3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmumax%2F3/lists"}