Awesome
nvml_enterprise_gpu_check
Shows how to detect if an NVIDIA GPU is an Enterprise or Quadro GPU, using NVML (the library for which is installed with the CUDA Toolkit). This code can also be modified to detect if the GPU is a Tesla or GeForce GPU.
Windows-only applications can also use NVAPI to detect if a GPU is an Enterprise or Quadro GPU using NvAPI_GPU_GetQuadroStatus
.
What Differentiates Enterprise GPUs?
NVIDIA Enterprise and Quadro GPUs such as the RTX A6000 or the Quadro RTX 8000 are designed for professional, scientific, and workstation applications, and are built for systems that need certified devices and drivers. They support special features such as Quadro Sync, NVIDIA Mosaic, Quadro View, and Quadro Virtual Data Center Workstation. They also include around 8x faster 64-bit floating-point performance, larger memory capacity, faster OpenGL interop, and more.
Example Outputs
On a device with a Quadro RTX 8000 GPU:
1 device(s).
Device 0:
Name: Quadro RTX 8000
Is Professional/Quadro GPU: Yes
On a device with two Quadro GPUs, one a Quadro RTX 8000 and the other a Quadro P3000:
2 device(s).
Device 0:
Name: Quadro RTX 8000
Is Professional/Quadro GPU: Yes
Device 1:
Name: Quadro P3000
Is Professional/Quadro GPU: Yes
On a device with a GeForce GTX 1060 Max-Q GPU (which is not a Professional or Quadro GPU):
1 device(s).
Device 0:
Name: GeForce GTX 1060 with Max-Q Design
Is Professional/Quadro GPU: No
How It Works
Determining which GPUs are Enterprise or Quadro GPUs takes five steps:
- Load the NVML shared library.
- Call
nvmlInit()
to initialize NVML. - Call
nvmlDeviceGetCount
to get the number of NVIDIA GPUs. Then for each index from 0 to the count minus one:- Call
nvmlDeviceGetHandleByIndex
to get thenvmlDevice_t
device from the index. - Call
nvmlDeviceGetBrand
with the device to get annvmlBrandType_t
brand. If this isNVML_BRAND_QUADRO
,NVML_BRAND_NVIDIA_VAPPS
, orNVML_BRAND_NVIDIA_RTX
, then the device is an Enterprise or Quadro GPU.
- Call
Some Info about the nvmlBrandType_t Enum |
---|
Recent drivers (R460+) now return the NVML_BRAND_NVIDIA_VAPPS (7), NVML_BRAND_QUADRO_RTX (12), and NVML_BRAND_NVIDIA_RTX (13) values of nvmlBrandType_t from nvmlDeviceGetBrand for Enterprise or Quadro GPUs. These new enum values are included in CUDA SDK 11.2.2. NVML_BRAND_NVIDIA_VAPPS is returned when using a virtual Quadro GPU without GPU passthrough, older drivers return NVML_BRAND_QUADRO , newer drivers with pre-Ampere Enterprise GPUs (e.g. Quadro RTX 6000s) return NVML_BRAND_QUADRO_RTX , and newer drivers with Ampere+ Enterprise GPUs (e.g. RTX A6000s) return NVML_BRAND_NVIDIA_RTX . |
The last four steps are usually straightforward, but the first step can be a bit more complex on Windows. We describe how to load NVML below.
Loading NVML
The NVML shared library depends on the version of the driver it was installed with, so applications should look for the NVML shared library installed with the driver (rather than redistributing the NVML shared library).
On Linux platforms, NVML is included in the standard library load path. As such, loading NVML is relatively easy; it's enough to link with nvml.lib
and include nvml.h
(see the included FindNVML.cmake
script for a way to include NVML in a CMake build system). However, on Windows, the best place to look for NVML is usually in the place it was installed with the driver, in a directory within C:\Windows\System32\DriverStore\FileRepository
.
We show one way to implement loading NVML correctly in loadNVML.cpp
using the build configuration in CMakeLists.txt
. On Windows, we tell the compiler to delay-load nvml.dll
, which makes it so that Windows doesn't attempt to load the DLL using the standard search order when the application starts. We then call LoadNVMLImports()
before nvmlInit()
. On Windows, this function finds the correct DriverStore subdirectory by getting the location of the OpenGL driver from the registry. It then adds this directory to the top of the search order using SetDllDirectoryA
, and then loads NVML's imports using __HrLoadAllImportsForDll("nvml.dll")
.
Build Instructions
This sample requires CMake, and a version of the CUDA Toolkit (for NVML). To build this sample, configure and generate the project using CMake on CMakeLists.txt
. (This should automatically find NVML on your system.) Then build and run the program.
This sample doesn't depend on the NVIDIA DesignWorks Samples' nvpro_core
project — but if it is built along with nvpro_core
(for instance, using build_all
), then it will automatically use the same build and install directories as the rest of the nvpro-samples.