Put TensorFlow in P2 instance with pip3

Just put Python3 in your p2 instance and pip into TensorFlow. Play with the Tesla K80.

Requirements

TensorFlow is as usual

As for compute capability, Tesla K80 has 3.7, so you can rest assured. CUDA GPUs | NVIDIA Developer

Introduction method

Set up an instance

TensorFlow seems to like Ubuntu, so I searched for AMI from Ubuntu official. Ubuntu Amazon EC2 AMI Finder

I tried the hvm: ebs-ssd guy on Ubuntu 16.10.

Put what you need

Classic

sudo apt-get update
sudo apt-get upgrade

Python3 (with 3.5.2+)

sudo apt-get install python3-pip python3-dev

The latest version of CUDA is 8. You can find the commands you can bring with wget by following the flow of CUDA 8.0 Downloads | NVIDIA Developer.

sudo apt-get wget
wget https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb
sudo dpkg -i cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb
sudo apt-get update
rm cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb
sudo apt-get install cuda

For cuDNN, you have to create an account and bring the cuDNN Library for Linux from cuDNN Download | NVIDIA Developer to upload it.

tar xvzf cudnn-8.0-linux-x64-v5.1-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*

cd /usr/local/cuda/lib64
sudo ln -s libcudart.so libcudart.so.7.5

The last two lines are ʻImportError: libcudart.so.7.5: cannot open shared object file: No such file or directory`. Below CUDA 7.5 fails with pip install and docker (Ubuntu 14.04) · Issue # 20 · tensorflow / tensorflow.

Leave it through the path.

export CUDA_HOME=/usr/local/cuda
export CUDA_ROOT=/usr/local/cuda
export PATH=$PATH:$CUDA_ROOT/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_ROOT/lib64

I put the TensorFlow main body with GPU.

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0rc0-cp35-cp35m-linux_x86_64.whl
pip3 install --ignore-installed --upgrade $TF_BINARY_URL

References

Installing TensorFlow on an AWS EC2 P2 GPU Instance - ExpressionFlowExpressionFlow This is the place to start from the source code.

Recommended Posts

Put TensorFlow in P2 instance with pip3
Put pip in Blender
Ensure reproducibility with tf.keras in Tensorflow 2.3
Put postfix 2.11 in source with ansible
Pip doesn't work with PyDev in Pleiades
Put Japanese fonts in images with Colaboratory
Try Tensorflow with a GPU instance on AWS
mod_wsgi talks about putting it in with pip
Zundokokiyoshi with TensorFlow
Throw costly instance health in Slack with Lambda
Breakout with Tensorflow
The story that fits in with pip installation
Complement the library you put in anaconda with jedi-vim
Put AWS data in Google Spreadsheet with boto + gspread
Start numerical calculation in Python (with Homebrew and pip)
Until you install TensorFlow-GPU with pip in Windows environment
I stumbled upon PyUnicodeUCS4_FromStringAndSize when inserting TensorFlow with pip
Stop an instance with a specific tag in Boto3
Put matplotlib in Centos7.
PIL installation with pip
Put scipy in ec2
Put jedi in emacs 24
Reading data with TensorFlow
Kyotei forecast with TensorFlow
Error with pip install
Use pip with MSYS2
Try regression with TensorFlow
Install scikit.learn with pip
Image normalization in TensorFlow
I'm having trouble with instance variables being inherited in Python
[Road to intermediate Python] Install packages in bulk with pip
[TensorFlow 2 / Keras] How to run learning with CTC Loss in Keras
Update packages already installed with pip in user environment (non-su)
Install Jupiter Notebook on Windows with pip in proxy environment
Use "% tensorflow_version 2.x" when using TPU with Tensorflow 2.1.0 in Colaboratory
If you think that the person you put in with pip doesn't work → Maybe you are using python3?