设为首页 加入收藏

TOP

NVML查询显卡信息(四)
2017-10-12 17:59:02 】 浏览:11549
Tags:NVML 查询 显卡 信息
DM driver model or on non-CUDA capable GPU.\n
"); else if (NVML_SUCCESS != result) { printf("\t\t Failed to set compute mode for device %i: %s\n", i, nvmlErrorString(result)); goto Error; } else { printf("\t Restoring device's compute mode back to '%s'\n", convertToComputeModeString(compute_mode)); result = nvmlDeviceSetComputeMode(device, compute_mode); if (NVML_SUCCESS != result) { printf("\t\t Failed to restore compute mode for device %i: %s\n", i, nvmlErrorString(result)); goto Error; } } } printf("\n"); printf("----- 温度 ----- \n"); unsigned int temperature_threshold = 100; result = nvmlDeviceGetTemperatureThreshold(device, NVML_TEMPERATURE_THRESHOLD_SHUTDOWN, &temperature_threshold); if (NVML_SUCCESS != result) { printf("device %i Failed to get NVML_TEMPERATURE_THRESHOLD_SHUTDOWN: %s\n", i, nvmlErrorString(result)); } else printf("截止温度: %d 摄氏度 (Temperature at which the GPU will shut down for HW protection)\n", temperature_threshold); result = nvmlDeviceGetTemperatureThreshold(device, NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, &temperature_threshold); if (NVML_SUCCESS != result) { printf("device %i Failed NVML_TEMPERATURE_THRESHOLD_SLOWDOWN: %s\n", i, nvmlErrorString(result)); } else printf("上限温度: %d 摄氏度 (Temperature at which the GPU will begin slowdown)\n", temperature_threshold); unsigned int temperature = 0; result = nvmlDeviceGetTemperature(device, NVML_TEMPERATURE_GPU, &temperature); if (NVML_SUCCESS != result) { printf("device %i NVML_TEMPERATURE_GPU Failed: %s\n", i, nvmlErrorString(result)); } else printf("当前温度: %d 摄氏度 \n", temperature); //使用率 printf("\n"); nvmlUtilization_t utilization; result = nvmlDeviceGetUtilizationRates(device, &utilization); if (NVML_SUCCESS != result) { printf(" device %i nvmlDeviceGetUtilizationRates Failed : %s\n", i, nvmlErrorString(result)); } else { printf("----- 使用率 ----- \n"); printf("GPU 使用率: %lld %% \n", utilization.gpu); printf("显存使用率: %lld %% \n", utilization.memory); } //FB memory printf("\n"); nvmlMemory_t memory; result = nvmlDeviceGetMemoryInfo(device, &memory); if (NVML_SUCCESS != result) { printf("device %i nvmlDeviceGetMemoryInfo Failed : %s\n", i, nvmlErrorString(result)); } else { printf("------ FB memory ------- \n"); printf("Total installed FB memory: %lld bytes \n", memory.total); printf("Unallocated FB memory: %lld bytes \n", memory.free); printf("Allocated FB memory: %lld bytes \n", memory.used); } //BAR1 memory printf("\n"); nvmlBAR1Memory_t bar1Memory; result = nvmlDeviceGetBAR1MemoryInfo(device, &bar1Memory); if (NVML_SUCCESS != result) { printf("device %i nvmlDeviceGetBAR1MemoryInfo Failed : %s\n", i, nvmlErrorString(result)); } else { printf("------ BAR1 memory ------- \n"); printf("Total BAR1 memory: %lld bytes \n", bar1Memory.bar1Total); printf("Unallocated BAR1 memory: %lld bytes \n", bar1Memory.bar1Free); printf("Allocated BAR1 memory: %lld bytes \n", bar1Memory.bar1Used); } //Information about running
首页 上一页 1 2 3 4 5 6 下一页 尾页 4/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇c++ 端口扫描程序 下一篇进程查杀

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目