Is it possible to query the number of active NVEnc sessions on one device?

I am working on a video transcoder that should support stacking any number og high-end nVidia GPUs in order to transcode multiple streams simultanously. Low-end GPUs only support 2 encoding session at a time. This makes it very easy to split the load over the different GPUs in the stack by simply trying device 0 and if it fails to open an encode session we try device 1 and then device 2 etc. The problem is that high-end cards will allow any number of encode sessions and multiplex the load over the two hardware encoders on the device. This means that following the previous mentioned logic, we will never use device 1 and keep piling encode sessions on device 0 until the card chokes and won’t be able to transcode live.

My question is: Is there any way to query the number of active encode sessions on a device? This way we can find the device with the least amount of active encode sessions and use that.

do you find the way to get the number of encode sessions??

Unfortunately no. We ended up having a file on a the filesystem where we list the encode session we start and on which device it is running. When we are done we find the entry and remove it from the list.