C++ 在curand_kernel.h之前包含推力/sort.h会导致编译错误

C++ 在curand_kernel.h之前包含推力/sort.h会导致编译错误,c++,cuda,header-files,thrust,C++,Cuda,Header Files,Thrust,这段代码编译得很好: #include <curand_kernel.h> #include <thrust/sort.h> int main(void) { return 0; } 在CUDA 5上,我只得到: ... curand_kernel.h(405): warning: missing return statement at end of non-void function "__curand_uint32_as_float" 其中“…”是我的C

这段代码编译得很好:

#include <curand_kernel.h>
#include <thrust/sort.h>

int main(void) {
    return 0;
}
在CUDA 5上,我只得到:

... curand_kernel.h(405): warning: missing return statement at end of non-void function "__curand_uint32_as_float"
其中“…”是我的CUDA安装目录。似乎所有这些区域都包含在宏中,以测试是否定义了
\uuuuu CUDA\u ARCH\uuuu
,或者它的值是什么。我只在
sort.h
中看到了这个问题,而没有看到我所包含的其他各种推力头(主机/设备向量、扫描、分散+聚集和一些奇特的迭代器)

考虑到这种行为,我无法(轻松而明智地)使当前项目中的所有标题都自给自足有人能向我解释一下为什么这里的顺序很重要,或者它是否是其中一个标题的错误或“功能”?

这是一个已知问题(实际上是两个独立的问题)。它与CUDA 6版本太接近,无法在CUDA 6中修复

它应该在将来的版本中修复

同时,您应该能够通过颠倒包含这些头文件的顺序来解决这个问题,或者您可以尝试更新到当前的头文件

... curand_mtgp32_kernel.h(315): error: calling a __device__ function("__syncthreads") from a __host__ __device__ function("curand_mtgp32_single") is not allowed

... include/curand_mtgp32_kernel.h(373): error: calling a __device__ function("__syncthreads") from a __host__ __device__ function("curand_mtgp32_single_specific") is not allowed

... curand_kernel.h(392): warning: missing return statement at end of non-void function "__curand_uint32_as_float"
... curand_kernel.h(405): warning: missing return statement at end of non-void function "__curand_uint32_as_float"