we can query the available GPU with nvenc hardware like this:
cuResult = cuInit(0);
if (cuResult != CUDA_SUCCESS)
{
printf(">> GetNumberEncoders() - cuInit() failed error:0x%x\n", cuResult);
exit(EXIT_FAILURE);
}
checkCudaErrors(cuDeviceGetCount(&deviceCount));
if (deviceCount == 0)
{
printf(">> GetNumberEncoders() - reports no devices available that support CUDA\n");
exit(EXIT_FAILURE);
}
else
{
printf(">> GetNumberEncoders() has detected %d CUDA capable GPU device(s) <<\n", deviceCount);
for (int currentDevice=0; currentDevice < deviceCount; currentDevice++)
{
checkCudaErrors(cuDeviceGet(&cuDevice, currentDevice));
checkCudaErrors(cuDeviceGetName(gpu_name, 100, cuDevice));
checkCudaErrors(cuDeviceComputeCapability(&SMmajor, &SMminor, currentDevice));
printf(" [ GPU #%d - < %s > has Compute SM %d.%d, NVENC %s ]\n",
currentDevice, gpu_name, SMmajor, SMminor,
(((SMmajor << 4) + SMminor) >= 0x30) ? "Available" : "Not Available");
if (((SMmajor << 4) + SMminor) >= 0x30)
{
encoderInfo[NVENC_devices].device = currentDevice;
strcpy(encoderInfo[NVENC_devices].gpu_name, gpu_name);
NVENC_devices++;
}
}
}
I have 8 GPU whit NVENC capability:
How can we check that specific NVENC hardware is now running or Idle. Is there any way to monitoring NVENC hardware ?
What about specific NVENC API function "OR" CUDA Driver or API functions that help me to find out which GPU or NVENC hardware is Idle?
NOTE: I know that CUDA and NVENC hardware are completely separate things but I am looking for Direct or Indirect (using Cuda API like using Cuda for specifying the available NVENC hardware) way for checking specific NVENC's status ???
you can monitor your NVENC hardware is Active or not in a indirect way using this command
to see specific NVENC hardware is busy or idle, because when you want to use specific NVENC you should create a cuda thread on that GPU first, and use its memory too, so by checking the status of the GPU we can extend it to its NVENC hardware.