-
Notifications
You must be signed in to change notification settings - Fork 87
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
Concurrent execution of workflow steps #544
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR implements concurrent processing of the main steps in the
.detect
workflow. Alongside this there are several other major changes including moving all the matched-filter components out ofcore.matched_filter.matched_filter
to focus on thetribe.detect
method. Thematched_filter
function has been retained, but it simply creates aTribe
internally and runs thetribe.detect
method.Fundamentally this PR breaks the workflow down into the following steps:
0. Downloading data (if running
.client_detect
, which I recommend)Detections
Party
Party
Each step as listed runs in it's own process, except steps 0 and 1, which run together when using
.client_detect
, and 0 is not run when using.detect
. Communication between steps is via multiprocessing Queues. Steps will wait until data are available in their incoming queue, then work on those data and put them into their output queue which forms the input queue for the following step. Steps loop until they getNone
from the input queue, used to signify the end of processing..detect
supports passing a queue as input, or aStream
. This means that if users do not want to use a client to get their data, they can provide a simple queue that might look something like:As currently implemented, only step 3, correlate and detect peaks, runs in the
MainProcess
. This enables this step to make use of multiprocessing if needed, and provides more safety for openmp threading in underlying C-functions. I attempted to move peak finding into its own Process, but found that putting the large arrays of cross-correlation sums into the Queue was prohibitively slow, and there is a strong risk of exceeding queue size. I also tried saving these and reading them back in in another process, but again, saving them to disk was too slow.Minor changes:
_spike_test
is now threaded for speed.Detection
objects provide a more helpful error when the correlation value exceeds the number of channels. I have only ever seen this happen for fmf correlations.Party
additional has been sped upmulti_find_peaks
now usesmultithreading
rather than openmp C threading. I found this was faster and safer on my machine (see pytest fixtures in correlate_test alter omp threads #543).Why was it initiated? Any relevant Issues?
Concurrent processing should enable us to more heavily load systems, which should please HPC admins... This PR speeds up EQcorrscan for large datasets, and should enable much better GPU utilisation when using the FMF backend.
PR Checklist
develop
base branch selected?CHANGES.md
.- [ ] First time contributors have added your name toCONTRIBUTORS.md
.TODO:
input_xx_queue
,output_yy_queue
)- [ ] type-hints