Can't get Ray to use my GPU

Hey guys,

I’m trying to my SAC agent to run on my GPU but Ray doesn’t seem to find it. Here’s some test code I used:

import ray
from ray.rllib.agents.sac import SACTrainer, DEFAULT_CONFIG

ray.init()

config = DEFAULT_CONFIG
config["num_gpus"] = 1

trainer = SACTrainer(env='Pendulum-v1', config=config,)

and here’s the error output

RuntimeError: Found 0 GPUs on your machine (GPU devices found: [])! If your machine
    does not have any GPUs, you should set the config keys `num_gpus` and
    `num_gpus_per_worker` to 0 (they may be set to 1 by default for your
    particular RL algorithm).
To change the config for the `rllib train|rollout` command, use
  `--config={'[key]': '[value]'}` on the command line.
To change the config for `tune.run()` in a script: Modify the python dict
  passed to `tune.run(config=[...])`.
To change the config for an RLlib Trainer instance: Modify the python dict
  passed to the Trainer's constructor, e.g. `PPOTrainer(config=[...])`.

Specs:

  • OS: Windows 10
  • GPU: NVIDIA RTX3070ti (Driver 512.77)
  • Ray version: 1.12.0

Did you check if the underlying framework is using the GPU first?

For example in TensorFlow: run python -c “import tensorflow as tf; tf.zeros((1000,1000))” and check at your GPU vram to see if it increases.

1 Like

Looks like there’s no increase of my VRAM. Also I ran this test and got nothing:

import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
Num GPUs Available:  0

Edit:
Currently using TF 2.8.0

Well this has nothing to do with ray then = ) I suggest you do a clean install of TensorFlow. You need cuda and cudnn etc GPU support  |  TensorFlow.

I would also suggest a dual boot on ubuntu. You will get more support and compatibility on ubuntu than window.

1 Like

Thanks ! Sadly the custom env that I’m working with only runs on Win10 :sweat:

@Stale_neutrino At first install proper CUDA and cuDNN versions for you tensorflow version.
https://www.tensorflow.org/install/source?hl=en#gpu

How to do that:
https://medium.com/geekculture/install-cuda-and-cudnn-on-windows-linux-52d1501a8805

1 Like