Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Build fails #30932

Closed
traits opened this issue Dec 7, 2019 · 6 comments
Closed

Windows Build fails #30932

traits opened this issue Dec 7, 2019 · 6 comments
Labels
module: windows Windows support for PyTorch triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@traits
Copy link

traits commented Dec 7, 2019

馃悰 Bug

For some days, I have a broken build on Windows (cf. appended error message)

To Reproduce

Steps to reproduce the behavior:

  1. Pull master, submodules etc.
  2. (Opt.) clear build directory
  3. Build pytorch

Expected behavior

A finishing build

Environment

PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A

OS: Microsoft Windows 10 Pro
GCC version: Could not collect
CMake version: version 3.16.0

Python version: 3.7
Is CUDA available: N/A
CUDA runtime version: 10.2.89
GPU models and configuration: GPU 0: Quadro M1200
Nvidia driver version: 441.28
cuDNN version: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\cudnn64_7.dll

Versions of relevant libraries:
[pip3] msgpack-numpy==0.4.4.3

[pip3] numpy==1.17.4+mkl

[pip3] numpydoc==0.9.1

[pip3] torch==1.3.1 # I don't know, what this means - my pip call lists the same development version as conda

[pip3] torchvision==0.4.2
[conda] blas 1.0 mkl

[conda] libblas 3.8.0 14_mkl conda-forge

[conda] libcblas 3.8.0 14_mkl conda-forge

[conda] liblapack 3.8.0 14_mkl conda-forge

[conda] liblapacke 3.8.0 14_mkl conda-forge

[conda] mkl 2019.4 245

[conda] mkl-include 2019.4 245

[conda] mkl-service 2.3.0 py37hfa6e2cd_0 conda-forge

[conda] pytorch-sphinx-theme 0.0.24 dev_0

[conda] torch 1.4.0a0+6e145b4 pypi_0 pypi

[conda] torchvision 0.5.0a0+95131de pypi_0 pypi

Additional context

MS Visual Studio got an update lately - maybe the used C++ compiler is worth a check:

Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64\cl.exe

Error message from build:

[95/995] Building CXX object caffe2\CMakeFiles\torch_cpu.dir\core\blob_serialization.cc.obj                                                                                                               
FAILED: caffe2/CMakeFiles/torch_cpu.dir/core/blob_serialization.cc.obj                                                                                                                                    
C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1424~1.283\bin\Hostx64\x64\cl.exe  /nologo /TP -DAT_PARALLEL_OPENMP=1 -DCPUINFO_SUPPORTED_PLATFORM=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTH_BLAS_MK
L -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE=1 -D_OPENMP_NOFORCE_MANIFEST -Dtorch_cpu_EXPORTS -Iaten\src -I..\aten\src -I. -I..\ -I..\cmake\..\third_party\benchmark\include -I..\third_party\onnx -
Ithird_party\onnx -I..\third_party\foxi -Ithird_party\foxi -I..\caffe2\..\torch\csrc\api -I..\caffe2\..\torch\csrc\api\include -I..\caffe2\aten\src\TH -Icaffe2\aten\src\TH -I..\caffe2\..\torch\..\aten\s
rc -Icaffe2\aten\src -Icaffe2\..\aten\src -Icaffe2\..\aten\src\ATen -I..\caffe2\..\torch\csrc -I..\caffe2\..\torch\..\third_party\miniz-2.0.8 -I..\aten\src\TH -I..\aten\..\third_party\catch\single_inclu
de -I..\aten\src\ATen\.. -Icaffe2\aten\src\ATen -I..\third_party\miniz-2.0.8 -I..\caffe2\core\nomnigraph\include -I..\c10\.. -I..\third_party\cpuinfo\include -I..\third_party\FP16\include -I..\cmake\..\
third_party\googletest\googlemock\include -I..\cmake\..\third_party\googletest\googletest\include -I..\third_party\protobuf\src -I"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\mkl
\include" -IV:\bin\scripting\python\conda\envs\pytorch\Library\include -I..\cmake\..\third_party\eigen -IV:\bin\scripting\python\conda\envs\pytorch\include -Iv:\bin\scripting\python\conda\envs\pytorch\l
ib\site-packages\numpy\core\include -I..\torch\include -I..\cmake\..\third_party\cub -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -I..\caffe2 /DWIN32 /D_WINDOWS /GR  /w /EHa /MP 
/bigobj -openmp:experimental -DHAVE_AVX_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /MD /O2 /Ob2  /w /EHa /MP /bigobj   -DCUDA_HAS_FP16=1 -DUSE_GCC_GET_CPUID -DUSE_AVX -DUSE_AVX2 -DTH_HAVE_THREAD /Z7 /EHa
 /DNOMINMAX /wd4267 /wd4251 /wd4522 /wd4838 /wd4305 /wd4244 /wd4190 /wd4101 /wd4996 /wd4275 /bigobj -O2 -DCAFFE2_BUILD_MAIN_LIB -DONNX_BUILD_MAIN_LIB -std:c++14 /showIncludes /Focaffe2\CMakeFiles\torch_
cpu.dir\core\blob_serialization.cc.obj /Fdcaffe2\CMakeFiles\torch_cpu.dir\ /FS -c ..\caffe2\core\blob_serialization.cc                                                                                    
V:\src\git\pytorch\src\pytorch\caffe2/core/context_base.h(92): error C2338: CopyToCPU requires fundamental types                                                                                          
..\caffe2\core\blob_serialization.cc(602): note: see reference to function template instantiation 'void at::BaseContext::CopyToCPU<c10::Half>(size_t,const T *,T *)' being compiled                       
        with                                                                                                                                                                                              
        [                                                                                                                                                                                                 
            T=c10::Half                                                                                                                                                                                   
        ]                                                                                                                                                                                                 
[102/995] Building CXX object caffe2\CMakeFiles\torch_cpu.dir\opt\onnxifi_op.cc.obj                                                                                                                       
ninja: build stopped: subcommand failed.                                                                                                                                                                  
Traceback (most recent call last):                                                                                                                                                                        
  File "setup.py", line 755, in <module>                                                                                                                                                                  
    build_deps()                                                                                                                                                                                          
  File "setup.py", line 316, in build_deps                                                                                                                                                                
    cmake=cmake)                                                                                                                                                                                          
  File "v:\src\git\pytorch\src\pytorch\tools\build_pytorch_libs.py", line 62, in build_caffe2                                                                                                             
    cmake.build(my_env)                                                                                                                                                                                   
  File "v:\src\git\pytorch\src\pytorch\tools\setup_helpers\cmake.py", line 337, in build                                                                                                                  
    self.run(build_args, my_env)                                                                                                                                                                          
  File "v:\src\git\pytorch\src\pytorch\tools\setup_helpers\cmake.py", line 141, in run                                                                                                                    
    check_call(command, cwd=self.build_dir, env=env)                                                                                                                                                      
  File "v:\bin\scripting\python\conda\envs\pytorch\lib\subprocess.py", line 347, in check_call                                                                                                            
    raise CalledProcessError(retcode, cmd)                                                                                                                                                                
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 1.
```                                       `


cc @peterjc123
@peterjc123
Copy link
Collaborator

So the compiler is complaining about std::is_fundamental<c10::Half> being false. Is that true, @ezyang?

@peterjc123
Copy link
Collaborator

Well, it should be true because it was set here: https://github.com/pytorch/pytorch/blob/master/c10/util/typeid.h#L51.

@peterjc123
Copy link
Collaborator

peterjc123 commented Dec 7, 2019

The following code gets 0 as an output in VS 2019 16.4, but 1 in VS 2017. It is likely a VS bug. Issue: https://developercommunity.visualstudio.com/content/problem/848198/cannot-customize-is-fundamental-for-a-new-type.html

#include <iostream>
#include <type_traits>

struct a {
	int b;
};

namespace std {
	template<>
	struct is_fundamental<a> : std::true_type {};
}

int main() {
	std::cout << std::is_fundamental<a>::value << std::endl;
}

@ezyang
Copy link
Contributor

ezyang commented Dec 8, 2019

Oof. So maybe we should polyfill is_fundamental with our own implementation to work around the problem.

@peterjc123
Copy link
Collaborator

This is the reply from MS. I think we should make the change.

See the C++ standard, [meta] / p4

Unless otherwise specified, the behavior of a program that adds specializations for any of the templates
specified in this subclause [meta] is undefined.

@traits
Copy link
Author

traits commented Dec 17, 2019

Unless otherwise specified, the behavior of a program that adds specializations for any of the templates
specified in this subclause [meta] is undefined.

This is a bit strange, I found this sentence only in newer drafts of the standard, it is not even part of C++ 2017. So, the current cmake value CMAKE_CXX_STANDARD 14 should be enough, shouldn't it? Otherwise, either cmake's or Visual Studio's behavior is incorrect.

wuhuikx pushed a commit to wuhuikx/pytorch that referenced this issue Jan 30, 2020
Summary:
Fixes pytorch#30932
Pull Request resolved: pytorch#30959

Differential Revision: D18891797

Pulled By: mingbowan

fbshipit-source-id: e6c36ee80065e66117873e768f86f507c48aaef1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: windows Windows support for PyTorch triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants