-
Notifications
You must be signed in to change notification settings - Fork 22
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
[Peer Review] Add progress monitoring #5
Comments
Many tries have been made to exchange progress information among threads during numba jit parallelism, which is necessary to print the overall progress, in particular, for the |
It is also attempted to use only one of the threads to print the progress as the estimation to the overall progress by using |
Interesting discussion, one I've been following for some time (across other threads). In my case I've been using a manual progress bar (just hash symbols printed as strings from no python mode) and when in parallelised mode it scrambles the order, e.g.: | | 0.0 %
|############################ | 87.87 %
|######################## | 75.75 %
|################ | 51.51 %
|#################### | 63.63 % Though I suppose this still gives some indication that something is happening. One way to give some sense of progress might be to change the progress bar to read something like "one of x number of batches has been completed..." instead of an explicit percentage and progress bar. Edit: Batches probably wouldn't work as the iterations triggering the update are probably fairly arbitrary...? |
Hi @songololo, thanks for your comment! That's a good idea and I've tried something similar along this line. But as you've pointed out at the end, there's some issue with the scheduling being random. And also the main issue that hold this kind of counting base approach back is due to inability to communicate progress information across threads during parallel execution in Numba, as briefly discussed above. So it is at the moment impossible to get an overall progress by counting the number of iterations done across all threads. With that being said, we could instead monitor the progress in each thread separately, and output similarly "x% of iterations completed in thread i / N", where i is the thread id and N is the total number of threads. However this makes the monitoring very messy and might not be a good idea to do so. One work around is to flush out previous prints whenever next monitoring message is being printed. But the flushing option is not currently supported by Numba |
@RemyLau I don't fully understand the i.e. just making peace with a not-so-nice progress bar that doesn't flush between prints? |
@songololo so the main idea of the Update: after some more searching, it seems like Update on
|
@RemyLau thanks, this makes sense compared to what I've experienced with plotting progress from For example, I've now switched to really simple updates which report a non-sequential bundle number:
From a function which looks like this: @njit(cache=False)
def progress_bar(current: int, total: int, steps: int = 20):
'''
Printing carries a performance penalty
Cache has to be set to false per Numba issue:
https://github.com/numba/numba/issues/3555
TODO: set cache to True once resolved
'''
if steps == 0:
return
step_size = int(total / steps)
if step_size == 0:
return
if current % step_size == 0:
chunk = round(current / step_size) + 1
print('Completed non-sequential bundle', chunk, 'of', steps) and called like this: for idx in prange(n):
# numba no object mode can only handle basic printing
# note that progress bar adds a performance penalty
if not suppress_progress:
progress_bar(idx, n, steps) Not very pretty but at least it gives a sense of progress! 🤣 |
Thanks for the suggestion @songololo! I've just pushed some changes (see commit:9c6ca6f
I guess the couple other things that I'll do right after is to add progress bar to the preprocessing phase for |
Interesting approach! Thanks for sharing. |
For small graphs like BioGRID, it might be reasonable to wait for 30 seconds or so in the different steps, but as the graphs start getting large and training time gets into the minutes/hours, it would be nice to communicate progress to the user.
I would normally suggest using tqdm, but after modifying the code myself, it doesn't look like it plays nicely with numba's parallelization. I found this thread: numba/numba#4267 that describes the issue a bit more in detail, and the outlook is a bit grim.
It's not a dealbreaker, but it would make your package much more user friendly.
The text was updated successfully, but these errors were encountered: