Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to effectively make use of a GPU for reinforcement learning?

Recently i looked into reinforcement learning and there was one question bugging me, that i could not find an answer for: How is training effectively done using GPUs? To my understanding constant interaction with an environment is required, which for me seems like a huge bottleneck, since this task is often non-mathematical / non-parallelizable. Yet for example Alpha Go uses multiple TPUs/GPUs. So how are they doing it?

like image 465
Konstantin Avatar asked Mar 08 '18 13:03

Konstantin


People also ask

Does reinforcement learning need GPU?

Traditional deep reinforcement learning uses a combination of CPU and GPU computing resources, requiring significant data transfers back and forth.

Can I use my GPU for machine learning?

GPUs can perform multiple, simultaneous computations. This enables the distribution of training processes and can significantly speed machine learning operations. With GPUs, you can accumulate many cores that use fewer resources without sacrificing efficiency or power.

How much GPU is enough for deep learning?

While the number of GPUs for a deep learning workstation may change based on which you spring for, in general, trying to maximize the amount you can have connected to your deep learning model is ideal. Starting with at least four GPUs for deep learning is going to be your best bet.


1 Answers

Indeed, you will often have interactions with the environment in between learning steps, which will often be better off running on CPU than GPU. So, if your code for taking actions and your code for running an update / learning step are very fast (as in, for example, tabular RL algorithms), it won't be worth the effort of trying to get those on the GPU.

However, when you have a big neural network, that you need to go through whenever you select an action or run a learning step (as is the case in most of the Deep Reinforcement Learning approaches that are popular these days), the speedup of running these on GPU instead of CPU is often enough for it to be worth the effort of running them on GPU (even if it means you're quite regularly ''switching'' between CPU and GPU, and may need to copy some things from RAM to VRAM or the other way around).

like image 143
Dennis Soemers Avatar answered Oct 16 '22 03:10

Dennis Soemers