So far I figured out that one can prevent Eclipse from complaining about proprietary CUDA keywords by defining them if __CDT_PARSER__
is defined. The following code prevents Eclipse from complaining about most of the CUDA keywords.
// Prevent eclipse from bitching about unknown keywords
#ifdef __CDT_PARSER__
#define __global__
#define __device__
#define __host__
#define __shared__
#endif
This however does not work with the brackets used to开发者_如何学运维 configure kernel launches, since my kernels usually have long argument lists this is annoying. Any ideas?
Here's a solution that will work with Eclipse CDT, Visual Studio or Qt Creator This is my solution:
#if (defined __CDT_PARSER__) || (defined __INTELLISENSE__) || (defined Q_CREATOR_RUN)
#define __global__
#define __device__
#define __host__
#define __shared__
#define CUDA_KERNEL_DIM(...)
#else
#define CUDA_KERNEL_DIM(...) <<< __VA_ARGS__ >>>
#endif
Then invoke kernels with:
myKernel CUDA_KERNEL_DIM(gridDim, blockDim) (foo, bar);
Now you can use a new "Nsight Eclipse Edition" that will be a part of CUDA Toolkit 5.0 and on.
精彩评论