-
Notifications
You must be signed in to change notification settings - Fork 62
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
Adding loopTool to analysis tools #1098
Conversation
else: | ||
return {key: loop_value} | ||
|
||
def setup_multi_processing(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use the parallel manager to setup parallel computing. It has logic for how to handle concurrent futures or MPI depending on the user specification and conda environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for the loopTool, as it needs to know if its running with MPI or not for when handling file saving (e.g. getting rank 0), other wise it setups number of subprocess and passes it to parameter sweep tool, which sets up its own parallel management.
Furthermore, number of subprocesses is only auto defined by looptool, if user does not provide a number them self, as it always opts to run in parallel, this is not the case in parameter sweep tool. We can change this behavior in parametersweep tool (e.g. always revert to multi-processing and auto define number of subprocesses based on available resources). Either way is fine, but the loopTool should not handle the logic for how paramterSweep tool handles multiprocessing, it should just instruct it on what should be done.
watertap/tools/analysis_tools/loop_tool/tests/test_expected_diff_directory.yaml
Outdated
Show resolved
Hide resolved
watertap/tools/analysis_tools/loop_tool/tests/test_expected_sweep_directory.yaml
Outdated
Show resolved
Hide resolved
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1098 +/- ##
========================================
Coverage 94.92% 94.93%
========================================
Files 331 333 +2
Lines 32501 32950 +449
========================================
+ Hits 30852 31280 +428
- Misses 1649 1670 +21
☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here. |
PR#1102 adds managment for num of subprocess for ray io when running on cluster
not really needed can be done in place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some comments from a first pass. I didn't go through all the details just yet but plan to do a second, more thorough pass.
"nominal_lb": values["nominal_lb"], | ||
"nominal_ub": values["nominal_ub"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't these point to nominal_lb
and nominal_ub
based on the logic above regarding diff_mode
being precentile
or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes fixed that in next commit.
Co-authored-by: Adam Atia <aatia@keylogic.com>
Co-authored-by: Adam Atia <aatia@keylogic.com>
Co-authored-by: Adam Atia <aatia@keylogic.com>
Co-authored-by: Adam Atia <aatia@keylogic.com>
Co-authored-by: Adam Atia <aatia@keylogic.com>
Co-authored-by: Adam Atia <aatia@keylogic.com>
docs/how_to_guides/how_to_use_loopTool_to_explore_flowsheets.rst
Outdated
Show resolved
Hide resolved
docs/how_to_guides/how_to_use_loopTool_to_explore_flowsheets.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com>
Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com>
Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com>
Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com>
Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com>
Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com>
Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com>
Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com>
# with open("test_expected_diff_directory.yaml", "w") as file: | ||
# documents = yaml.dump(lp.sweep_directory, file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# with open("test_expected_diff_directory.yaml", "w") as file: | |
# documents = yaml.dump(lp.sweep_directory, file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to leave these in, so its easy to recreate the test file in the future. (You can't really create it manually)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already a big PR so it may be fine to make changes in subsequent PRs.
outputs[key] = model.find_component(pyo_object) | ||
return outputs | ||
|
||
def run_parameter_sweep(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of constructing the keyword argument dictionary here and constructing the parameter sweep object, can we call the parameter_sweep function? Same goes for the differential parameter sweep function later in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to use the ps API directly, as some options are not available in parmenter functions (Which IMO should be depreciated, not sure why we even have that). (such as custom_function and custom_function_kwargs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find notable issues. Approving at this point. Maybe we count on more testing of them in future's practices.
* merged LoopTool from Analysis * updated diff test * add_diff_fixed_names * Update loopTool.rst * Update index.rst * fixed tests * Fixing file pathing, using abspath(__file__) * fixed covecod for diff_spec, and pathing in test files * switched to useing parallel manager to get mpi config PRwatertap-org/watertap#1102 adds managment for num of subprocess for ray io when running on cluster * simplify mpi check * Remove setup_multi_processing not really needed can be done in place * Update docs/technical_reference/tools/loopTool.rst Co-authored-by: Adam Atia <aatia@keylogic.com> * Update docs/technical_reference/tools/loopTool.rst Co-authored-by: Adam Atia <aatia@keylogic.com> * Update docs/technical_reference/tools/loopTool.rst Co-authored-by: Adam Atia <aatia@keylogic.com> * Update docs/technical_reference/tools/loopTool.rst Co-authored-by: Adam Atia <aatia@keylogic.com> * Update docs/technical_reference/tools/loopTool.rst Co-authored-by: Adam Atia <aatia@keylogic.com> * Update docs/technical_reference/tools/loopTool.rst Co-authored-by: Adam Atia <aatia@keylogic.com> * Update docs/technical_reference/tools/loopTool.rst Co-authored-by: Adam Atia <aatia@keylogic.com> * update watertap-org/watertap#1 to match new async setup * updarted tests to reader and small fixes throughout * added additonal tests * Update test_data_merging_tool.py * moved doc to howto as it seems better place for it * Update index.rst * Removed legacy code, added additional tests, added MPI test * Update mpi4py-test.yml * mpi fix try watertap-org/watertap#1 * Fixing MPI test * Fixed MPI rank * Clean up and changes to MPI rank * update doc and added outputs and tests * cleaned up sim_csaes and added key tests for yaml config file * Update mpi4py-test.yml * Update docs/how_to_guides/how_to_use_loopTool_to_explore_flowsheets.rst Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> * Update watertap/tools/analysis_tools/loop_tool/loop_tool.py Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> * Update watertap/tools/analysis_tools/loop_tool/loop_tool.py Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> * Update docs/how_to_guides/how_to_use_loopTool_to_explore_flowsheets.rst Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> * Update watertap/tools/analysis_tools/loop_tool/loop_tool.py Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> * Update watertap/tools/analysis_tools/loop_tool/loop_tool.py Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> * Update watertap/tools/analysis_tools/loop_tool/loop_tool.py Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> * Update watertap/tools/analysis_tools/loop_tool/tests/test_loop_tool.py Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> * updates to loopt tool * Update test_loop_tool.py * Update test_loop_tool.py * Update loop_tool.py --------- Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> Co-authored-by: bknueven <30801372+bknueven@users.noreply.github.com> Co-authored-by: Adam Atia <aatia@keylogic.com>
Fixes/Resolves:
This is PR includes the complete loopTool that uses current WaterTAP parametr sweep tool.
The PR includes the full loopTool and documentation.
-Support parameter sweeps
-Support differential parameter sweeps
Currently, the loopTool is not setup to run tests in parallel due to ongoing work of adding a parallel manager, this will need to be updated later on.
(replace this with the issue # fixed or resolved, if no issue exists then a brief statement of what this PR does)
Summary/Motivation:
Changes proposed in this PR:
Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: