If you're working with NVIDIA GPUs and need to retrieve hardware-specific details like the VBIOS (Video BIOS) version, the NVIDIA Management Library (NVML) is a powerful tool for the job. The VBIOS is a firmware component of the GPU that controls the basic hardware-level functionalities and is essential for debugging and configuration in certain scenarios. This tutorial shows how to get VBIOS version of Nvidia GPU using NVML and C++.
The code initializes the NVML and retrieves the number of NVIDIA GPUs available on the system. For each GPU, it retrieves the GPU's name via nvmlDeviceGetName
and its VBIOS version using nvmlDeviceGetVbiosVersion
. These details are then printed to the console. Finally, the code release NVML resources.
#include <iostream>
#include <nvml.h>
int main()
{
nvmlInit();
uint32_t deviceCount;
nvmlDeviceGetCount(&deviceCount);
for (uint32_t i = 0; i < deviceCount; ++i) {
nvmlDevice_t device;
nvmlDeviceGetHandleByIndex(i, &device);
char name[NVML_DEVICE_NAME_V2_BUFFER_SIZE];
nvmlDeviceGetName(device, name, NVML_DEVICE_NAME_V2_BUFFER_SIZE);
char version[NVML_DEVICE_VBIOS_VERSION_BUFFER_SIZE];
nvmlDeviceGetVbiosVersion(device, version, NVML_DEVICE_VBIOS_VERSION_BUFFER_SIZE);
std::cout << "Device Number: " << i << std::endl;
std::cout << " Device Name: " << name << std::endl;
std::cout << " VBIOS Version: " << version << std::endl;
}
nvmlShutdown();
return 0;
}
The output might look like this:
Device Number: 0
Device Name: NVIDIA GeForce RTX 3070 Laptop GPU
VBIOS Version: 94.04.42.00.CA
Leave a Comment
Cancel reply