nvcc can't compile anything (Windows 10)

Hello,
I reseted Windows 10 to default settings (+ updated to latest 1903 version) so all my programs have been deleted and started CUDA + Visual Studio installation, but all combination of CUDA + Visual Studio (I tried CUDA 9.0, 9.2, 10.1 and Visual Studio 2015, 2017 with v140, v141 toolsets + v14.11 toolset in case of Visual Studio 2017) fails because nvcc returns exit code.
For example, I try to compile project from Github which had successfully compiled with Visual Studio 2017 and CUDA 9.0 and 10.1 before Windows 10 reset to factory settings:

cmake -G "Visual Studio 14 2015 Win64" ..
-- Selecting Windows SDK version  to target Windows 10.0.18362.
-- The CXX compiler identification is MSVC 19.0.24215.1
-- <b>The CUDA compiler identification is unknown</b>
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_CUDA_COMPILER could be found.

if I try to set CMAKE_CUDA_COMPILER via Cmake (usually project compiled fine without any additional settings) I get the next error:

CMake Error at C:/Program Files/CMake/share/cmake-3.14/Modules/CMakeTestCUDACompiler.cmake:46 (message):
  The CUDA compiler

    "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/bin"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: D:/Work/argus-tensor-stream/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe cmTC_f7653.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=14.0 /v:m
    Microsoft (R) Build Engine версии 14.0.25420.1
    (C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.

      Compiling CUDA source file main.cu...

      D:\Work\argus-tensor-stream\build\CMakeFiles\CMakeTmp>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin\nvcc.exe" -gencode=arch=compute_30,code=\"sm_30,compute_30\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64" -x cu   -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include"     --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static  -g   -D"CMAKE_INTDIR=\"Debug\"" -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -Xcompiler "/EHsc /W1 /nologo /O2 /FdcmTC_f7653.dir\Debug\vc140.pdb /FS /Zi  /MD " -o cmTC_f7653.dir\Debug\main.obj "D:\Work\argus-tensor-stream\build\CMakeFiles\CMakeTmp\main.cu"
    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\CUDA 9.2.targets(712,9): error MSB3721: выход из команды ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin\nvcc.exe" -gencode=arch=compute_30,code=\"sm_30,compute_30\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64" -x cu   -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include"     --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static  -g   -D"CMAKE_INTDIR=\"Debug\"" -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -Xcompiler "/EHsc /W1 /nologo /O2 /FdcmTC_f7653.dir\Debug\vc140.pdb /FS /Zi  /MD " -o cmTC_f7653.dir\Debug\main.obj "D:\Work\argus-tensor-stream\build\CMakeFiles\CMakeTmp\main.cu"" с кодом "2". [D:\Work\argus-tensor-stream\build\CMakeFiles\CMakeTmp\cmTC_f7653.vcxproj]

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

the first lines of CMakeError.log are:

Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed.
Compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/bin 
Build flags: 
Id flags:  -v;--keep;--keep-dir;tmp

The output was:
1

So I tried to compile CUDA 9.2 samples with Visual Studio 2015 and 2017, “marching cubes” for example:

C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.2_Graphics\marchingCubes>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin\nvcc.exe" -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\" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -gencode=arch=compute_70,code=\"sm_70,compute_70\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64" -x cu  -I./ -I../../common/inc -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\/include" -I../../common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler "/wd 4819" -g   -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64/Debug/vc140.pdb /FS /Zi /RTC1 /MTd " -o x64/Debug/marchingCubes_kernel.cu.obj "C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.2_Graphics\marchingCubes\marchingCubes_kernel.cu"
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\CUDA 9.2.targets(712,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin\nvcc.exe" -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\" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -gencode=arch=compute_70,code=\"sm_70,compute_70\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64" -x cu  -I./ -I../../common/inc -I./ -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\/include" -I../../common/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static -Xcompiler "/wd 4819" -g   -DWIN32 -DWIN32 -D_MBCS -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Fdx64/Debug/vc140.pdb /FS /Zi /RTC1 /MTd " -o x64/Debug/marchingCubes_kernel.cu.obj "C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.2_Graphics\marchingCubes\marchingCubes_kernel.cu"" <b>exited with code 2</b>.

if I try to execute the nvcc command above via cmd, I get empty output.

Please help with this issue, I don’t know why I can’t compile anything with nvcc.
Thanks in advance!

2 Likes