CUDA 中是否有 __host__ 和 __device__ 的 shorthand?
Is there a shorthand for __host__ and __device__ in CUDA?
我的 cuda C 程序中有许多函数都带有 __host__
和 __device__
修饰符。我正在为这两个寻找 shorthand 以通过更改
使我的代码看起来整洁
__host__ __device__ void foo() {
}
到
__both__ void foo() {
}
。
我当然可以
#define __both__ __host__ __device__
,但如果这样的东西已经存在,我更愿意使用现有的解决方案。
目前在 CUDA C/C++ 中没有这方面的简写。
我的 cuda C 程序中有许多函数都带有 __host__
和 __device__
修饰符。我正在为这两个寻找 shorthand 以通过更改
__host__ __device__ void foo() {
}
到
__both__ void foo() {
}
。 我当然可以
#define __both__ __host__ __device__
,但如果这样的东西已经存在,我更愿意使用现有的解决方案。
目前在 CUDA C/C++ 中没有这方面的简写。