CUDA on Windows without Visual Studio IDE?

I am trying to get a cuda 11 dev environment set up on windows. We have MSVC 2019 build tools already for general C++ compilation. Is there any way to get CUDA to compile without a full Visual Studio IDE installed?

Due to licensing I am unable to use VS Community edition and it will take to long to procure a VS Professional licence.

I know CUDA is unable to install the visual studio integrations / plugins without the full IDE but is there any other supported configuration to enable just building using only the MSVC build tools?


You do not need the Visual Studio IDE to program in CUDA. In fact I have been using MSVS Professional and CUDA on Windows for 14 years and have never used the IDE. If you are comfortable with gmake and makefiles, you can build your projects using the same command line tools that the MSVS IDE uses under the hood. For simple CUDA programs, you can just compile with the CUDA compiler driver nvcc from the commandline.

I even still use the traditional bare bones “Command Prompt” instead of the more capable PowerShell. I install Cygwin on all my Windows systems, so I’d probably rather use bash if the need arose.

I don’t know what “only the MSVC build tools” refers to. From personal experience (in the US), procuring a single-user MSVS 2019 Professional license takes about 15 minutes altogether, with five minutes of that spent on finding the page where they let you purchase a non-subscription version.

For context, I am porting a linux CUDA application over to Windows. By MSVC build tools I meant “Build Tools for Visual Studio 2019”. These Build Tools allow you to build Visual Studio projects from a command-line interface. This is how all the other C++ builds are currently done for windows in this environment, with no full IDE Visual Studio installation.

My problem is that the whole rest of the project is built with VS2019 compilers and without the IDE, the CUDA install cannot install the Visual Studio integration scripts. Running the build using Nvcc.exe (through cmake) produces the error " Cannot find compiler cl.exe in path ", which I assume is something relating to the integrations, as it works fine with the full IDE.

The procurement issue is more that the corporate structure that I am beholden to could take an unnecessarily long time to make a licence happen, and I was wondering if there was an easier way to accomplish this with the tools I have available.

Thanks for the assistance and prompt reply

Sorry, can’t help you with cmake. I avoid it like the plague.

To run from the command line, the Visual C/C++ compiler needs to have a bunch of environment variables set up, independent of the use of CUDA. Check whether the build tools include a file vcvarsall.bat. If so, run it with

vcvarsall.bat amd64

This will set up necessary environment variables for an x86-64 platform. Depending on what kind of apps you are building you may also need to add additional directories to the INCLUDE and LIB environment variables. Once the environment is set up and you can build Windows command line applications with the Microsoft compiler by invoking cl, you should also be able to successfully run nvcc. Try it standalone before you try via cmake, which may have additional quirky requirements.

Got it working without VS ;)