cuda/tensorflow/keras安装笔记

  1. sudo yum install kernel-devel-$(uname -r)、kernel-headers-$(uname -r) 手动下载,rpm -ivh安装

  2. 禁用nouveau driver,创建 /etc/modprobe.d/blacklist-nouveau.conf:

    1
    2
    blacklist nouveau
    options nouveau modeset=0
  3. Regenerate the kernel initramfs and 重启机器: sudo dracut --force

  4. sh cuda_8.0.44_linux.run(全部默认选项) & chmod 755 -R /usr/local/cuda-8.0

  5. cudnn安装:

    1
    2
    3
    4
    5
    6
    7
    8
    tar -xzvf cudnn-8.0-linux-x64-v5.1.tgz
    cd cudnn-8.0-linux-x64-v5.1
    sudo cp lib64/* /usr/local/cuda/lib64/
    sudo cp include/* /usr/local/cuda/include/
    复制后软链接会失效,需要重新建立软链接:
    ln -s libcudnn.so.6.0.21 libcudnn.so.6
    ln -s libcudnn.so.6 libcudnn.so
  6. 设置环境变量:

    1
    2
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-8.0/lib64
    export PATH="/usr/local/cuda-8.0/bin:$PATH"
  7. pip install tensorflow/theano/keras(若无法下载包,手动下载再安装)

    1
    pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.2.0-cp35-cp35m-manylinux1_x86_64.whl