I have been trying to use event timers as per example code seen at https://developer.nvidia.com/blog/how-implement-performance-metrics-cuda-cc/
However no matter what I do I seem to always get an error invalid resource handle or worse, a SIGSEGV. This is somewhat baffling.
I have been trying over and over to reduce down to a minimal test case and the code is just a vector addition as can be seen here ~blastwave/bw: nvidia_cuda/event_timer/event_timer.cu - sourcehut git
I do select a GPU device with " int device_id = gpu_unit_min_number;" and then the call “cuda_err = cudaSetDevice(device_id);” which seems to work. Near as anyone can tell. After the device has been selected I then call “cudaEventCreate(&cuda_start);” for both the start and stop event timers. No matter what I do these blow up when I try to use them later with “cuda_err = cudaEventRecord(cuda_start, 0);”
Any insight would be greatly appreciated.