I am running some Keras/tensorflow code in python on my MacBook Pro with Radeon Pro 560X 4096 MB and Intel UHD Graphics 630 1536 MB. What do I have to do to use the graphics cards in running the neural network code?
Asked
Active
Viewed 2,340 times
3
-
You would need to use this version of tensorflow, if it supports your GPU: https://github.com/ROCmSoftwarePlatform/tensorflow-upstream – Dr. Snoopy Mar 04 '19 at 10:25
2 Answers
3
If you are running Keras, then you can use PlaidML as a backend: https://github.com/plaidml/plaidml
Installation is as easy as:
virtualenv plaidml
source plaidml/bin/activate
pip install plaidml-keras plaidbench
Then you need to run setup (to select default processor):
plaidml-setup
Then you need to add:
import os
os.environ["KERAS_BACKEND"] = "plaidml.keras.backend"
At the beginning of your script.
Best
-
is it a must to use virtualenv? if i don't use virtualenv, does this affect my other python programming? – yts61 Nov 05 '20 at 11:02
-
0
If you want to stick to Tensorflow then you need to compile TensorFlow on your own machine so that it works with OpenCL. Otherwise, it will only work with CUDA which is restricted to NVidia.

RaJa
- 1,471
- 13
- 17