Closed rik1599 closed 5 months ago
Took some hints here - microsoft/vscode-cpptools#8091
When I searched for "compile" in my C/C++ extension in my workspace settings, I found the Compiler Args. I added "-arch native" to it. At first it didn't work. I looked at the c_cpp_properties.json and split the string representation to be "-arch", "native". My intellisense accepted the double atmoicAdd and didn't break my other intellisense for c++17.
These settings are added to your .vscode/c_cpp_properties.json and not my .vscode/settings.json file as...
{ "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/src/", "/usr/local/cuda-11.7/" ], "defines": [], "compilerPath": "/usr/local/cuda-11.7/bin/nvcc", "cStandard": "gnu17", "cppStandard": "c++17", "intelliSenseMode": "linux-gcc-x64", "configurationProvider": "ms-vscode.makefile-tools", "compilerArgs": [ "-arch", "native" ] } ], "version": 4 }
This seems to work for me now. This makes sense, since similarly when you build with make, you need to define the -arch flag for nvcc.
nvcc --help has an explanation of the -arch flag.
Here's a good article about identifying the right gpu architecture: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
To see what you can set with -arch, do nvcc --help and read
--gpu-architecture
Intellisense recognize atomicAdd(double*, double) as an error
But I'm compiling for compute capability 6.1 (so atomicAdd for doubles exists) and there isn't an option for choosing the desired compute capability for Intellisense.
Any solution/workaround?