在Windows 10上使用CMake构建TensorFlow时出现错误 [英] Errors when building TensorFlow with CMake on Windows 10

查看:363
本文介绍了在Windows 10上使用CMake构建TensorFlow时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows上 TensorFlow CMake构建 ,但我遇到了问题.

I am attempting a TensorFlow CMake build on Windows, but I'm running into problems.

首先,我奔跑

C:\work\tensorflow\tensorflow\contrib\cmake\build>cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release ^
More? -DSWIG_EXECUTABLE=C:/Program1/swigwin-3.0.12/swig.exe ^
More? -DPYTHON_EXECUTABLE=C:/Python3.5/python.exe ^
More? -DPYTHON_LIBRARIES=C:/Python3.5/libs/python35.lib ^
More? -Dtensorflow_ENABLE_GPU=ON ^
More? -DCUDNN_HOME="C:\Program1\cudnn\cuda"

并获取输出

-- Building for: Visual Studio 14 2015
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED
-- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0 (found suitable version "8.0", minimum required is "8.0")
-- Found PythonInterp: C:/Python3.5/python.exe (found version "3.5")
-- Found PythonLibs: C:/Python3.5/libs/python35.lib (found version "3.5.0")
-- Found SWIG: C:/Program1/swigwin-3.0.12/swig.exe (found version "3.0.12")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/work/tensorflow/tensorflow/contrib/cmake/build

这里唯一令人困扰的行是-- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed,我真的不知道这意味着什么,或者这是否是一个严重的问题. (是吗?)

The only troubling line here is -- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed, which I don't really know what it means or whether it's a serious problem. (Is it?)

第二,我跑

MSBuild /p:Configuration=Release tf_tutorials_example_trainer.vcxproj

这给了我几个错误:

"C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_tutorials_example_trainer.vcxproj" (default target) (1) ->
"C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_gpu_kernels.vcxproj" (default target) (90) ->
(CustomBuild target) ->
  C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_gpu_kernels.vcxproj]


"C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_tutorials_example_trainer.vcxproj" (default target) (1) ->
"C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_kernels.vcxproj" (default target) (91) ->
(ClCompile target) ->
  c:\work\tensorflow\tensorflow\core\kernels\cuda_solvers.h(24): fatal error C1083: Cannot open include file: 'cuda/include/cusolverDn.h': No such file or directory (compiling source file C:\work\tensorflow\tensorflow\core\kernels\cholesky_op.cc) [C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_kernels.vcxproj]
  c:\work\tensorflow\tensorflow\core\kernels\cuda_solvers.h(24): fatal error C1083: Cannot open include file: 'cuda/include/cusolverDn.h': No such file or directory (compiling source file C:\work\tensorflow\tensorflow\core\kernels\cuda_solvers.cc) [C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_kernels.vcxproj]
  c:\work\tensorflow\tensorflow\contrib\cmake\build\external\eigen_archive\eigen\src\core\coreevaluators.h(1052): fatal error C1060: compiler is out of heap space (compiling source file C:\work\tensorflow\tensorflow\core\kernels\svd_op_float.cc) [C:\work\tensorflow\tensorflow\contrib\cmake\build\tf_core_kernels.vcxproj]

    696 Warning(s)
    4 Error(s)

我不知道MSBuild在哪个文件夹中寻找cuda/include/cusolverDn.h.我在c:\work\tensorflow\tensorflow\core\kernels中没有任何名为cuda的文件夹,并且tensorflow存储库中的任何位置都不存在名为cusolverDn.h的文件. (不过,我的CUDA安装目录中确实有文件cusolverDn.h.)因此,

I don't know relative to which folder MSBuild is looking for cuda/include/cusolverDn.h. I don't have any folder called cuda in c:\work\tensorflow\tensorflow\core\kernels, and no file named cusolverDn.h exists anywhere in the tensorflow repository. (I do have the file cusolverDn.h in my CUDA install directory, though.) So,

如何使MSBuild查找cusolverDn.h?以及如何防止编译器用完堆空间?

What can I do to make MSBuild find cusolverDn.h? And what can I do to prevent the compiler from running out of heap space?

在先前尝试运行最后一条命令的过程中,我还收到了消息

In a previous attempt to run the last command I also received the message

nvcc fatal   : Microsoft Visual Studio configuration file 'vcvars64.bat' could not be found for installation at 'C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/../..'

有人建议重新命名文件夹和该文件夹中的文件.我暂时还不能真正验证这种方法是否可行,因为该问题似乎暂时已经消失(也许被编译器空间不足"问题掩盖了,这是我以前没有的...).

Some recommend renaming a folder and a file in that folder. I can't really verify that this works right now since the problem temporarily seems to have disappeared (maybe masked by the "compiler is out of heap space" problem, which I didn't have before...).

是否正在重命名此文件和此文件夹的正确解决方案?

推荐答案

按照

  • 您必须为Visual Studio运行启用了64位的命令提示符;您应该在这样的提示符下运行msbuild.exe命令;
  • 安装CUDNN的Nvidia zio文件并将其/bin/目录附加到您的PATH环境变量中,它应包含两个类似于以下内容的条目:
    • D:\ Program Files \ NVIDIA GPU计算工具包\ CUDA \ v8.0 \ bin
    • D:\ YOURCUDNNPATH \ cuda \ bin
    • you must be running a 64 bit enabled Command Prompt for Visual Studio; you should run your msbuild.exe commands from such a prompt;
    • install CUDNN's Nvidia zio file and append its /bin/ directory to your PATH environment variable, it should contains two entries similar to the following:
      • D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
      • D:\YOURCUDNNPATH\cuda\bin

      这篇关于在Windows 10上使用CMake构建TensorFlow时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆