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.