强烈推荐cuda8.0+cudnn5+ 然后直接pip安装!源码编译非常费劲 很多坑 de的我都意识模糊了
配置:ubuntu14,cuda7.5,cudnn版本未知(应该是5吧) 安装tensorflow 1.0.1-gpu 需要准备一台能翻墙疯狂google github issues的电脑因为是cuda7.5还是公用服务器。被迫源码编译
clone 要从github下载zip文件手动解压,不要用git clone, 否则丢文件git check 不出来但是编译会报错【原因未知】 大体按照官网安装。也就是install from source
装bazel. bazel 官网install页面挂了,去百度搜别人博客基本能装上。
$ cd tensorflow # cd to the top-level directory created $ ./configure这两行开始问题就比较大 首先 ./configure 不要用sudo!, 如果没权限就把tensorflow目录cp 到能不用sudo的
XLA just-in-time compiler (experimental)? [y/N]点N
所有让输地址的尽量不要用default.挨个查清楚装在哪了再输进去
如果./configure报错,那就重新输,直到成功或者报错信息连续多次一样为止,因为有时候只是网不好
Please note that each additional compute capability significantly increases your build time and binary size. [Default is: "3.5,5.2"]: 6.1这个要查一下,titan所以6.1, 令人惊奇的是我的笔记本居然是5.0
这行。会报错
ERROR: /home/darth/.cache/bazel/_bazel_darth/08554d152596e5a7df399506682a63f3/external/local_config_cuda/crosstool/BUILD:4:1: Traceback (most recent call last): File "/home/darth/.cache/bazel/_bazel_darth/08554d152596e5a7df399506682a63f3/external/local_config_cuda/crosstool/BUILD", line 4 error_gpu_disabled() File "/home/darth/.cache/bazel/_bazel_darth/08554d152596e5a7df399506682a63f3/external/local_config_cuda/crosstool/error_gpu_disabled.bzl", line 3, in error_gpu_disabled fail("ERROR: Building with --config=c...") ERROR: Building with --config=cuda but TensorFlow is not configured to build with GPU support. Please re-run ./configure and enter 'Y' at the prompt to build with GPU support. ERROR: no such target '@local_config_cuda//crosstool:toolchain': target 'toolchain' not declared in package 'crosstool' defined by /home/darth/.cache/bazel/_bazel_darth/08554d152596e5a7df399506682a63f3/external/local_config_cuda/crosstool/BUILD. INFO: Elapsed time: 0.097s解决:更新.bashrc里面的cuda变量 Problem on building target with GPU support #4841 也就是
export "TF_NEED_CUDA=1" in my ~/.bashrc我是用vim 写进去的,别忘了出来source更新。