Compile CUDA without Visual Studio - “Cannot find compiler cl.exe in path”

后端 未结 5 2030
一生所求
一生所求 2021-02-06 00:44

I\'ve just begun a small project in CUDA.

I need to know the following: Is it possible to compile CUDA code without using/buying Microsoft Visual Studio? Using Nvcc.exe

相关标签:
5条回答
  • 2021-02-06 01:17

    You have to figure out where NVIDIA GPU Computing Toolkit is installed. In my system it's in "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" Then

    1. "Edit Environment Variables" on Windows.
    2. Click on New...
    3. Variable name: NVCC Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe
    4. Click on OK.
    0 讨论(0)
  • 2021-02-06 01:19

    Following the previous comments I've installed Studio Express & VS2010. This did not solve the "cl.exe not in path" problem.

    I solved the problem with the error Cannot find compiler cl.exe in path, by including c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 in PATH, before installing Windows SDK.

    This question also contains valuable information.
    For some reason VS2010 & Studio Express failed to set the proper variables in path even after the execution of vsvars32.bat.

    Thank you all for your valuable help.

    0 讨论(0)
  • 2021-02-06 01:20

    Use windows subsystem for linux and install ubuntu and nvcc along with gcc and g++ using the ubuntu terminal in windows (gui does not works for linux subsystem for windows). Then configure .bashrc using bash and vim/nano with a 'cd' command to your desired location as it is done in usual linux terminal (makes it easy as bash opens in system32 folder everytime). And then you can compile .cu files using nvcc over bash. As nvcc supports gcc and g++ under linux so it solves the problem. No need to sacrifice peace for switching over to linux or dealing with crappy visual studio. It worked for me.

    0 讨论(0)
  • 2021-02-06 01:27

    add this options to nvcc

    nvcc x.cu <other options>  -ccbin "D:\Program Files\Microsoft Visual Studio 11.0\VC\bin"
    

    i use VS2012 and my cl.exe dir is here.

    0 讨论(0)
  • 2021-02-06 01:29

    Update

    As noted in the comments, versions of the SDK after Windows 7's do not include the build tools. If you want to use Microsoft's most recent tools you have to install Visual Studio. Once installed, you can use the tools from the command-line.

    At the moment the free versions are the "Community" versions, e.g. Microsoft Visual Studio Community 2015.

    You can continue to develop apps for Windows 7 and earlier (and they will run on later versions of Windows) using the old SDK tools as I described before:

    Original Answer

    If you desperately want to avoid Visual Studio, download and install the Windows SDK. This contains (more or less) the same build tools as Visual Studio.

    Then run the Windows SDK Command Prompt (which you'll find on the start menu under Microsoft Windows SDK) to set the path to point to the tools, and you are set.

    Or just use Visual C++ Express.

    0 讨论(0)
提交回复
热议问题