美文网首页
使用google cloud的compute engine进行深

使用google cloud的compute engine进行深

作者: Anabas | 来源:发表于2017-10-09 12:24 被阅读299次

    1. 启动脚本,用来安装显卡驱动

    #add gpu

    Ubuntu 16.04 LTS or 17.04 - CUDA 8:

    #!/bin/bash

    echo "Checking for CUDA and installing."

    # Check for CUDA and try to install.

    if ! dpkg-query -W cuda-8-0; then

    # The 16.04 installer works with 16.10.

    curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb

    dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb

    apt-get update

    apt-get install cuda-8-0 -y

    fi

    sudo apt-get update

    2. 安装anaconda包 配置jupyter

    mkdir downloads

    cd downloads

    wget http://repo.continuum.io/archive/Anaconda2-5.0.0.1-Linux-x86_64.sh

    bash Anaconda2-5.0.0.1-Linux-x86_64.sh

    source ~/.bashrc

    jupyter notebook --generate-config

    cd ..

    sudo vim .jupyter/jupyter_notebook_config.py

    将下面四行添加到该文件中

    c = get_config()

    c.NotebookApp.ip = '*'

    c.NotebookApp.open_browser = False

    c.NotebookApp.port = 8888

    jupyter notebook password

    端口与vpc网络->防火墙规则  中自己设置的tcp或者udp端口一致

    jupyter-notebook --no-browser --port=8888

    安装anaconda后需要重新安装google-compute-engine

    sudo pip uninstall google-compute-engine

    sudo pip install google-compute-engine

    授权google账户

    gcloud auth login

    安装cudnn6  注意:亲测不能使用6以下版本for tensorflow1.3

    现在本地下载好,上传到google storage cloud

    然后下载到compute engine

    sudo apt-get install openjdk-8-jdk git python-dev python-numpy python-six build-essential python-pip python-virtualenv swig python-wheel libcurl3-dev libcupti-dev

    tar -xzvf cudnn-8.0-linux-x64-v6.0.tgz

    sudo cp cuda/include/cudnn.h /usr/local/cuda/include

    sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64

    sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

    sudo vim ~/.bashrc

    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"

    export CUDA_HOME=/usr/local/cuda

    source ~/.bashrc

    echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list

    curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -

    sudo apt-get update

    sudo apt-get install bazel

    sudo apt-get upgrade bazel

    git clone https://github.com/tensorflow/tensorflow

    cd ~/tensorflow

    ./configure

    bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

    bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

    相关文章

      网友评论

          本文标题:使用google cloud的compute engine进行深

          本文链接:https://www.haomeiwen.com/subject/paiuyxtx.html