Cuda 如何获得设备的GPU架构?

Cuda 如何获得设备的GPU架构?,cuda,Cuda,CudaGetDeviceProperty具有获取计算能力的属性(major.minor),但是,如何将GPU体系结构(sm_**)输入到设备的编译中呢? sm_10是一种计算能力为1.0的设备 sm_11是一种计算能力为1.1的设备 sm_12是一种计算能力为1.2的设备 sm_13是一种计算能力为1.3的设备 sm_20是一种计算能力为2.0的设备 sm_21是一种计算能力为2.1的设备 sm_30是一种计算能力为3.0的设备 sm_32是一种计算能力为3.2的设备 sm_35是一种计算能力

CudaGetDeviceProperty具有获取计算能力的属性(major.minor),但是,如何将GPU体系结构(sm_**)输入到设备的编译中呢?

  • sm_10是一种计算能力为1.0的设备
  • sm_11是一种计算能力为1.1的设备
  • sm_12是一种计算能力为1.2的设备
  • sm_13是一种计算能力为1.3的设备
  • sm_20是一种计算能力为2.0的设备
  • sm_21是一种计算能力为2.1的设备
  • sm_30是一种计算能力为3.0的设备
  • sm_32是一种计算能力为3.2的设备
  • sm_35是一种计算能力为3.5的设备
  • sm_37是一种计算能力为3.7的设备
  • sm_50是一种计算能力为5.0的设备
  • sm_52是一种计算能力为5.2的设备
  • sm_53是一种计算能力为5.3的设备
  • sm_60是一种计算能力为6.0的设备
  • sm_61是一种计算能力为6.1的设备
  • sm_62是一种计算能力为6.2的设备
sm_XY对应于“物理”或“真实”架构

compute_ZW对应于

并非所有sm_XY都有相应的计算

例如,没有计算21(虚拟)体系结构是最简单的方法

如果您使用的是cuda 7.x,请使用如下所示的nvcc标志以获得兼容性

-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 
如果您使用的是cuda 8.x,请设置如下标志:

-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 \

如果我正确理解了你的问题,那就是主要和次要属性的编码。