Skip to content

remove redundant pool.wait()

I think there is some misunderstanding of how the worker threads are initialised. The instructions at https://schwimmbad.readthedocs.io/en/latest/examples/index.html#using-mpipool are most likely wrong.

The lines of code for the worker tasks

if not pool.is_master():
    pool.wait()

is never actually executed, because the __init__ function of MPIPool already has these lines in it. So the worker tasks wait and execute in __init__ and then call sys.exit(0) once the pool is closed, and never get to any of the subsequent code. This isn’t a big deal, because the code still behaves as you’d expect, and has no effect on performance or the results. It’s just not doing what the author of those lines intended.

It should be sufficient to replace those lines with

if pool.is_master():

Just wanted to bring this to your attention - doesn't make any practical difference whether it's implemented or not.

Merge request reports

Loading