tensorflow: Bazel & cmake compilations for Windows are completely broken
Can’t compile tensorflow revision 1.3 using Bazel (revision of the last successful nightly build using cmake). Error is the following:
ERROR: C:/tensorflow-1.3rc1/tensorflow/stream_executor/BUILD:39:1: C++ compilation of rule '//tensorflow/stream_executor:cuda_platform' failed (Exit 2): cl.exe failed: error executing command
cd C:/msys64/tmp/_bazel_dmitry/ehgyfc-k/execroot/org_tensorflow
SET CUDA_COMPUTE_CAPABILITIE=None
SET CUDA_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0
SET CUDA_TOOLKIT_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0
SET CUDNN_INSTALL_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0
SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\\shared;C:\Program Files (x86)\Windows Kits\8.1\include\\um;C:\Program Files (x86)\Windows Kits\8.1\include\\winrt;
SET LIB=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64;
SET NO_WHOLE_ARCHIVE_OPTION=1
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64;C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools;C:\Program Files (x86)\Windows Kits\8.1\bin\x64;C:\Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\;C:\msys64\mingw64\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;C:\msys64\usr\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\msys64\usr\bin\site_perl;C:\msys64\usr\bin\vendor_perl;C:\msys64\usr\bin\core_perl;C:\WINDOWS\system32
SET PWD=/proc/self/cwd
SET PYTHON_BIN_PATH=C:/Users/Dmitry/AppData/Local/Programs/Python/Python36/python.exe
SET PYTHON_LIB_PATH=C:/Users/Dmitry/AppData/Local/Programs/Python/Python36/lib/site-packages
SET TEMP=C:\Users\Dmitry\AppData\Local\Temp
SET TF_CUDA_CLANG=0
SET TF_CUDA_COMPUTE_CAPABILITIES=3.5,5.2
SET TF_CUDA_VERSION=8.0
SET TF_CUDNN_VERSION=6
SET TF_NEED_CUDA=1
SET TF_NEED_OPENCL=0
SET TMP=C:\Users\Dmitry\AppData\Local\Temp
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS /bigobj /Zm500 /J /Gy /GF /EHsc /wd4351 /wd4291 /wd4250 /wd4996 -march=native -march=native /nologo /I. /Ibazel-out/msvc_x64-py3-opt/genfiles /Iexternal/bazel_tools /Ibazel-out/msvc_x64-py3-opt/genfiles/external/bazel_tools /Iexternal/protobuf /Ibazel-out/msvc_x64-py3-opt/genfiles/external/protobuf /Iexternal/eigen_archive /Ibazel-out/msvc_x64-py3-opt/genfiles/external/eigen_archive /Iexternal/local_config_sycl /Ibazel-out/msvc_x64-py3-opt/genfiles/external/local_config_sycl /Iexternal/gif_archive /Ibazel-out/msvc_x64-py3-opt/genfiles/external/gif_archive /Iexternal/jpeg /Ibazel-out/msvc_x64-py3-opt/genfiles/external/jpeg /Iexternal/com_googlesource_code_re2 /Ibazel-out/msvc_x64-py3-opt/genfiles/external/com_googlesource_code_re2 /Iexternal/farmhash_archive /Ibazel-out/msvc_x64-py3-opt/genfiles/external/farmhash_archive /Iexternal/fft2d /Ibazel-out/msvc_x64-py3-opt/genfiles/external/fft2d /Iexternal/highwayhash /Ibazel-out/msvc_x64-py3-opt/genfiles/external/highwayhash /Iexternal/png_archive /Ibazel-out/msvc_x64-py3-opt/genfiles/external/png_archive /Iexternal/zlib_archive /Ibazel-out/msvc_x64-py3-opt/genfiles/external/zlib_archive /Iexternal/snappy /Ibazel-out/msvc_x64-py3-opt/genfiles/external/snappy /Iexternal/local_config_cuda /Ibazel-out/msvc_x64-py3-opt/genfiles/external/local_config_cuda /Iexternal/bazel_tools/tools/cpp/gcc3 /Iexternal/protobuf/src /Ibazel-out/msvc_x64-py3-opt/genfiles/external/protobuf/src /Iexternal/eigen_archive /Ibazel-out/msvc_x64-py3-opt/genfiles/external/eigen_archive /Iexternal/gif_archive/lib /Ibazel-out/msvc_x64-py3-opt/genfiles/external/gif_archive/lib /Iexternal/gif_archive/windows /Ibazel-out/msvc_x64-py3-opt/genfiles/external/gif_archive/windows /Iexternal/farmhash_archive/src /Ibazel-out/msvc_x64-py3-opt/genfiles/external/farmhash_archive/src /Iexternal/png_archive /Ibazel-out/msvc_x64-py3-opt/genfiles/external/png_archive /Iexternal/zlib_archive /Ibazel-out/msvc_x64-py3-opt/genfiles/external/zlib_archive /Iexternal/local_config_cuda/cuda /Ibazel-out/msvc_x64-py3-opt/genfiles/external/local_config_cuda/cuda /Iexternal/local_config_cuda/cuda/cuda/include /Ibazel-out/msvc_x64-py3-opt/genfiles/external/local_config_cuda/cuda/cuda/include /showIncludes /DEIGEN_MPL2_ONLY /DSNAPPY /MT /O2 /c tensorflow/stream_executor/cuda/cuda_gpu_executor.cc /Fobazel-out/msvc_x64-py3-opt/bin/tensorflow/stream_executor/_objs/cuda_platform/tensorflow/stream_executor/cuda/cuda_gpu_executor.o.
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(274): error C2589: 'constant': illegal token on right side of '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(274): error C2059: syntax error: '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(289): error C2589: 'constant': illegal token on right side of '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(289): error C2059: syntax error: '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(372): error C2589: 'constant': illegal token on right side of '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(372): error C2059: syntax error: '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(620): error C2589: 'constant': illegal token on right side of '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(620): error C2059: syntax error: '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(639): error C2589: 'constant': illegal token on right side of '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(639): error C2059: syntax error: '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(666): error C2589: 'constant': illegal token on right side of '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(666): error C2059: syntax error: '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(680): error C2589: 'constant': illegal token on right side of '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(680): error C2059: syntax error: '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(694): error C2589: 'constant': illegal token on right side of '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(694): error C2059: syntax error: '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(708): error C2589: 'constant': illegal token on right side of '::'
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc(708): error C2059: syntax error: '::'
cl : Command line warning D9002 : ignoring unknown option '-march=native'
cl : Command line warning D9002 : ignoring unknown option '-march=native'
____Building complete.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
____Elapsed time: 216.281s, Critical Path: 141.66s
If you try to compile master revision then compilation even won’t start with the error:
ERROR: C:/tensorflow/tensorflow/core/kernels/BUILD:1932:1: C++ compilation of rule '//tensorflow/core/kernels:resize_bilinear_op_gpu' failed (Exit 2).
.\tensorflow/core/util/cuda_kernel_helper.h(359): error C3861: 'atomicAdd': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(360): error C3861: 'atomicAdd': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(361): error C3861: 'atomicAdd': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(362): error C3861: 'atomicAdd': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(365): error C3861: 'atomicMax': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(366): error C3861: 'atomicMax': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(378): error C3861: 'max': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(378): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(394): error C3861: '__longlong_as_double': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(394): error C3861: '__double_as_longlong': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(393): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(399): error C3861: '__longlong_as_double': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(445): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(462): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(498): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(507): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(516): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(527): error C3861: '__int_as_float': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(527): error C3861: '__float_as_int': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(526): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(529): error C3861: '__int_as_float': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(538): error C3861: '__longlong_as_double': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(538): error C3861: '__double_as_longlong': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(537): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(540): error C3861: '__longlong_as_double': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(548): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(557): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(566): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(577): error C3861: '__int_as_float': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(577): error C3861: '__float_as_int': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(576): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(579): error C3861: '__int_as_float': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(588): error C3861: '__longlong_as_double': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(588): error C3861: '__double_as_longlong': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(587): error C3861: 'atomicCAS': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(590): error C3861: '__longlong_as_double': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(617): error C2065: 'warpSize': undeclared identifier
.\tensorflow/core/util/cuda_kernel_helper.h(619): error C2059: syntax error: 'volatile'
.\tensorflow/core/util/cuda_kernel_helper.h(620): error C3861: '__shfl': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(621): error C3861: '__shfl': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(622): error C2059: syntax error: 'volatile'
.\tensorflow/core/util/cuda_kernel_helper.h(637): error C2065: 'warpSize': undeclared identifier
.\tensorflow/core/util/cuda_kernel_helper.h(639): error C2059: syntax error: 'volatile'
.\tensorflow/core/util/cuda_kernel_helper.h(640): error C3861: '__shfl_up': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(641): error C3861: '__shfl_up': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(642): error C2059: syntax error: 'volatile'
.\tensorflow/core/util/cuda_kernel_helper.h(657): error C2065: 'warpSize': undeclared identifier
.\tensorflow/core/util/cuda_kernel_helper.h(659): error C2059: syntax error: 'volatile'
.\tensorflow/core/util/cuda_kernel_helper.h(660): error C3861: '__shfl_down': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(661): error C3861: '__shfl_down': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(662): error C2059: syntax error: 'volatile'
.\tensorflow/core/util/cuda_kernel_helper.h(677): error C2065: 'warpSize': undeclared identifier
.\tensorflow/core/util/cuda_kernel_helper.h(679): error C2059: syntax error: 'volatile'
.\tensorflow/core/util/cuda_kernel_helper.h(680): error C3861: '__shfl_xor': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(681): error C3861: '__shfl_xor': identifier not found
.\tensorflow/core/util/cuda_kernel_helper.h(682): error C2059: syntax error: 'volatile'
cl : Command line warning D9002 : ignoring unknown option '-march=native'
cl : Command line warning D9002 : ignoring unknown option '-march=native'
cl : Command line warning D9002 : ignoring unknown option '-x'
cl : Command line warning D9002 : ignoring unknown option '-nvcc_options=relaxed-constexpr'
cl : Command line warning D9002 : ignoring unknown option '-nvcc_options=ftz=true'
cl : Command line warning D9024 : unrecognized source file type 'cuda', object file assumed
cl : Command line warning D9027 : source file 'cuda' ignored
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
____Elapsed time: 3817.327s, Critical Path: 143.61s
I’ll be glad to help to fix the issues. But I absolutely has no idea what’s going on here. Can anybody help to fix Windows compilation please? Currently here is no build for Windows with AVX, AVX2 support in the whole world!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 44 (17 by maintainers)
Hi @zyavrik ,
Please set USE_MSVC_WRAPPER=1
e.g.
Just FYI, I’ve successfully compile v1.3 with CMake + Visual Studio 2015 + CUDA 8 + CUDNN 6.1 on Windows 10. Had to include various hacks to fix several compilation error related to Eigen and CUDA though 😒 But at least it works now 😄 Feel free to ask me about issues you run into if you are compiling with similar set up.
I follow this post to get started, but it doesn’t show how to fix the errors I got. https://joe-antognini.github.io/machine-learning/build-windows-tf This post is also very helpful for the next step if you want to build a standalone application: https://joe-antognini.github.io/machine-learning/windows-tf-project
For anyone stumbling on this while googling
ignoring unknown option '-march=native', the issue is becausemarch=nativeis agccflag. I’ve got my TF+GPU 1.14 to build in Windows by using/arch:AVX2. See MSVC docs@snnn I think you would be interested in https://github.com/meteorcloudy/tensorflow/commits/fix_contrib_with_cc_import
I can now use Bazel@HEAD to build tensorflow on Windows with
//tensorflow/contrib/...enabled.The fix requires a new rule,
cc_import, that will come out with Bazel 0.10.0, so I’ll send to PR to fix tensorflow/contrib/… after 0.10,0 is released.@gunan, could you look at what could be done to streamline/fix this to work out of the box?
The only one reason to compile it is to enable AVX, AVX2 support…
It’s one of the external dependencies. Try to find nsync under
cmake\build\externaland also thecmake\build\nsync. You should be able to find compiled.libfiles and header files. Link them to the library you were trying to compile.I fixed this error in https://github.com/phg1024/tensorflow/commit/291f29533a510797f64e1f646b38aeea62238389
You need to explicitly instantiate it
Then you can just compile this very file in Visual studio and see if you get other errors. If not, go ahead and do the linking stage only.
I incorrectly merged your changes to the repository. The same files were changed recently. Thanks for your help!
Can anybody create pull request for those fixes?
@zyavrik These are the changes I can find in the code: https://github.com/phg1024/tensorflow/commit/291f29533a510797f64e1f646b38aeea62238389
There are also some configuration changes about the VS project settings to resolve undefined symbols in the linking stage. You can follow take a look at https://joe-antognini.github.io/machine-learning/windows-tf-project to get some sense about how to resolve those.