-1

In VSCode I have following configuration in the launch.json:

{
            "name": "CUDA C++ Debug",
            "type": "cuda-gdb",
            "request": "launch",
            "program": "${workspaceFolder}/build/support_01",
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}/build/",
            "preLaunchTask": "CMake: clean rebuild",            
        },        

Now

when I try to debug using this configuration, when I reach this line:

cudaError_t err = cudaMalloc((void**)&d_list, flattened_list_size);

I am getting an error:

Incompatible CUDA driver version. Expected 12.2.134 or later and found 8.0.129 instead.&"fatal:  Incompatible CUDA driver version. (error code = CUDBG_ERROR_INCOMPATIBLE_API(0x13)\n"

However, when I use CTRL-F5 it goes fine:

[Detaching after fork from child process 69973]
[New Thread 0x7ffff389c000 (LWP 69974)]
[New Thread 0x7ffff07ff000 (LWP 69975)]
[New Thread 0x7fffefffe000 (LWP 69976)]
Loaded '/lib/x86_64-linux-gnu/libcuda.so.1'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libdl.so.2'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libpthread.so.0'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/librt.so.1'. Symbols loaded.

How this could be fixed?

user2109066
  • 77
  • 1
  • 8

1 Answers1

0

sorry for confusion, apparently I need to specify environment in launch configuration, something like this:

{
            "name": "CUDA C++ Debug",
            "type": "cuda-gdb",
            "request": "launch",
            "program": "${workspaceFolder}/build/support_01",
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}/build/",
            "preLaunchTask": "CMake: clean rebuild",
            // "args": [""]
            "environment": [
                {
                    "name": "PATH",
                    "value": "/usr/local/cuda/bin:${env:PATH}"
                },
                {
                    "name": "LD_LIBRARY_PATH",
                    "value": "/usr/local/cuda/lib64:${env:LD_LIBRARY_PATH}"
                }
            ]
        },     
user2109066
  • 77
  • 1
  • 8