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

So far I have found out that Eclipse cannot complain about the proprietary CUDA keywords, defining them, if defined __CDT_PARSER__. The following code does not allow Eclipse to complain about most CUDA keywords.

// Prevent eclipse from bitching about unknown keywords
#ifdef __CDT_PARSER__
#define __global__
#define __device__
#define __host__
#define __shared__
#endif

However, this does not work with the brackets used to configure the kernel launch, since my kernels usually have long lists of arguments, this is annoying. Any ideas?

+3
source share
2 answers

Here is 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 call the kernels with:

myKernel CUDA_KERNEL_DIM(gridDim, blockDim) (foo, bar);
+1

"Nsight Eclipse Edition", CUDA Toolkit 5.0 .

0

All Articles