NVIDIA / nsight-vscode-edition

A Visual Studio Code extension for building and debugging CUDA applications.
Other
68 stars 11 forks source link

#include errors, very limited IntelliSense when building deviceQuery example #39

Closed ackalker closed 10 months ago

ackalker commented 11 months ago

Type: Bug

  1. Clone the NVIDIA/cuda-samples repository from GitHub.
  2. Open the deviceQuery project in VSCode connected to WSL-Ubuntu with CUDA Toolkit installed, C/C++ and Nsight extensions enabled.
  3. Open the file deviceQuery.cpp from the Explorer pane.
  4. Observe any error squiggles in the file, problems in bottom panel.
  5. Build the project manually by running make at a terminal shell prompt.

Actual results:

Problems tab shows: cannot open source file "cuda_runtime.h"

include errors detected based on information provided by the configurationProvider setting. Squiggles are disabled for this translation unit (/mnt/d/git/cuda-samples/Samples/1_Utilities/deviceQuery/deviceQuery.cpp).

cannot open source file "stddef.h" (dependency of "helper_cuda.h") cannot open source file "cuda.h"

Regardless of these errors, the project builds without problems, both from within VSCode as well as manually from the commandline. The deviceQuery binary runs successfully.

Expected results:

Opening the project should present no errors and working IntelliSense.

Extension version: 2023.2.32964508 VS Code version: Code - Insiders 1.83.0-insider (bccfade64adb249f57c8fcf03cba41609f76ce5c, 2023-09-15T05:35:16.508Z) OS version: Windows_NT x64 10.0.22621 Modes: Remote OS version: Linux x64 5.15.90.1-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i5-12400F (12 x 2496)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|15.79GB (4.46GB free)| |Process Argv|--crash-reporter-id 78c6d751-e4b0-4959-a782-10106e5f6b9d| |Screen Reader|yes| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 5.15.90.1-microsoft-standard-WSL2| |CPUs|12th Gen Intel(R) Core(TM) i5-12400F (12 x 2495)| |Memory (System)|7.65GB (5.90GB free)| |VM|0%|
A/B Experiments ``` vsliv695:30137379 vsins829:30139715 vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256197 vslsvsres303:30308271 pythontb:30258533 pythonptprofiler:30281269 vsdfh931cf:30280410 vshan820:30294714 vscod805:30301674 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30404738 py29gd2263:30784851 vsclangdf:30492506 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30618038 a9j8j154:30646983 showlangstatbar:30737417 57b77579:30687741 pythonfmttext:30716741 fixshowwlkth:30771523 showindicator:30805243 pythongtdpath:30726887 i26e3531:30792625 welcomedialog:30812478 pythonnosmt12:30779711 pythonidxpt:30768918 pythonnoceb:30776497 copilotsettingt:30808721 asynctok:30821568 dsvsc013:30777762 dsvsc014:30777825 diffeditorv2:30786206 pythonlinttype:30823781 pythonmpsinfo:30815194 dsvsc015:30821418 pythontestfixt:30826906 pythonfb280951:30830809 ```
ackalker commented 11 months ago

Screenshot: image

ackalker commented 11 months ago

Output from running nvcc --version:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0

Output from running nvcc -v nonexistentfile (a trick I learned to get nvcc to dump some useful configuration information):

$ nvcc -v nonexistentfile
#$ _NVVM_BRANCH_=nvvm
#$ _SPACE_= 
#$ _CUDART_=cudart
#$ _HERE_=/usr/local/cuda/bin
#$ _THERE_=/usr/local/cuda/bin
#$ _TARGET_SIZE_=
#$ _TARGET_DIR_=
#$ _TARGET_DIR_=targets/x86_64-linux
#$ TOP=/usr/local/cuda/bin/..
#$ NVVMIR_LIBRARY_DIR=/usr/local/cuda/bin/../nvvm/libdevice
#$ LD_LIBRARY_PATH=/usr/local/cuda/bin/../lib:
#$ PATH=/usr/local/cuda/bin/../nvvm/bin:/usr/local/cuda/bin:/home/miki/.vscode-server-insiders/bin/bccfade64adb249f57c8fcf03cba41609f76ce5c/bin/remote-cli:/usr/local/cuda/bin::/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/libnvvp:/mnt/c/Program Files/openxr-explorer/bin:/mnt/c/Program Files/Oculus/Support/oculus-runtime:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2023.2.2/:/mnt/c/Users/ackal/scoop/apps/nodejs/current/bin:/mnt/c/Users/ackal/scoop/apps/nodejs/current:/mnt/c/Users/ackal/scoop/apps/python/current/Scripts:/mnt/c/Users/ackal/scoop/apps/python/current:/mnt/c/Users/ackal/scoop/shims:/mnt/c/Users/ackal/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/ackal/AppData/Local/Programs/Microsoft VS Code Insiders/bin:/snap/bin
#$ INCLUDES="-I/usr/local/cuda/bin/../targets/x86_64-linux/include"  
#$ LIBRARIES=  "-L/usr/local/cuda/bin/../targets/x86_64-linux/lib/stubs" "-L/usr/local/cuda/bin/../targets/x86_64-linux/lib"
#$ CUDAFE_FLAGS=
#$ PTXAS_FLAGS=
nvcc fatal   : Don't know what to do with 'nonexistentfile'
ackalker commented 11 months ago

I'm wondering why VSCode doesn't seem to pick up the system include paths known by nvcc.

sanannavyaa commented 11 months ago

@ackalker do you have the cpptools extension installed in VS Code?

ackalker commented 11 months ago

Yes I have the cpptools extension installed.

ackalker commented 11 months ago

Perhaps the problem is with the cpptools extension, I have created a separate issue there just in case: https://github.com/microsoft/vscode-cpptools/issues/11454 In that issue are the results of my attempts at analyzing the root cause.

I am not sure if the problem is with the c_cpp_properties.json file in the deviceQuery project, could it be that one or more settings in there are interfering? As far as I know support for CUDA C++ in cpptools is quite recent, maybe still in flux.

sanannavyaa commented 11 months ago

Fixed - v1.18.0 of cpptools fixes the issue.