This is an old revision of the document!
Table of Contents
TensorFlow is a open-source machine learning framework mainly developed by Google. It can be used for verious machine learning tasks, e.g. deep learning. TensorFlow provides a high level API in python and other languages and is can run on CPUs as well as GPUs.
module load python/3.5.1 virtualenv <your_virtual_env> cd <your_virtual_env> source bin/activate pip install --upgrade pip pip install tensorflow-gpu==1.12.0
If you do not want to use GPUs simply replace the last line with
pip install tensorflow
Testing the installation
To run TensorFlow on GPUs, load the correct modules and submit a job to the gpu queue.
#!/bin/bash #SBATCH -p gpu #SBATCH -t 1 #SBATCH --gres=gpu:1 module load cuda90/toolkit/9.0.176 module load cuda90/blas/9.0.176 module load cudnn/90v7.3.1 python tftest.py
import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello))
The out-ID.txt file should contain
The output (if any) follows: b'Hello, TensorFlow!'
and the err-ID.txt file contains information about the GPUs selected.
Testing CPU only installation
If you want to test a CPU only installation, you can just run the tftest.py on a login node.
You can now use TensorFlow in your python scripts. Please read Running Jobs (for experienced Users)#gpu_selection for more information about GPU usage.