[v0.01] Reading PCI vendor/device values, needed to deduce the GPU chip and thus manufacturing process

This commit is contained in:
Dr-Noob
2021-08-13 11:31:51 +02:00
parent 8bc37d9d71
commit bdc4fd7c45
7 changed files with 134 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
#include <cuda_runtime.h>
#include "cuda.hpp"
#include "nvmlb.hpp"
#include "uarch.hpp"
#include "../common/global.hpp"
@@ -29,6 +30,7 @@ int64_t get_peak_performance(struct gpu_info* gpu) {
struct gpu_info* get_gpu_info() {
struct gpu_info* gpu = (struct gpu_info*) emalloc(sizeof(struct gpu_info));
gpu->pci = NULL;
printf("Waiting for CUDA driver to start...\n");
int dev = 0;
@@ -41,6 +43,11 @@ struct gpu_info* get_gpu_info() {
strcpy(gpu->name, deviceProp.name);
gpu->freq = 10000;
gpu->nvmld = nvml_init();
if(nvml_get_pci_info(dev, gpu->nvmld)) {
gpu->pci = get_pci_from_nvml(gpu->nvmld);
}
gpu->arch = get_uarch_from_cuda(gpu);
gpu->cach = get_cache_info(gpu);
gpu->topo = get_topology_info(gpu);