4

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?

user366312
  • 16,949
  • 65
  • 235
  • 452
  • 1
    in terms of configuration I am not aware but you can use google colab. – raviraj Nov 25 '21 at 06:04
  • 1
    Did you follow this [thread](https://stackoverflow.com/questions/40690598/can-keras-with-tensorflow-backend-be-forced-to-use-cpu-or-gpu-at-will) ? – Kalana Nov 25 '21 at 06:20

1 Answers1

5

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
Joyanta J. Mondal
  • 888
  • 1
  • 8
  • 20