Skip to content

Commit e594754

Browse files
committed
docs: use defaulted t-params for communicators in code examples
1 parent b959aa0 commit e594754

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

docs/api/core_recv.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
#include <Kokkos_Core.hpp>
22
#include <KokkosComm/KokkosComm.hpp>
33

4-
// Define the communication and execution spaces
5-
using Co = KokkosComm::DefaultCommunicationSpace;
6-
using Ex = Kokkos::DefaultExecutionSpace;
7-
8-
// Source rank
9-
int src_rank = 1;
10-
4+
// Create an execution space instance
5+
auto exec = Kokkos::DefaultExecutionSpace();
116
// Create a communicator
12-
auto comm = KokkosComm::Communicator<Co, Ex>::duplicate(raw_comm_handle, exec_space);
7+
auto comm = KokkosComm::Communicator<>::duplicate(raw_comm_handle, exec);
138

149
// Allocate a view to receive the data
1510
Kokkos::View<double*> data("recv_view", 100);
1611

12+
// Source rank
13+
int src_rank = 1;
14+
1715
// Initiate a non-blocking receive with a handle
1816
auto req1 = KokkosComm::recv(comm, data, src_rank);
1917

docs/api/core_send.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
#include <Kokkos_Core.hpp>
22
#include <KokkosComm/KokkosComm.hpp>
33

4-
// Define the communication and execution spaces
5-
using Co = KokkosComm::DefaultCommunicationSpace;
6-
using Ex = Kokkos::DefaultExecutionSpace;
7-
84
// Create an execution space instance
9-
auto exec = Ex();
5+
auto exec = Kokkos::DefaultExecutionSpace();
106
// Create a communicator
11-
auto comm = KokkosComm::Communicator<Co, Ex>::duplicate(raw_comm_handle, exec);
7+
auto comm = KokkosComm::Communicator<>::duplicate(raw_comm_handle, exec);
128

139
// Create a Kokkos view
14-
Kokkos::View<double*> data("data", 100);
10+
Kokkos::View<double*> data("send_data", 100);
1511

1612
// Fill the view with some data
17-
Kokkos::parallel_for("fill_data", Kokkos::RangePolicy(exec, 0, 100), KOKKOS_LAMBDA(int i) {
18-
data(i) = static_cast<double>(i);
19-
});
13+
Kokkos::parallel_for(
14+
"fill_data", Kokkos::RangePolicy(exec, 0, 100), KOKKOS_LAMBDA(int i) { data(i) = static_cast<double>(i); }
15+
);
2016
exec.fence();
2117

2218
// Destination rank
@@ -28,5 +24,5 @@ auto req1 = KokkosComm::send(comm, data, dst_rank);
2824
// Simulate a blocking send by waiting immediately
2925
KokkosComm::send(comm, data, dst_rank).wait();
3026

31-
// Wait for a requests to complete
27+
// Wait for a request to complete
3228
KokkosComm::wait(req1);

0 commit comments

Comments
 (0)