Error while compiling Apache MXNET using CUDA Toolkit 10.2 and CUDNN in Windows 10 using Visual Studio 2017

Dear Experts,

Kindly help me with the issues while compiling apache MXNET (incubate) in Windows using Visual Studio 2017, CUDA Toolkit 10.2, and CUDNN. I use CMake to build the Visual Studio 2017 project file, with the following command:

cmake -G "Visual Studio 15 2017 Win64" -T cuda=10.2,host=x64^
 -DCMAKE_BUILD_TYPE=Release -DUSE_CUDA=1 -DUSE_CUDNN=1 -DUSE_CPP_PACKAGE=1^
 -DUSE_NVRTC=1 -DUSE_OPENCV=1 -DUSE_OPENMP=1 -DUSE_BLAS=open -DUSE_LAPACK=1^
 -DUSE_DIST_KVSTORE=0 -DCUDA_ARCH_LIST=Common -DCUDA_TOOLSET=10.2^
 -DCUDNN_INCLUDE="C:\cuda\include"^
 -DCUDNN_LIBRARY="C:\cuda\lib\x64\cudnn.lib" ..

The Build command was:

msbuild -v:diag mxnet.sln /p:Configuration=Release;Platform=x64 /maxcpucount

When compiling MXNET using NVIDIA libraries encountered the following error:

Command:

“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe” -gencode=arch=compute_50,code="sm_50,compute_50" -gencode=arch=compute_50,code="compute_50,compute_50" --use-local-env -ccbin “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64” -x cu -I"C:\incubator-mxnet\include" -I"C:\incubator-mxnet\src" -I"C:\incubator-mxnet\3rdparty\nvidia_cub" -I"C:\incubator-mxnet\3rdparty\tvm\nnvm\include" -I"C:\incubator-mxnet\3rdparty\tvm\include" -I"C:\incubator-mxnet\3rdparty\dmlc-core\include" -I"C:\incubator-mxnet\3rdparty\dlpack\include" -I"C:\incubator-mxnet\3rdparty\mshadow" -I"C:\incubator-mxnet\build\3rdparty\dmlc-core\include" -IC:\openblas -IC:\opencv\build\include -IC:\cuda\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -Xcompiler=“/EHsc -Ob2 -Gy /bigobj” -D_WINDOWS -DNDEBUG -DDMLC_LOG_FATAL_THROW=1 -DDMLC_MODERN_THREAD_LOCAL=0 -DDMLC_LOG_STACK_TRACE_SIZE=0 -DDMLC_USE_CXX11 -DDMLC_STRICT_CXX11 -DDMLC_USE_CXX14 -DMSHADOW_IN_CXX11 -DWIN32_LEAN_AND_MEAN -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DMXNET_EXPORTS -DNNVM_EXPORTS -DNOMINMAX -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -DMXNET_USE_BLAS_OPEN=1 -DMXNET_USE_LIBJPEG_TURBO=0 -DMXNET_USE_OPENCV=1 -DMXNET_USE_OPENMP=1 -DMXNET_USE_LAPACK=1 -DUSE_CUDNN -DMXNET_ENABLE_CUDA_RTC=1 -DMXNET_USE_CUDA=1 -DMXNET_USE_SIGNAL_HANDLER=1 -DMSHADOW_USE_CUDA=1 -DMSHADOW_FORCE_STREAM -DMSHADOW_USE_SSE=0 -DMSHADOW_USE_CUDNN -DMSHADOW_USE_F16C=0 -DMSHADOW_INT64_TENSOR_SIZE=0 -D__USE_XOPEN2K8 -DDMLC_CORE_USE_CMAKE -DDMLC_USE_CXX11=1 -D"CMAKE_INTDIR="Release"" -Dmxnet_50_EXPORTS -DWIN32 -D_WINDOWS -DNDEBUG -DDMLC_LOG_FATAL_THROW=1 -DDMLC_MODERN_THREAD_LOCAL=0 -DDMLC_LOG_STACK_TRACE_SIZE=0 -DDMLC_USE_CXX11 -DDMLC_STRICT_CXX11 -DDMLC_USE_CXX14 -DMSHADOW_IN_CXX11 -DWIN32_LEAN_AND_MEAN -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DMXNET_EXPORTS -DNNVM_EXPORTS -DNOMINMAX -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -DMXNET_USE_BLAS_OPEN=1 -DMXNET_USE_LIBJPEG_TURBO=0 -DMXNET_USE_OPENCV=1 -DMXNET_USE_OPENMP=1 -DMXNET_USE_LAPACK=1 -DUSE_CUDNN -DMXNET_ENABLE_CUDA_RTC=1 -DMXNET_USE_CUDA=1 -DMXNET_USE_SIGNAL_HANDLER=1 -DMSHADOW_USE_CUDA=1 -DMSHADOW_FORCE_STREAM -DMSHADOW_USE_SSE=0 -DMSHADOW_USE_CUDNN -DMSHADOW_USE_F16C=0 -DMSHADOW_INT64_TENSOR_SIZE=0 -D__USE_XOPEN2K8 -DDMLC_CORE_USE_CMAKE -DDMLC_USE_CXX11=1 -D"CMAKE_INTDIR="Release"" -Dmxnet_50_EXPORTS -D_WINDLL -D_MBCS -Xcompiler “/EHsc /W3 /nologo /O2 /Fdmxnet_50.dir\Release\vc141.pdb /FS /Zi /MT /GR” -o mxnet_50.dir\Release/src/operator/quantization/quantized_pooling.cu.obj “C:\incubator-mxnet\src\operator\quantization\quantized_pooling.cu”

Errors Message:

c:\incubator-mxnet\include\mshadow./base.h(838): warning: calling a constexpr host function(“max”) from a host device function(“MaxValue”) is not allowed. The experimental flag ‘–expt-relaxed-constexpr’ can be used to allow this.

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\thrust/system/cuda/detail/core/util.h(761): error: expected an identifier

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\thrust/system/cuda/detail/core/util.h(783): error: expected an identifier

C:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm/op.h(106): warning: field of class type without a DLL interface used in a class with a DLL interface

C:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm/op.h(111): warning: field of class type without a DLL interface used in a class with a DLL interface

C:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm/op.h(113): warning: field of class type without a DLL interface used in a class with a DLL interface

C:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm/op.h(141): warning: field of class type without a DLL interface used in a class with a DLL interface

C:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm/op.h(147): warning: field of class type without a DLL interface used in a class with a DLL interface

C:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm/op.h(180): warning: field of class type without a DLL interface used in a class with a DLL interface

c:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm\node.h(163): warning: field of class type without a DLL interface used in a class with a DLL interface

c:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm\node.h(165): warning: field of class type without a DLL interface used in a class with a DLL interface

c:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm\node.h(170): warning: field of class type without a DLL interface used in a class with a DLL interface

c:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm\node.h(172): warning: field of class type without a DLL interface used in a class with a DLL interface

C:\incubator-mxnet\3rdparty\tvm\nnvm\include\nnvm/symbolic.h(73): warning: field of class type without a DLL interface used in a class with a DLL interface

2 errors detected in the compilation of “C:/Users/wwidj/AppData/Local/Temp/tmpxft_0000a86c_00000000-7_quantized_pooling.cpp1.ii”.

After investigation, its look like, the Microsoft Visual Studio Compiler (cl.exe) rejected the following codes on NVIDIA CUDA library header:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\thrust/system/cuda/detail/core/util.h(761): error: expected an identifier

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include\thrust/system/cuda/detail/core/util.h(783): error: expected an identifier

Both lines pointed to the following codes:

template<class T, size_t N>
  struct array
  {
    typedef T value_type;
    typedef T ref[N];
    enum {SIZE = N}; // THIS IS THE LINE 761 AND 783**
    private:
      T data_[N];

    public:
      __host__ __device__ T* data() { return data_; }
      __host__ __device__ const T* data() const { return data_; }
      __host__ __device__ T& operator[](unsigned int idx) { return ((T*)data_)[idx]; }
      __host__ __device__ T const& operator[](unsigned int idx) const { return ((T*)data_)[idx]; }
      __host__ __device__ unsigned int size() const { return N; }
      __host__ __device__ operator ref&() { return data_; }
  };

Kindly help me to figure out the solution to this problem.

Thanks and Best Regards