Flamefire
Flamefire

Reputation: 5807

Make eclipse parse or ignore CUDA kernel launch parameters

I'm working on a C++ project that uses C++11 and CUDA.

I want to use the syntax highlighting and parsing capabilities of eclipse, especially go to symbol and the live error checking. However when I use "pure" eclipse, the CUDA kernel launch parameter notation via <<<..>>> breaks the parsing and the whole call is marked invalid. When I use Eclipse Nsight 7 then it won't parse C++11 related stuff like constexpr and therefor is not able to resolve my templated types. (see https://devtalk.nvidia.com/default/topic/830892/nsight-editor-does-not-parse-c-11-shows-syntax-error/)

Is there any way (hack, plugin,...) to make regular eclipse handle those <<<...>>>?

Upvotes: 3

Views: 378

Answers (1)

havogt
havogt

Reputation: 2822

For this particular problem (support for constexpr) you can now use the nsight which ships with CUDA 9 (based on CDT 8.4).

Custom CDT with nsight plugin (requires CUDA 9)

In case you still want to use a more recent CDT version, there is a new option since CUDA 9: it ships with an installer <cuda-install-path>/bin/nsight_ee_plugins_manage.sh which allows adding the nsight plugin to an existing eclipse installation.

Before CUDA 9

A work-around could be to wrap your kernel launch in a macro:

#ifdef PARSED_BY_ECLIPSE
#define CALL_CUDA_KERNEL(cmd) (void)0 /* do nothing */
#else
#define CALL_CUDA_KERNEL(cmd) cmd
#endif

And add the symbol PARSED_BY_ECLIPSE to the configuration which is used for indexing.

Upvotes: 2

Related Questions