[v0.10] Add support for displaying the number of tensor cores

This commit is contained in:
Dr-Noob
2021-11-23 18:09:13 +01:00
parent f212fb88d4
commit 821b6e760e
4 changed files with 22 additions and 0 deletions

View File

@@ -53,12 +53,19 @@ struct cache* get_cache_info(cudaDeviceProp prop) {
return cach;
}
int get_tensor_cores(int sm, int major) {
if(major == 7) return sm * 8;
else if(major == 8) return sm * 4;
else return 0;
}
struct topology* get_topology_info(cudaDeviceProp prop) {
struct topology* topo = (struct topology*) emalloc(sizeof(struct topology));
topo->streaming_mp = prop.multiProcessorCount;
topo->cores_per_mp = _ConvertSMVer2Cores(prop.major, prop.minor);
topo->cuda_cores = topo->streaming_mp * topo->cores_per_mp;
topo->tensor_cores = get_tensor_cores(topo->streaming_mp, prop.major);
return topo;
}
@@ -174,3 +181,10 @@ char* get_str_cuda_cores(struct gpu_info* gpu) {
return dummy;
}
char* get_str_tensor_cores(struct gpu_info* gpu) {
uint32_t max_size = 10;
char* dummy = (char *) ecalloc(max_size, sizeof(char));
snprintf(dummy, max_size, "%d", gpu->topo->tensor_cores);
return dummy;
}

View File

@@ -8,5 +8,6 @@ int print_gpus_list();
char* get_str_sm(struct gpu_info* gpu);
char* get_str_cores_sm(struct gpu_info* gpu);
char* get_str_cuda_cores(struct gpu_info* gpu);
char* get_str_tensor_cores(struct gpu_info* gpu);
#endif