为 Windows 构建具有 AVX 支持的 Tensorflow C/C++ API(>2.1.15)?

问题描述 投票:0回答:1

我正在尝试构建具有 AVX 支持的 2.1.15 版本的 Tensorflow C API。我选择该版本是因为,截至本文发布之日,Tensorflow C API 安装页面 上的 C API 预构建二进制文件具有该版本,并且我能够使用这些二进制文件构建我的 Visual Studio 2022 项目。但是,我在为 Tensorflow C API 构建共享和/或静态库时遇到了麻烦。

我已查看并遵循此Tensorflow GitHub页面Tensorflow官方网站上给出的说明,但我没有取得任何进展。同样,我尝试实现类似问题中的答案,例如如何为tensorflow构建c库。所以,我的问题是,是否有为启用 AVX 指令的 Tensorflow 2.1.15 构建 C API 二进制文件的指南,或者这是否可以在 Windows 上执行?

这是我得到的输出 如何构建张量流的 C 库

PS C:\Users\ekine\Desktop\tensorflow> git checkout v2.15.0
Updating files: 100% (19221/19221), done.
Note: switching to 'v2.15.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 6887368d6d4 Merge pull request #62369 from tensorflow/r2.15-ea45e14c926
PS C:\Users\ekine\Desktop\tensorflow> bazelisk --version
bazel 6.1.0
PS C:\Users\ekine\Desktop\tensorflow> python .\configure.py
You have bazel 6.1.0 installed.
Please specify the location of python. [Default is C:\Users\ekine\AppData\Local\Programs\Python\Python310\python.exe]:


Found possible Python library paths:
  C:\Users\ekine\AppData\Local\Programs\Python\Python310\lib\site-packages
Please input the desired Python library path to use.  Default is [C:\Users\ekine\AppData\Local\Programs\Python\Python310\lib\site-packages]

Do you wish to build TensorFlow with ROCm support? [y/N]: N
No ROCm support will be enabled for TensorFlow.


WARNING: Cannot build with CUDA support on Windows.
Starting in TF 2.11, CUDA build is not supported for Windows. For using TensorFlow GPU on Windows, you will need to build/install TensorFlow in WSL2.

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is /arch:AVX]: /AVX2


Would you like to override eigen strong inline for some C++ compilation to reduce the compilation time? [Y/n]: n
Not overriding eigen strong inline, some compilations could take more than 20 mins.

Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: N
Not configuring the WORKSPACE for Android builds.

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=mkl_aarch64    # Build with oneDNN and Compute Library for the Arm Architecture (ACL).
        --config=monolithic     # Config for mostly static monolithic build.
        --config=numa           # Build with NUMA support.
        --config=dynamic_kernels        # (Experimental) Build kernels into separate shared objects.
        --config=v1             # Build with TensorFlow 1 API instead of TF 2 API.
Preconfigured Bazel build configs to DISABLE default on features:
        --config=nogcp          # Disable GCP support.
        --config=nonccl         # Disable NVIDIA NCCL support.
PS C:\Users\ekine\Desktop\tensorflow> type .\.tf_configure.bazelrc
build --action_env PYTHON_BIN_PATH="C:/Users/ekine/AppData/Local/Programs/Python/Python310/python.exe"
build --action_env PYTHON_LIB_PATH="C:/Users/ekine/AppData/Local/Programs/Python/Python310/lib/site-packages"
build --python_path="C:/Users/ekine/AppData/Local/Programs/Python/Python310/python.exe"
build:opt --copt=/AVX2
build:opt --host_copt=/AVX2
build --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions
test --test_size_filters=small,medium
test:v1 --test_tag_filters=-benchmark-test,-no_oss,-oss_excluded,-no_windows,-windows_excluded,-gpu,-oss_serial
test:v1 --build_tag_filters=-benchmark-test,-no_oss,-oss_excluded,-no_windows,-windows_excluded,-gpu
test:v2 --test_tag_filters=-benchmark-test,-no_oss,-oss_excluded,-no_windows,-windows_excluded,-gpu,-oss_serial,-v1only
test:v2 --build_tag_filters=-benchmark-test,-no_oss,-oss_excluded,-no_windows,-windows_excluded,-gpu,-v1only
PS C:\Users\ekine\Desktop\tensorflow> bazelisk build --config opt //tensorflow/tools/lib_package:libtensorflow
Starting local Bazel server and connecting to it...
INFO: Reading 'startup' options from c:\users\ekine\desktop\tensorflow\.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=120
INFO: Reading rc options for 'build' from c:\users\ekine\desktop\tensorflow\.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Options provided by the client:
  'build' options: --python_path=C:/Users/ekine/AppData/Local/Programs/Python/Python310/python.exe
INFO: Reading rc options for 'build' from c:\users\ekine\desktop\tensorflow\.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --features=-force_no_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from c:\users\ekine\desktop\tensorflow\.tf_config  ure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=C:/Users/ekine/AppData/Local/Programs/Python/Python310/python.exe --action_env PYTHON_LIB_PATH=C:/Users/ekine/AppData/Local/Programs/Python/Python310/lib/site-packages --python_path=C:/Users/ekine/AppData/Local/Programs/Python/Python310/python.exe --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions
INFO: Found applicable config definition build:short_logs in file c:\users\ekine\desktop\tensorflow\.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file c:\users\ekine\desktop\tensorflow\.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:opt in file c:\users\ekine\desktop\tensorflow\.tf_configure.bazelrc: --copt=/AVX2 --host_copt=/AVX2
INFO: Found applicable config definition build:windows in file c:\users\ekine\desktop\tensorflow\.bazelrc: --copt=/W0 --host_copt=/W0 --copt=/Zc:__cplusplus --host_copt=/Zc:__cplusplus --copt=/D_USE_MATH_DEFINES --host_copt=/D_USE_MATH_DEFINES --features=compiler_param_file --features=archive_param_file --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --enable_runfiles --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --config=monolithic --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --copt=/Zc:preprocessor --host_copt=/Zc:preprocessor --linkopt=/DEBUG --host_linkopt=/DEBUG --linkopt=/OPT:REF --host_linkopt=/OPT:REF --linkopt=/OPT:ICF --host_linkopt=/OPT:ICF --verbose_failures --features=compiler_param_file --config=no_tfrt
INFO: Found applicable config definition build:monolithic in file c:\users\ekine\desktop\tensorflow\.bazelrc: --define framework_shared_object=false --define tsl_protobuf_header_only=false --experimental_link_static_libraries_once=false
INFO: Found applicable config definition build:no_tfrt in file c:\users\ekine\desktop\tensorflow\.bazelrc: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/ir,tensorflow/compiler/mlir/tfrt/ir/mlrt,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/mlrt,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/compiler/mlir/tfrt/transforms/mlrt,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/runtime_fallback/test,tensorflow/core/runtime_fallback/test/gpu,tensorflow/core/runtime_fallback/test/saved_model,tensorflow/core/runtime_fallback/test/testdata,tensorflow/core/tfrt/stubs,tensorflow/core/tfrt/tfrt_session,tensorflow/core/tfrt/mlrt,tensorflow/core/tfrt/mlrt/attribute,tensorflow/core/tfrt/mlrt/kernel,tensorflow/core/tfrt/mlrt/bytecode,tensorflow/core/tfrt/mlrt/interpreter,tensorflow/compiler/mlir/tfrt/translate/mlrt,tensorflow/compiler/mlir/tfrt/translate/mlrt/testdata,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils,tensorflow/core/tfrt/utils/debug,tensorflow/core/tfrt/saved_model/python,tensorflow/core/tfrt/graph_executor/python,tensorflow/core/tfrt/saved_model/utils
DEBUG: C:/users/ekine/desktop/tensorflow/tensorflow/tools/toolchains/python/python_repo.bzl:21:14:
TF_PYTHON_VERSION variable was not set correctly, using default version. 3.10 Python
will be used.

To set Python version, run
export TF_PYTHON_VERSION=3.9
INFO: Repository python_x86_64-pc-windows-msvc instantiated at:
  C:/users/ekine/desktop/tensorflow/WORKSPACE:36:27: in <toplevel>
  C:/users/ekine/_bazel_cagdas/bktrqpw2/external/rules_python/python/repositories.bzl:580:26: in python_register_toolchains
Repository rule python_repository defined at:
  C:/users/ekine/_bazel_cagdas/bktrqpw2/external/rules_python/python/repositories.bzl:404:36: in <toplevel>
INFO: repository @python_x86_64-pc-windows-msvc' used the following cache hits instead of downloading the corresponding file.
 * Hash 'b8d930ce0d04bda83037ad3653d7450f8907c88e24bb8255a29b8dab8930d6f1' for https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.10.13+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz
If the definition of 'repository @python_x86_64-pc-windows-msvc' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'python_x86_64-pc-windows-msvc':
   Traceback (most recent call last):
        File "C:/users/ekine/_bazel_cagdas/bktrqpw2/external/rules_python/python/repositories.bzl", line 377, column 17, in _python_repository_impl
                rctx.symlink(python_bin, "python")
Error in symlink: java.io.IOException: Could not create symlink from C:/users/ekine/_bazel_cagdas/bktrqpw2/external/python_x86_64-pc-windows-msvc/python.exe to C:/users/ekine/_bazel_cagdas/bktrqpw2/external/python_x86_64-pc-windows-msvc/python: Cannot create symlink (name=C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python, target=C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python.exe): ERROR: src/main/native/windows/file-jni.cc(117): nativeCreateSymlink(\\?\C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python, \\?\C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python.exe): ERROR: src/main/native/windows/file.cc(474): CreateSymlink(\\?\C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python.exe): createSymbolicLinkW failed (permission denied). Either Windows developer mode or admin privileges are required.
ERROR: C:/users/ekine/desktop/tensorflow/WORKSPACE:36:27: fetching python_repository rule //external:python_x86_64-pc-windows-msvc: Traceback (most recent call last):
        File "C:/users/ekine/_bazel_cagdas/bktrqpw2/external/rules_python/python/repositories.bzl", line 377, column 17, in _python_repository_impl
                rctx.symlink(python_bin, "python")
Error in symlink: java.io.IOException: Could not create symlink from C:/users/ekine/_bazel_cagdas/bktrqpw2/external/python_x86_64-pc-windows-msvc/python.exe to C:/users/ekine/_bazel_cagdas/bktrqpw2/external/python_x86_64-pc-windows-msvc/python: Cannot create symlink (name=C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python, target=C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python.exe): ERROR: src/main/native/windows/file-jni.cc(117): nativeCreateSymlink(\\?\C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python, \\?\C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python.exe): ERROR: src/main/native/windows/file.cc(474): CreateSymlink(\\?\C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python.exe): createSymbolicLinkW failed (permission denied). Either Windows developer mode or admin privileges are required.
ERROR: Error computing the main repository mapping: Encountered error while reading extension file 'requirements.bzl': no such package '@pypi//': no such package '@python_x86_64-pc-windows-msvc//': java.io.IOException: Could not create symlink from C:/users/ekine/_bazel_cagdas/bktrqpw2/external/python_x86_64-pc-windows-msvc/python.exe to C:/users/ekine/_bazel_cagdas/bktrqpw2/external/python_x86_64-pc-windows-msvc/python: Cannot create symlink (name=C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python, target=C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python.exe): ERROR: src/main/native/windows/file-jni.cc(117): nativeCreateSymlink(\\?\C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python, \\?\C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python.exe): ERROR: src/main/native/windows/file.cc(474): CreateSymlink(\\?\C:\users\ekine\_bazel_cagdas\bktrqpw2\external\python_x86_64-pc-windows-msvc\python.exe): createSymbolicLinkW failed (permission denied). Either Windows developer mode or admin privileges are required.
Loading:
    Fetching repository @pypi; Restarting. 5s

我在计算机上启用了开发人员模式并再次运行构建命令(重新启动后):

PS C:\Users\ekine\Desktop\tensorflow> bazelisk build --config opt //tensorflow/tools/lib_package:libtensorflow
Starting local Bazel server and connecting to it...
INFO: Reading 'startup' options from c:\users\ekine\desktop\tensorflow\.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=120
INFO: Reading rc options for 'build' from c:\users\ekine\desktop\tensorflow\.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Options provided by the client:
  'build' options: --python_path=C:/Users/ekine/AppData/Local/Programs/Python/Python310/python.exe
INFO: Reading rc options for 'build' from c:\users\ekine\desktop\tensorflow\.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --features=-force_no_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from c:\users\ekine\desktop\tensorflow\.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=C:/Users/ekine/AppData/Local/Programs/Python/Python310/python.exe --action_env PYTHON_LIB_PATH=C:/Users/ekine/AppData/Local/Programs/Python/Python310/lib/site-packages --python_path=C:/Users/ekine/AppData/Local/Programs/Python/Python310/python.exe --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions
INFO: Found applicable config definition build:short_logs in file c:\users\ekine\desktop\tensorflow\.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file c:\users\ekine\desktop\tensorflow\.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:opt in file c:\users\ekine\desktop\tensorflow\.tf_configure.bazelrc: --copt=/AVX2 --host_copt=/AVX2
INFO: Found applicable config definition build:windows in file c:\users\ekine\desktop\tensorflow\.bazelrc: --copt=/W0 --host_copt=/W0 --copt=/Zc:__cplusplus --host_copt=/Zc:__cplusplus --copt=/D_USE_MATH_DEFINES --host_copt=/D_USE_MATH_DEFINES --features=compiler_param_file --features=archive_param_file --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --enable_runfiles --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --config=monolithic --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --copt=/Zc:preprocessor --host_copt=/Zc:preprocessor --linkopt=/DEBUG --host_linkopt=/DEBUG --linkopt=/OPT:REF --host_linkopt=/OPT:REF --linkopt=/OPT:ICF --host_linkopt=/OPT:ICF --verbose_failures --features=compiler_param_file --config=no_tfrt
INFO: Found applicable config definition build:monolithic in file c:\users\ekine\desktop\tensorflow\.bazelrc: --define framework_shared_object=false --define tsl_protobuf_header_only=false --experimental_link_static_libraries_once=false
INFO: Found applicable config definition build:no_tfrt in file c:\users\ekine\desktop\tensorflow\.bazelrc: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/ir,tensorflow/compiler/mlir/tfrt/ir/mlrt,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/mlrt,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/compiler/mlir/tfrt/transforms/mlrt,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/runtime_fallback/test,tensorflow/core/runtime_fallback/test/gpu,tensorflow/core/runtime_fallback/test/saved_model,tensorflow/core/runtime_fallback/test/testdata,tensorflow/core/tfrt/stubs,tensorflow/core/tfrt/tfrt_session,tensorflow/core/tfrt/mlrt,tensorflow/core/tfrt/mlrt/attribute,tensorflow/core/tfrt/mlrt/kernel,tensorflow/core/tfrt/mlrt/bytecode,tensorflow/core/tfrt/mlrt/interpreter,tensorflow/compiler/mlir/tfrt/translate/mlrt,tensorflow/compiler/mlir/tfrt/translate/mlrt/testdata,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils,tensorflow/core/tfrt/utils/debug,tensorflow/core/tfrt/saved_model/python,tensorflow/core/tfrt/graph_executor/python,tensorflow/core/tfrt/saved_model/utils
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:639:16: In rule 'c_api_test_cpu', size 'medium' is not a valid size.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:639:16: In rule 'c_api_test_cpu', timeout 'illegal' is not a valid timeout.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:639:16: In rule 'c_api_test_gpu', size 'medium' is not a valid size.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:639:16: In rule 'c_api_test_gpu', timeout 'illegal' is not a valid timeout.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:696:16: In rule 'c_api_remote_test_cpu', size 'medium' is not a valid size.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:696:16: In rule 'c_api_remote_test_cpu', timeout 'illegal' is not a valid timeout.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:696:16: In rule 'c_api_remote_test_gpu', size 'medium' is not a valid size.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:696:16: In rule 'c_api_remote_test_gpu', timeout 'illegal' is not a valid timeout.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:728:16: In rule 'c_api_remote_function_test_cpu', size 'medium' is not a valid size.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:728:16: In rule 'c_api_remote_function_test_cpu', timeout 'illegal' is not a valid timeout.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:728:16: In rule 'c_api_remote_function_test_gpu', size 'medium' is not a valid size.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:728:16: In rule 'c_api_remote_function_test_gpu', timeout 'illegal' is not a valid timeout.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:779:16: In rule 'c_api_cluster_test_cpu', size 'medium' is not a valid size.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:779:16: In rule 'c_api_cluster_test_cpu', timeout 'illegal' is not a valid timeout.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:779:16: In rule 'c_api_cluster_test_gpu', size 'medium' is not a valid size.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:779:16: In rule 'c_api_cluster_test_gpu', timeout 'illegal' is not a valid timeout.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:1034:11: In rule 'custom_device_test', size 'medium' is not a valid size.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/c/eager/BUILD:1034:11: In rule 'custom_device_test', timeout 'illegal' is not a valid timeout.
ERROR: C:/users/ekine/desktop/tensorflow/tensorflow/tools/lib_package/BUILD:84:8: Target '//tensorflow/c/eager:headers' contains an error and its package is in error and referenced by '//tensorflow/tools/lib_package:eager_cheaders'
ERROR: Analysis of target '//tensorflow/tools/lib_package:libtensorflow' failed; build aborted:
INFO: Elapsed time: 197.783s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (17 packages loaded, 31 targets configured)
    currently loading: tensorflow
    Fetching repository @local_config_cc_toolchains; Restarting.
    Fetching repository @local_execution_config_python; starting
c++ c tensorflow build bazel
1个回答
0
投票

使用 AVX 在 Windows 上构建 TensorFlow C/C++ API 的解决方案

1.启用开发者模式

  • 转到 设置更新和安全开发人员
  • 启用开发者模式以避免使用 Bazel 时出现符号链接问题。

2.配置 Bazel 标志

  • 使用这些标志进行 AVX 优化:
    bazel build --config=opt --copt=/arch:AVX //tensorflow:libtensorflow_cc.so
    
    

3. CUDA 和 TensorFlow 兼容性

  • 确保您的 CUDA 工具包和 cuDNN 版本与您的 TensorFlow 版本一致,以避免运行时冲突。
© www.soinside.com 2019 - 2024. All rights reserved.