-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix restaring from files not containing the derefinement counter (from #1073) #1089
Changes from 7 commits
e560ea7
5e25fc0
32c6141
54f6daa
5bfdfbe
320ef1e
bceceeb
52035a6
28775f7
f79ab08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,16 @@ RestartReaderHDF5::MeshInfo RestartReaderHDF5::GetMeshInfo() const { | |
mesh_info.level_gid_lid_cnghost_gflag = | ||
ReadDataset<int>("/Blocks/loc.level-gid-lid-cnghost-gflag"); | ||
|
||
try { | ||
mesh_info.derefinement_count = ReadDataset<int>("/Blocks/derefinement_count"); | ||
} catch (const std::runtime_error &e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. knowing HDF5 I bet there's voluminous output here... I'm fine with this solution, but if we wanted to reduce the amount that HDF5 complains, you could instead check for the existence of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly, I am a little confused by the output. The beginning of // make sure dataset exists
auto status = PARTHENON_HDF5_CHECK(H5Oexists_by_name(fh_, name.c_str(), H5P_DEFAULT));
PARTHENON_REQUIRE_THROWS(
status > 0, "Dataset '" + name + "' does not exist in HDF5 file " + filename_); and that throw is what I am catching here I think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah. That makes sense. In which case yeah I wouldn't expect HDF5 to complain at all. Bizarre. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah in that case disregard my suggestion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am going to leave it as is for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that the (quite extensive) error message is printed by every rank, I now went for the |
||
// File does not contain this dataset, so must be older. Set to default value of zero | ||
PARTHENON_WARN( | ||
"Restarting from an HDF5 file that doesn't contain /Blocks/derefinement_count. \n" | ||
"If you are running with AMR, this may cause restarts to not be bitwise exact \n" | ||
"with simulations that are run without restarting."); | ||
lroberts36 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mesh_info.derefinement_count = std::vector<int>(mesh_info.nbtotal, 0); | ||
} | ||
return mesh_info; | ||
} | ||
|
||
|
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.
Shall we always write (i..e, a bunch of zeros for static runs) or move the
if (pm->pmr)
fromComputeDerefinementCount
here to only write the deref counter for multilevel sims?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 kind of lean towards always writing to file, with or without refinement, just to keep the structure of the files the same. I think this should happen with things written as they are now.