Hailiang Zhang
Hailiang Zhang

Reputation: 18870

How to get the GPU architecture of a device?

cudaGetDeviceProperties has attributes for getting the compute capability (major.minor), but, how do we get the GPU architecture (sm_**) to feed into the compilation for a device?

Upvotes: 3

Views: 7609

Answers (2)

ynhuang
ynhuang

Reputation: 1

simplest way

if you are using cuda 7.x , using nvcc flags like below to gain compatibility

-arch=sm_30 \
-gencode=arch=compute_20,code=sm_20 \
-gencode=arch=compute_30,code=sm_30 \
-gencode=arch=compute_50,code=sm_50 \
-gencode=arch=compute_52,code=sm_52 

if you are using cuda 8.x, set the flags like below:

-arch=sm_30 \
-gencode=arch=compute_20,code=sm_20 \
-gencode=arch=compute_30,code=sm_30 \
-gencode=arch=compute_50,code=sm_50 \
-gencode=arch=compute_52,code=sm_52 \
-gencode=arch=compute_60,code=sm_60 \
-gencode=arch=compute_61,code=sm_61 \
-gencode=arch=compute_62,code=sm_62 \

Upvotes: -1

Robert Crovella
Robert Crovella

Reputation: 151899

  • sm_10 is a compute capability 1.0 device
  • sm_11 is a compute capability 1.1 device
  • sm_12 is a compute capability 1.2 device
  • sm_13 is a compute capability 1.3 device
  • sm_20 is a compute capability 2.0 device
  • sm_21 is a compute capability 2.1 device
  • sm_30 is a compute capability 3.0 device
  • sm_32 is a compute capability 3.2 device
  • sm_35 is a compute capability 3.5 device
  • sm_37 is a compute capability 3.7 device
  • sm_50 is a compute capability 5.0 device
  • sm_52 is a compute capability 5.2 device
  • sm_53 is a compute capability 5.3 device
  • sm_60 is a compute capability 6.0 device
  • sm_61 is a compute capability 6.1 device
  • sm_62 is a compute capability 6.2 device

sm_XY corresponds to "physical" or "real" architecture

compute_ZW corresponds to "virtual" architecture

not all sm_XY have a corresponding compute_XY

for example, there is no compute_21 (virtual) architecture

Upvotes: 11

Related Questions