{"id":19817154,"url":"https://github.com/nvpro-samples/nvml_enterprise_gpu_check","last_synced_at":"2025-05-01T11:30:22.946Z","repository":{"id":86083470,"uuid":"314587632","full_name":"nvpro-samples/nvml_enterprise_gpu_check","owner":"nvpro-samples","description":"Shows how to check if a GPU is an Enterprise/Quadro GPU using NVML.","archived":false,"fork":false,"pushed_at":"2024-06-28T09:55:14.000Z","size":26,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-06-28T11:15:44.235Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nvpro-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-20T15:05:50.000Z","updated_at":"2024-06-28T09:55:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"dfb1900a-7387-4474-97e4-4d9d686afb67","html_url":"https://github.com/nvpro-samples/nvml_enterprise_gpu_check","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fnvml_enterprise_gpu_check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fnvml_enterprise_gpu_check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fnvml_enterprise_gpu_check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvpro-samples%2Fnvml_enterprise_gpu_check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvpro-samples","download_url":"https://codeload.github.com/nvpro-samples/nvml_enterprise_gpu_check/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224253426,"owners_count":17280934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T10:11:51.312Z","updated_at":"2024-11-12T10:11:51.985Z","avatar_url":"https://github.com/nvpro-samples.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nvml_enterprise_gpu_check\n\nShows how to detect if an NVIDIA GPU is an Enterprise or Quadro GPU, using [NVML](https://developer.nvidia.com/nvidia-management-library-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.\n\nWindows-only applications can also use [NVAPI](https://developer.nvidia.com/nvapi) to detect if a GPU is an Enterprise or Quadro GPU using `NvAPI_GPU_GetQuadroStatus`.\n\n## What Differentiates Enterprise GPUs?\n\nNVIDIA 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.\n\n## Example Outputs\n\nOn a device with a Quadro RTX 8000 GPU:\n\n```\n1 device(s).\nDevice 0:\n        Name: Quadro RTX 8000\n        Is Professional/Quadro GPU: Yes\n```\n\nOn a device with two Quadro GPUs, one a Quadro RTX 8000 and the other a Quadro P3000:\n\n```\n2 device(s).\nDevice 0:\n        Name: Quadro RTX 8000\n        Is Professional/Quadro GPU: Yes\nDevice 1:\n        Name: Quadro P3000\n        Is Professional/Quadro GPU: Yes\n```\n\nOn a device with a GeForce GTX 1060 Max-Q GPU (which is not a Professional or Quadro GPU):\n\n```\n1 device(s).\nDevice 0:\n        Name: GeForce GTX 1060 with Max-Q Design\n        Is Professional/Quadro GPU: No\n```\n\n## How It Works\n\nDetermining which GPUs are Enterprise or Quadro GPUs takes five steps:\n\n- Load the NVML shared library.\n- Call `nvmlInit()` to initialize NVML.\n- Call `nvmlDeviceGetCount` to get the number of NVIDIA GPUs. Then for each index from 0 to the count minus one:\n  - Call `nvmlDeviceGetHandleByIndex` to get the `nvmlDevice_t` device from the index.\n  - Call `nvmlDeviceGetBrand` with the device to get an `nvmlBrandType_t` brand. If this is `NVML_BRAND_QUADRO`, `NVML_BRAND_NVIDIA_VAPPS`, or `NVML_BRAND_NVIDIA_RTX`, then the device is an Enterprise or Quadro GPU.\n\n| ***Some Info about the `nvmlBrandType_t` Enum***             |\n| ------------------------------------------------------------ |\n| 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](https://www.nvidia.com/en-us/data-center/virtual-solutions/) 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`. |\n\nThe 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.\n\n### Loading NVML\n\nThe 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).\n\nOn 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`](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`.\n\nWe show one way to implement loading NVML correctly in [`loadNVML.cpp`](loadNVML.cpp) using the build configuration in [`CMakeLists.txt`](CMakeLists.txt). On Windows, we tell the compiler to [delay-load](https://docs.microsoft.com/en-us/cpp/build/reference/linker-support-for-delay-loaded-dlls) `nvml.dll`, which makes it so that Windows doesn't attempt to load the DLL using the [standard search order](https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-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\")`.\n\n## Build Instructions\n\nThis 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.\n\nThis sample doesn't depend on the [NVIDIA DesignWorks Samples'](https://github.com/nvpro-samples) [`nvpro_core`](https://github.com/nvpro-samples/nvpro_core) project — but if it is built along with `nvpro_core` (for instance, using [`build_all`](https://github.com/nvpro-samples/build_all)), then it will automatically use the same build and install directories as the rest of the nvpro-samples.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvpro-samples%2Fnvml_enterprise_gpu_check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvpro-samples%2Fnvml_enterprise_gpu_check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvpro-samples%2Fnvml_enterprise_gpu_check/lists"}