NVlabs / GA3C

Hybrid CPU/GPU implementation of the A3C algorithm for deep reinforcement learning.
BSD 3-Clause "New" or "Revised" License
649 stars 195 forks source link

How do you make your that sess.run is not run at the same time or while in use? #36

Closed silgon closed 6 years ago

silgon commented 6 years ago

This is more a question than an issue. I was looking at the code, and I realized that you use the functions like train, predict_p_and_v, predict_p and some others from file NetworkVP.py. All this functions use the method sess.run, my question is: how do you know that this code runs without a problem? I ask because as far as I can see, there's nothing controlling that sess.run is not called while another sess.run is in use. I thought that I needed to use a coordinator to do something like that. If you have a reference just to understand, that'd be great. Thanks!

ppwwyyxx commented 6 years ago

sess.run is thread safe.

silgon commented 6 years ago

Thanks for the answer. I think I can start looking for more information based on that. I also found this answer explaining that before version 10 it wasn't. I will dig more into it in order to understand why and how do you do gpu thread-safe.