You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when num_workers=0, the parallel fn does not execute.
That makes absolute sense to me, you're telling it to execute a function with 0 threads and it does exactly that. It's the same as doing:
for i inrange(0):
print("hi")
it will do nothing 🤷♂️
num_workers<0 causes wierd output
This can probably be a quick fix by doing max(0, num_workers) (or aborting if num_workers < 0). Could you change the title of the issue to refer to that so that this can be fixed by the Mojo team ? (parallelize is not open sourced yet so I can't make a PR)
(reproducible with mojo 2024.7.2605)
SynodicMonth
changed the title
[BUG] parallelize won't run when num_workers=0
[BUG] parallelize should abort if num_workers < 0, currently it has weird behavior
Jul 27, 2024
Actually this is associated to another bug #3311, where a global variable initialized from num_performance_cores() become 0 after compile. Then the whole parallel body just don't execute.
Since num_work_items is not zero, if num_workers=0, the program would better complain it can't excecute instead of just don't execute.
Or we should clarify this in the doc and let the user to add some check.
Bug description
when num_workers=0, the parallel fn does not execute.
Steps to reproduce
Also,
num_workers<0 causes wierd output
when num_workers=-1:
when num_workers=-2:
System information
The text was updated successfully, but these errors were encountered: