This project is read-only.

Cl.exe not found exception

Mar 23, 2012 at 5:44 PM


I'm new in CUDA programming. Every time i run C# project with CUDAfy examples, it throw an exception, cl.exe not found.

I added cl.exe to enviroment variables:

Name: cl.exe

Path: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe

But it doesn't work, please help. Thanks a million.

Mar 24, 2012 at 4:54 PM

Add the directory only, not the file path.

Mar 25, 2012 at 4:03 PM

No success.

Compilation error: nvcc fatal   : Cannot find compiler 'cl.exe' in PATH. 

I have added:

Path: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin

Name: cl.exe

What now ?

Mar 25, 2012 at 5:03 PM

Can you get nvcc working without CUDAfy?  You can try running some of the NVIDIA samples.  It is important to get this working before trying from CUDAfy since it is a wrapper around the CUDA tools and library.

What version of CUDA are you using?


Mar 25, 2012 at 11:50 PM

Yes I can compile and run CUDA and C codes. 

But when i use CUDAfy and try some examples eg. CudafyIntroduction from CUDAfy website it will crash with error above your comment.

I'm using CUDA SDK 4.1.

Hope that we can solve this problem...

Mar 26, 2012 at 10:52 AM

Okay then we need to think about 32- or 64-bit?  Your OS is most likely 64-bit.  Did you install CUDA for this?  What platform is your project compiling for?

Mar 26, 2012 at 2:44 PM
Edited Mar 26, 2012 at 2:44 PM

Yes i have 64bit OS. Cuda lib path is %CUDA_PATH%lib\x64 so i think it's 64bit CUDA. 

Here's a platform screenshot

Mar 26, 2012 at 7:48 PM

Can you try setting platform to x86?

Mar 28, 2012 at 11:19 AM

I've tried, but same error message.

Mar 29, 2012 at 8:56 AM

In the debug output window you should see the command line that was used when calling nvcc.  Can you post that?  We then need to compare this to the command line used when calling nvcc directly.

Mar 30, 2012 at 7:53 AM
Edited Mar 30, 2012 at 7:59 AM

You mean this?

------ Build started: Project: CudafyIntroduction, Configuration: Debug Any CPU ------  CudafyIntroduction -> C:\Users\Hlavson\Downloads\CudafyIntroduction\CudafyIntroduction\CudafyIntroduction\bin\Debug\CudafyIntroduction.exe========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

EDIT: But, if i want to use CUDAfy, all i need to do is download CUDAfy.dll, add it to my solution, add cl.exe
(C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin) to enviroment variables, and CUDAfy should work. Is that all i need to do? 

Mar 30, 2012 at 8:56 AM

No I mean the line generated when you run the program. You want to see what arguments are passed to nvcc. For example:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.1\bin\nvcc.exe -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.1\include" -m64  -arch=sm_20  "D:\Sandbox\HybridDSPSystems\Codeplex\Cudafy\CudafyExamples\bin\Debug\"  -o "D:\Sandbox\HybridDSPSystems\Codeplex\Cudafy\CudafyExamples\bin\Debug\CUDAFYSOURCETEMP.ptx"  --ptx

Since you are not building the sources and therefore do not have the debug version you will need to access the CompilerOutput property on the CudafyModule.

Apr 1, 2012 at 1:29 PM

Sorry, I'm not from english speaking country. Can you specify this in more detailed way? What exactly should i do ?

Apr 2, 2012 at 3:08 PM

There is a property on the CudafyModule class that shows you the command line params passed to nvcc.  You can print this to the console or debug window.

Apr 18, 2012 at 4:11 PM

I had the same issue today. You have to add the nvidia and visual studio paths to the PATH variable:


C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\;
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\bin;
D:\Microsoft Visual Studio 2008\Common7\IDE;
D:\Microsoft Visual Studio 2008\VC\bin;
D:\Microsoft Visual Studio 2008\Common7\Tools;
D:\Microsoft Visual Studio 2008\VC\bin\x86_amd64


May 20, 2012 at 2:56 PM
Edited May 20, 2012 at 3:38 PM

Me too,

My computer OS :windows 7 64 bit. and use CUDA SDK 4.2. I meet the same problem.

Any soultion??

"You have to add the nvidia and visual studio paths to the PATH variable" is computer surrounding variable??



May 21, 2012 at 2:47 PM

Yes this is the solution.  After you've added it to your path then do a reboot!

Jul 9, 2013 at 7:35 PM
Compiler version: v5.0
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin\nvcc
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include" -m64 -arch=sm_13 "C:\Users\Admin\Documents\Visual Studio 2010\Projects\SaveImageToAviEx_CSharp\bin\Debug\" -o "C:\Users\Admin\Documents\Visual Studio 2010\Projects\SaveImageToAviEx_CSharp\bin\Debug\CUDAFYSOURCETEMP.ptx" --ptx
nvcc : fatal error : Cannot find compiler 'cl.exe' in PATH

Hello I am able to run "cudafybyexample"

However When I try using the code else where I get the "Cannot find compiler 'cl.exe' in PATH" error
Jul 10, 2013 at 1:47 PM

"However When I try using the code else where I get the "Cannot find compiler 'cl.exe' in PATH" error"

Is visual studio's cl.exe compiler installed in this other PC?
If you're going to use your compiled cudafy code elsewhere, you're better off embedding the cudafy'ed module onto your dll. Check cudafy's manual for a better explanation.