I’m struggling in debugging a CUDA code within a cmake project on VS2022. Specifically, I open a cmake project in VS2022 and build it with ‘-G’ nvcc flag. But I can’t debug into the kernel code. Meanwhile I can’t click “Start CUDA Debugging” in “Extension->Nsight” because it greyed out.
My toy cmake project only contain a hello.cu and a CMakeLists.txt.
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(hello LANGUAGES CUDA)
add_executable(hello hello.cu)
target_compile_options(hello PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-G>)
VisualStudio 2022; Nsight 2022; CUDA Toolkit 11.7