Home > Back-end >  How can I run tensorflow without GPU?
How can I run tensorflow without GPU?

Time:11-25

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?

CodePudding user response:

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 it doesn't work, uncomment this line; it should help.
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
#Your Code Here
  • Related