Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Mumax3 with CUDA not in default directory #212

Closed
Crolan opened this issue Dec 2, 2018 · 5 comments
Closed

Install Mumax3 with CUDA not in default directory #212

Crolan opened this issue Dec 2, 2018 · 5 comments
Labels

Comments

@Crolan
Copy link

Crolan commented Dec 2, 2018

Hi, I'm installing mumax on a server which CUDA is not installed at the default location. If you have any direct solutions, please skip all the following redundancy.

I tried add the CUDA path to both /cuda/curand/cgoflags.go and /cuda/cu/cgoflags.go, and I got the following message after "go install":


//# github.com/mumax/3/cuda/curand
../../cuda/curand/generator.go:3:20: fatal error: curand.h: No such file or directory
 //#include <curand.h>
                    ^
compilation terminated.
//# github.com/mumax/3/cuda/cu
/opt/apps/gcc/5.4.0/bin/ld: cannot find -lcuda
/opt/apps/gcc/5.4.0/bin/ld: cannot find -lcuda
collect2: error: ld returned 1 exit status
......

To deal with the curand.h issue, I copied the curand.h file from the cuda folder to /cuda/curand, the curand.h error disappeared, but the other messages left as:


/# github.com/mumax/3/cuda/cu
/opt/apps/gcc/5.4.0/bin/ld: cannot find -lcuda
/opt/apps/gcc/5.4.0/bin/ld: cannot find -lcuda
collect2: error: ld returned 1 exit status
/# github.com/mumax/3/cuda/cu
cgo-gcc-prolog: In function ‘_cgo_208fe6b3463b_Cfunc_cuDeviceComputeCapability’:
cgo-gcc-prolog:47:2: warning: ‘cuDeviceComputeCapability’ is deprecated [-Wdeprecated-declarations]
In file included from ../../cuda/cu/device.go:5:0:
/opt/apps/cuda/9.2/include/cuda.h:2531:36: note: declared here
 __CUDA_DEPRECATED CUresult CUDAAPI cuDeviceComputeCapability(int *major, int *minor, CUdevice dev);
                                    ^
cgo-gcc-prolog: In function ‘_cgo_208fe6b3463b_Cfunc_cuDeviceGetProperties’:
cgo-gcc-prolog:150:2: warning: ‘cuDeviceGetProperties’ is deprecated [-Wdeprecated-declarations]
In file included from ../../cuda/cu/device.go:5:0:
/opt/apps/cuda/9.2/include/cuda.h:2497:36: note: declared here
 __CUDA_DEPRECATED CUresult CUDAAPI cuDeviceGetProperties(CUdevprop *prop, CUdevice dev);

I got no clue since here. What other steps should I have before I can finish the installation?

This problem seems related to another open issue: #180 (comment)

Thanks in advance.

@barnex
Copy link
Member

barnex commented Dec 3, 2018

Is it possible that only added header locations to CFLAGS, but no library locations to LDFLAGS? Seems like the linker cannot find libcuda.so.

Can you post the changes you made?

@barnex barnex added the question label Dec 3, 2018
@Crolan
Copy link
Author

Crolan commented Dec 3, 2018

Is it possible that only added header locations to CFLAGS, but no library locations to LDFLAGS? Seems like the linker cannot find libcuda.so.

Can you post the changes you made?

Hi barnex,

I've changed the following bold parts:

package curand

// This file provides CGO flags to find CUDA libraries and headers.

//#cgo LDFLAGS:-lcurand
//
////default location:

//#cgo LDFLAGS:-L/opt/apps/cuda/9.2/lib64 -L/opt/apps/cuda/9.2/lib
//#cgo CFLAGS: -I/opt/apps/cuda/9.2/include

//
////default location if not properly symlinked:
...

and

package cu

// This file provides CGO flags to find CUDA libraries and headers.

//#cgo LDFLAGS:-lcuda
//
////default location:

//#cgo LDFLAGS:-L/opt/apps/cuda/9.2/lib64 -L/opt/apps/cuda/9.2/lib
//#cgo CFLAGS: -I/opt/apps/cuda/9.2/include/

//
////default location if not properly symlinked:
...

Thank you and let me know if you need any further information.

@barnex
Copy link
Member

barnex commented Dec 4, 2018 via email

@Crolan
Copy link
Author

Crolan commented Dec 4, 2018

That looks reasonable. Do any of the directories under LDPATH contain libcuda.so?

On Mon 3 Dec 2018, 23:55 Crolan, @.***> wrote: Is it possible that only added header locations to CFLAGS, but no library locations to LDFLAGS? Seems like the linker cannot find libcuda.so. Can you post the changes you made? Hi barnex, I've changed the following bold parts: package curand // This file provides CGO flags to find CUDA libraries and headers. //#cgo LDFLAGS:-lcurand // ////default location: //#cgo LDFLAGS:-L/opt/apps/cuda/9.2/lib64 -L/opt/apps/cuda/9.2/lib //#cgo CFLAGS: -I/opt/apps/cuda/9.2/include // ////default location if not properly symlinked: ... and package cu // This file provides CGO flags to find CUDA libraries and headers. //#cgo LDFLAGS:-lcuda // ////default location: //#cgo LDFLAGS:-L/opt/apps/cuda/9.2/lib64 -L/opt/apps/cuda/9.2/lib //#cgo CFLAGS: -I/opt/apps/cuda/9.2/include/ // ////default location if not properly symlinked: ... Thank you and let me know if you need any further information. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#212 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ3AnzG7w-CAuP4A4ejRVLh7COQdHhDks5u1bndgaJpZM4Y9Qk- .

I cannot find the libcuda.so file right at the LDPATH directory which is /opt/apps/cuda/9.2/lib64, but there is a sub-folder /opt/apps/cuda/9.2/lib64/stubs that do have the libcuda.so file. Should that work? or I need to make changes?

Thanks,

@Crolan Crolan closed this as completed Dec 12, 2018
@Crolan
Copy link
Author

Crolan commented Dec 12, 2018

It seems like that this issue is due to a problem of the nvidia driver, and solved through reinstall and redirect. Thanks for all the helpful suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants