{"id":13340454,"url":"https://github.com/pjueon/cuda_intellisense","last_synced_at":"2026-04-09T04:10:40.349Z","repository":{"id":37018742,"uuid":"495422417","full_name":"pjueon/cuda_intellisense","owner":"pjueon","description":"A simple python script to fix cuda C++ intellisense for visual studio.","archived":false,"fork":false,"pushed_at":"2022-06-19T04:13:29.000Z","size":322,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-24T04:29:14.223Z","etag":null,"topics":["cuda","visual-studio"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pjueon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-23T13:27:38.000Z","updated_at":"2022-06-02T23:42:17.000Z","dependencies_parsed_at":"2022-09-02T19:00:28.491Z","dependency_job_id":null,"html_url":"https://github.com/pjueon/cuda_intellisense","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjueon%2Fcuda_intellisense","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjueon%2Fcuda_intellisense/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjueon%2Fcuda_intellisense/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjueon%2Fcuda_intellisense/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjueon","download_url":"https://codeload.github.com/pjueon/cuda_intellisense/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243079083,"owners_count":20232928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","visual-studio"],"created_at":"2024-07-29T19:23:00.491Z","updated_at":"2026-04-09T04:10:40.322Z","avatar_url":"https://github.com/pjueon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cuda_intellisense\nA simple python script to fix cuda C++ IntelliSense for visual studio. \n\n**Note**  \nWith the latest version of the Visual Studio, maybe you don't need cuda_intellisense any more. \n\n\n## Background \nIf you write cuda C++ code with Visual Studio, you might see some annoying red lines like this:  \n\n![before](img/before.jpg)\n\nTypicially you can find theses red lines on:\n- texture reference, surface reference  (when you didn't define macro `__CUDACC__`)\n- kernel arguments (`\u003c\u003c\u003c ... \u003e\u003e\u003e`)\n- cuda macros like `__global__`, `__host__` (when you explicitly defined macro `__CUDACC__`)\n\nWith cuda_intellisense, you can fix this!\n\n![after](img/after.jpg)\n\n\n## Installation\nFirst, clone this repository.\n\n```shell\ngit clone https://github.com/pjueon/cuda_intellisense.git\ncd cuda_intellisense\n```\n\nAnd then, run the `scripts/cuda_intellisense.py` file.   \n\n**Note**  \nYou should run it as administrator.\n\n```shell\npython scripts/cuda_intellisense.py [options]\n```\n\n### Install options\n|Option|Description|\n|------|-----------|\n|`--path=`, `-p`|installation path. default value: `${CUDA_PATH}/include`|\n|`--cuda_path=`|name of the cuda path environment variable (ex\u003e `CUDA_PATH_v10_2`). default value: `CUDA_PATH`|\n|`--version`|show the version of cuda_intellisense.|\n|`--uninstall`|uninstall cuda_intellisense.|\n|`--help`, `-h`|show help.|\n\nThat's it!\n\n## Usage\nAfter installation, the Visual Studio will stop complaining about cuda code except for the kernel arguments(`\u003c\u003c\u003c ... \u003e\u003e\u003e`).\nFor the kernel arguments, you can use `KERNEL_ARGS` macro.\n\nIt works just like `\u003c\u003c\u003c ... \u003e\u003e\u003e`: \n- `KERNEL_ARGS(grid, block)` is equal to `\u003c\u003c\u003cgrid, block\u003e\u003e\u003e`\n- `KERNEL_ARGS(grid, block, sh_mem)` is equal to `\u003c\u003c\u003cgrid, block, sh_mem\u003e\u003e\u003e`\n- `KERNEL_ARGS(grid, block, sh_mem, stream)` is equal to `\u003c\u003c\u003cgrid, block, sh_mem, stream\u003e\u003e\u003e`\n\n**Note**  \n**You should add `cuda_intellisense/kernel_args.h` file to your source tree** unless those who didn't install the cuda_intellisense won't be able to build your code.\nCreate `cuda_intellisense` directory to your project and copy `kernel_args.h` file from `headers` directory of this repository or your installation path.   \n\n```cpp\n# include \"cuda_intellisense/kernel_args.h\" // for KERNEL_ARGS macro\n\n/* ... */\n\n// equal to addKernel \u003c\u003c\u003cgrid, block\u003e\u003e\u003e (dev_c, dev_b, dev_a);\naddKernel KERNEL_ARGS(grid, block) (dev_c, dev_b, dev_a);\n```\n\n\n## How does it work?\nThe trick is using the [`__INTELLISENSE__`](https://devblogs.microsoft.com/cppblog/troubleshooting-tips-for-intellisense-slowness/) macro, which is only defined when using the IntelliSense compiler. cuda_intellisense uses `#ifdef __INTELLISENSE__` macro to hide stuff from the IntelliSense compiler. \nSo the IntelliSense compiler cannot see the cuda codes that it cannot understand and stop complaining about them.\n\n\n## Test environment\ncuda_intellisense was tested on the following environment. \n\n- OS: Windows 10 \n- Visual Studio version: 2019, 2022\n- CUDA Toolkit version: 10.2, 11.1 \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjueon%2Fcuda_intellisense","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjueon%2Fcuda_intellisense","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjueon%2Fcuda_intellisense/lists"}