RayaneCTX
RayaneCTX

Reputation: 593

Debugging Issues in CLion of CUDA files: the debugger does not stop at breakpoints

I've started a CUDA application in the new CLion 2020.1 version. Although I can compile and run it, I am not able to debug it, not even the host code. Specifically, debug does not stop at breakpoints, even though I am running the debug build. I'm not encountering this issue with running a regular C project in CLion 2020.1. I don't receive any error message of any kind. Here is my CMakeLists.txt file:

# Setup the CUDA compiler
set(CMAKE_CUDA_COMPILER /usr/local/cuda-10.2/bin/nvcc)

# Setup the host compiler
set(CMAKE_CUDA_HOST_COMPILER /usr/bin/g++-8)

# CMAKE minimum required version
cmake_minimum_required(VERSION 3.16)

project(PageRank_GPU CUDA)

set(CMAKE_CUDA_STANDARD 14)

add_executable(PageRank_GPU main.cu graph.cu graph.cuh vertex.cuh error.cuh parser.cu parser.cuh)

set_target_properties(
        PageRank_GPU
        PROPERTIES
        CUDA_SEPARABLE_COMPILATION ON)

Upvotes: 1

Views: 756

Answers (1)

RayaneCTX
RayaneCTX

Reputation: 593

Reporting that the issue has disappeared after playing around in the project settings a bit. Specifically, under Build, Execution, Deployment then Toolchain, I set the C and C++ compilers to gcc-8 and g++-8 respectively (even though I am specifying the compiler in the CMakeLists.txt file) and under CMake, I set the toolchain to "Default" (the one I just modified) instead of "Use Default". After doing that, the debugger stops at breakpoints and I am able to step through my code. I don't understand what happened because, even after reverting the changes, I cannot make the problem re-appear.

Upvotes: 2

Related Questions