PyTorch 1.7.1 CUDA 11.1 Windows build failed

Hi
I’m trying to build PyTorch 1.7.1 from source using CUDA 11.1 on Windows (build worked fine on Ubuntu 18.04, now needs the Windows version)
I’m following this thread: PyTorch build from source on Windows - #17 by mmisiur and I keep getting these errors:

..\aten\src\ATen/core/dispatch/Dispatcher.h(368): error C2039: 'boxArgs': is not a member of 'c10::impl::BoxedKernelWrapper<Return (at::Tensor &,const at::Tensor &,c10::optional<c10::MemoryFormat>),void>'
        with
        [
            Return=at::Tensor &
        ]
..\aten\src\ATen/core/dispatch/Dispatcher.h(368): note: see declaration of 'c10::impl::BoxedKernelWrapper<Return (at::Tensor &,const at::Tensor &,c10::optional<c10::MemoryFormat>),void>'
        with
        [
            Return=at::Tensor &
        ]
..\aten\src\ATen/core/boxing/impl/boxing.h(100): error C2070: 'FuncType': illegal sizeof operand
        with
        [
            FuncType=at::Tensor (const at::Tensor &,c10::optional<c10::MemoryFormat>)
        ]

CMake summary output (not enough room to post entire output, will post later if needed):

--
-- ******** Summary ********
-- General:
--   CMake version         : 3.19.2
--   CMake command         : C:/Users/cbarak/.conda/envs/pytorch_1.7.1/Library/bin/cmake.exe
--   System                : Windows
--   C++ compiler          : C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
--   C++ compiler id       : MSVC
--   C++ compiler version  : 19.16.27040.0
--   BLAS                  : MKL
--   CXX flags             : /DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -openmp -DNDEBUG -DUSE_FBGEMM -DUSE_VULKAN_WRAPPER
--   Build type            : Release
--   Compile definitions   : ONNX_ML=1;ONNXIFI_ENABLE_EXT=1;ONNX_NAMESPACE=onnx_torch;_CRT_SECURE_NO_DEPRECATE=1;WIN32_LEAN_AND_MEAN;USE_EXTERNAL_MZCRC;MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
--   CMAKE_PREFIX_PATH     : C:\Users\cbarak\.conda\envs\pytorch_1.7.1\Lib\site-packages;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1
--   CMAKE_INSTALL_PREFIX  : C:/dev/pytorch/torch
--
--   TORCH_VERSION         : 1.7.0
--   CAFFE2_VERSION        : 1.7.0
--   BUILD_CAFFE2          : ON
--   BUILD_CAFFE2_OPS      : ON
--   BUILD_CAFFE2_MOBILE   : OFF
--   BUILD_STATIC_RUNTIME_BENCHMARK: OFF
--   BUILD_BINARY          : OFF
--   BUILD_CUSTOM_PROTOBUF : ON
--     Link local protobuf : ON
--   BUILD_DOCS            : OFF
--   BUILD_PYTHON          : True
--     Python version      : 3.8.6
--     Python executable   : C:/Users/cbarak/.conda/envs/pytorch_1.7.1/python.exe
--     Pythonlibs version  : 3.8.6
--     Python library      : C:/Users/cbarak/.conda/envs/pytorch_1.7.1/libs/python38.lib
--     Python includes     : C:/Users/cbarak/.conda/envs/pytorch_1.7.1/include
--     Python site-packages: Lib/site-packages
--   BUILD_SHARED_LIBS     : ON
--   BUILD_TEST            : True
--   BUILD_JNI             : OFF
--   BUILD_MOBILE_AUTOGRAD : OFF
--   INTERN_BUILD_MOBILE   :
--   USE_ASAN              : OFF
--   USE_CPP_CODE_COVERAGE : OFF
--   USE_CUDA              : 1
--     CUDA static link    : OFF
--     USE_CUDNN           : ON
--     CUDA version        : 11.1
--     cuDNN version       : 8.0.5
--     CUDA root directory : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1
--     CUDA library        : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/lib/x64/cuda.lib
--     cudart library      : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/lib/x64/cudart_static.lib
--     cublas library      : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/lib/x64/cublas.lib
--     cufft library       : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/lib/x64/cufft.lib
--     curand library      : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/lib/x64/curand.lib
--     cuDNN library       : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/lib/x64/cudnn.lib
--     nvrtc               : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/lib/x64/nvrtc.lib
--     CUDA include path   : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/include
--     NVCC executable     : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin/nvcc.exe
--     NVCC flags          : -Xcompiler;/w;-w;-Xfatbin;-compress-all;-DONNX_NAMESPACE=onnx_torch;--use-local-env;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_86,code=compute_86;-Xcudafe;--diag_suppress=cc_clobber_ignored;-Xcudafe;--diag_suppress=integer_sign_change;-Xcudafe;--diag_suppress=useless_using_declaration;-Xcudafe;--diag_suppress=set_but_not_used;-Xcudafe;--diag_suppress=field_without_dll_interface;-Xcudafe;--diag_suppress=base_class_has_different_dll_interface;-Xcudafe;--diag_suppress=dll_interface_conflict_none_assumed;-Xcudafe;--diag_suppress=dll_interface_conflict_dllexport_assumed;-Xcudafe;--diag_suppress=implicit_return_from_non_void_function;-Xcudafe;--diag_suppress=unsigned_compare_with_zero;-Xcudafe;--diag_suppress=declared_but_not_referenced;-Xcudafe;--diag_suppress=bad_friend_decl;--Werror;cross-execution-space-call;--no-host-device-move-forward;-Xcompiler;-MD$<$<CONFIG:Debug>:d>;--expt-relaxed-constexpr;--expt-extended-lambda;-Xcompiler;/wd4819;-Xcompiler;/wd4503;-Xcompiler;/wd4190;-Xcompiler;/wd4244;-Xcompiler;/wd4251;-Xcompiler;/wd4275;-Xcompiler;/wd4522;-Wno-deprecated-gpu-targets;--expt-extended-lambda;-DCUDA_HAS_FP16=1;-D__CUDA_NO_HALF_OPERATORS__;-D__CUDA_NO_HALF_CONVERSIONS__;-D__CUDA_NO_HALF2_OPERATORS__
--     CUDA host compiler  : C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
--     NVCC --device-c     : OFF
--     USE_TENSORRT        : OFF
--   USE_ROCM              : OFF
--   USE_EIGEN_FOR_BLAS    : ON
--   USE_FBGEMM            : ON
--     USE_FAKELOWP          : OFF
--   USE_FFMPEG            : OFF
--   USE_GFLAGS            : OFF
--   USE_GLOG              : OFF
--   USE_LEVELDB           : OFF
--   USE_LITE_PROTO        : OFF
--   USE_LMDB              : OFF
--   USE_METAL             : OFF
--   USE_MKL               : OFF
--   USE_MKLDNN            : ON
--   USE_MKLDNN_CBLAS      : OFF
--   USE_NCCL              : OFF
--   USE_NNPACK            : OFF
--   USE_NUMPY             : ON
--   USE_OBSERVERS         : ON
--   USE_OPENCL            : OFF
--   USE_OPENCV            : OFF
--   USE_OPENMP            : ON
--   USE_TBB               : OFF
--   USE_VULKAN            : OFF
--   USE_PROF              : OFF
--   USE_QNNPACK           : OFF
--   USE_PYTORCH_QNNPACK   : OFF
--   USE_REDIS             : OFF
--   USE_ROCKSDB           : OFF
--   USE_ZMQ               : OFF
--   USE_DISTRIBUTED       : ON
--     USE_MPI             : OFF
--     USE_GLOO            : ON
--     USE_TENSORPIPE      : OFF
--   Public Dependencies  : Threads::Threads;caffe2::mkldnn
--   Private Dependencies : cpuinfo;fbgemm;fp16;gloo;aten_op_header_gen;foxi_loader;fmt::fmt-header-only
-- Configuring done
-- Generating done
-- Build files have been written to: C:/dev/pytorch/build
cmake --build . --target install --config Release -- -j 12
1 Like

I am running into the same problems. Has there been a solution yet?