-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Low GPU Usage #381
Comments
Hi, could you link the example here explicitly? Just to make it easier to retrieve the code. Also because there are at least two versions of it (one for the old API and one for the new). Secondly, what GPU are you running this on? Of course this plays an important part as GPUs are very diverse. Anyway, I can make some assumptions about what is going on. Low usage is could be related to a CPU or IO bottleneck, that is, generating/reading your data takes much more time than actually fitting your model on it. This is typical of reinforcement learning tasks, as data must be generated by playing games, and games are played on CPU cores. To prove the point, you may try monitoring your CPU usage during execution. A single threaded application will only show a peak on one core. On a unix machine, you can easily take a look with Finally, what can you do about it? |
Another thing I didn't mention, you can squeeze out extra usage from your GPU by adjusting the batch size (i.e. how much data is sent to the GPU at each iteration). In the example, I believe there is no batch size specified to the # Example code...
agent = DQNAgent(
...,
batch_size=64
)
# ... more example code 64 is the natural example, but you can increase it more in subsequent experiments. Keep monitoring your CPU and GPU to see how the bottlenecks evolve. Since your VRAM occupation is already high, it may not be possible for you to increase it. In this case the whole script would crash with an out of memory error. If this is the case, 32 was already your best value. |
Hi Ball-Man, Could you provide a simple example parallel implementation using TF Agents? Would be helpful for newbies like me :) Also would like to ask if you have managed to have a good random battles bot? I can't make any good ones, wonder if I am doing something wrong, but what I think is that the agent is missing the information of the possible moves the opponent could have from the random battles sets, making it play blindly until it finds each move when revealed. |
tf-agents is by far a better beginner friendly environment compared to the now ancient keras-rl, and can execute all rl algorithm code on the gpu independent of python. but, the tf-agents multiprocessing module doesnt work with poke-env. it should be possible to set up a multiprocessing pipeline however, and it so happens that this is what ill be doing next for my project. you can contact me on discord (kyma#2862) for how and if i actually achieve this. |
Thank you Kymawave for your help. @mancho2000 regarding your concerns about the random battles sets, I think you are right. With the minimal provided setup the agent is learning solely from experience. This is similar to how a human newcomer with no previous knowledge would experiment the format. Given a complex enough model and enough train time, the agent could start learning and recognizing the different sets on its own. Clearly, if we provided to the agent "a list" of the existing sets we could expect faster and better training, even though encoding such knowledge is not necessarily trivial. |
Hi! I've been using a slightly-modified version of the example OpenAI code, and I only get about 15% utilization on my GPU regardless of what step size I set. I've tried changing a few other values randomly, and nothing seems to increase my utilization. I do notice that about 75% of my VRAM is used, however.
I also wanted to know if there were plans to make a Discord server or something similar. It would be really helpful to have a community that helps each other similar to RLBot.
The text was updated successfully, but these errors were encountered: