我試圖用Thrust/CUDA 4.0構建一個簡單的應用程序,並得到很多警告「警告:無法判斷指向哪個指針,假設爲全局內存空間「解決推力/ CUDA警告「不能說出什麼指針指向...」
有沒有其他人看到這個,我該如何禁用它們或修復我的代碼?
感謝,
阿德
這裏是我的代碼。
Hello.h
class DECLSPECIFIER Hello
{
private:
thrust::device_vector<unsigned long> m_device_data;
public:
Hello(const thrust::host_vector<unsigned long>& data);
unsigned long Sum();
unsigned long Max();
};
Hello.cu
#include "Hello.h"
Hello::Hello(const thrust::host_vector<unsigned long>& data)
{
m_device_data = data;
}
unsigned long Hello::Sum()
{
return thrust::reduce(m_device_data.cbegin(), m_device_data.cend(), 0, thrust::plus<unsigned long>());
}
unsigned long Hello::Max()
{
return *thrust::max_element(m_device_data.cbegin(), m_device_data.cend(), thrust::less<unsigned long>());
}
輸出
1> Compiling CUDA source file Hello.cu...
1>
1> C:\SrcHg\blog\HelloWorld\HelloWorldCuda>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2008 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" -G0 --keep-dir "Debug" -maxrregcount=32 --machine 32 --compile -D_NEXUS_DEBUG -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "Debug\Hello.cu.obj" "C:\SrcHg\blog\HelloWorld\HelloWorldCuda\Hello.cu"
1> Hello.cu
1> tmpxft_00001fac_00000000-0_Hello.cudafe1.gpu
1> tmpxft_00001fac_00000000-5_Hello.cudafe2.gpu
1> Hello.cu
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include\thrust/detail/internal_functional.h(197): warning : Cannot tell what pointer points to, assuming global memory space
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include\thrust/detail/internal_functional.h(197): warning : Cannot tell what pointer points to, assuming global memory space
1>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include\thrust/detail/internal_functional.h(197): warning : Cannot tell what pointer points to, assuming global memory space
有很多的這些。