-
Notifications
You must be signed in to change notification settings - Fork 18
Add global comm #341
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
Open
hgangwar
wants to merge
25
commits into
SCOREC:develop
Choose a base branch
from
hgangwar:add_global_comm
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add global comm #341
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
2f7318d
add_global_comm_header
hgangwar 313df5e
add_test_case
hgangwar e8cd7cd
format_test
hgangwar dcbc7f3
update_redev_ref
hgangwar f197296
format
hgangwar 29984dc
fix_warnings
hgangwar 22d089e
clang-tidy-redev_update
hgangwar 3761c83
CI_update
hgangwar e11b082
add_DataHandle
hgangwar 21f0ce7
clang_format
hgangwar 25671dd
add_try_catch
hgangwar a9a7267
format
hgangwar b900e4a
use_view_instead_of_ptr_in_GDI_api
hgangwar e8b82ed
format
hgangwar 6d2e846
fix_test_GDI
hgangwar d192a2e
tidy_fix
hgangwar 0d5a622
removed_GetDataInterface_from_DataHandle
hgangwar 88ee07b
changes_in_api
34b4aa2
resolved_conflicts-self-hosted.yml-and-coupler.hpp
hgangwar 6e75dc2
update_testcase
hgangwar 95a6af8
rm_GDI_from_application
hgangwar 79c3f4c
fix_missing_test_eqdsk
hgangwar ce400bb
Add_data_pass_ref
hgangwar f384dcb
remove_repetition
hgangwar 593df94
add_comment
hgangwar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ set(PCMS_COUPLER_HEADERS | |
| field_exchange_planner.h | ||
| partition.h | ||
| overlap_mask.h | ||
| global_communicator.h | ||
| ) | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #ifndef PCMS_GLOBAL_COMMUNICATOR_H | ||
| #define PCMS_GLOBAL_COMMUNICATOR_H | ||
| #include <redev.h> | ||
| #include <pcms/utility/profile.h> | ||
| #include <pcms/utility/assert.h> | ||
| namespace pcms | ||
| { | ||
| using redev::Mode; | ||
| template <typename T> | ||
| struct GlobalCommunicator | ||
| { | ||
| using value_type = T; | ||
|
|
||
| public: | ||
| GlobalCommunicator(std::string name, MPI_Comm mpi_comm, | ||
| redev::Channel& channel) | ||
| : mpi_comm(mpi_comm), channel_(channel), name_(std::move(name)) | ||
| { | ||
| PCMS_FUNCTION_TIMER; | ||
| comm_ = channel_.CreateComm<T>(name_, mpi_comm, redev::CommType::Global); | ||
| } | ||
| GlobalCommunicator(const GlobalCommunicator&) = delete; | ||
| GlobalCommunicator& operator=(const GlobalCommunicator&) = delete; | ||
| GlobalCommunicator(GlobalCommunicator&&) = default; | ||
| GlobalCommunicator& operator=(GlobalCommunicator&&) = default; | ||
|
|
||
| void Send(T* msg, std::string VarName, size_t msg_size, | ||
| Mode mode = Mode::Synchronous) | ||
| { | ||
| PCMS_FUNCTION_TIMER; | ||
| PCMS_ALWAYS_ASSERT(channel_.InSendCommunicationPhase()); | ||
| comm_.SetCommParams(VarName, msg_size); | ||
| comm_.Send(msg, mode); | ||
| } | ||
| std::vector<T> Receive(std::string VarName, size_t msg_size, | ||
| Mode mode = Mode::Synchronous) | ||
| { | ||
| PCMS_FUNCTION_TIMER; | ||
| PCMS_ALWAYS_ASSERT(channel_.InReceiveCommunicationPhase()); | ||
| comm_.SetCommParams(VarName, msg_size); | ||
| auto data = comm_.Recv(mode); | ||
| return data; | ||
| } | ||
|
|
||
| private: | ||
| MPI_Comm mpi_comm; | ||
| redev::Channel& channel_; | ||
| std::string name_; | ||
| redev::BidirectionalComm<T> comm_; | ||
| }; | ||
| } // namespace pcms | ||
| #endif // PCMS_GLOBAL_COMMUNICATOR_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,6 +96,37 @@ if(PCMS_ENABLE_OMEGA_H) | |
| ${d3d16p} | ||
| ignored) | ||
| endif() | ||
| add_exe(test_GDI) | ||
| tri_mpi_test( | ||
| TESTNAME | ||
| test_GDI | ||
| TIMEOUT | ||
| 20 | ||
| NAME1 | ||
| app | ||
| EXE1 | ||
| ./test_GDI | ||
| PROCS1 | ||
| 1 | ||
| ARGS1 | ||
| 1 | ||
| NAME2 | ||
| rdv | ||
| EXE2 | ||
| ./test_GDI | ||
| PROCS2 | ||
| 1 | ||
| ARGS2 | ||
| -1 | ||
| NAME3 | ||
| app | ||
| EXE3 | ||
| ./test_GDI | ||
| PROCS3 | ||
| 1 | ||
| ARGS3 | ||
| 0 | ||
| ) | ||
|
|
||
| set(d3d8p ${PCMS_TEST_DATA_DIR}/d3d/d3d-full_9k_sfc_p8.osh/) | ||
| add_exe(test_twoClientOverlap) | ||
|
|
@@ -380,7 +411,7 @@ if(Catch2_FOUND) | |
| APPEND | ||
| PCMS_UNIT_TEST_SOURCES | ||
| test_error_handling.cpp | ||
| test_eqdsk.cpp | ||
|
Collaborator
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. why are you removing this test case?
Contributor
Author
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. Added it back, possibly came in from a merge. |
||
| test_eqdsk.cpp | ||
| test_uniform_grid.cpp | ||
| test_field_evaluation.cpp | ||
|
Comment on lines
411
to
416
|
||
| test_field_interpolation.cpp | ||
|
|
@@ -402,7 +433,6 @@ if(Catch2_FOUND) | |
| test_omega_h_lagrange_field.cpp | ||
| test_point_evaluator.cpp) | ||
| endif() | ||
|
|
||
| if(PCMS_ENABLE_MESHFIELDS) | ||
| list(APPEND PCMS_UNIT_TEST_SOURCES | ||
| test_omega_h_form_integrator_utils.cpp) | ||
|
|
@@ -430,15 +460,6 @@ if(Catch2_FOUND) | |
| target_link_libraries(unit_tests PRIVATE PETSc::PETSc) | ||
| endif() | ||
|
|
||
| target_link_libraries(unit_tests PUBLIC | ||
| Catch2::Catch2 | ||
| pcms::core | ||
| pcms_transfer | ||
| pcms_transfer | ||
| ) | ||
|
|
||
| target_include_directories(unit_tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
|
||
| add_executable(test_interpolation_on_ltx_mesh test_interpolation_on_ltx_mesh.cpp) | ||
| target_link_libraries(test_interpolation_on_ltx_mesh PUBLIC Catch2::Catch2WithMain | ||
| pcms::core | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@hgangwar I though we updated the redev API to take a ptr/size instead of returning a vector. If not, we need to go back and update that. We should not need to allocate/copy on every receive.
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.
Redev receive still returns a vector. I will make a PR for it in redev.