如何在 OS X High Sierra 10.13.2 上为 Tensorflow 安装适用于 CUDA 9.1 的 NVIDIA CuDNN v7?

How to install NVIDIA CuDNN v7 for CUDA 9.1 for Tensorflow on OS X High Sierra 10.13.2?

我正在尝试从 Mac OSX 10.13.2.

上的源代码为 Python3.6 安装 Tensorflow-GPU

安装过程是...

  1. 我为我的 Geforce GT-750M 安装了 Nvidia-Web-Driver 并进行了更新。

  2. 已安装并更新至 CUDA 驱动程序 v387.99(GPU 驱动程序版本:378.10.10.10.25.102)。

  3. 我尝试为 CUDA 9.1 安装 CuDNN v7。

但是我无法从 NVIDIA 网站上找到适合我 Mac 的版本。 https://developer.nvidia.com/rdp/cudnn-download

我努力安装 Tensorflow,尝试了所有我能想到的方法,但都失败了,我在下面遇到了同样的错误。

nvcc fatal: The version ('90000') of the host compiler ('Apple clang') is not supported

即使我运行编译CUDA 9.1示例代码的命令也遇到了同样的错误

$make -C 0_Simple/vectorAdd

错误是...

/Developer/NVIDIA/CUDA-9.1/bin/nvcc -ccbin clang++ -I../../common/inc -m64 -Xcompiler -arch -Xcompiler x86_64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -o vectorAdd.o -c vectorAdd.cu nvcc fatal : The version ('90000') of the host compiler ('Apple clang') is not supported make: *** [vectorAdd.o] Error 1

我该如何解决这个问题?我需要你们的帮助。

这些是我的开发环境信息。

$uname -a

Darwin Kenneth-MBP.local 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64

$cmake --version

cmake version 3.10.1

$clang --version

Apple LLVM version 9.0.0 (clang-900.0.39.2) Target: x86_64-apple-darwin17.3.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2017 NVIDIA Corporation Built on Fri_Nov__3_21:08:57_CDT_2017 Cuda compilation tools, release 9.1, V9.1.85

$git describe --tags # Tensorflow 

v1.3.0-rc1-6207-ge210cb140a

GPU 驱动程序 - NVIDIA GT 750M

GPU Driver Version: 378.10.10.10.25.102,

CUDA 驱动程序

CUDA Driver Version: 387.99

提前致谢。

您可能想要更新此 post 的标题。这里发生了很多事情,似乎主要是关于在不受支持的配置中安装 Tensorflow。

首先,cuDNN 仅适用于 CUDA 9.0,因此我会避开 CUDA 9.1。在 macOS 10.13 上构建 CUDA 应用程序的技巧是使用 Xcode 8.2 并在构建过程中切换 command-line 工具。 Xcode 9 中较新的编译器无法与 nvcc 一起使用。

为了构建 Tensorflow,有一些补丁需要制作,参考 here。黄金在评论中(尤其是 OpenMP 部分)。不要忘记禁用 SIP(​​系统完整性保护)。

我在分支 v1-4-1-high-sierra-cuda 中有一个 Tensorflow 的分支,其中已经应用了修改和一个超级基本的 build_high_sierra.sh 脚本,如果你想试一试的话。在 12 核野兽上编译需要 15 分钟以上,因此请注意(并确保将 COMPILE_CORES 从 24 减少)。


构建起来有点麻烦。您可以尝试我在发布部分 post 编辑的 pre-compiled 二进制文件之一。只要您安装了先决条件(CUDA 9.0 和适当的 cuDNN),无论如何您都需要构建它,它可能会起作用。

https://github.com/pestilence669/tensorflow/releases/tag/1.4.1_high_sierra_cuda_xmas