Skip to content

Improve parallel performance - #177

Merged
dbrakenhoff merged 10 commits into
devfrom
improve-parallel-mp
Sep 9, 2026
Merged

dbrakenhoff merged 10 commits into
devfrom
improve-parallel-mp

Conversation

@dbrakenhoff

@dbrakenhoff dbrakenhoff commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes memory usage issues related to parallel processing. Before the entire model class was sent over to each process for each task, this quickly grew the memory used to significant amounts, especially, for larger models and lots of points at which to compute the heads.

This is now fixed by setting up a single model on each worker, then performing all calculations using those copied models.

Some additional changes:

  • tqdm is now a required dependency.
  • progress bars are shown by default but can be turned off.
  • parallel can be set to True/False or a number, if a number, use that many workers
  • better default number of workers when parallel=True

dbrakenhoff and others added 6 commits August 26, 2026 13:41
For semi-confined aquifers (ilap == 0) in steady models, the vcontour_array
method was using aq.z for z-coordinates which includes all layer boundaries
(leaky and aquifer), but the arr array only had values for aquifer layers.
This caused dimension mismatches or incorrect contour plots.

The fix builds a z array that matches the structure of the arr array:
- z[0] = top boundary (where head = hstar)
- z[1], z[3], ... = aquifer tops
- z[2], z[4], ... = aquifer bottoms

This ensures dimensions always match and the head values are properly
aligned with the z-coordinates.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- send one model copy per worker
- modify disvec signature to match head
- parallel progressbars updates per completed chunk
- add disvec_array method
@dbrakenhoff
dbrakenhoff requested a review from mbakker7 August 26, 2026 13:08
@dbrakenhoff dbrakenhoff self-assigned this Aug 26, 2026
@dbrakenhoff dbrakenhoff added the bug Something isn't working label Aug 26, 2026
- use passed in x1 if x1 is finite, otherwise compute x1 from x2 - some offset
@dbrakenhoff dbrakenhoff mentioned this pull request Sep 2, 2026
5 tasks
@mbakker7

mbakker7 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This needs to be updated with dev, right?
I tried this for a transient model, and a grid was 2-3 times faster. Nice.

@dbrakenhoff

Copy link
Copy Markdown
Contributor Author

This needs to be updated with dev, right?

Apparently there are no conflicts so i can just merge. And I'm gonna interpret your comment as an approval :)

@dbrakenhoff
dbrakenhoff merged commit 665bc86 into dev Sep 9, 2026
11 checks passed
@dbrakenhoff
dbrakenhoff deleted the improve-parallel-mp branch September 9, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants