"Run CUDA test" produces compilation error in Cudafy Viewer and error: "nvcc fatal : Cannot find compiler 'cl.exe' in PATH"

Mar 5, 2016 at 6:20 PM
Edited Mar 5, 2016 at 6:43 PM
I have:
  • Visual Studio 2010 Professional (10.0.30319.1)
  • CUDA 7.5.18 (1TB install)
  • GeForce GTX 750 Ti (Compute capability: 5.0)
Downloaded and ran the giant 1GB Nvidia CUDA installation. Then I ran Cudafy Viewer and clicked "Check for CUDA" - looked okay - found the GPU.

BUT, then I clicked "Run CUDA Test". Here's the output. As you can see, the Compilation error "." is quite cryptic. What can I do to fix this?
Checking for CUDA SDK at C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin\nvcc
CUDA SDK Version=7.5
Attempting to cudafy a kernel function.
Successfully translated to CUDA C.
Attempting to compile CUDA C code.
Compilation error: .
I also get this problem when I try to run the "CudafyExamples" project from Visual Studio:
Cudafy.CudafyCompileException: Compilation error:
nvcc fatal   : Cannot find compiler 'cl.exe' in PATH

Please add the Visual Studio VC bin directory to PATH in Environment Variables..
   at Cudafy.CudafyModule.Compile(CompileProperties[] props)
   at Cudafy.Translator.CudafyTranslator.Cudafy(IEnumerable`1 props, Type[] types)
   at Cudafy.Translator.CudafyTranslator.Cudafy(CompileProperties prop, Type[] types)
   at Cudafy.Translator.CudafyTranslator.Cudafy(eArchitecture arch)
   at CudafyExamples.Arrays.ArrayBasicIndexing.Execute() in F:\ZMain\_Dan\CudafyV1.29\CudafyV1.29\CudafyExamples\Arrays\ArrayBasicIndexing.cs:line 39
   at CudafyExamples.Program.Main(String[] args) in F:\ZMain\_Dan\CudafyV1.29\CudafyV1.29\CudafyExamples\Program.cs:line 46
What's the quickest way to fix the above problems?

For the latter problem, do I just add "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" to system variables? If so, that path is the 'value' what's the 'variable' name?
Mar 6, 2016 at 3:51 PM
This has often been answered in this forum, you should search for it. The gist of it is, the path to cl.exe should be part of the PATH environment variable.
Mar 8, 2016 at 1:20 AM
Ah, yes after a search, answers appear to confirm what I was saying at the end of my previous comment.

Unfortunately, while there's a few posts discussing the issue, none of them say what the 'variable' name should be only what the 'value' is (which is the path).

To be clear, I'm here: System Properties -> Advanced -> Environment variables -> System Variables

One other question - if this issue is so common, why not put the info in your README.txt Quick Start section?

I assume that Cudafy works with the latest version of CUDA.

Thanks for your response.
Mar 14, 2016 at 4:40 AM
Okay I'm guessing the 'variable' name doesn't matter and can be set to anything. Only the 'value' name matters (which I have set to "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC").

Unfortunately, I'm still getting exactly the same problem as before when I click "Run CUDA test" in Cudafy Viewer.

What am I missing?
Mar 17, 2016 at 10:56 AM
The name matters - it's the PATH variable:
Mar 17, 2016 at 11:00 AM
Edited Mar 17, 2016 at 11:01 AM
To be sure, here'a a printscreen of it
Make sure you a semicolons as separator for the different path locations.
Mar 20, 2016 at 5:40 AM
Edited Mar 20, 2016 at 12:14 PM
Okay it matters after all, so what should the name of the "Variable name" be? I looked at your image, and there was no sign of the "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" or equivalent path for the "Variable value".

For clarity, see the red outlined section from this image: http://i.imgur.com/HdGr6EZ.png
Mar 20, 2016 at 3:12 PM
the "Variable name" is "PATH". It should already exist in your system, and you should edit it and append to it, separated by a semicolon, the location of the visual studio's c++ compiler cl.exe (which in your case seems to be "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC", but you'd better double check that).
Make sure you reboot once you change the PATH variable.
Mar 24, 2016 at 9:15 PM
Edited Mar 24, 2016 at 9:18 PM
Thanks - that clears up that problem! (I misinterpreted your previous reply thinking the "PATH environment variable" was another name for the "Variable" name, when "PATH" is the actual value of that property!)