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

mwe of halo exchange #744

Draft
wants to merge 1 commit into
base: melt-mpi-metadata
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/include/ModelArraySlice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ class ModelArraySlice {
}

ModelArray& copyToModelArray(ModelArray& target) const;
template <typename T> T& copyToBuffer(T& buffer)
template <typename T> T& copyToBuffer(T& buffer, size_t startIndex = 0)
{
// make no especial attempt at efficiency here
SliceIter thisIter(slice, data.dimensions());
auto biter = buffer.begin();
auto biter = std::next(buffer.begin(), startIndex);
Comment on lines +103 to +107
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@timspainNERSC this was a bit hacky from me. I want to populate the buffer but from a specific starting index. Let me know if there's a better way of doing this.

I was trying to avoid creating temporary arrays for each of the edges.


while (!thisIter.isEnd()) {
// If the buffer ends before the slice, throw an exception
Expand Down
13 changes: 12 additions & 1 deletion core/src/include/Slice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,18 @@ class Slice {
}
std::ostream& print(std::ostream& os) const
{
return os << start << ":" << stop << ":" << step;
// TODO remove me before merging into develop
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: remove this before merging this PR. I was using this for debugging purposes

// this is for debugging purposes only
if (start.isAll()) {
os << ":*:";
} else {
os << start << ":";
}
if (stop.isAll()) {
return os << "*:" << step;
} else {
return os << stop << ":" << step;
}
}
friend SliceIter;
};
Expand Down
22 changes: 22 additions & 0 deletions core/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,28 @@ if(ENABLE_MPI)
)
target_link_libraries(testModelMetadata_MPI3 PRIVATE nextsimlib doctest::doctest)

# set(ModelArrayStructure "discontinuousgalerkin")
set(CoreDir "../../core/src/")

# set(MODEL_INCLUDE_DIR "./testmodelarraydetails")
add_executable(testHaloExchange_MPI4
"HaloExchange_test.cpp"
"MainMPI.cpp"
"../src/ModelArray.cpp"
"../src/ModelArraySlice.cpp"
"${MODEL_INCLUDE_DIR}/ModelArrayDetails.cpp"
)
target_compile_definitions(testHaloExchange_MPI4 PRIVATE USE_MPI)
target_include_directories(
testHaloExchange_MPI4 PRIVATE
"../src"
"../../dynamics/src"
${MODEL_INCLUDE_DIR}
)
target_link_libraries(testHaloExchange_MPI4 PRIVATE doctest::doctest Eigen3::Eigen)

set(MODEL_INCLUDE_DIR "../../core/src/discontinuousgalerkin")

add_executable(testParaGrid_MPI2 "ParaGrid_test.cpp" "MainMPI.cpp")
target_compile_definitions(
testParaGrid_MPI2
Expand Down
Loading
Loading