find out the least busy GPU for nvenc

Hi,

I’m using the nvenc lib for H264 encoding across multiple GPUs in a multi-threaded env. Is there a function can find out the usage of the GPU so I can chose a least busy one for the next encoder? Thanks.

Seven.

The NVML library (https://developer.nvidia.com/nvidia-management-library-nvml) can be used to assess GPU utilization for use with CUDA. Note: Best I know this library is not available on OS X, only Linux and Windows.

An interesting question, to which I do not know the answer, is whether NVML’s GPU utilitization metric accounts for GPU use by NVENC itself, as this encoder block is a functional unit separate from the CUDA cores.

I tried that lib on linux it can return some utilization data and seems it can reflect how busy it is.

Another question maybe off topic but releated, if I alloc a cu context and opened the encoder session, and my process crashes, will the lib or cuda itself can release the resource? If not, how can I make sure the cuda is not messed up w/o reboot the entire server?

Thanks.