Skip to content

Instantly share code, notes, and snippets.

@oplatek
Last active April 21, 2019 16:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oplatek/323b63b8f116cd3d78c0f492f78cc289 to your computer and use it in GitHub Desktop.
Save oplatek/323b63b8f116cd3d78c0f492f78cc289 to your computer and use it in GitHub Desktop.
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