相关疑难解决方法(0)

CUDA和nvcc:使用预处理器在float或double之间进行选择

问题:

有了.h,我想在编译c/c ++或者计算能力> = 1.3的cuda时将real定义为double.如果为计算能力<1.3的cuda进行编译,则将real定义为float.

几个小时后我来到这里(这不起作用)

#   if defined(__CUDACC__)

#       warning * making definitions for cuda

#       if defined(__CUDA_ARCH__)
#           warning __CUDA_ARCH__ is defined
#       else
#           warning __CUDA_ARCH__ is NOT defined
#       endif

#       if (__CUDA_ARCH__ >= 130)
#                       define real double
#                       warning using double in cuda
#       elif (__CUDA_ARCH__ >= 0)
#               define real float
#               warning using float in cuda
#               warning how the hell is this printed when __CUDA_ARCH__ is not defined?
#       else …

preprocessor cuda nvcc

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

cuda ×1

nvcc ×1

preprocessor ×1