Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing Tensorflow 0.8 for GPU on Linux and test if GPU is used supported Python2.7 and 3.4
#!/bin/bash
[ -z $1 ] && python=3.4
if [ $(whoami) = root ] ; then
user=''
else
echo Not running under sudo. pip install --user
user='--user'
fi
if [ $python = '2.7' ] ; then
wheel=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
pip=pip2
elif [ $python = '3.4' ] ; then
wheel=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl
pip=pip3
else
echo Not supported version of python
exit 1
fi
$pip install $user --upgrade $wheel
python${python} -c 'import tensorflow as tf; a = tf.constant([[2]]); tf.Session(config=tf.ConfigProto(log_device_placement=True)).run(tf.matmul(a, a))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment