Windows下编译带CUDA 11.3的TensorFlow 2.5.0(Python3.9.5,cuDNN 8.2.0,兼容性3.5 - 8.6,附编译结果下载)

2023-05-16

基本参照我的这篇文章:《Windows下编译带CUDA 11.2的TensorFlow 2.4.1(Python3.9.1,cuDNN 8.1.0,兼容性3.5 - 8.6,附编译结果下载)》,有些地方有所改动。

环境准备

1. 内存要求

在8个并行任务下(默认并行数为CPU线程数),应有不小于10G的内存,否则会产生编译器堆空间不足的错误。

2. Python & Pip

首先Python需要安装一些包:six、numpy、wheel、setuptools、keras_applications和keras_preprocessing,使用管理员权限打开命令提示符:

pip install six numpy wheel setuptools
pip install Keras_applications Keras_preprocessing --no-deps

 注意,Python路径中不能出现空格,即Windows下默认安装路径C:\Program Files\Python39会在编译时报错,因此如果装到了这个路径,需要在一个没有空格的目录下创建一个链接(不是快捷方式),用mklink命令。

3. CUDA

这里选的CUDA 11.3,CUDA官网下载安装,没什么好说的。

4. Bazel

然后是Bazel,bazel很简单,就一个exe,需要设置环境变量给到Path下,我偷懒直接放到CUDA的bin目录下。我选的版本是3.7.2。

5. MSYS2

再安装MSYS2,同样需要给msys64\usr\bin目录设置环境变量。

装好后再安装一些包,用的是pacman,由于默认源极慢极慢,所以建议国内换源。

进到msys64\etc\pacman.d目录下,修改所有mirrolist,分别在各自所有Server行前加一行,把下面清华/中科大/北邮的随便选一个复制上来就行。

打开msys64命令行,官方教程少提了一个zip包,因此安装命令如下:

pacman -S git patch unzip zip

6. Visual Studio 2019

 然后是VS,下载VS安装器,为避免麻烦,装到C盘默认路径这次我没有尝试非C盘路径,不知道找不到编译器的bug还在不在)。如果非VS用户,只需安装除必选组件外的MSVC v142 - VS 2019 C++ x64/x86生成工具(随便一个,我选的最新版本)和Windows 10 SDK(同样随便,我选的最新的)。

编译

配置编译

下载TensorFlow 2.5.0源码,进入解压后的根目录,执行

D:\tensorflow-2.5.0>python configure.py
You have bazel 3.7.2 installed.
Please specify the location of python. [Default is C:\Python39\python.exe]:


Found possible Python library paths:
  C:\Python39\lib\site-packages
Please input the desired Python library path to use.  Default is [C:\Python39\lib\site-packages]

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

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

Found CUDA 11.3 in:
    D:/CUDA/lib/x64
    D:/CUDA/include
Found cuDNN 8 in:
    D:/CUDA/lib/x64
    D:/CUDA/include


Please specify a list of comma-separated CUDA compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. Each capability can be specified as "x.y" or "compute_xy" to include both virtual and binary GPU code, or as "sm_xy" to only include the binary code.
Please note that each additional compute capability significantly increases your build time and binary size, and that TensorFlow only supports compute capabilities >= 3.5 [Default is: 3.5,7.0]: 3.5,3.7,5.0,5.2,6.0,6.1,7.0,7.5,8.0,8.6


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


Would you like to override eigen strong inline for some C++ compilation to reduce the compilation time? [Y/n]:
Eigen strong inline overridden.

Would you like to interactively configure ./WORKSPACE for Android builds? [y/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=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.

这版TensorFlow编译SM 3.5会报错,查了一下貌似TensorRT不支持这么低的版本。

代码修改

启用MKL时

从2.4开始TensorFlow将MKL用到的OpenMP从直接下载二进制可执行文件变为了从LLVM项目下载开源代码并编译,带来了一系列问题,这里建议官网下载安装程序(Pre-Built Binaries)安装LLVM(记住安装中写入系统环境变量),作用有二:

  1. 用现成的libiomp5md.lib和libiomp5md.dll取代编译过程,MSVC编译LLVM的OpenMP会出错。
  2. 将LLVM用到的DLL(在LLVM安装目录\bin下)复制到msys安装目录\usr\bin下,否则在后续编译步骤中使用msys里的bash时没有复制系统环境变量的Path会报错(比如编译Lite相关内容时会报找不到api-ms-win-crt-locale-l1-1-0.dll的错)。

将libiomp5md.lib放到third_party\mkl目录下,并在third_party\mkl\mkl.BUILD的第75行后插入:

cc_import(
    name = "iomp5",
    interface_library = "libiomp5md.lib",
    system_provided = 1,
)

 然后将下方Windows编译配置修改为:

cc_library(
    name = "mkl_libs_windows",
    deps = [
        "iomp5"
    ],
    visibility = ["//visibility:public"],
)

将libiomp5md.dll放到系统环境变量里。

将third_party\llvm_openmp\BUILD第74行修改为0,取消强制使用MSVC:

omp_vars_win = {
    "MSVC": 0,
}

没有这一步会报类似于如下错误(这段报错复制自2.4.1版,但2.5.0也会报同样的错误):

ERROR: D:/output_base/external/llvm_openmp/BUILD.bazel:176:10: C++ compilation of rule '@llvm_openmp//:libiomp5md.dll' failed (Exit 1): ml64.exe failed: error executing command
  cd D:/output_base/execroot/org_tensorflow
  SET CUDA_TOOLKIT_PATH=D:/CUDA
    SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt
    SET LIB=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\lib\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\\Extensions\Microsoft\IntelliCode\CLI;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\;;C:\Windows\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
    SET PWD=/proc/self/cwd
    SET PYTHON_BIN_PATH=C:/Python39/python.exe
    SET PYTHON_LIB_PATH=C:/Python39/lib/site-packages
    SET RUNFILES_MANIFEST_ONLY=1
    SET TEMP=D:/tmp
    SET TF2_BEHAVIOR=1
    SET TF_CONFIGURE_IOS=0
    SET TF_CUDA_COMPUTE_CAPABILITIES=3.5,3.7,5.0,5.2,6.0,6.1,7.0,7.5,8.0,8.6
    SET TF_NEED_CUDA=1
    SET TMP=D:/tmp
  C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/HostX64/x64/ml64.exe -B external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py /nologo /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 /Iexternal/llvm_openmp /Ibazel-out/x64_windows-opt/bin/external/llvm_openmp /Iexternal/bazel_tools /Ibazel-out/x64_windows-opt/bin/external/bazel_tools /Iexternal/llvm_openmp/runtime/src /Ibazel-out/x64_windows-opt/bin/external/llvm_openmp/runtime/src /Iexternal/llvm_openmp/include /Ibazel-out/x64_windows-opt/bin/external/llvm_openmp/include /showIncludes /MD /O2 /DNDEBUG /W0 /D_USE_MATH_DEFINES -DWIN32_LEAN_AND_MEAN -DNOGDI /experimental:preprocessor -DTHRUST_IGNORE_CUB_VERSION_CHECK /Domp_EXPORTS /D_M_AMD64 /DOMPT_SUPPORT=0 /D_WINDOWS /D_WINNT /D_USRDLL /Fobazel-out/x64_windows-opt/bin/external/llvm_openmp/_objs/libiomp5md.dll/z_Windows_NT-586_asm.obj /c bazel-out/x64_windows-opt/bin/external/llvm_openmp/z_Windows_NT-586_asm.S
Execution platform: @local_execution_config_platform//:platform
Microsoft (R) Macro Assembler (x64) Version 14.27.29111.0
Copyright (C) Microsoft Corporation.  All rights reserved.

MASM : warning A4018:invalid command-line option : -B
 Assembling: external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(1) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(2) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(3) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(4) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(5) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(6) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(7) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(8) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(9) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(10) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(11) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(12) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(13) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(14) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(15) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(16) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(17) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(18) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(19) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(20) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(21) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(22) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(23) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(24) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(25) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(26) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(27) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(28) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(29) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(30) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(31) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(32) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(33) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(34) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(35) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(36) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(37) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(38) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(39) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(40) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(41) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(42) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(43) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(44) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(45) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(46) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(47) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(48) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(49) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(50) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(51) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(52) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(53) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(54) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(55) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(56) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(57) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(58) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(59) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(60) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(61) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(62) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(63) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(64) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(65) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(66) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(67) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(68) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(69) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(70) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(71) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(72) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(73) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(74) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(75) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(76) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(77) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(78) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(79) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(80) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(81) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(82) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(83) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(84) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(85) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(86) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(87) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(88) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(89) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(90) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(91) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(92) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(93) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(94) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(95) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(96) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(97) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(98) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(99) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(100) : error A2044:invalid character in file
external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py(101) : fatal error A1012:error count exceeds 100; stopping assembly
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 229.166s, Critical Path: 30.31s
INFO: 966 processes: 239 internal, 727 local.
FAILED: Build did NOT complete successfully

此外,最后链接时找不到DLL,需要将LLVM的libiomp5md.dll放到python.exe同目录下,否则会出现以下错误:

ERROR: D:/tensorflow-2.4.1/tensorflow/python/keras/api/BUILD:111:19: Executing genrule //tensorflow/python/keras/api:keras_python_api_gen failed (Exit 1): bash.exe failed: error executing command
  cd D:/output_base/execroot/org_tensorflow
  SET CUDA_TOOLKIT_PATH=D:/CUDA
    SET PATH=C:\msys64\usr\bin;C:\msys64\bin;C:\Windows;C:\Windows\System32;C:\Windows\System32\WindowsPowerShell\v1.0;C:\NASM;D:\;D:\CUDA\bin;D:\CUDA\libnvvp;C:\Python39\Scripts\;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.1.2\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.2.0\;C:\Program Files\CMake\bin;C:\LLVM\bin;C:\Git\cmd;C:\msys64\usr\bin;C:\Users\用户名\AppData\Local\Microsoft\WindowsApps;C:\Users\用户名\.dotnet\tools
    SET PYTHON_BIN_PATH=C:/Python39/python.exe
    SET PYTHON_LIB_PATH=C:/Python39/lib/site-packages
    SET RUNFILES_MANIFEST_ONLY=1
    SET TF2_BEHAVIOR=1
    SET TF_CONFIGURE_IOS=0
    SET TF_CUDA_COMPUTE_CAPABILITIES=3.5,3.7,5.0,5.2,6.0,6.1,7.0,7.5,8.0,8.6
    SET TF_NEED_CUDA=1
  C:/msys64/usr/bin/bash.exe bazel-out/x64_windows-opt/bin/tensorflow/python/keras/api/keras_python_api_gen.genrule_script.sh
Execution platform: @local_execution_config_platform//:platform
Traceback (most recent call last):
  File "\\?\D:\tmp\Bazel.runfiles_q5x32q4w\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "\\?\D:\tmp\Bazel.runfiles_q5x32q4w\runfiles\org_tensorflow\tensorflow\python\tools\api\generator\create_python_api.py", line 26, in <module>
    from tensorflow.python.tools.api.generator import doc_srcs
  File "\\?\D:\tmp\Bazel.runfiles_q5x32q4w\runfiles\org_tensorflow\tensorflow\python\__init__.py", line 39, in <module>
    from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
  File "\\?\D:\tmp\Bazel.runfiles_q5x32q4w\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "\\?\D:\tmp\Bazel.runfiles_q5x32q4w\runfiles\org_tensorflow\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 找不到指定的模块。


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
ERROR: D:/tensorflow-2.4.1/tensorflow/tools/pip_package/BUILD:165:10 Executing genrule //tensorflow/python/keras/api:keras_python_api_gen_compat_v2 failed (Exit 1): bash.exe failed: error executing command
  cd D:/output_base/execroot/org_tensorflow
  SET CUDA_TOOLKIT_PATH=D:/CUDA
    SET PATH=C:\msys64\usr\bin;C:\msys64\bin;C:\Windows;C:\Windows\System32;C:\Windows\System32\WindowsPowerShell\v1.0;C:\NASM;D:\;D:\CUDA\bin;D:\CUDA\libnvvp;C:\Python39\Scripts\;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.1.2\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.2.0\;C:\Program Files\CMake\bin;C:\LLVM\bin;C:\Git\cmd;C:\msys64\usr\bin;C:\Users\用户名\AppData\Local\Microsoft\WindowsApps;C:\Users\用户名\.dotnet\tools
    SET PYTHON_BIN_PATH=C:/Python39/python.exe
    SET PYTHON_LIB_PATH=C:/Python39/lib/site-packages
    SET RUNFILES_MANIFEST_ONLY=1
    SET TF2_BEHAVIOR=1
    SET TF_CONFIGURE_IOS=0
    SET TF_CUDA_COMPUTE_CAPABILITIES=3.5,3.7,5.0,5.2,6.0,6.1,7.0,7.5,8.0,8.6
    SET TF_NEED_CUDA=1
  C:/msys64/usr/bin/bash.exe bazel-out/x64_windows-opt/bin/tensorflow/python/keras/api/keras_python_api_gen_compat_v2.genrule_script.sh
Execution platform: @local_execution_config_platform//:platform
INFO: Elapsed time: 19969.544s, Critical Path: 4113.50s
INFO: 10487 processes: 127 internal, 10360 local.
FAILED: Build did NOT complete successfully

启用Release时

修改.bazelrc的第559行:

build:release_gpu_base --repo_env=TF_CUDA_COMPUTE_CAPABILITIES="sm_35,sm_50,sm_60,sm_70,sm_75,compute_80,compute_86"

也就是加了个“compute_86”。 

启动编译

如果需要代理(bazel需要下载大量直连非常慢的资源),在命令提示符中输入:

git config --global http.proxy http://ip:port
git config --global https.proxy https://ip:port
set http_proxy=http://ip:port
set https_proxy=https://ip:port

如果C盘空间不够,可以单独指定临时文件夹位置(实测一次编译下来,临时文件夹需要50GB左右的空间):

set TMP=D:/tmp
set TEMP=D:/tmp

构建pip包:

bazel --output_user_root=D:/output_user_root --output_base=D:/output_base build --config=mkl --config=numa --config=monolithic --define=no_tensorflow_py_deps=true --//tensorflow/core/kernels/mlir_generated:enable_gpu=false --experimental_strict_action_env=false --config=release_gpu_windows //tensorflow/tools/pip_package:build_pip_package

这一行编译,耗时极长。

  1. 下载的bazel会因为权限问题无法写入用户文件夹,指定另外的文件夹是比较方便的操作。
  2. 编译输出最好也指定另外的文件夹,一次编译下来会占用50GB左右的空间。
  3. 之前我说可以从GitHub提前下载bazel本体文件夹的压缩包再解压以免额外时间,即指定--distdir=D:/bazel,但现在发现可能有些包的校验码对不上,还是建议去掉这个选项在线下载。
  4. --config=mkl用于启用MKL(依赖libiomp5md.dll),可以不写以不启用MKL。
  5. --experimental_strict_action_env=false用于启用系统环境变量,以防链接时找不到DLL。
  6. --config=release_gpu_windows用于启用Release编译,之前我没启用文件体积很大,不知道启用了会不会影响debug,未测试。
  7. --//tensorflow/core/kernels/mlir_generated:enable_gpu=false用于关闭MLIR的GPU编译,否则编译会出错,类似于(关键词:xxx_kernel_generator_kernel.o failed (Exit -1073741515): tf_to_kernel.exe failed):
ERROR: D:/tensorflow-2.5.0/tensorflow/core/kernels/mlir_generated/BUILD:893:23: compile tensorflow/core/kernels/mlir_generated/neg_gpu_f16_f16_kernel_generator_kernel.o failed (Exit -1073741515): tf_to_kernel.exe failed: error executing command
  cd D:/output_base/execroot/org_tensorflow
bazel-out/x64_windows-opt/bin/tensorflow/compiler/mlir/tools/kernel_gen/tf_to_kernel.exe --unroll_factors=4 --tile_sizes=256 --arch=compute_50,compute_52,compute_60,compute_61,compute_70,compute_75,compute_80,compute_86 --input=bazel-out/x64_windows-opt/bin/tensorflow/core/kernels/mlir_generated/neg_gpu_f16_f16.mlir --output=bazel-out/x64_windows-opt/bin/tensorflow/core/kernels/mlir_generated/neg_gpu_f16_f16_kernel_generator_kernel.o --enable_ftz=False --cpu_codegen=False
Execution platform: @local_execution_config_platform//:platform
Target //tensorflow/tools/pip_package:build_pip_package failed to build

然后构建包,会在源码根目录下创建tfpy文件夹,成功后whl包就会放到这个文件夹下,文件夹名字随意:

bazel-bin\tensorflow\tools\pip_package\build_pip_package.exe tfpy

构建C++库

执行:

bazel --output_user_root=D:/output_user_root --output_base=D:/output_base build --config=mkl --config=numa --config=monolithic --//tensorflow/core/kernels/mlir_generated:enable_gpu=false --experimental_strict_action_env=false --config=release_gpu_windows //tensorflow:tensorflow_cc.dll
bazel --output_user_root=D:/output_user_root --output_base=D:/output_base build --config=mkl --config=numa --config=monolithic --//tensorflow/core/kernels/mlir_generated:enable_gpu=false --experimental_strict_action_env=false --config=release_gpu_windows //tensorflow:tensorflow_cc_dll_import_lib

即在bazel-bin\tensorflow目录下得到tensorflow_cc.dll和tensorflow_cc.lib。

再执行:

bazel --output_user_root=D:/output_user_root --output_base=D:/output_base build --config=mkl --config=numa --config=monolithic --//tensorflow/core/kernels/mlir_generated:enable_gpu=false --experimental_strict_action_env=false --config=release_gpu_windows //tensorflow:install_headers

即在bazel-bin\tensorflow目录下得到include文件夹,里面是需要的头文件。

安装须知

编译得到whl包后,由于源码中依赖包版本限制得比较死,pip安装过程中会各种报错(尤其是grpcio,TensorFlow指定的版本无法在Windows下成功编译),因此需要先去掉依赖安装TensorFlow本体:

pip install tensorflow-2.5.0-cp39-cp39-win_amd64.whl --no-deps

然后再安装其依赖的包,如:

pip install absl-py astunparse flatbuffers google_pasta grpcio h5py keras_preprocessing numpy opt_einsum protobuf six termcolor typing_extensions wheel wrapt gast tensorboard tensorflow_estimator

如有缺失,后续导入的时候会有明确提示。

如果启用MKL,则需要另外将libomp.dll放到系统python.exe同目录下(即便是虚拟环境也要放到系统的Python目录下)。

结果获取(还没来得及测试,有问题请评论或私信)

pip安装包:tensorflow-2.5.0-cp39-cp39-win_amd64.whl(394.34MB)

pip安装包压缩版:tensorflow-2.5.0-cp39-cp39-win_amd64.rar(250.15MB)

C++库:tensorflow-cpp-2.5.0.rar(218.10MB)

pip安装包(MKL):tensorflow-mkl-2.5.0-cp39-cp39-win_amd64.whl(393.64MB)

pip安装包压缩版(MKL):tensorflow-mkl-2.5.0-cp39-cp39-win_amd64.rar(249.58MB)

C++库(MKL):tensorflow-cpp-mkl-2.5.0.rar(217.57MB)

libomp.dll:libomp-tensorflow-2.5.0.rar(378.75KB)

pip安装包的压缩版,解压后再用ZIP打包,改后缀为“whl”即可正常安装。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Windows下编译带CUDA 11.3的TensorFlow 2.5.0(Python3.9.5,cuDNN 8.2.0,兼容性3.5 - 8.6,附编译结果下载) 的相关文章

  • you-get下载bilibili视频

    you get是一个命令行工具 xff0c 可以从网络上下载视频 音频 图片等资源 https codechina csdn net mirrors soimort you get utm source 61 csdn github acc
  • gpg: 无法检查签名:没有公钥

    repo error 34 git 34 failed with exit status 1 cmd 39 git 39 39 tag 39 39 v 39 39 v1 12 16 39 stdout gt gt object 666d53
  • ARM指令中怎么判断合法立即数的方法(转载)

    在ARM汇编的数据处理指令中经常会使用到常数 xff0c 而ARM汇编中规定使用的常数必 须是立即数 ARM立即数的是由一个8位的常数循环右移偶数位得到的 xff0c 其中循环右移 的位数由一个4位2进制的两倍表示 xff0c 公式如下 i
  • 选择排序算法

    概要 本章介绍排序算法中的选择排序 目录 1 选择排序介绍 2 选择排序图文说明 3 选择排序的时间复杂度和稳定性 4 选择排序实现 4 1 选择排序C实现 4 2 选择排序C 43 43 实现 4 3 选择排序Java实现 转载请注明出处
  • 字符编码详解

    相信很多程序员在面对 字符编码 这个问题时 xff0c 都曾困扰过 xff0c 甚至头疼不已 接着之前两篇博客 xff08 二进制文件和文本文件 文本文件换行符 xff09 xff0c 本文将对 字符编码 做一个全面而细致的剖析 xff0c
  • CentOS + Mongodb 搭建NodeBB [转载翻译]

    原文 xff1a https www kancloud cn a632079 nodebb cn 372108 服务器选用 64 位 CentOS xff0c MongoDB 现在只有64位版本 CentOS amp MongoDB 一 准
  • 国家气象局提供的天气预报接口(完整Json接口)

    国家气象局提供的天气预报接口主要有三个 xff0c 分别是 xff1a http www weather com cn data sk 101010100 html http www weather com cn data cityinfo
  • 数据结构题集(c语言版)严蔚敏答案pdf

    前言 xff1a 最近在学习数据结构 xff0c 在做习题的时候找答案费了一番力气 xff0c 好不容易找到了 xff0c 分享出来 xff0c 希望想学的人找得没那么累 图书目录 xff1a 第一篇 习题与学习指导 第0章 本篇提要与作业
  • ios swift uitextview如何应对键盘的遮挡

    参考http stackoverflow com questions 36405752 keyboard to move the view only if the textfield is hidden 1 继承 UITextViewDel
  • Android设备唯一标识符ID

    一 获取各种单一的设备标识方式 1 DEVICE ID 概念 xff1a 是区别移动设备的标志 xff0c 储存在移动设备中 xff0c 可用于监控被窃或无效的移动设备 优点 xff1a 根据不同的手机设备返回IMEI xff0c MEID
  • 关于Uview ui框架的使用

    uview源码 api 按照使用场景自定义修改 如果想要使用 uview的 Upload 组件的 手动上传功能 xff0c 突然发现最近的1 x版本不能用了 xff0c 所以 我想手动diy一下 Upload 部分的源码 xff0c 本人使
  • 关于node-sass装不上,项目运行不了把我搞崩溃一记

    由于之前手贱 xff0c 用电脑管家的软件管理 更新了一下nodejs的最新稳定版本 xff0c 好家伙 xff0c 最近一直在开发uniapp xff0c 因为是hbuild自带node sass的插件版本 xff0c 所以一直也没有影响
  • OpenGL---VS2010环境搭建

    参看 xff1a http www cppblog com doing5552 archive 2009 01 08 71532 html 1 安装GLUT工具包 http www opengl org resources librarie
  • C++两个类互相引用的解决方法

    问题描述 xff1a c 43 43 在使用过程中遇到两个类需要相互包含引用的问题 解决办法 xff1a 两个类的头文件之中 xff0c 选一个包含另一个类的头文件 xff0c 另一个头文件中采用class xff1b 的申明形式 xff0
  • VTK 3D图像显示

    目的 根据不同需求 xff0c 医学3D图像的显示方式有多种 xff0c 本篇先简单罗列3D图像的几种显示模式 xff0c 后续再进行详细补充 1 剂量模体和二维数据 体模原图 xff08 网络截图 xff09 xff1a 体模二维X射线影
  • 原版win7全新安装后无法通过windows update安装更新的解决办法.2023-03-07

    首先要确保网络畅通 系统时间设置正确 系统没有被病毒流氓程序等破坏 是一个正常完整的初始安装的系统 方法一 1 安装 Windows 更新客户端 kb3138612 kb3138612 Microsoft Update Catalog 2
  • xmind 8 pro Mac破解版(思维导图) 附xmind 8 序列号

    链接 https pan baidu com s 1tTKYuqCjGo WC2ns6tN54w 密码 1b1w 转载地址 小伙伴们XMind 8 pro Mac破解版 思维导图 最新版本v3 7 8中文破解版上线了 xff0c 本次的XM
  • 操作系统系列笔记(五) - 同步互斥, 信号量和管程

    同步互斥 背景 并发进程在多个进程间有资源共享 导致执行过程是不确定性和不可重现的 程序错误可能是间歇性发生 原子操作 是指一次不存在任何中断或失败的操作 操作系统需要利用同步机制 在并发执行的同时保证一些操作是原子操作 几个状态 互斥 一
  • compilation terminated. The terminal process terminated with exit code: 1头文件包含错误解决办法

    错误描述 xff1a d coding clanguage datastruct chapterone mian1 cpp 1 46 fatal error c1 h No such file or directory include 34
  • 实践支持HTTPS SSL的七牛云存储CDN

    最近 xff0c 听说七牛云存储CDN这货支持HTTPS SSL Godaddy SSL证书 xff0c 试用了一下 xff0c 简直发现了新大陆 刚开始设置好以后 xff0c 发现HTTPS下的网页并没有采用七牛的服务 xff0c 只是H

随机推荐

  • 超详细,多图,PVE安装以及简单设置教程(个人记录)

    前言 写这个的目的是因为本人健忘所以做个记录以便日后再折腾时查阅 本人笔拙如有选词 xff0c 错字 xff0c 语法 xff0c 标点错误请忽视 xff0c 大概率知道了也不会修改 xff0c 本人能看懂就好 内容仅适用于本人的使用环境
  • Visual Studio 编译时moc 某些头文件找不到,编译不过,解决办法

    Visual Studio 编译时moc 某些头文件找不到 xff0c 编译不过 xff0c 解决办法 主要是不同的VS版本提交时存在的差异造成的 需要把编译时moc不过的头文件先移除掉 xff0c 然后再添加回来 xff0c 再编译就能编
  • UITableViewController使用

    列表视图控制器 xff0c 用起来很方便 xff0c 不仅可以实现分组列表 xff0c 连tem都有很多定义好的样式 xff0c 使用时基本上不需要有大的自定义的部分 xff0c 这里做一些简单的尝试 1 新建MyTableViewCont
  • TQ2440外接GPIO蜂鸣器驱动程序

    本文通过TQ2440开发板上可外接的GPIO口GPG14连接蜂鸣器 xff0c 通过控制GPG14引脚的高低电平的输出和高低电平输出之间的时间间隔来使蜂鸣器发出不同的声音 1 打开S3C2440的底板原理图找到GPIO xff0c 如下图所
  • Ubuntu下QT静态编译教程

    1 安装Ubuntu系统 xff0c 然后 root 账户登录 xff0c 不然可能会有权限问题 xff0c 避免麻烦 2 打开终端 xff0c 安装必要环境 xff1a 注 xff1a 如安装时 xff0c 遇到暂停需要输入y时 xff0
  • 用 GitHub Actions 自动打包发布 Python 项目

    用 GitHub Actions 自动打包发布 Python 项目 文章目录 用 GitHub Actions 自动打包发布 Python 项目前言在 GitHub 上保存 token创建 workflow定义工作流程的工作环境签出项目 x
  • 用 R 做数据分析

    用 R 做数据分析 Vol 0 xff1a 数据的数字特征及相关分析 导入数据 导入文本表格数据 Year Nationwide Rural Urban 1978 184 138 405 1979 207 158 434 1980 236
  • win下配置Rust及Clion开发环境

    登录官网下载最新的win安装包 地址 默认情况下 rustup安装在用户目录下 也就是C盘 这里我们通过修改环境变量的方式 安装到D盘 RUSTUP HOME 存储工具链和配置文件CARGO HOME 存储cargo的缓存 一定要在rust
  • [docker]CentOS安装docker

    文章目录 先卸载旧版本添加 Docker 软件源使用dnf安装使用yun安装 配置镜像源加速关于tencentOS系统的差异处理 先卸载旧版本 span class token function sudo span yum remove s
  • c语言printf输出格式

    最近C语言中遇到一些基础知识 xff0c 写出来分享一下 xff1a 一 一些基本输出格式小试 include lt stdio h gt include lt stdlib h gt int main int x 61 017 print
  • Linux man命令解析

    文章目录 使用方法手册页面结构手册章节说明命令选项命令参数常见用法1 man k command2 man f command man命令 英文单词manual 使用手册 的缩写 是Linux系统中的一个命令 用于显示其他命令的手册页面 它
  • Linux usr/share/doc帮助文档介绍

    文章目录 usr share doc介绍目录结构查看文档使用文档总结附录 xff1a 关于删除 usr share doc的影响 usr share doc 介绍 在Linux系统中 usr share doc目录是非常重要的 它是用来存储
  • POJ题目分类 很好很有层次感

    OJ上的一些水题 可用来练手和增加自信 poj3299 poj2159 poj2739 poj1083 poj2262 poj1503 poj3006 poj2255 poj3094 初期 一 基本算法 1 枚举 poj1753 poj29
  • Codeforces Beta Round #1

    做了好久 感觉做的有点蠢 题目总体难度不高吧应该 因为考虑的不周WA了两次 题目传送门 xff1a http codeforces com contest 1 A Theatre Square time limit per test 1 s
  • Codeforces Beta Round #2

    codeforces 2A Winner codeforces 2B The least round way codeforces 2C Commentator problem 这期题目想对感觉较难 A敲了十多分钟 B是想了很久才开始写的中
  • windows 系统下找不到kernel32.lib和windows.h等问题

    windows 系统下找不到kernel32 lib和windows h等问题 因为项目中一个硬件驱动只支持windows7 xff0c 所以找了一个硬盘重装系统 window 7 64位官方纯净版 装完之后又安装了VS2013 xff0c
  • Debian 10.1升级内核

    今天决定把Debian 10 1自带的4 19内核升级到5 2 14 需要的工具 automake make g 43 43 xff08 包含gcc xff09 bison flex libelf dev libssl dev bc 懒人命
  • Windows下编译带CUDA 10.2的TensorFlow 2.2(Python3.8.2,附编译结果下载)

    官方教程说得基本差不多了 xff0c 然而在此基础上编译还是会出问题 xff0c 因此做一些补充 环境准备 1 Python amp Pip 首先是Python需要安装一些包 xff0c 除了官方说的six numpy wheel kera
  • Windows下编译带CUDA 11.2的TensorFlow 2.4.1(Python3.9.1,cuDNN 8.1.0,兼容性3.5 - 8.6,附编译结果下载)

    基本参照我的这篇文章 xff1a Windows下编译带CUDA 11 1 xff08 Update 1 xff09 的TensorFlow 2 4 xff08 RC0 xff09 xff08 Python3 9 0 xff0c cuDNN
  • Windows下编译带CUDA 11.3的TensorFlow 2.5.0(Python3.9.5,cuDNN 8.2.0,兼容性3.5 - 8.6,附编译结果下载)

    基本参照我的这篇文章 xff1a Windows下编译带CUDA 11 2的TensorFlow 2 4 1 xff08 Python3 9 1 xff0c cuDNN 8 1 0 xff0c 兼容性3 5 8 6 xff0c 附编译结果下