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

Go get fails with Cuda Toolkit 6.5 installed #37

Open
nuqz opened this issue Aug 16, 2018 · 26 comments
Open

Go get fails with Cuda Toolkit 6.5 installed #37

nuqz opened this issue Aug 16, 2018 · 26 comments

Comments

@nuqz
Copy link

nuqz commented Aug 16, 2018

Hi! I have Cuda Toolkit 6.5 and Cuda Toolkit 8.0 installed on different machines. The package works well with 8.0, but fails with 6.5.

Error stack:

# gorgonia.org/cu
../../go/src/gorgonia.org/cu/addressing.go:57:8: could not determine kind of name for C.CUmem_advise
../../go/src/gorgonia.org/cu/addressing.go:60:16: could not determine kind of name for C.cuMemAdvise
../../go/src/gorgonia.org/cu/addressing.go:86:16: could not determine kind of name for C.cuMemPrefetchAsync
@nuqz nuqz changed the title Go get fails Go get fails with Cuda Toolkit 6.5 installed Aug 16, 2018
@chewxy
Copy link
Member

chewxy commented Aug 16, 2018

Yeah older versions are a pain. No clue how to support them

@nuqz
Copy link
Author

nuqz commented Aug 16, 2018

@chewxy, thank you for fast response. As I can understand, 8.0 is the oldest toolkit supported, right?

@chewxy
Copy link
Member

chewxy commented Aug 16, 2018

In an ideal world, we'd want to support as many versions of CUDA as possible. In reality there are constraints. This library started with CUDA 5, it'd be nice to support CUDA 5... but for now I only have the bandwidth to support 8+

@cobnst
Copy link

cobnst commented Dec 3, 2018

@chewxy I meet the same problem,i installed CUDA9.2 .but when i run go get -u gorgonia.org/cu,

gorgonia.org/cu

go\src\gorgonia.org\cu\addressing.go:3:11: fatal error: cuda.h: No such file or directory
// #include <cuda.h>
^~~~~~~~
compilation terminated.

@cfgt
Copy link
Contributor

cfgt commented Dec 3, 2018

@cobnst Have you added the CUDA include directory to your C_INCLUDE_PATH?

@cobnst
Copy link

cobnst commented Dec 3, 2018

@cfgt yes
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp
ALL are in system PATH

@cfgt
Copy link
Contributor

cfgt commented Dec 3, 2018

@cobnst you also need to add a variable for C_INCLUDE_PATH pointing at

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include

@cobnst
Copy link

cobnst commented Dec 3, 2018

@cfgt thanks a lot ,but there's another error
# gorgonia.org/cu C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcuda collect2.exe: error: ld returned 1 exit status
did miss some path?

@cfgt
Copy link
Contributor

cfgt commented Dec 3, 2018

@cobnst hm, I'm not sure - maybe try adding C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64 to LIBRARY_PATH or LD_LIBRARY_PATH

@cobnst
Copy link

cobnst commented Dec 4, 2018

@cfgt lol it work! thks!

@cobnst
Copy link

cobnst commented Dec 5, 2018

@cfgt hi do you have some example for kernel func?

@cfgt
Copy link
Contributor

cfgt commented Dec 5, 2018

Unfortunately, I don't have any I can share at the moment.

@lupo112
Copy link

lupo112 commented Jun 11, 2019

Hi, im having the same issue:

λ go get -u gorgonia.org/cu
# gorgonia.org/cu
go\src\gorgonia.org\cu\addressing.go:57:8: could not determine kind of name for C.CUmem_advise
go\src\gorgonia.org\cu\addressing.go:60:16: could not determine kind of name for C.cuMemAdvise
go\src\gorgonia.org\cu\addressing.go:86:16: could not determine kind of name for C.cuMemPrefetchAsync

I have installed CUDA 9.2, all environments are set (cuda bin, libnvvp= and lib/x64 are in PATH) even all other variables in this issue i already set (LIBRARY_PATH, LD_LIBRARY_PATH, C_INCLUDE_PATH).

Any idea what is wrong?

EDIT:
From GoLand IDE, im getting this error:

# gorgonia.org/cu
vendor\gorgonia.org\cu\addressing.go:57:8: could not determine kind of name for C.CUmem_advise
vendor\gorgonia.org\cu\addressing.go:60:16: could not determine kind of name for C.cuMemAdvise
vendor\gorgonia.org\cu\addressing.go:86:16: could not determine kind of name for C.cuMemPrefetchAsync
# gorgonia.org/cu/dnn
vendor\gorgonia.org\cu\dnn\convolution.go:119:66: could not determine kind of name for C.CUDNN_CONVOLUTION_BWD_DATA_ALGO_COUNT
vendor\gorgonia.org\cu\dnn\convolution.go:96:70: could not determine kind of name for C.CUDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT
vendor\gorgonia.org\cu\dnn\convolution.go:95:70: could not determine kind of name for C.CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING
vendor\gorgonia.org\cu\dnn\convolution.go:93:70: could not determine kind of name for C.CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD
vendor\gorgonia.org\cu\dnn\convolution.go:73:61: could not determine kind of name for C.CUDNN_CONVOLUTION_FWD_ALGO_COUNT
vendor\gorgonia.org\cu\dnn\convolution.go:170:18: could not determine kind of name for C.gocudnnNewConvolution
cgo: 
gcc errors for preamble:
In file included from vendor\gorgonia.org\cu\dnn\convolution.go:4:0:
./convolution.h:2:2: error: unknown type name 'cudnnMathType_t'
  cudnnMathType_t mathType, const int groupCount, 
  ^


Compilation finished with exit code 2

@cfgt
Copy link
Contributor

cfgt commented Jun 11, 2019

I assume this is on Linux? Have you installed cuDNN?

@lupo112
Copy link

lupo112 commented Jun 11, 2019

I tried install cuDNN. Currently i am getting only these errors:

# gorgonia.org/cu
vendor\gorgonia.org\cu\addressing.go:57:8: could not determine kind of name for C.CUmem_advise
vendor\gorgonia.org\cu\addressing.go:60:16: could not determine kind of name for C.cuMemAdvise
vendor\gorgonia.org\cu\addressing.go:86:16: could not determine kind of name for C.cuMemPrefetchAsync

Compilation finished with exit code 2

Is it compatible with CUDA 9.2?

EDIT: Its on Windows 7

@cfgt
Copy link
Contributor

cfgt commented Jun 13, 2019

@lupo112 Sorry, got busy at work.

Hm, maybe let's go through a few steps - it should be compatible with CUDA 9.2 - I can't confirm however, since I'm using CUDA 10 on my machine at the moment.

What version of Go do you have installed?
Can you tell me what are the CUDA related paths you have in LIBRARY_PATH, LD_LIBRARY_PATH, PATH and C_INCLUDE_PATH?
Would you happen to have other versions of CUDA installed?

@lupo112
Copy link

lupo112 commented Jun 18, 2019

go version go1.12.5 windows/amd64

C_INCLUDE_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include
LD_LIBRARY_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64
LIBRARY_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64
PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp;D:\programs\anaconda3;D:\programs\anaconda3\Library\mingw-w64\bin;D:\programs\anaconda3\Library\usr\bin;D:\programs\anaconda3\Library\bin;D:\programs\anaconda3\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;D:\programs\ND4JBlas;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\mpirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\mpirt;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32_win\compiler;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\NVIDIA Corporation\NVSMI;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program Files\TortoiseSVN\bin;c:\Program Files\Java\jdk1.7.0_67\bin;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\;C:\Program Files\MATLAB\R2014b\runtime\win64;C:\Program Files\MATLAB\R2014b\bin;d:\programs\qpdf-5.1.2\bin;d:\wamp\bin\php\php7.2.4;C:\ProgramData\ComposerSetup\bin;d:\programs\ant\bin;C:\MinGW\msys\1.0\bin;C:\Program Files (x86)\scala\bin;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Dart\dart-sdk\bin;C:\Program Files\Git\cmd;D:\go\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common

Yes, im having installed v6.5, v7.5, v8.0, v9.0 and v9.2.

@cfgt
Copy link
Contributor

cfgt commented Jun 19, 2019

It generally looks correct - I don't see any CUDA specific issues - the only major difference between your environment and mine is that I can see if that you are using MinGW directly instead via MSYS2 - so the only thing left I would try would be to installing MSYS2 and installing the mingw toolchain package in it (replace your MinGW in your path) and see if that might resolve the problem.

@lupo112
Copy link

lupo112 commented Jun 25, 2019

No change, again the same problem:

# gorgonia.org/cu
go\src\gorgonia.org\cu\addressing.go:57:8: could not determine kind of name for C.CUmem_advise
go\src\gorgonia.org\cu\addressing.go:60:16: could not determine kind of name for C.cuMemAdvise
go\src\gorgonia.org\cu\addressing.go:86:16: could not determine kind of name for C.cuMemPrefetchAsync

@cfgt
Copy link
Contributor

cfgt commented Jun 25, 2019

Darn - can you check if you have any references to cuda_v7.h or cudnn_v7.h in your src/gorgonia.org/cu directory?

Also, can you check that you have cudnn.h and cuda.h in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include?

@lupo112
Copy link

lupo112 commented Jun 25, 2019

In directory src/gorgonia.org/cu there in no such files.

In C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include files cudnn.h and cuda.h exist.

Any idea why they not exist in src/gorgonia.org/cu?

@cfgt
Copy link
Contributor

cfgt commented Jun 25, 2019

My current guess is that it must have something to do with your environment - it appears to be picking up a <cuda.h> which doesn't have the correct definitions for some reason.

Can you try making a generic C file with the following lines:

#include <cuda.h>
#include <cudnn.h>

Then, run gcc -M name_of_file.c and pasting the output here?

@lupo112
Copy link

lupo112 commented Jun 25, 2019

I tried different setting of variable C_INCLUDE_PATH even simplify the path to use the c:/cuda/ symlink. Everytime it looks ok:

name_of_file.o: name_of_file.c c:/cuda/v9.2/include/cuda.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/stdlib.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw_mac.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/_mingw_secapi.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/vadefs.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_directx.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/sdks/_mingw_ddk.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/corecrt_wstdlib.h \
 c:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.1.0/include-fixed/limits.h \
 c:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.1.0/include-fixed/syslimits.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/limits.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/crtdefs.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/sec_api/stdlib_s.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/malloc.h \
 c:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.1.0/include/stdint.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/stdint.h \
 c:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/9.1.0/include/stddef.h \
 c:/msys64/mingw64/x86_64-w64-mingw32/include/stddef.h \
 c:/cuda/v9.2/include/cudnn.h c:/cuda/v9.2/include/driver_types.h \
 c:/cuda/v9.2/include/host_defines.h \
 c:/cuda/v9.2/include/crt/host_defines.h \
 c:/cuda/v9.2/include/vector_types.h c:/cuda/v9.2/include/cuda_runtime.h \
 c:/cuda/v9.2/include/host_config.h \
 c:/cuda/v9.2/include/crt/host_config.h \
 c:/cuda/v9.2/include/builtin_types.h c:/cuda/v9.2/include/device_types.h \
 c:/cuda/v9.2/include/surface_types.h \
 c:/cuda/v9.2/include/texture_types.h \
 c:/cuda/v9.2/include/library_types.h \
 c:/cuda/v9.2/include/channel_descriptor.h \
 c:/cuda/v9.2/include/cuda_runtime_api.h \
 c:/cuda/v9.2/include/cuda_device_runtime_api.h \
 c:/cuda/v9.2/include/driver_functions.h \
 c:/cuda/v9.2/include/vector_functions.h \
 c:/cuda/v9.2/include/vector_functions.hpp                                           

But the result is still the same:

src\gorgonia.org\cu\addressing.go:57:8: could not determine kind of name for C.CUmem_advise
src\gorgonia.org\cu\addressing.go:60:16: could not determine kind of name for C.cuMemAdvise
src\gorgonia.org\cu\addressing.go:86:16: could not determine kind of name for C.cuMemPrefetchAsync

@cfgt
Copy link
Contributor

cfgt commented Jun 27, 2019

Hm, still completely mysterious what in your environment is causing this.

There may be clues in go env

Maybe try go get -u -v gorgonia.org/cu and see what the output is.

And as a last resort, I guess cloning the source code manually into your go directory and let's see if we can actually build anything.

@lupo112
Copy link

lupo112 commented Jun 27, 2019

I already tried everything and im hopeless now.

Here is the output of go env

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\komp2\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\komp2\go
set GOPROXY=
set GORACE=
set GOROOT=c:\msys64\mingw64\lib\go
set GOTMPDIR=
set GOTOOLDIR=c:\msys64\mingw64\lib\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\komp2\AppData\Local\Temp\go-build081029130=/tmp/go-build -gno-record-gcc-switches

And here is the output of go get -u -v gorgonia.org/cu:

Fetching https://gorgonia.org/cu?go-get=1
Parsing meta tags from https://gorgonia.org/cu?go-get=1 (status code 200)
get "gorgonia.org/cu": found meta tag get.metaImport{Prefix:"gorgonia.org/cu", VCS:"git", RepoRoot:"https://github.com/gorgonia/cu"} at https://gorgonia.org/cu?go-get=1
gorgonia.org/cu (download)
github.com/pkg/errors (download)
gorgonia.org/cu
# gorgonia.org/cu
src\gorgonia.org\cu\addressing.go:57:8: could not determine kind of name for C.CUmem_advise
src\gorgonia.org\cu\addressing.go:60:16: could not determine kind of name for C.cuMemAdvise
src\gorgonia.org\cu\addressing.go:86:16: could not determine kind of name for C.cuMemPrefetchAsync

After downloading the repo (master or v0.8.0) i get after go build same output:

# gorgonia.org/cu
.\addressing.go:57:8: could not determine kind of name for C.CUmem_advise
.\addressing.go:60:16: could not determine kind of name for C.cuMemAdvise
.\addressing.go:86:16: could not determine kind of name for C.cuMemPrefetchAsync

Any idea?

@cfgt
Copy link
Contributor

cfgt commented Jun 27, 2019

Yeah, it's really bizarre - I can't come anywhere close to reproducing your error.

C:\Users\cfgt\Desktop>go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\cfgt\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\cfgt\go
set GOPROXY=
set GORACE=
set GOROOT=c:\go
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\cfgt\AppData\Local\Temp\go-build002203578=/tmp/go-build -gno-record-gcc-switches

@cfgt cfgt mentioned this issue Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants