Cuda Linux Clion Configuration

Because I spent close to a week trying to get a Cuda / Linux / Clion (Jetbrains) Environment working - I am sharing what worked (for me) - as it completely did not match the guides / documentation that I could find. It is not complete, and it is currently buggy - but it works!

  • I installed ALL my cuda toolkits / nvidia drivers BEFORE I installed Clion.

Drivers were:
image

  • I am currently not able to debug into the kernel warps - I use copious printf statements to develop.
  • Clion will debug the C side portion of the code. Somehow it is compiling even with printf being flagged in error.

image

A new project (once you make it you cannot move it)

CMakeLists are being written as:
image

This part I don’t even know how/why it works because there is zero reference to nvcc? But it is - and it’s compiling.

Current path was really important (note that /usr/loca/cuda is a alias to the 12.0 Cuda Toolkit)
/usr/local/cuda:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/c/.local/share/JetBrains/Toolbox/scripts

My nvcc version:
image

My cuda toolkit version!
image

Mistakes that I made:

  • Setting toolchain to point to nvcc broke Clion. For some reason in the above setup it ‘works’
  • printf gets flagged but still compiles

I think there is quite a bit of development with their product and hopefully it will have tighter - stronger integration with Cuda.