Задать вопрос
@alst161

Как подключить CUDA в go?

Вот пример https://github.com/miguelzambrana/cudagolabs . Компилирую и вот что получаю
# github.com/mumax/3/cuda/cu
C:\Go\src\github.com\mumax\3\cuda\cu\context.go:5:18: fatal error: cuda.h: No such file or directory
 //#include <cuda.h>
                  ^
compilation terminated.
# github.com/barnex/cuda5/cu
C:\Go\src\github.com\barnex\cuda5\cu\context.go:5:18: fatal error: cuda.h: No such file or directory
 //#include <cuda.h>
                  ^
compilation terminated.

Так же использовал другие сборки на go для cuda. Тоже не видел. Указывал в ручную и вот
# github.com/unixpickle/cuda
In file included from C:/CUDA/v8.0/include/cuda_runtime_api.h:133:0,
                 from C:\Go\src\github.com\unixpickle\cuda\allocator.go:4:
C:/CUDA/v8.0/include/host_defines.h:84:0: warning: "__cdecl" redefined
 #define __cdecl
 ^
<built-in>: note: this is the location of the previous definition
# github.com/unixpickle/cuda
In file included from C:/CUDA/v8.0/include/cuda_runtime_api.h:133:0,
                 from C:\Go\src\github.com\unixpickle\cuda\allocator_bfc.go:5:
C:/CUDA/v8.0/include/host_defines.h:84:0: warning: "__cdecl" redefined
 #define __cdecl
 ^
<built-in>: note: this is the location of the previous definition
# github.com/unixpickle/cuda
In file included from C:/CUDA/v8.0/include/cuda_runtime_api.h:133:0,
                 from C:\Go\src\github.com\unixpickle\cuda\buffer.go:5:
C:/CUDA/v8.0/include/host_defines.h:84:0: warning: "__cdecl" redefined
 #define __cdecl
 ^
<built-in>: note: this is the location of the previous definition
# github.com/unixpickle/cuda
In file included from C:/CUDA/v8.0/include/cuda_runtime_api.h:133:0,
                 from C:\Go\src\github.com\unixpickle\cuda\errors.go:5:
C:/CUDA/v8.0/include/host_defines.h:84:0: warning: "__cdecl" redefined
 #define __cdecl
 ^
<built-in>: note: this is the location of the previous definition
# github.com/unixpickle/cuda
In file included from C:/CUDA/v8.0/include/cuda_runtime_api.h:133:0,
                 from C:\Go\src\github.com\unixpickle\cuda\module.go:6:
C:/CUDA/v8.0/include/host_defines.h:84:0: warning: "__cdecl" redefined
 #define __cdecl
 ^
<built-in>: note: this is the location of the previous definition
# github.com/unixpickle/cuda
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\allocator.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cudaFree':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:41: undefined reference to `cudaFree'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\allocator.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cudaMalloc':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:60: undefined reference to `cudaMalloc'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\allocator.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cudaMemGetInfo':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:79: undefined reference to `cudaMemGetInfo'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\buffer.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cudaMemcpy':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:45: undefined reference to `cudaMemcpy'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\buffer.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cudaMemset':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:66: undefined reference to `cudaMemset'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\context.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuCtxCreate':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:43: undefined reference to `cuCtxCreate_v2'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\context.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuCtxDestroy':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:61: undefined reference to `cuCtxDestroy_v2'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\context.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuInit':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:80: undefined reference to `cuInit'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\device.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuDeviceGet':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:43: undefined reference to `cuDeviceGet'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\device.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuDeviceGetAttribute':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:63: undefined reference to `cuDeviceGetAttribute'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\device.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuDeviceGetCount':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:81: undefined reference to `cuDeviceGetCount'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\device.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuDeviceGetName':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:101: undefined reference to `cuDeviceGetName'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\device.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuDeviceTotalMem':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:121: undefined reference to `cuDeviceTotalMem_v2'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\errors.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cudaGetErrorString':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:41: undefined reference to `cudaGetErrorString'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\module.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuLaunchKernel':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:52: undefined reference to `cuLaunchKernel'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\module.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuModuleGetFunction':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:72: undefined reference to `cuModuleGetFunction'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\module.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuModuleLoadDataEx':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:95: undefined reference to `cuModuleLoadDataEx'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\module.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuModuleUnload':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:113: undefined reference to `cuModuleUnload'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\stream.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuCtxSynchronize':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:40: undefined reference to `cuCtxSynchronize'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\stream.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuStreamCreate':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:60: undefined reference to `cuStreamCreate'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\stream.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuStreamCreateWithPriority':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:80: undefined reference to `cuStreamCreateWithPriority'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\stream.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuStreamDestroy':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:98: undefined reference to `cuStreamDestroy_v2'
C:\Users\alst161\AppData\Local\Temp\go-build729909150\github.com\unixpickle\cuda\_obj\stream.cgo2.o: In function `_cgo_44df6db5b5f3_Cfunc_cuStreamSynchronize':
C:\Go\src\github.com\unixpickle\cuda/cgo-gcc-prolog:116: undefined reference to `cuStreamSynchronize'
collect2.exe: error: ld returned 1 exit status
  • Вопрос задан
  • 762 просмотра
Подписаться 2 Оценить 1 комментарий
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы