Make setDVsFromHistory parallel safe - #489
Open
timryanb wants to merge 3 commits into
Open
Conversation
…oc only The method opened the SQLite-backed history file (via SqliteDict) on every processor that executed it. SQLite takes POSIX fcntl() locks, so on network filesystems (e.g. NFS scratch on HPC clusters) this meant every rank taking file locks on the same file through the NFS lock manager, which can block indefinitely and hang the whole job before the optimizer starts. Now only the root processor opens the history file and the resulting DVs (or any exception, to avoid deadlocking the collective) are broadcast to all processors, mirroring the rank-0 guard already used in Optimizer._setHistory. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #489 +/- ##
=======================================
Coverage 54.22% 54.22%
=======================================
Files 1 1
Lines 225 225
=======================================
Hits 122 122
Misses 103 103 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or 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.
Purpose
Modify
setDVsFromHistorymethod to read the history file on the root proc only.The method opened the SQLite-backed history file (via SqliteDict) on every processor that executed it. SQLite takes POSIX fcntl() locks, so on network filesystems (e.g. NFS scratch on HPC clusters) this meant every rank taking file locks on the same file through the NFS lock manager, which can bottleneck and hang the whole job before the optimizer starts.
Now only the root processor opens the history file and the resulting DVs (or any exception, to avoid deadlocking the collective) are broadcast to all processors, mirroring the rank-0 guard already used in Optimizer._setHistory.
Expected time until merged
1 week
Type of change
run optProb.setDVsFromHistory on any sqlite history file in parallel.
Testing
Checklist
ruff checkandruff formatto make sure the Python code adheres to PEP-8 and is consistently formattedfprettifyor C/C++ code withclang-formatas applicable