-
Notifications
You must be signed in to change notification settings - Fork 13
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
WIP: MPI-ify the dynamics #663
base: slicer
Are you sure you want to change the base?
Conversation
fdb3f12
to
a382d9f
Compare
a382d9f
to
a07e699
Compare
a07e699
to
88f9e68
Compare
add metadata info for periodic and non-periodic neighbours i.e., halo sizes, starting indices etc. add an associated unit test to check values are read correctly from file.
88f9e68
to
63e6f77
Compare
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.
Looks great, thanks @TomMelt. I drew a diagram and convinced myself that the numbers in the CDL files are consistent with the expected values in the tests. I have a couple of suggestions, the main one being a bit of refactoring to avoid duplication.
// this metadata should be identical to the Closed Boundary version so we check it again | ||
if (test_rank == 0) { | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::LEFT].size() == 0); | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::RIGHT] == std::vector<int> { 2 }); | ||
REQUIRE(metadata.neighbourExtents[ModelMetadata::RIGHT] == std::vector<int> { 4 }); | ||
REQUIRE(metadata.neighbourHaloStarts[ModelMetadata::RIGHT] == std::vector<int> { 0 }); | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::BOTTOM].size() == 0); | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::TOP] == std::vector<int> { 1 }); | ||
REQUIRE(metadata.neighbourExtents[ModelMetadata::TOP] == std::vector<int> { 7 }); | ||
REQUIRE(metadata.neighbourHaloStarts[ModelMetadata::TOP] == std::vector<int> { 0 }); | ||
} else if (test_rank == 1) { | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::LEFT].size() == 0); | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::RIGHT] == std::vector<int> { 2 }); | ||
REQUIRE(metadata.neighbourExtents[ModelMetadata::RIGHT] == std::vector<int> { 5 }); | ||
REQUIRE(metadata.neighbourHaloStarts[ModelMetadata::RIGHT] == std::vector<int> { 12 }); | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::BOTTOM] == std::vector<int> { 0 }); | ||
REQUIRE(metadata.neighbourExtents[ModelMetadata::BOTTOM] == std::vector<int> { 7 }); | ||
REQUIRE(metadata.neighbourHaloStarts[ModelMetadata::BOTTOM] == std::vector<int> { 21 }); | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::TOP].size() == 0); | ||
} else if (test_rank == 2) { | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::LEFT] == std::vector<int> { 0, 1 }); | ||
REQUIRE(metadata.neighbourExtents[ModelMetadata::LEFT] == std::vector<int> { 4, 5 }); | ||
REQUIRE(metadata.neighbourHaloStarts[ModelMetadata::LEFT] == std::vector<int> { 6, 6 }); | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::RIGHT].size() == 0); | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::BOTTOM].size() == 0); | ||
REQUIRE(metadata.neighbourRanks[ModelMetadata::TOP].size() == 0); | ||
} else { | ||
std::cerr << "only valid for 3 ranks" << std::endl; | ||
exit(1); | ||
} |
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.
Could this common part of the tests be pulled out into a function that's called in both places? It'd avoid duplication and reduce the likelihood of human errors when copy/pasting and reviewing.
|
||
// this metadata is specific to the periodic boundary conditions | ||
if (test_rank == 0) { | ||
// clang-format off |
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'm guessing this is because of line length? Might be sufficient to put using namespace std;
at the top.
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.
Or define a typedef
(or using
)
const std::string filename = testFilesDir + "/paraGrid_test.nc"; | ||
const std::string diagFile = "paraGrid_diag.nc"; | ||
const std::string dateString = "2000-01-01T00:00:00Z"; |
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.
Unused?
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.
A couple of minor edits.
size_t nStart {}; // start point in metadata arrays | ||
size_t count {}; // number of elements to read from metadata arrays |
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.
Initialize numeric types using = 0
, if indeed that is necessary (nStart
and count
seem to be set to other values before being read from).
|
||
// this metadata is specific to the periodic boundary conditions | ||
if (test_rank == 0) { | ||
// clang-format off |
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.
Or define a typedef
(or using
)
Fixes #120
Change Description
To parallelize the dynamics we first need the halo region information for each process.
This information is located in the metadata file produced by the domain
decomp
tool.This PR updates
ModelMetadata::getPartitionMetadata
with all the necessary information on halo regions.Test Description
This PR adds two new tests to check the functionality of the
getPartitionMetadata
method and the halo exchange.ModelMetadata_test.cpp
- testgetPartitionMetadata
can correctly load metadata from a partition metadata file into the appropriate data structure e.g.,neighbourExtents
,neighbourHaloStarts
etc.HaloExchange_test.cpp
- check that we can do basic halo exchange by making use of the new slicing utilities e.g.,ModelArraySlice
Add halo exchange logic #744Pre-Request Checklist