CLion code completion for CUDA is missing many options

I'm using CLion on Windows 11 with Cuda Toolkit 11.7.99 and the MSVC compiler from Visual Studio 2022. It works fine (after I manually went into toolchain and chained architecture from x86 to amd64, which seems like an step that should not be necessary).

However, the code completion seems to be missing many things, like `cudaMallocManaged` and `cudaFree`. I'm assuming I need to include some kind of header file to get those, but it seems that nvcc does not require me to manually include header files, as it takes care of all of that for me. So shouldn't the full code completion also be available without manually including header files?

 

 

4 comments
Comment actions Permalink

It seems like all of the items in that menu are Macros which we can see from the # in front. So the problem here seems to be that normal functions are not actually included in the code completion. Interestingly, if I write cudaMallocManaged, it actually knows the names of the arguments: devPtr and size, so it *does* know about the function; it just for some reason does not expose the function name in code coimpletion.

0
Comment actions Permalink

I looked into this further by right clicking cudaMallocManaged and going to "definition", and it put me in cuda_runtime.h, where I noticed that cudaMallocManaged is actually a C++ template. Maybe that's the issue here?

 

0
Comment actions Permalink

Trying this on Fedora 35 with CLion, and code completion of functions doesn't work here either. It still only shows macros. However, once I type cudaMallocManaged, CLion *does* seem to know the arguments that go into it.

0
Comment actions Permalink

so it seems if I press ctrl + space, then all the completions including cudaMalloc and cudaFree successfully show up. It's only when DON'T press ctrl + space, the completion menu only has macros. I was not aware that there's supposed to be a difference between the menus with and without ctrl + space

0

Please sign in to leave a comment.