-
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
base: develop
Are you sure you want to change the base?
Add global comm #341
Changes from all commits
2f7318d
313df5e
e8cd7cd
dcbc7f3
f197296
29984dc
22d089e
3761c83
e11b082
21f0ce7
25671dd
a9a7267
b900e4a
e8b82ed
6d2e846
d192a2e
0d5a622
88ee07b
34b4aa2
6e75dc2
95a6af8
79c3f4c
ce400bb
f384dcb
593df94
01595d1
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 |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ set(PCMS_COUPLER_HEADERS | |
| field_exchange_planner.h | ||
| partition.h | ||
| overlap_mask.h | ||
| global_communicator.h | ||
| ) | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #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); | ||
| } | ||
| void Receive(T* destination, std::string VarName, size_t msg_size, | ||
|
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. In PCMS we have access to |
||
| Mode mode = Mode::Synchronous) | ||
| { | ||
| PCMS_FUNCTION_TIMER; | ||
| PCMS_ALWAYS_ASSERT(channel_.InReceiveCommunicationPhase()); | ||
| comm_.SetCommParams(VarName, msg_size); | ||
| comm_.Recv(destination, msg_size, mode); | ||
| } | ||
|
|
||
| private: | ||
| MPI_Comm mpi_comm; | ||
| redev::Channel& channel_; | ||
| std::string name_; | ||
| redev::BidirectionalComm<T> comm_; | ||
| }; | ||
| } // namespace pcms | ||
| #endif // PCMS_GLOBAL_COMMUNICATOR_H | ||
| 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 | ||
|
|
||
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.
If we are using ptr semantics over the array, let's take
Rank1View<HostMemory>here. That way if someone has an array that is not a vector the function can work with that as well.