Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CUDA cudaMalloc

Tags:

c++

cuda

gpgpu

gpu

I've started writing a new CUDA application. However I hit a funny detour along the way. Calling the first cudaMalloc on a variable x, fails the first time. However when I call it the second time it returns cudaSuccess. Recently upgraded to CUDA 4.0 SDK, it's a really weird bug.

I even did some testing and it seems the first call of cudaMalloc fails.

like image 378
Nocturnal Avatar asked Jul 24 '26 22:07

Nocturnal


1 Answers

The very first call to any of the cuda library functions launches an initialisation subroutine. It can happen that somehow the initialisation fails and not the cudaMalloc itself. (CUDA Programming Guide, section 3.2.1)

Somehow, later, however it seems it works, despite the initial failure. I don't know your setting and your code so I can't really help you further. Check the Programming Guide!

like image 147
CygnusX1 Avatar answered Jul 26 '26 15:07

CygnusX1