Compilation with Visual Studio 2017


#1

Hi everyone,

I am trying to compile mxnet with Visual studio 2017 on Windows 10. I can configure the project with cmake as long as I disable Cuda. But I can’t make it work with Cuda, even with the version 8.0 that is advertised on the website. I almost always fall on this error message :

No CMAKE_CUDA_COMPILER could be found.

My environment variables seems to be correct though… I thus tried with several version of Cuda. It doesn’t seem to help much…

How to get pass through it?

Thanks!


#2

Ahhh, and I forgot to specify: when I specify the path to the Cuda environment directly, I get this error.

CMake Error at C:/Program Files/CMake/share/cmake-3.11/Modules/CMakeTestCUDACompiler.cmake:46 (message):
The CUDA compiler
“C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/bin/nvcc.exe”
is not able to compile a simple test program.
It fails with the following output:
Change Dir: F:/installMxnet/mxnet/build/CMakeFiles/CMakeTmp
Run Build Command:“C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe” “cmTC_776f7.vcxproj” “/p:Configuration=Debug” “/p:VisualStudioVersion=15.0”
Microsoft ® Build Engine version 15.7.177.53362 for .NET Framework
Copyright © Microsoft Corporation. All rights reserved.
Build started 2018-05-23 16:31:08.
Project “F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj” on node 1 (default targets).
PrepareForBuild:
Creating directory “cmTC_776f7.dir\Debug”.

  Creating directory "F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\Debug\".

  Creating directory "cmTC_776f7.dir\Debug\cmTC_776f7.tlog\".

InitializeBuildStatus:

  Creating "cmTC_776f7.dir\Debug\cmTC_776f7.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.

AddCudaCompileDeps:

  C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /DCMAKE_INTDIR="Debug" /DCMAKE_INTDIR="Debug" /D_MBCS /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include" /I. /FIcuda_runtime.h /c F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\main.cu 

Project "F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj" (1) is building "F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj" (1:2) on node 1 (CudaBuildCore target(s)).

CudaBuildCore:

  Compiling CUDA source file main.cu...

  cmd.exe /C "C:\Users\educrocq\AppData\Local\Temp\tmp1f5b9100dd0149709400579c18701960.cmd"

  "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\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include" -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 /FS /Zi  /MD " -o cmTC_776f7.dir\Debug\main.obj "F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\main.cu"
  F:\installMxnet\mxnet\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\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include" -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 /FS /Zi  /MD " -o cmTC_776f7.dir\Debug\main.obj "F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\main.cu" 

c:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\crt/host_config.h(133): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported! [F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj]

  main.cu

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 9.2.targets(707,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\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include" -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 /FS /Zi  /MD " -o cmTC_776f7.dir\Debug\main.obj "F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\main.cu"" exited with code 2. [F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj]

Done Building Project "F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj" (CudaBuildCore target(s)) -- FAILED.

Done Building Project "F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj" (default targets) -- FAILED.

Build FAILED.
"F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj" (default target) (1) ->

"F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj" (CudaBuildCore target) (1:2) ->

(CudaBuildCore target) -> 

  c:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\crt/host_config.h(133): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported! [F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj]
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 9.2.targets(707,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\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include" -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 /FS /Zi  /MD " -o cmTC_776f7.dir\Debug\main.obj "F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\main.cu"" exited with code 2. [F:\installMxnet\mxnet\build\CMakeFiles\CMakeTmp\cmTC_776f7.vcxproj]
    0 Warning(s)
    2 Error(s)
Time Elapsed 00:00:00.59

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


#3

Not sure if CUDA9.2 is supported yet. But the error comes from

fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported!

#4

Indeed. By editing the cuda header, I managed to make it work! Thanks!
It seems that NVidia lags behind the Visual Studio version, because I am using the Visual Studio 2017 with an update. But it remains Visual Studio 2017…