'How can I run tensorflow without GPU?

My system has a GPU.

When I run Tensorflow on it, TF automatically detects GPU and starts running the thread on the GPU.

How can I change this?

I.e. how can I run Tensorflow without GPU?



Solution 1:[1]

It should work. It mainly disables the CUDA device. So, the code looks for other sources (CPU) to run the code.

import os
import tensorflow as tf
#os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" #If the line below doesn't work, uncomment this line (make sure to comment the line below); it should help.
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
#Your Code Here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1