PWhiddy / PokemonRedExperiments

Playing Pokemon Red with Reinforcement Learning
MIT License
6.88k stars 629 forks source link

How to change GPU #165

Closed jonthers closed 8 months ago

jonthers commented 8 months ago

Hi, I have two GPUs: the core GPU (GPU 0) and a dedicated NVIDIA (GPU 1). I am seeing in the Windows task manager that runs in this graph which I feel is inefficient. How could I change it?

PWhiddy commented 8 months ago

pytorch can only use an nvidia gpu. If you have a nvidia gpu available and cuda installed, stable baselines will automatically use it. Note that even if your nvidia GPU is being used, it won't show a particularly high utilization because running the gameboy emulator is also a bottleneck for this RL training.

jonthers commented 8 months ago

Screenshot (592) Screenshot (591)

jonthers commented 8 months ago

I am running the script normally and this is the use I have in the graphs. The 128MB vram Xe Graphics Intel is being used every time I run the script. and NVIDIA is at 0 in all its sectors

PWhiddy commented 8 months ago

If you run python and do

import torch
torch.cuda.is_available()

You can see if your pytorch installation has your cuda gpu available. If this shows false, try following instructions to install pytorch with cuda support on windows. https://pytorch.org/get-started/locally/ Once the above commands^ come back with "true", then you can try running the training again.

jonthers commented 8 months ago

Perfect! Thanks! image