-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[RLlib] APPO accelerate vol 02: Various enhancements. #50162
[RLlib] APPO accelerate vol 02: Various enhancements. #50162
Conversation
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Some minor nits.
# Default is to have a learner thread. | ||
if not hasattr(self, "_learner_thread_in_queue"): | ||
self._learner_thread_in_queue = deque(maxlen=self.config.learner_queue_size) | ||
|
||
# Create and start the GPU loader thread(s). | ||
if self.config.num_gpus_per_learner > 0: | ||
self._gpu_loader_threads = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's name the threads for better debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
class _GPULoaderThread(threading.Thread): | ||
def __init__( | ||
self, | ||
*, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the name argument here and pass it to super
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -166,9 +225,8 @@ def step(self): | |||
ma_batch_on_gpu = self._in_queue.sample() | |||
else: | |||
# Queue is empty: Sleep a tiny bit to avoid CPU-thrashing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually the scheduler makes a good job in providing runtime to each process. This while loop could slow things down and in worst case block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think we have to sleep here (or at least be careful with removing this logic).
The "queue" here is a deque
, which doesn't have the GIL-release logic of a Queue.get()
. Looping here with while True:
without sleeping would certainly harm performance.
…_accelerate_02_various_enhancements
Signed-off-by: sven1977 <[email protected]>
…_accelerate_02_various_enhancements
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
Signed-off-by: sven1977 <[email protected]>
APPO accelerate vol 02: Various enhancements.
ray.wait
requests.Why are these changes needed?
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.