先安装vscode插件Nsight Visual Studio Code Edition和cudacpp
tasks.json设置
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "nvcc",
"args": ["-g","-G","-o","${fileDirname}/${fileBasenameNoExtension}","${file}"] //其中-g表示主机代码编译为可调式版本;-G表示GPU代码编译为可调式版本。
}
]
}
launch.json(格式为cudacpp类调试,显示gpu内调试信息,例如调试kernel)
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "CUDA C++: Launch",
"type": "cuda-gdb",
"reques