Skip to content

Add global comm - #341

Open
hgangwar wants to merge 17 commits into
SCOREC:developfrom
hgangwar:add_global_comm
Open

Add global comm#341
hgangwar wants to merge 17 commits into
SCOREC:developfrom
hgangwar:add_global_comm

Conversation

@hgangwar

@hgangwar hgangwar commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Moving PR #228 to here for a clean PR.

This PR introduces redev::AdiosGlobalComm to provide a global communication interface between the coupler and the applications using the existing ADIOS channel.
Usage:

auto GDI = app->AddData<pcms::GO>("global_comm", comm);

This creates a global communicator that can send and receive data, for example:

app->BeginSendPhase();
GDI->Send(mean, "mean");
app->EndSendPhase();

app->BeginReceivePhase();
GDI->Receive(mean, "mean");
app->EndReceivePhase();
  • The test_GDI test case verifies global communication and data transfer.

@jacobmerson

Copy link
Copy Markdown
Collaborator

@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
hgangwar marked this pull request as ready for review July 21, 2026 00:05
@jacobmerson

Copy link
Copy Markdown
Collaborator

@hgangwar I think we discussed having this owned by the application so we have a consistent API between fields and "global data"

AddField -> AddData
SendField -> SendData
ReceiveField -> ReceiveData

@jacobmerson jacobmerson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See previous comment about making the API match between fields and global data.

@jacobmerson jacobmerson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry I did not read carefully, you did add the global data communicator to the application. However for consistency:

  • SendData should be a function on the application that takes a string
  • Send should be a function on the GDI pointer.

@jacobmerson

Copy link
Copy Markdown
Collaborator

Also, look at how the FieldHandle works. I.e., we return a cheap to copy handle of the field which stores a string which is used to actually perform the send/receive. That way we are not handing a pointer back to the user.

@jacobmerson jacobmerson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Comment thread src/pcms/coupler/coupler.hpp Outdated
redev::Mode mode = redev::Mode::Synchronous) const;

[[nodiscard]] std::vector<T> Receive(
std::string variable_name, std::size_t msg_size,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made the changes, can you please take a look again?

Comment thread src/pcms/coupler/coupler.hpp Outdated
{
}

void Send(T* msg, std::string variable_name, std::size_t msg_size,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should take an array_view instead of a pointer and a size.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as above.

template <typename T>
DataHandle<T> AddData(std::string name, MPI_Comm mpi_comm);
template <typename T>
[[nodiscard]] GlobalDataInterface<T>& GetDataInterface(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this return the handle we discussed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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> plus Application::AddData() and DataHandle<T> to send/receive global data during communication phases.
  • Add test_GDI and CTest wiring to run a 3-process (coupler + 2 apps) global-comm integration test.
  • Update CI workflows to pin a newer redev commit 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.

Comment thread test/CMakeLists.txt
Comment on lines +105 to +108
NAME1
app
EXE1
./test_GDI
Comment thread test/CMakeLists.txt
Comment on lines 411 to 415
APPEND
PCMS_UNIT_TEST_SOURCES
test_error_handling.cpp
test_eqdsk.cpp
test_uniform_grid.cpp
test_field_evaluation.cpp
Comment thread test/CMakeLists.txt
pcms_transfer
)

target_include_directories(unit_tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Comment on lines +3 to +4
#include <redev.h>
#include <pcms/utility/profile.h>
Comment thread test/test_GDI.cpp
Comment on lines +1 to +6
#include <Omega_h_mesh.hpp>
#include <Omega_h_file.hpp>
#include "test_support.h"
#include "pcms/coupler/coupler.hpp"
#include <pcms/utility/types.h>

Comment thread test/test_GDI.cpp
app->BeginReceivePhase();
GDI.Receive(mean, "mean");
app->EndReceivePhase();
printf("total Recieved mean:%ld\n", mean[0]);
Comment thread test/test_GDI.cpp
delta_f->EndReceivePhase();
printf("delta Received mean:%ld\n", mean[0]);
mean[0] = mean[0] / 2;
const auto msg_size = mean.size();
Comment thread test/test_GDI.cpp
Comment on lines +98 to +102
total_f->BeginReceivePhase();
GDI_total.Receive(mean, "mean");
total_f->EndReceivePhase();
printf("delta Received mean:%ld\n", mean[0]);
mean[0] = mean[0] / 2;
Comment on lines +91 to +95
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,
Comment thread test/test_GDI.cpp
Comment on lines +17 to +20
Kokkos::View<long*, pcms::HostMemorySpace> mean_buffer("mean_buffer", 1);

pcms::Rank1View<long, pcms::HostMemorySpace> mean{mean_buffer.data(),
mean_buffer.extent(0)};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants