Add global comm - #341
Conversation
|
@hgangwar did you update this based on the redev merge? Note, you will need to make sure you bump the redev version in the config files for the CI. |
|
@hgangwar I think we discussed having this owned by the application so we have a consistent API between fields and "global data" |
jacobmerson
left a comment
There was a problem hiding this comment.
See previous comment about making the API match between fields and global data.
jacobmerson
left a comment
There was a problem hiding this comment.
Sorry I did not read carefully, you did add the global data communicator to the application. However for consistency:
SendDatashould be a function on the application that takes a stringSendshould be a function on the GDI pointer.
|
Also, look at how the |
jacobmerson
left a comment
There was a problem hiding this comment.
Don't have time to finish this review right now...but I want to go over again why we need to pass the data directly into SendData I understand at the redev level this is needed for the communictor because otherwise we will be constructing a lot of adios2 objects. However, it's less clear why that's needed here. It is possible that it's the correct choice, just the mismatch to how the fields are handled is giving me pause.
You may want to discuss with Sichao or Cameron or Fuad. Show them the general API and see which direction seems more natural to them.
| redev::Mode mode = redev::Mode::Synchronous) const; | ||
|
|
||
| [[nodiscard]] std::vector<T> Receive( | ||
| std::string variable_name, std::size_t msg_size, |
There was a problem hiding this comment.
Shouldn't this API be consistent with Send i.e., you should pass in the appropriate array_view which gets filled up. otherwise, a buffer needs to be created on the heap for every call to recieve.
There was a problem hiding this comment.
Made the changes, can you please take a look again?
| { | ||
| } | ||
|
|
||
| void Send(T* msg, std::string variable_name, std::size_t msg_size, |
There was a problem hiding this comment.
This should take an array_view instead of a pointer and a size.
| template <typename T> | ||
| DataHandle<T> AddData(std::string name, MPI_Comm mpi_comm); | ||
| template <typename T> | ||
| [[nodiscard]] GlobalDataInterface<T>& GetDataInterface( |
There was a problem hiding this comment.
Should this return the handle we discussed?
There was a problem hiding this comment.
AddData is returning a DataHandle, this is for DataHandle to be able return GlobalDataInterface object ptr. This is non-essential for now, so I have removed it.
There was a problem hiding this comment.
Pull request overview
This PR adds a new “global data” communication path built on the existing Redev/ADIOS channel, enabling coupler/applications to exchange arbitrary scalar arrays via a named global communicator, and wires in a new multi-process test to validate the flow.
Changes:
- Introduce
pcms::GlobalCommunicator<T>/GlobalDataInterface<T>plusApplication::AddData()andDataHandle<T>to send/receive global data during communication phases. - Add
test_GDIand CTest wiring to run a 3-process (coupler + 2 apps) global-comm integration test. - Update CI workflows to pin a newer
redevcommit and install the new header.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
src/pcms/coupler/global_communicator.h |
Adds a thin wrapper over Redev global comm creation and send/recv operations. |
src/pcms/coupler/coupler.hpp |
Exposes the new global data interface on Application and adds a handle-based API for callers. |
src/pcms/coupler/CMakeLists.txt |
Installs the new global communicator header. |
test/test_GDI.cpp |
New 3-role integration test exercising global send/receive across coupler/apps. |
test/CMakeLists.txt |
Registers test_GDI and adjusts unit test source/link configuration. |
.github/workflows/self-hosted.yml |
Updates the pinned redev commit for self-hosted CI. |
.github/workflows/cmake-test.yml |
Updates the pinned redev commit for cmake-test CI. |
.github/workflows/clang-tidy.yml |
Updates the pinned redev commit for clang-tidy CI. |
Comments suppressed due to low confidence (3)
test/CMakeLists.txt:124
- NAME3 is also set to "app", which will overwrite NAME1's log output (both write to app.log). Use a unique name for this third process (e.g., client0).
NAME3
app
EXE3
./test_GDI
test/test_GDI.cpp:49
- mean_buffer/mean are typed as long, but this data handle is AddDatapcms::GO. Using pcms::GO for the buffer/view avoids template type mismatches on platforms where int64_t is not long.
Kokkos::View<long*, pcms::HostMemorySpace> mean_buffer("mean_buffer", 1);
pcms::Rank1View<long, pcms::HostMemorySpace> mean{mean_buffer.data(),
mean_buffer.extent(0)};
test/test_GDI.cpp:84
- mean_buffer/mean are typed as long, but the global comm is instantiated as AddDatapcms::GO. Use pcms::GO here as well to keep the test type-correct across platforms.
Kokkos::View<long*, pcms::HostMemorySpace> mean_buffer("mean_buffer", 1);
pcms::Rank1View<long, pcms::HostMemorySpace> mean{mean_buffer.data(),
mean_buffer.extent(0)};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| NAME1 | ||
| app | ||
| EXE1 | ||
| ./test_GDI |
| APPEND | ||
| PCMS_UNIT_TEST_SOURCES | ||
| test_error_handling.cpp | ||
| test_eqdsk.cpp | ||
| test_uniform_grid.cpp | ||
| test_field_evaluation.cpp |
| pcms_transfer | ||
| ) | ||
|
|
||
| target_include_directories(unit_tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) |
| #include <redev.h> | ||
| #include <pcms/utility/profile.h> |
| #include <Omega_h_mesh.hpp> | ||
| #include <Omega_h_file.hpp> | ||
| #include "test_support.h" | ||
| #include "pcms/coupler/coupler.hpp" | ||
| #include <pcms/utility/types.h> | ||
|
|
| app->BeginReceivePhase(); | ||
| GDI.Receive(mean, "mean"); | ||
| app->EndReceivePhase(); | ||
| printf("total Recieved mean:%ld\n", mean[0]); |
| delta_f->EndReceivePhase(); | ||
| printf("delta Received mean:%ld\n", mean[0]); | ||
| mean[0] = mean[0] / 2; | ||
| const auto msg_size = mean.size(); |
| total_f->BeginReceivePhase(); | ||
| GDI_total.Receive(mean, "mean"); | ||
| total_f->EndReceivePhase(); | ||
| printf("delta Received mean:%ld\n", mean[0]); | ||
| mean[0] = mean[0] / 2; |
| void Send(Rank1View<T, pcms::HostMemorySpace> msg, std::string variable_name, | ||
| redev::Mode mode = redev::Mode::Synchronous) const; | ||
|
|
||
| void Receive(Rank1View<T, pcms::HostMemorySpace> msg, | ||
| std::string variable_name, |
| Kokkos::View<long*, pcms::HostMemorySpace> mean_buffer("mean_buffer", 1); | ||
|
|
||
| pcms::Rank1View<long, pcms::HostMemorySpace> mean{mean_buffer.data(), | ||
| mean_buffer.extent(0)}; |
Moving PR #228 to here for a clean PR.
This PR introduces
redev::AdiosGlobalCommto provide a global communication interface between the coupler and the applications using the existing ADIOS channel.Usage:
This creates a global communicator that can send and receive data, for example:
test_GDItest case verifies global communication and data transfer.