lightvector / KataGo

GTP engine and self-play learning in Go
https://katagotraining.org/
Other
3.49k stars 564 forks source link

A problem building for CUDA #949

Closed oldnyr closed 1 month ago

oldnyr commented 3 months ago

Hello,

With, cmake . -DUSE_BACKEND=CUDA and then, make I have this error

In file included from /home/jim/KataGo/cpp/neuralnet/cudabackend.cpp:2: /home/jim/KataGo/cpp/neuralnet/cudabackend.cpp: In constructor ‘Buffers::Buffers(CudaHandles*, const Model&, const ScratchBuffers&)’: /home/jim/KataGo/cpp/neuralnet/cudabackend.cpp:2240:37: error: invalid conversion from ‘float’ to ‘void’ [-fpermissive] 2240 CUDA_ERR("Buffers",cudaMalloc(&inputMetaBufFloat, inputMetaBufBytesFloat)); ^~~~~~
float**

/home/jim/KataGo/cpp/neuralnet/../neuralnet/cudaerrorcheck.h:12:46: note: in definition of macro ‘CUDA_ERR’ 12 | #define CUDA_ERR(opName,x) { checkCudaError((x),opName,FILE,#x,LINE); } | ^ In file included from /usr/local/cuda-12.5/include/vector_functions.h:63, from /usr/local/cuda-12.5/include/cuda_fp16.h:131, from /home/jim/KataGo/cpp/neuralnet/../neuralnet/../neuralnet/cudaincludes.h:9, from /home/jim/KataGo/cpp/neuralnet/../neuralnet/cudaerrorcheck.h:4: /usr/local/cuda-12.5/include/cuda_runtime_api.h:5363:76: note: initializing argument 1 of ‘cudaError_t cudaMalloc(void, size_t)’ 5363 | __cudart_builtin__ cudaError_t CUDARTAPI cudaMalloc(void devPtr, size_t size); | ~^~~~

make[2]: [CMakeFiles/katago.dir/build.make:643: CMakeFiles/katago.dir/neuralnet/cudabackend.cpp.o] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [CMakeFiles/Makefile2:83: CMakeFiles/katago.dir/all] Error 2 make: [Makefile:91: all] Error 2

Thank you

oldnyr commented 3 months ago

This appears to be resolved by changing cpp/neuralnet/cudabackend.cpp line 2240 to,

CUDA_ERR("Buffers",cudaMalloc(reinterpret_cast<void**>(&inputMetaBufFloat), inputMetaBufBytesFloat));

Is this change correct?

lightvector commented 1 month ago

Thanks for reporting this way back, I missed it earlier but yes it is correct and I have gotten around to making the fix now as of https://github.com/lightvector/KataGo/releases/tag/v1.15.2 and master branch.