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

multiprocessing + multithreading should cooperate on the number of concurrent threads #1588

Open
ttung opened this issue Sep 30, 2019 · 0 comments
Labels
feature New work
Milestone

Comments

@ttung
Copy link
Collaborator

ttung commented Sep 30, 2019

Once we support passing ImageStacks from process -> process, we need a way to coordinate how much parallelism the individual processes kick off. Each process will see a system with N cpus and start up N threads, which won't work out well.

One quick and dirty hack is to suppress multithreading when we do multiprocessing + ImageStacks. However, if one process takes a lot longer to process than the other processes, then we waste compute at the end of the processing.

Ideally, the solution is to have a centralized semaphore that each thread needs to acquire to start. Each worker process can start up N threads, but the system as a whole can only run N threads concurrently.

@ttung ttung added the feature New work label Sep 30, 2019
@shanaxel42 shanaxel42 added this to the 0.2.0 milestone Oct 7, 2019
ttung pushed a commit that referenced this issue Oct 10, 2019
We want to support multiprocessing + imagestack for two use cases:

1. algorithms that do not release the GIL do not run well under multithreading.
2. it allows us to parallelize across FOVs in an interesting way [1]

This adds a test case that we can pass an ImageStack to a child process for processing.

Note that this will not pass travis until spacetx/slicedimage#125 is landed and released.

Test plan: this is the test plan
Depends on #1586

[1] Ideally, we should make it such that the child workers cooperatively share the compute resources.  This is not done today.  See #1588 for what needs to be done next.
ttung pushed a commit that referenced this issue Oct 10, 2019
We want to support multiprocessing + imagestack for two use cases:

1. algorithms that do not release the GIL do not run well under multithreading.
2. it allows us to parallelize across FOVs in an interesting way [1]

This adds a test case that we can pass an ImageStack to a child process for processing.

Note that this will not pass travis until spacetx/slicedimage#125 is landed and released.

Test plan: this is the test plan
Depends on #1586

[1] Ideally, we should make it such that the child workers cooperatively share the compute resources.  This is not done today.  See #1588 for what needs to be done next.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New work
Projects
None yet
Development

No branches or pull requests

2 participants