3

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?

  • 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 Answers2

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

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Paweł D
  • 69
  • 6
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.

Using Keras & Tensorflow with AMD GPU

RaJa
  • 1,471
  • 13
  • 17