You can use only CPUs by openning a session with a GPU limit of 0:
sess = tf.Session(config=tf.ConfigProto(device_count={'GPU': 0}))
See https://www.tensorflow.org/api_docs/python/tf/ConfigProto for more details.
A proof that it works for @Nicolas:
In Python, write:
import tensorflow as tf
sess_cpu = tf.Session(config=tf.ConfigProto(device_count={'GPU': 0}))
Then in a terminal:
nvidia-smi
You will see something like:
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 24869 C /.../python 99MiB |
+-----------------------------------------------------------------------------+
Then repeat the process:
In Python, write:
import tensorflow as tf
sess_gpu = tf.Session()
Then in a terminal:
nvidia-smi
You will see something like:
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 25900 C /.../python 5775MiB |
+-----------------------------------------------------------------------------+