Skip to content
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

remove ParthenonInit and add docs #930

Merged
merged 6 commits into from
Sep 21, 2023
Merged

Conversation

Yurlungur
Copy link
Collaborator

@Yurlungur Yurlungur commented Aug 24, 2023

PR Summary

Based on the discussion in #929 , it seems like it might be a good idea to remove the ParthenonManager::ParthenonInit function. This PR does so. I also add documentation on ParthenonManager, which I couldn't otherwise find.

This is a breaking change. I would like the go-ahead from downstream codes before merging this.

PR Checklist

  • Code passes cpplint
  • New features are documented.
  • Adds a test for any bugs fixed. Adds tests for new features.
  • Code is formatted
  • Changes are summarized in CHANGELOG.md
  • CI has been triggered on Darwin for performance regression tests.
  • Docs build
  • (@lanl.gov employees) Update copyright on changed files

@Yurlungur Yurlungur added documentation Improvements or additions to documentation refactor An improvement to existing code. labels Aug 24, 2023
@Yurlungur Yurlungur self-assigned this Aug 24, 2023
Copy link
Collaborator

@lroberts36 lroberts36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM.

Comment on lines +43 to +45
ParthenonStatus ParthenonManager::ParthenonInitEnv(int argc, char *argv[]) {
if (called_init_env_) {
PARTHENON_THROW("ParthenonInitEnv called twice!");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice.

Comment on lines +145 to +149
if (called_init_packages_and_mesh_) {
PARTHENON_THROW("Called ParthenonInitPackagesAndMesh twice!");
}
called_init_packages_and_mesh_ = true;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice.

Copy link
Collaborator

@bprather bprather left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'd have done static vars with function scope but this is more flexible. Could see e.g. erroring in driver.Execute if init wasn't called, or other hand-holding like that if there are common errors. It also allows multiple ParthenonManagers I guess, though I'm not sure MPI & Kokkos would react well to that anyway.

For my own edification: are there other reasons to prefer members?

@Yurlungur
Copy link
Collaborator Author

LGTM. I'd have done static vars with function scope but this is more flexible. Could see e.g. erroring in driver.Execute if init wasn't called, or other hand-holding like that if there are common errors. It also allows multiple ParthenonManagers I guess, though I'm not sure MPI & Kokkos would react well to that anyway.

For my own edification: are there other reasons to prefer members?

To be honest, I didn't think about it very hard. Members seemed natural and easy to reason about, since the object is already stateful. If people prefer statics, that's fine with me.

@Yurlungur Yurlungur linked an issue Aug 25, 2023 that may be closed by this pull request
@Yurlungur
Copy link
Collaborator Author

Ping someone from AthenaPK @BenWibking @forrestglines @pgrete . Can we merge this in?

Copy link
Collaborator

@forrestglines forrestglines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that this PR works for AthenaPK (Had some unrelated trouble with ctest on Frontier since apparently the python script couldn't find the generated outputs in the filesystem).


ParthenonStatus ParthenonManager::ParthenonInitEnv(int argc, char *argv[]) {
// initialize MPI
#ifdef MPI_PARALLEL
if (MPI_SUCCESS != MPI_Init(&argc, &argv)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we'd like to optionally start withMPI_Init_thread which is apparently required by HDF5 subfiling. Another time and PR though

@pgrete pgrete enabled auto-merge (squash) September 21, 2023 17:04
@pgrete pgrete merged commit 86f454d into develop Sep 21, 2023
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaks-downstream documentation Improvements or additions to documentation refactor An improvement to existing code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does anyone use ParthenonInit
6 participants