Multiple CPU threads and CUDA_ERROR_DEINITIALIZED

Hello Forum,

I’m working on a CUDA application using the C API that spawns several CPU threads.

I am allocating device memory with cudaMalloc from a thread other than the main thread but I am getting a result of CUDA_ERROR_DEINITIALIZED.

I am not making any other CUDA calls from any other threads. Are there any special considerations to make under this circumstances?

I’m using CUDA version 2.0 on Mac OS X 10.5.8. My device is a GeForce 9400M.

Thanks in advance,
Alejandro.-

Okay, I’ve been able to find the problem. Apparently CUDA has two separate ways of addressing errors which are mutually exclusive.

If you are using the C API (as opposed to the driver API), you should check for errors agains cudaSuccess and not CUDA_SUCCESS.

You should also call cudaThreadSynchronize() before attempting to obtain the last error code, otherwise you might get an error code from another CUDA operation that executed at a different time.

Alejandro.-

Okay, I’ve been able to find the problem. Apparently CUDA has two separate ways of addressing errors which are mutually exclusive.

If you are using the C API (as opposed to the driver API), you should check for errors agains cudaSuccess and not CUDA_SUCCESS.

You should also call cudaThreadSynchronize() before attempting to obtain the last error code, otherwise you might get an error code from another CUDA operation that executed at a different time.

Alejandro.-