Skip to content
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

imap in SerialPool and MPIPool #18

Open
edwardreed81 opened this issue Nov 8, 2017 · 2 comments
Open

imap in SerialPool and MPIPool #18

edwardreed81 opened this issue Nov 8, 2017 · 2 comments

Comments

@edwardreed81
Copy link

It'd be sweet if imap was implemented in MPIPool and SerialPool like in MultiPool (inherited) so that I could get a progress bar for big jobs using tqdm.

Right now I'm using:

with schwimmbad.choose_pool(mpi=args.mpi, processes=args.np) as pool:
    # make it so we can use imap in serial and mpi mode
    if not isinstance(pool, schwimmbad.MultiPool):
        pool.imap = pool.map
    main(pool)

and

with tqdm(total=nmc) as pbar:
    for i, d in enumerate(pool.imap(worker, arg_gen)):
        dat.append(d)
        pbar.update()

This works fine for SerialPool since map doesn't block (I guess?), but when using MPI it doesn't update the progress bar until it is entirely finished.

Previously I had MPI implemented just using mpi4py directly and was able to get the behavior I wanted, but I like the idea of using a single code for all possible run scenarios.

@vsmagalhaes
Copy link

I am also interested in this enhancement, is there any progress on this?

Best

@AlecThomson
Copy link

+1 on this feature. Would really love to have it for tqdm usage. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants