开发者

CUDA and Eclipse: How can I tell eclipse that <<< (or >>>) is part of the syntax?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜