Cuda building error

I installed Visual Studio 2015 community edition, then I installed Cuda 8.0, but when I try to compile anything even newly created empty project I get this error

everity    Code    Description    Project    File    Line    Suppression State
Error    MSB3721    The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2015 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static  -g   -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /FS /Zi  /MDd " -o x64\Debug\kernel.cu.obj "C:\Users\fredy\Documents\Visual Studio 2015\Projects\aaaaaa\aaaaaa\kernel.cu"" exited with code 1.    aaaaaa    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\CUDA 8.0.targets    689

Can somebody help ?

start by increasing the verbosity on visual studio. You don’t need to ask me how to do it, just google it. There are instructions on the web.

After you have increased the verbosity, get the full error output. There should be an nvcc error in the console before the one you have shown.

Toolkit\CUDA\v8.0\bin\nvcc.exe" [CodeGeneration] --use-local-env --cl-version 2015 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64” [GenerateRelocatableDeviceCode] [Include] [RequiredIncludes] [InterleaveSourceInPTX] [GPUDebugInfo] [GenerateLineInfo] [Keep] [KeepDir] [MaxRegCount] [PtxAsOptionV] [TargetMachinePlatform] [NvccCompilation] [CudaRuntime] [AdditionalOptions] [HostDebugInfo] [Emulation] [FastMath] [Defines] -Xcompiler “/EHsc [Warning] /nologo [Optimization] /FS /Zi [RuntimeChecks] [Runtime] [TypeInfo]” [CompileOut] “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0\0_Simple\asyncAPI\asyncAPI.cu” (TaskId:33)
1> (TaskId:33)
1> C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0\0_Simple\asyncAPI>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe” -gencode=arch=compute_20,code=“sm_20,compute_20” -gencode=arch=compute_30,code=“sm_30,compute_30” -gencode=arch=compute_35,code=“sm_35,compute_35” -gencode=arch=compute_37,code=“sm_37,compute_37” -gencode=arch=compute_50,code=“sm_50,compute_50” -gencode=arch=compute_52,code=“sm_52,compute_52” -gencode=arch=compute_60,code=“sm_60,compute_60” --use-local-env --cl-version 2015 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64” -I./ -I…/…/common/inc -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0/include" -I…/…/common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler “/wd 4819” -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler “/EHsc /W3 /nologo /O2 /FS /Zi /MT " -o x64/Release/asyncAPI.cu.obj “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0\0_Simple\asyncAPI\asyncAPI.cu” (TaskId:33)
1>11:55:34.543 1:2>
1>CUDACOMPILE : nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
1> nvcc fatal : Cannot find compiler ‘x86_amd64’ in PATH (TaskId:33)
1>11:55:34.548 1:2>
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\CUDA 8.0.targets(689,9): error MSB3721: The command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe” -gencode=arch=compute_20,code=“sm_20,compute_20” -gencode=arch=compute_30,code=“sm_30,compute_30” -gencode=arch=compute_35,code=“sm_35,compute_35” -gencode=arch=compute_37,code=“sm_37,compute_37” -gencode=arch=compute_50,code=“sm_50,compute_50” -gencode=arch=compute_52,code=“sm_52,compute_52” -gencode=arch=compute_60,code=“sm_60,compute_60” --use-local-env --cl-version 2015 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64” -I./ -I…/…/common/inc -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0/include” -I…/…/common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include” --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler “/wd 4819” -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler “/EHsc /W3 /nologo /O2 /FS /Zi /MT " -o x64/Release/asyncAPI.cu.obj “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0\0_Simple\asyncAPI\asyncAPI.cu”” exited with code 1.
1> Done executing task “CudaCompile” – FAILED. (TaskId:33)
1>11:55:34.549 1:2>
1>Done building target “CudaBuildCore” in project “asyncAPI_vs2015.vcxproj” – FAILED.: (TargetId:43)
1>11:55:34.551 1>
1>Done executing task “MSBuild” – FAILED. (TaskId:23)
1>11:55:34.551 1>
1>Done building target “CudaBuild” in project “asyncAPI_vs2015.vcxproj” – FAILED.: (TargetId:39)

Fix this (by configuring PATH):

I am guessing you need to add “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64” to PATH. Alternatively, MSVC typically comes with a batch file that sets up required environment variables. It may be called vcvarsall.bat or something along those lines.

Thank you very much njuffa this fixed my error. :)

Hi, I have same problem but ı couldn’t understand what ı have to add

Hi, coder
In my case, I had installed way too many visual studious on my pc and the one that I used for cuda was not able to install properly. I remember that there were missing files in the path, you can see earlier in the forum. So I had to manually copy them from cuda files I think, but I don’t remember it clearly. But try going through every path in error and see if there are files there.