Core¶
Point-to-point¶
-
template<KokkosView SendView, KokkosExecutionSpace ExecSpace = Kokkos::DefaultExecutionSpace, Transport TRANSPORT = DefaultTransport>
Req<TRANSPORT> send(Handle<ExecSpace, TRANSPORT> &h, SendView &sv, int dest)¶ Initiates a non-blocking send operation.
Warning
This is not a blocking operation despite being named like
MPI_Send
.- Template Parameters:
SendView – The type of the Kokkos view to send.
ExecSpace – The execution space to use. Defaults to Kokkos::DefaultExecutionSpace.
TRANSPORT – The transport mechanism to use. Defaults to DefaultTransport.
- Parameters:
h – A handle to the execution space and transport mechanism.
sv – The Kokkos view to send.
dest – The destination rank.
- Returns:
A request object for the non-blocking send operation.
-
template<KokkosView SendView, KokkosExecutionSpace ExecSpace = Kokkos::DefaultExecutionSpace, Transport TRANSPORT = DefaultTransport>
Req<TRANSPORT> send(SendView &sv, int dest)¶ Initiates a non-blocking send operation using a default handle.
Warning
This is not a blocking operation despite being named like
MPI_Send
.- Template Parameters:
SendView – The type of the Kokkos view to send.
ExecSpace – The execution space to use. Defaults to Kokkos::DefaultExecutionSpace.
TRANSPORT – The transport mechanism to use. Defaults to DefaultTransport.
- Parameters:
sv – The Kokkos view to send.
dest – The destination rank.
- Returns:
A request object for the non-blocking send operation.
Example usage:
#include <Kokkos_Comm.hpp>
// Define the execution space and transport
using ExecSpace = Kokkos::DefaultExecutionSpace;
using Transport = DefaultTransport;
// Create a Kokkos view
Kokkos::View<double*> data("data", 100);
// Fill the view with some data
Kokkos::parallel_for("fill_data", Kokkos::RangePolicy<ExecSpace>(0, 100), KOKKOS_LAMBDA(int i) {
data(i) = static_cast<double>(i);
});
// Destination rank and message tag
int dest = 1;
// Create a handle
KokkosComm::Handle<> handle; // Same as Handle<Execspace, Transport>
// Initiate a non-blocking send with a handle
auto req1 = send(handle, data, dest);
// Initiate a non-blocking send with a default handle
auto req2 = send(data, dest);
// Wait for the requests to complete (assuming a wait function exists)
KokkosComm::wait(req1);
KokkosComm::wait(req2);
-
template<KokkosView RecvView, KokkosExecutionSpace ExecSpace = Kokkos::DefaultExecutionSpace, Transport TRANSPORT = DefaultTransport>
Req<TRANSPORT> recv(Handle<ExecSpace, TRANSPORT> &h, RecvView &rv, int src)¶ Initiates a non-blocking receive operation.
Warning
This is not a blocking operation despite being named like
MPI_Recv
.- Template Parameters:
RecvView – The type of the Kokkos view for receiving data.
ExecSpace – The execution space where the operation will be performed. Defaults to Kokkos::DefaultExecutionSpace.
TRANSPORT – The transport mechanism to be used. Defaults to DefaultTransport.
- Parameters:
h – A handle to the execution space and transport mechanism.
rv – The Kokkos view where the received data will be stored.
src – The source rank from which to receive data.
- Returns:
A request object of type Req<TRANSPORT> representing the non-blocking receive operation.
This function initiates a non-blocking receive operation using the specified execution space and transport mechanism. The data will be received into the provided view from the specified source rank and message tag. The function returns a request object that can be used to check the status of the receive operation or to wait for its completion.
Example usage:
Handle<> handle;
Kokkos::View<double*> recv_view("recv_view", 100);
auto req = recv(handle, recv_view, 1/*src*/);
KokkosComm::wait(req);
-
template<KokkosView RecvView, KokkosExecutionSpace ExecSpace = Kokkos::DefaultExecutionSpace, Transport TRANSPORT = DefaultTransport>
Req<TRANSPORT> recv(RecvView &rv, int src)¶ Initiates a non-blocking receive operation using a default handle.
Warning
This is not a blocking operation despite being named like
MPI_Recv
.- Template Parameters:
RecvView – The type of the Kokkos view for receiving data.
ExecSpace – The execution space where the operation will be performed. Defaults to Kokkos::DefaultExecutionSpace.
TRANSPORT – The transport mechanism to be used. Defaults to DefaultTransport.
- Parameters:
rv – The Kokkos view where the received data will be stored.
src – The source rank from which to receive data.
- Returns:
A request object of type Req<TRANSPORT> representing the non-blocking receive operation.
Collective¶
-
template<KokkosExecutionSpace ExecSpace = Kokkos::DefaultExecutionSpace, Transport TRANSPORT = DefaultTransport>
void barrier(Handle<ExecSpace, TRANSPORT> &&h)¶ A function to create a barrier using the given execution space and transport handle.
- Template Parameters:
ExecSpace – The execution space to be used. Defaults to Kokkos::DefaultExecutionSpace.
TRANSPORT – The transport mechanism to be used. Defaults to DefaultTransport.
- Parameters:
h – A handle of type Handle<ExecSpace, TRANSPORT> to be forwarded to the barrier implementation.