This project is read-only.

cudaDeviceReset() with CUDAFY

Dec 9, 2012 at 3:26 PM


is there any way how to call cudaDeviceReset(), or is it called automatically at some point ?

Thanks for answer


Dec 10, 2012 at 7:39 AM

Hi Jan,

cudaDeviceReset is part of the run time API whereas CUDAfy is built on the driver API.  There is not direct equivalent.  Need to check what the side effects will be when calling this from CUDAfy.  Do you have a use case you can share?


Dec 10, 2012 at 8:35 AM


thanks for answer,

I was just unable to profile my aplication. CUDA Visual Profiler just showed me a message that I probably forgot to call cudaDeviceReset()


May 8, 2013 at 12:10 AM
+1 for this. I've been unable to use the profiler for the same reason. Suggestions?
May 9, 2013 at 8:46 AM
Adding cudaDeviceReset() would not be difficult but this is actually from the runtime API and as far as I can see there is no equivalent in the driver API that CUDAfy uses. There are also two additional calls that would be useful: cudaProfilerStart and cudaProfilerStop.
What error message are you seeing with the profiler? With the latest Visual Profiler I am seeing a a No timeline message. Using an old version of the profiler there are no issues.
May 9, 2013 at 12:30 PM
Hi Nick, it seems profiler functions are available on the device api, but GASS didn't import them. Should be a simple matter adding them. Check it out:

Speaking of which, the functions "cuFuncSetCacheConfig"/ "cuCtxSetCacheConfig" and "cuFuncSetSharedMemConfig" / "cuCtxSetSharedMemConfig" would also be a welcome addition to cudafy, no? And event management, such as cuEventCreate, cuStreamWaitEvent etc, might also be useful for advanced scenarios.

As for device clean-up, you're right, i could find no analogue on the driver api to "cudaDeviceReset". I wonder what that method does internally, since ultimately it will have to call the driver api. I suspect it won't do more than memory clean-up, stream and ctx destruction (beside counter resets and stuff).

As for the visual profiler, I once had that particular error when I was doing bad things with device memory. I think you shouldn't need to call cudaDeviceReset. But I could be mistaken.
May 9, 2013 at 8:50 PM
It appears I can't actually paste an image here, but the error is:

Session Timeline Incomplete

Unable to read the entire session timeline. The displayed timeline may be empty or incomplete because the application aborted or failed to flush profile data before exiting. The application should call cudaDeviceReset() before exiting to ensure that all profile data is flushed.

@NickKopp what profiler version are you using that works?
May 9, 2013 at 10:01 PM
May 10, 2013 at 4:24 PM
Awesome. I downloaded the last v4.* toolkit from NVidia and the profiler does, in fact, work.