How can I get the number of cores in a cuda device?

I am looking for a function that counts the number of cells of my cuda device. I know that each microprocessor has specific cores, and my cuda device has 2 microprocessors.

I searched a lot to find a property function that counts the number of cores per microprocessor, but I could not. I use the code below, but do I still need the number of cores?

  • cuda 7.0
  • C programming language
  • visual studio 2013

the code:

void printDevProp(cudaDeviceProp devProp) { printf("%s\n", devProp.name); printf("Major revision number: %d\n", devProp.major); printf("Minor revision number: %d\n", devProp.minor); printf("Total global memory: %u", devProp.totalGlobalMem); printf(" bytes\n"); printf("Number of multiprocessors: %d\n", devProp.multiProcessorCount); printf("Total amount of shared memory per block: %u\n",devProp.sharedMemPerBlock); printf("Total registers per block: %d\n", devProp.regsPerBlock); printf("Warp size: %d\n", devProp.warpSize); printf("Maximum memory pitch: %u\n", devProp.memPitch); printf("Total amount of constant memory: %u\n", devProp.totalConstMem); return; } 
+10
c cuda nvidia
source share
3 answers

Multiprocessor cores are the only "missing" piece of data. This data is not directly represented in the cudaDeviceProp structure, but it can be inferred from published data and more published data from the devProp.major and devProp.minor , which together constitute the computing power of the CUDA device.

Something like this should work:

 int getSPcores(cudaDeviceProp devProp) { int cores = 0; int mp = devProp.multiProcessorCount; switch (devProp.major){ case 2: // Fermi if (devProp.minor == 1) cores = mp * 48; else cores = mp * 32; break; case 3: // Kepler cores = mp * 192; break; case 5: // Maxwell cores = mp * 128; break; case 6: // Pascal if (devProp.minor == 1) cores = mp * 128; else if (devProp.minor == 0) cores = mp * 64; else printf("Unknown device type\n"); break; case 7: // Volta if (devProp.minor == 0) cores = mp * 64; else printf("Unknown device type\n"); break; default: printf("Unknown device type\n"); break; } return cores; } 

(encoded in browser)

"kernels" is a bit of a marketing term. In my opinion, the most common connotation is equating it to SP units in SM. This is the meaning that I have demonstrated here. I also omitted cc 1.x devices as these types of devices are no longer supported in CUDA 7.0 and CUDA 7.5

+14
source share

Perhaps this can help a little more.

https://devtalk.nvidia.com/default/topic/470848/cuda-programming-and-performance/what-39-s-the-proper-way-to-detect-sp-cuda-cores-count-per- sm- / post / 4414371 / # 4414371

"there is a helper_cuda.h library that contains the subroutine _ConvertSMVer2Cores (int major, int minor), which takes the GPU computing level and returns the number of cores (stream processors) in each SM or SMX" - from the message.

+1
source share

On Linux, you can run the following command to get the number of CUDA cores:

 nvidia-settings -q CUDACores -t 

To get the output of this command in C, use the popen function.

0
source share

All Articles