Is there a way, I can query the number of CUDA contexts, i.e. indepedent processes that each have a CUDA context? I did not see any such API in the programming guide, something like cudaGetDeviceContextCount(device).
I would like to do this for GPU load balancing when there are many processes each using the GPU with its own context. I could have a cpp macro wrapped around cudaSetDevice to handle a global counter, but it will be alot cleaner if there’s a way with the driver API.