无法在Intel i7 930 CPU上从源代码编译TensorFlow;GTS-250 GPU



我是TF的新手,想从源代码进行编译,因为我的桌面没有支持AVX指令的CPU或GPU。我的系统有一个Intel i7 930处理器(来自nehalem家族的Bloomfield(和一个Nvidea GTS-250 CPU。是的,我知道,两个人的牙齿都长了。

以下是我在此过程中失败的完整堆栈。我遵循以下网页的指示。

https://www.tensorflow.org/install/source_windows

我继续编译,最后看到了以下错误。。。

H:PythonTensorFlowCompiletensorflow>python ./configure.py
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.29.1 installed.
Please specify the location of python. [Default is C:UsersZeekAppDataLocalProgramsPythonPython37python.exe]:

Found possible Python library paths:
C:UsersZeekAppDataLocalProgramsPythonPython37libsite-packages
Please input the desired Python library path to use.  Default is [C:UsersZeekAppDataLocalProgramsPythonPython37libsite-packages]
Do you wish to build TensorFlow with XLA JIT support? [y/N]: N
No XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with ROCm support? [y/N]: N
No ROCm support will be enabled for TensorFlow.
Do you wish to build TensorFlow with CUDA support? [y/N]: N
No CUDA support will be enabled for TensorFlow.
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is /arch:AVX]: --config=v2 -march=nehalem

Would you like to override eigen strong inline for some C++ compilation to reduce the compilation time? [Y/n]: Y
Eigen strong inline overridden.
Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See .bazelrc for more details.
--config=mkl            # Build with MKL support.
--config=monolithic     # Config for mostly static monolithic build.
--config=ngraph         # Build with Intel nGraph support.
--config=numa           # Build with NUMA support.
--config=dynamic_kernels        # (Experimental) Build kernels into separate shared objects.
--config=v2             # Build TensorFlow 2.x instead of 1.x.
Preconfigured Bazel build configs to DISABLE default on features:
--config=noaws          # Disable AWS S3 filesystem support.
--config=nogcp          # Disable GCP support.
--config=nohdfs         # Disable HDFS support.
--config=nonccl         # Disable NVIDIA NCCL support.
H:PythonTensorFlowCompiletensorflow>bazel build //tensorflow/tools/pip_package:build_pip_package
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
Inherited 'common' options: --isatty=0 --terminal_columns=269
INFO: Options provided by the client:
'build' options: --python_path=C:/Users/Zeek/AppData/Local/Programs/Python/Python37/python.exe
INFO: Reading rc options for 'build' from h:pythontensorflowcompiletensorflow.bazelrc:
'build' options: --apple_platform_type=macos --define framework_shared_object=true --define open_source_build=true --java_toolchain=//third_party/toolchains/java:tf_java_toolchain --host_java_toolchain=//third_party/toolchains/java:tf_java_toolchain --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone --strategy=Genrule=standalone -c opt --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --announce_rc --define=grpc_no_ares=true --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --config=v2
INFO: Reading rc options for 'build' from h:pythontensorflowcompiletensorflow.tf_configure.bazelrc:
'build' options: --action_env PYTHON_BIN_PATH=C:/Users/Zeek/AppData/Local/Programs/Python/Python37/python.exe --action_env PYTHON_LIB_PATH=C:/Users/Zeek/AppData/Local/Programs/Python/Python37/lib/site-packages --python_path=C:/Users/Zeek/AppData/Local/Programs/Python/Python37/python.exe --config monolithic --copt=-w --host_copt=-w --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --verbose_failures --distinct_host_configuration=false --define=override_eigen_strong_inline=true --action_env TF_CONFIGURE_IOS=0
INFO: Found applicable config definition build:v2 in file h:pythontensorflowcompiletensorflow.bazelrc: --define=tf_api_version=2
INFO: Found applicable config definition build:monolithic in file h:pythontensorflowcompiletensorflow.bazelrc: --define framework_shared_object=false
INFO: Found applicable config definition build:monolithic in file h:pythontensorflowcompiletensorflow.bazelrc: --define framework_shared_object=false
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (1 packages loaded, 0 targets configured)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (6 packages loaded, 18 targets configured)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (6 packages loaded, 18 targets configured)
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (6 packages loaded, 18 targets configured)
INFO: Call stack for the definition of repository 'com_google_protobuf' which is a tf_http_archive (rule definition at H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl:121:19):
- H:/python/tensorflowcompile/tensorflow/tensorflow/workspace.bzl:434:5
- H:/python/tensorflowcompile/tensorflow/WORKSPACE:19:1
Analyzing: target //tensorflow/tools/pip_package:build_pip_package (6 packages loaded, 18 targets configured)
INFO: Repository 'com_google_protobuf' used the following cache hits instead of downloading the corresponding file.
* Hash 'b9e92f9af8819bbbc514e2902aec860415b70209f31dfc8c4fa72515a5df9d59' for https://storage.googleapis.com/mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/310ba5ee72661c081129eb878c1bbcec936b20f0.tar.gz
If the definition of 'com_google_protobuf' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'com_google_protobuf':
Traceback (most recent call last):
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 101
_apply_patch(ctx, ctx.attr.patch_file)
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 68, in _apply_patch
_execute_and_check_ret_code(ctx, cmd)
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 52, in _execute_and_check_ret_code
fail("Non-zero return code({1}) when ...))
Non-zero return code(127) when executing 'C:msys64usrbinbash.exe -l -c "patch" "-p1" "-d" "C:/users/Zeek/_bazel_Zeek/hfhzrtpt/external/com_google_protobuf" "-i" "H:/python/tensorflowcompile/tensorflow/third_party/protobuf/protobuf.patch"':
Stdout:
Stderr: /usr/bin/bash: patch: command not found
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: no such package '@com_google_protobuf//': Traceback (most recent call last):
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 101
_apply_patch(ctx, ctx.attr.patch_file)
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 68, in _apply_patch
_execute_and_check_ret_code(ctx, cmd)
File "H:/python/tensorflowcompile/tensorflow/third_party/repo.bzl", line 52, in _execute_and_check_ret_code
fail("Non-zero return code({1}) when ...))
Non-zero return code(127) when executing 'C:msys64usrbinbash.exe -l -c "patch" "-p1" "-d" "C:/users/Zeek/_bazel_Zeek/hfhzrtpt/external/com_google_protobuf" "-i" "H:/python/tensorflowcompile/tensorflow/third_party/protobuf/protobuf.patch"':
Stdout:
Stderr: /usr/bin/bash: patch: command not found
INFO: Elapsed time: 19.298s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (6 packages loaded, 18 targets configured)
FAILED: Build did NOT complete successfully (6 packages loaded, 18 targets configured)

在编译之前,我运行了一个更新版本的bazel,并出现了以下错误,这就是为什么我恢复到0.29.1

H:PythonTensorFlowCompiletensorflow>python ./configure.py
Extracting Bazel installation...
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 1.0.1 installed.
Please downgrade your bazel installation to version 0.29.1 or lower to build TensorFlow! To downgrade: download the installer for the old version (from https://github.com/bazelbuild/bazel/releases) then run the installer.

任何关于我哪里出了问题的想法,我在这方面还很陌生,所以这可能是一件很刺眼/很容易的事情。。。。[编辑]这似乎可以通过设置未安装的修补程序来解决:pacman-Suu补丁

**我更进一步,现在我在zip阶段失败了,如下所示。**

INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
[0 / 23] [Prepa] PythonZipper tensorflow/python/keras/api/create_tensorflow.python_api_1_keras_python_api_gen_compat_v1.zip ... (3 actions, 0 running)
ERROR: H:/python/tensorflowcompile/tensorflow/tensorflow/lite/python/BUILD:46:1: PythonZipper tensorflow/lite/python/tflite_convert.zip failed (Exit 255)
FATAL: MappedOutputFile(bazel-out/x64_windows-opt/bin/tensorflow/lite/python/tflite_convert.zip): CreateFileMapping failed
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 38.195s, Critical Path: 4.35s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

**然后,我试图回到python配置阶段,以确保我选择了v2和正确的CPU系列,但当我重新编译时,我看到另一个错误,它很快就失败了。**

java.lang.RuntimeException: Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:@local_config_cc' (requested by nodes 'REPOSITORY:@local_config_cc')
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:528)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:399)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.nio.file.InvalidPathException: Illegal char <> at index 60: C:/users/bill/_bazel_bill/hfhzrtpt/external/local_config_cc/*********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0
** Copyright (c) 2017 Microsoft Corporation
C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build/VCVARSALL.BAT
at java.base/sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at java.base/sun.nio.fs.WindowsPath.parse(Unknown Source)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
at java.base/java.nio.file.Path.of(Unknown Source)
at java.base/java.nio.file.Paths.get(Unknown Source)
at com.google.devtools.build.lib.vfs.JavaIoFileSystem.getNioPath(JavaIoFileSystem.java:84)
at com.google.devtools.build.lib.vfs.JavaIoFileSystem.exists(JavaIoFileSystem.java:119)
at com.google.devtools.build.lib.vfs.Path.exists(Path.java:356)
at com.google.devtools.build.lib.bazel.repository.skylark.SkylarkPath.exists(SkylarkPath.java:79)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.google.devtools.build.lib.syntax.MethodDescriptor.call(MethodDescriptor.java:135)
at com.google.devtools.build.lib.syntax.DotExpression.eval(DotExpression.java:126)
at com.google.devtools.build.lib.syntax.DotExpression.doEval(DotExpression.java:51)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.UnaryOperatorExpression.doEval(UnaryOperatorExpression.java:98)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execIf(Eval.java:139)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:214)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.syntax.FuncallExpression.callFunction(FuncallExpression.java:992)
at com.google.devtools.build.lib.syntax.FuncallExpression.doEval(FuncallExpression.java:904)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.UnaryOperatorExpression.doEval(UnaryOperatorExpression.java:98)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execIf(Eval.java:139)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:214)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.syntax.FuncallExpression.callFunction(FuncallExpression.java:992)
at com.google.devtools.build.lib.syntax.FuncallExpression.doEval(FuncallExpression.java:904)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execAssignment(Eval.java:72)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:192)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.Eval.execStatements(Eval.java:231)
at com.google.devtools.build.lib.syntax.Eval.execIf(Eval.java:144)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:214)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.syntax.FuncallExpression.callFunction(FuncallExpression.java:992)
at com.google.devtools.build.lib.syntax.FuncallExpression.doEval(FuncallExpression.java:904)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execAssignment(Eval.java:72)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:192)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.syntax.FuncallExpression.callFunction(FuncallExpression.java:992)
at com.google.devtools.build.lib.syntax.FuncallExpression.doEval(FuncallExpression.java:904)
at com.google.devtools.build.lib.syntax.Expression.eval(Expression.java:75)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:201)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.Eval.execStatements(Eval.java:231)
at com.google.devtools.build.lib.syntax.Eval.execIfBranch(Eval.java:83)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:198)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.Eval.execIf(Eval.java:140)
at com.google.devtools.build.lib.syntax.Eval.execDispatch(Eval.java:214)
at com.google.devtools.build.lib.syntax.Eval.exec(Eval.java:183)
at com.google.devtools.build.lib.syntax.UserDefinedFunction.call(UserDefinedFunction.java:91)
at com.google.devtools.build.lib.syntax.BaseFunction.callWithArgArray(BaseFunction.java:474)
at com.google.devtools.build.lib.syntax.BaseFunction.call(BaseFunction.java:436)
at com.google.devtools.build.lib.bazel.repository.skylark.SkylarkRepositoryFunction.fetch(SkylarkRepositoryFunction.java:173)
at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.fetchRepository(RepositoryDelegatorFunction.java:298)
at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.compute(RepositoryDelegatorFunction.java:225)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:451)
... 7 more
FAILED: Build did NOT complete successfully (231 packages loaded, 3779 targets configured)
WARNING: Waiting for server process to terminate (waited 5 seconds, waiting at most 60)
H:PythonTensorFlowCompiletensorflow>

对不起,伙计们,我不确定我在哪里或如何展示这个时候接近这个。。。有没有办法重新开始编译,有没有我错过的东西在pythonzip阶段失败了,我的bezal配置有没有问题。。。。

TensorFlow还不支持Bazel 1.x(它即将推出,但还没有完成(,所以在那之前你需要0.29.1。

  1. 将环境变量设置为指向VC目录,请参阅"安装和使用Bazel">"在Windows上安装">"疑难解答">"问题:Bazel找不到Visual Studio或Visual C++">
  2. 启动一个普通的cmd.exeshell,无需运行Visual Studio命令行
  3. 安装TensorFlow所需的Python模块:python -m pip install numpy keras_preprocessing
  4. 配置TensorFlow:python configure.py
  5. 构建pip模块:bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package

非常感谢大家的回复。我能够让TF按照上面列出的方式工作。我感觉CPU和GPU也升级了!

最新更新