Issue with Compiling MUMAX3 with DMI Extension

162 views
Skip to first unread message

Gary Young

unread,
Jun 29, 2024, 5:49:14 PM6/29/24
to mumax2

Dear all,

I am currently working on chiral helimagnetism and would like to use MUMAX3 to perform some related simulations. I have downloaded the paper-supplement-standard-problem-dmi extension package this link.

Following Josh Lauzier's steps to compile the source for the magnetoelastic extension (https://groups.google.com/g/mumax2/c/vJ6flBOmBrY/m/Gphq9eEKBwAJ), I have reached step (p).

In the extension package discussion, it was suggested that the function needs to be generated in a wrapper file using the cuda2go.go script. The suggested steps were to navigate to the cuda folder and run the make.bash script using bash make.bash, which should generate a file named dmi2d_wrapper.go. However, when I tried to do this, I received the following error:

garyy@chenghao /cygdrive/c/Users/garyy/go/src/github.com/mumax/3/cuda
$ bash make.bash
bash: make.bash: No such file or directory

Could you please guide me on how to resolve this issue?

Best regards,
Chenghao

Josh Lauzier

unread,
Jul 1, 2024, 4:25:39 AM7/1/24
to mumax2
Hi,

A few comments:

The extension author is correct, you'll need to regenerate the PTX/wrapper files. In the guide I did above, I did not do that, that is simply reusing the existing generated Cuda code.

[ Before you do this step, see the next paragraph, as it may make it unnecessary]. For your specific error, I would agree with the extension author- if you want to regenerate the PTX/wrapper, check to make sure the makefile is there. It comes in the cuda folder by default, so either you moved/deleted it somehow, or your install of Cygwin still needs some set up (based on your command prompt line, it looks like you are using Cygwin. While you can probably get it to work, I did not use Cygwin so you might have to do extra set up. I would recommend sticking with (preferably) Git bash or Msys2 if you're trying to follow my guide. Assuming you did not delete the make file, my guess is that one of Go/bash/make is not properly set up in your Cygwin environment, and so it is not recognizing "make.bash" and is looking for a file with that name instead of running the make command. I don't think git bash and mysy2 come with make preinstalled, not sure about Cygwin. For the process I listed, I didn't need to use make, so I don't know offhand if it's set up by default with my instructions)

However, secondly, the advice to simply run the make file is for Linux, not Windows. It will not work for Windows by default. For Windows, you either need to adjust the Makefile (see this post, mainly you have to adjust the nvcc flags), or use this powershell script. That powershell script should be in your mumax source files already, in the deploy folder . The powershell script goes through, regenerates all the Cuda code, and then compiles mumax. (Technically, it recompiles all of the Cuda files, not just the one you want changed. But the added time difference is negligible). I highly recommend the powershell script, it was super easy to get running (honestly, it was easier than the method in that previous guide using Git bash/Msys2. However I was unaware of it at the time. At some point I'll make an updated guide). If you do the powershell script, you won't have to deal with making sure your set up of Cygwin/Git Bash/Msys2 is proper, or dealing with changing the make file, as mentioned in the previous paragraph.

You will have to make some small changes to the powershell script , mainly to the Cuda versions, and maybe the build directory and cuda directory. If I recall, I also had to add cl.exe to my PATH, and also change the "ccbin" variable in the powershell script to point to it (it should be somewhere like "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin". I think for me for Visual Studio 2022 it was in "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\Hostx86\x64". It gets moved around depending on where Microsoft feels like putting it). (The short reason is basically nvcc needs to use the cl.exe linker, which is the Microsoft Visual Studio linker for Windows, instead of gcc compiler for linux. The makefile provided assumes linux). For both methods, you will also need to have installed Visual Studio to get cl.exe, nvcc ( Nvidia's Cuda compiler) won't accept gcc for windows.

(Potentially important side note: You might also want to confirm that this extension isn't already default mumax behavior. I know some features for e.g. open BCs from that extension were incorporated into normal mumax such as : https://github.com/mumax/3/pull/195 . So you might not even need the extension. I don't know if it was fully incorporated. However, if you aren't comfortable with Golang the easiest way to confirm is probably just to compile them both and test them anyway, so perhaps it is a moot point ;) ).

Best,
Josh L.

Reply all
Reply to author
Forward
0 new messages