ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

GPU not active.

Open fast8wild opened this issue 8 years ago • 7 comments

So over the course of trying to solve certain performance issues, I noticed through task manager that my GPU was barely doing any processes. Is this how it is supposed to be or am I missing something in order to maximize my performance?

fast8wild avatar Jan 09 '18 16:01 fast8wild

Are you talking about the training or game performance?

Concerning the training, I suspect that this repo's PPO implementation doesn't support GPUs. However, OpenAI published GPU supported PPO implementation a couple of weeks ago.

Also, I'm not quiet sure if a GPU is really capable of accelerating training progress for reinforcement learning problems. At least for the given environment examples. A GPU is strong on training very large batches of data. If the batches are too small, the GPU will be slower than the CPU.

MarcoMeter avatar Jan 09 '18 16:01 MarcoMeter

Yeah I was talking about training. In my scenario I do have quite a large batches of data, so ill see if I can get any leverage out of OpenAI's PPO implementation. Though not gonna lie I am a bit clueless as to how to utilize said PPO. is it just a matter of placing it in the python directory or are there extra steps?

fast8wild avatar Jan 09 '18 16:01 fast8wild

The PPO implementation does indeed use the GPU. As @MarcoMeter mentioned, RL algorithms are unfortunatly inherently inefficient when utilizing GPU. GPUs are best utilized when doing large batches of gradient descent. The issue is that most wall-clock time is spent doing inference within the simulation, which utilizes relatively little GPU. When enough data is collected, then the GPU utilization will go up for the actual gradient descent phase.

Given that PPO is an online algorithm, we have to sequentially perform data collection and training on the data, so we can't parallelize them to get better GPU usage. Of course I am sure there are schemes which would allow for better utilization, which I am open to pursuing in the future.

awjuliani avatar Jan 09 '18 19:01 awjuliani

Is it possible to disable the GPU completely?

I didn't find any reference in the code so far which could be modified. I've got an environment where a batch size of 8 (even a batch size of 1) gets the best training results and that runs extremely slow (likely due to the GPU).

3 discrete actions Gamma 0.99 Lambda 0.95 Time Horizon 2048 Beta 1.00E-03 Epoch 3 Epsilon 0.2 Buffer Size 4096 Learning Rate 3.00E-04 Hidden Units 30 Num Layers 1 Batch Size 8

MarcoMeter avatar Jan 10 '18 21:01 MarcoMeter

@MarcoMeter, You can wrap the graph creating in models.py with with tf.device('/cpu:0'):, and that will ensure the CPU is used instead of the GPU.

awjuliani avatar Jan 10 '18 21:01 awjuliani

Thanks, I'll try that. Initially I was searching for device references but couldn't find them.

MarcoMeter avatar Jan 10 '18 21:01 MarcoMeter

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 03 '20 15:01 lock[bot]