Allow MPI variables to be optional#1456
Allow MPI variables to be optional#1456vishalbh wants to merge 1 commit intoGoogleCloudPlatform:developfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the configurability of the system by making key MPI-related variables optional. This change addresses scenarios where MPI might not be in use, preventing unnecessary variable definitions and potential configuration errors. The system now dynamically determines the need for MPI variable definition based on executable usage, leading to a more robust and adaptable framework. Supporting test cases have been adjusted to validate this new behavior. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request makes MPI-related variables like n_ranks, n_nodes, and processes_per_node optional. The logic is updated to only define these variables if an MPI command is actually used in an experiment. This is a great change for flexibility, especially for non-MPI workloads. The tests have been updated accordingly to reflect this change. I've found one critical issue in the implementation that needs to be addressed.
var/ramble/repos/builtin/base_classes/application-base/base_class.py
Outdated
Show resolved
Hide resolved
|
/gcbrun |
|
/gcbrun |
1 similar comment
|
/gcbrun |
| self.define_variable(var_name, value) | ||
|
|
||
| define_mpi_vars() | ||
| is_mpi_in_use = False |
There was a problem hiding this comment.
Can we make a helper method in the class to return if MPI is required for the workload, and then call it here?
|
|
||
| workspace( | ||
| "generate-config", "gromacs", "-p", "spack", "--wf", "water_*", global_args=global_args | ||
| "generate-config", |
There was a problem hiding this comment.
Instead of editing the tests, can we use the helper method that I mentioned below in the base class, and then conditionally defined these in workspace.add_experiments rather than setting them explicitly here?
The main reason is because we want the user experience from generate-config or workspace manage experiments to be that users get a mostly functional workspace when they run these. And we should be able to identify if we need to define the MPI vars or not when they are creating experiments.
There was a problem hiding this comment.
Another option actually is to write two helper functions. One to determine if MPI is required, and another to update the keywords to make the MPI variables required (if MPI is required).
Then this code:
https://github.com/GoogleCloudPlatform/ramble/blob/develop/lib/ramble/ramble/workspace/workspace.py#L1352
should automatically handle defining them.
6e3d1a0 to
ce69e73
Compare
076d887 to
96b6700
Compare
|
/gcbrun |
|
/Gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors how MPI-related variables are handled within the Ramble framework, making n_ranks, n_nodes, and processes_per_node optional by default and dynamically marking them as required when MPI is detected for a workload. It introduces new methods for checking and requiring MPI variables and improves error handling for undefined workloads by catching WorkloadNotDefinedError. The review identified several areas for improvement, including replacing silent try...except Exception: pass blocks with more specific error handling or logging, removing unused code (make_keys_required method), and cleaning up debugging print statements and commented-out code in test files.
var/ramble/repos/builtin/base_classes/application-base/base_class.py
Outdated
Show resolved
Hide resolved
|
/gcbrun |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request modifies the requirement status of MPI-related keywords, making n_ranks, n_nodes, and processes_per_node optional by default and introducing logic to enforce them only when a workload requires MPI. It also improves error handling by replacing terminal log calls with a new WorkloadNotDefinedError and updates the workspace logic to handle version validation more gracefully during experiment addition. Feedback was provided to improve the readability of the is_mpi_required method by combining nested conditional statements.
var/ramble/repos/builtin/base_classes/application-base/base_class.py
Outdated
Show resolved
Hide resolved
|
/gcbrun |
No description provided.