Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>vscode-cudacppNew to Visual Studio Code? Get it now.
vscode-cudacpp

vscode-cudacpp

kriegalex

|
233,283 installs
| (9) | Free
CUDA C++ language support for Visual Studio Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CUDA for VSCode (syntax + snippets)

This extension aims at providing syntax support and snippets for CUDA (C++) in VS Code.

Features

Code coloring

This extension supports most of the basic CUDA keywords and functions, such as but not limited to :

  • cudaMalloc, cudaFree, ...
  • __global__, __device__, __host__, ...
  • atomicAdd, atomicSub, surfCubemapLayeredread, ...
  • __shfl_down, __syncthreads, ...

code-coloring

To maximize compatibility with existing popular themes, textmate language grammar guidelines have not always been respected (external libraries like CUDA in support scope). If your theme still doesn't color the CUDA code, you can set them with the template rules below (put this into your VSCode user settings in settings.json). This can also be used to override your theme colors, if you want to separate C++ and CUDA colors.

"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "support.function.cuda-cpp",
            "settings":{
                "foreground": "#56b6c2"
            }
        },
        {
            "scope": "keyword.function.qualifier.cuda-cpp",
            "settings":{
                "foreground": "#56b6c2"
            }
        }
    ]
}

List of scopes

  • "support.function.cuda-cpp" : atomicAdd, cudaMalloc, cudaFree, ...
  • "keyword.function.qualifier.cuda-cpp" : __global__, __host__, __device__, ...
  • "storage.modifier.cuda-cpp" : __constant__, __device__, __shared__, ...
  • "support.type.cuda-cpp" : dim3, uint1, ulong1, ...
  • "variable.language.cuda-cpp" : gridDim, blockIdx, blockDim, threadIdx, warpSize
  • "punctuation.section.kernel" : the kernel brackets <<< >>>
  • "meta.kernel-call.cuda-cpp entity.name.function.c" : the function name before the <<< >>>

CUDA snippets

The following snippets are available :

  • __s : __syncthreads();
  • cmal : cudaMalloc((void**)&${1:variable}, ${2:bytes});
  • cmalmng : cudaMallocManaged((void**)&${1:variable}, ${2:bytes});
  • cmem : cudaMemcpy(${1:dest}, ${2:src}, ${3:bytes}, cudaMemcpy${4:Host}To${5:Device});
  • cfree : cudaFree(${1:variable});
  • kerneldef : __global__ void ${1:kernel}(${2}) {\n}
  • kernelcall : ${1:kernel}<<<${2},${3}>>>(${4});
  • thrusthv : thrust::host_vector<${1:char}> v$0;
  • thrustdv : thrust::device_vector<${1:char}> v$0;

snippets

Requirements

  • VSCode 1.18+. Slightly older versions should work, very old versions are not guaranteed to work.
  • This extension has been tested with the default VSCode skin (dark+) and the popular One Dark Pro theme.

Extension Settings

This extension contributes the following settings:

  • none

Known Issues

  • No support for Intellisense navigation through code (right click->Go to definition,...). This will be implemented by another extension dedicated to IntelliSense and debugging.

Planned features

Below are listed the features that ideally should be available for this extension. IntelliSense and debugging coexist in another repository. There is no guarantees this features will be implemented.

  • Icon for files
  • CUDA syntax colors as parameters of this extension instead of using "editor.tokenColorCustomizations" in settings.json

Feature requests & issues

Requests should be made here : https://github.com/kriegalex/vscode-cuda/issues

Release Notes

See also the changelog

0.1.0

Initial release of vscode-cuda extension

0.1.1

Better documentation


  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft