ze_Loader.dll(Intel Level 0 API)?
This is Windows dll (c:/users/windows/ze_loader.dll) that loads the
Level Zero driver and exposes the GPU runtime APIs to C/C++ programs.
Temperature, fan speed, power usage, memory info, and utilization are
fetched through Level Zero and Level Zero System Management (ZES) API
calls.
A program can call functions like
zeInit, enumerate devices, and then use the ZES APIs to
read system metrics
Example C code
#include <stdio.h>
#include <stdint.h>
#include <ze_api.h>
#include <zes_api.h>
int main(void) {
uint32_t driverCount = 0;
uint32_t deviceCount = 0;
zes_driver_handle_t *drivers = NULL;
zes_device_handle_t *devices = NULL;
zes_temp_handle_t *temps = NULL;
uint32_t tempCount = 0;
// Initialize runtime
ze_result_t zres = zeInit(0);
if (zres != ZE_RESULT_SUCCESS) {
printf("zeInit failed: %d\n", zres);
return 1;
}
// Enumerate Intel drivers
zres = zesInit(0);
if (zres != ZE_RESULT_SUCCESS) {
printf("zesInit failed: %d\n", zres);
return 1;
}
zres = zesDriverGet(&driverCount, NULL);
if (zres != ZE_RESULT_SUCCESS || driverCount == 0) {
printf("No Intel drivers found.\n");
return 1;
}
drivers = (zes_driver_handle_t *)calloc(driverCount, sizeof(zes_driver_handle_t));
zres = zesDriverGet(&driverCount, drivers);
if (zres != ZE_RESULT_SUCCESS) {
printf("zesDriverGet failed: %d\n", zres);
return 1;
}
// Enumerate devices for the first driver
zres = zesDeviceGet(drivers[0], &deviceCount, NULL);
if (zres != ZE_RESULT_SUCCESS || deviceCount == 0) {
printf("No devices found.\n");
return 1;
}
devices = (zes_device_handle_t *)calloc(deviceCount, sizeof(zes_device_handle_t));
zres = zesDeviceGet(drivers[0], &deviceCount, devices);
if (zres != ZE_RESULT_SUCCESS) {
printf("zesDeviceGet failed: %d\n", zres);
return 1;
}
// Query temperature sensors
zres = zesDeviceEnumTemperatureSensors(devices[0], &tempCount, NULL);
if (zres == ZE_RESULT_SUCCESS && tempCount > 0) {
temps = (zes_temp_handle_t *)calloc(tempCount, sizeof(zes_temp_handle_t));
zres = zesDeviceEnumTemperatureSensors(devices[0], &tempCount, temps);
if (zres == ZE_RESULT_SUCCESS) {
for (uint32_t i = 0; i < tempCount; ++i) {
float tempC = 0.0f;
zesTemperatureGet(temps[i], &tempC);
printf("GPU temp sensor %u: %.2f C\n", i, tempC);
}
}
}
// Additional values can be queried similarly:
// - fan speed with zesDeviceEnumFans / zesFanGetSpeed
// - power with zesDeviceEnumPowerDomains / zesPowerGetEnergyCounter
// - memory/usage with device properties and runtime queries
free(drivers);
free(devices);
free(temps);
return 0;
}