-
Notifications
You must be signed in to change notification settings - Fork 17
refactor!: rename and rewrite Handle impls
#220
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?
Changes from 23 commits
d740238
3e637e1
498c3b7
bcf9857
11eab36
1b512ce
e482389
db0153f
c2d87fe
c7702ae
40d9bd8
f98e15a
fc8687f
5f6128e
30badf1
b01d939
c25d889
e1832ae
d6461fb
ae80875
a621a5b
266c409
b49867d
63bfc20
f76ed39
b959aa0
e594754
72038ae
a24e308
9447ef8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,24 @@ | ||
| #include "KokkosComm/KokkosComm.hpp" | ||
| #include <Kokkos_Core.hpp> | ||
| #include <KokkosComm/KokkosComm.hpp> | ||
|
|
||
| // Define the execution space and transport | ||
| using ExecSpace = Kokkos::DefaultExecutionSpace; | ||
| using CommSpace = DefaultCommunicationSpace; | ||
| // Define the communication and execution spaces | ||
| using Co = KokkosComm::DefaultCommunicationSpace; | ||
| using Ex = Kokkos::DefaultExecutionSpace; | ||
|
|
||
| // Source rank | ||
| int src = 1; | ||
| int src_rank = 1; | ||
|
|
||
| // Create a handle | ||
| KokkosComm::Handle<> handle; // Same as Handle<Execspace, CommSpace> | ||
| // Create a communicator | ||
| auto comm = KokkosComm::Communicator<Co, Ex>::duplicate(raw_comm_handle, exec_space); | ||
|
||
|
|
||
| // Allocate a view to receive the data | ||
| Kokkos::View<double*> data("recv_view", 100); | ||
|
|
||
| // Initiate a non-blocking receive with a handle | ||
| auto req1 = recv(handle, data, src); | ||
| auto req1 = KokkosComm::recv(comm, data, src_rank); | ||
|
|
||
| // Initiate a non-blocking receive with a default handle | ||
| auto req2 = recv(data, src); | ||
| // Simulate a blocking receive by waiting immediately | ||
| KokkosComm::recv(comm, data, src_rank).wait(); | ||
|
|
||
| // Wait for the requests to complete (assuming a wait function exists) | ||
| // Wait for a requests to complete | ||
| KokkosComm::wait(req1); | ||
| KokkosComm::wait(req2); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,32 @@ | ||
| #include "KokkosComm/KokkosComm.hpp" | ||
| #include <Kokkos_Core.hpp> | ||
| #include <KokkosComm/KokkosComm.hpp> | ||
|
|
||
| // Define the execution space and transport | ||
| using ExecSpace = Kokkos::DefaultExecutionSpace; | ||
| using CommSpace = DefaultCommunicationSpace; | ||
| // Define the communication and execution spaces | ||
| using Co = KokkosComm::DefaultCommunicationSpace; | ||
| using Ex = Kokkos::DefaultExecutionSpace; | ||
|
|
||
| // Create an execution space instance | ||
| auto exec = Ex(); | ||
| // Create a communicator | ||
| auto comm = KokkosComm::Communicator<Co, Ex>::duplicate(raw_comm_handle, exec); | ||
|
|
||
| // 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) { | ||
| Kokkos::parallel_for("fill_data", Kokkos::RangePolicy(exec, 0, 100), KOKKOS_LAMBDA(int i) { | ||
| data(i) = static_cast<double>(i); | ||
| }); | ||
| exec.fence(); | ||
|
|
||
| // Destination rank | ||
| int dest = 1; | ||
|
|
||
| // Create a handle | ||
| KokkosComm::Handle<> handle; // Same as Handle<Execspace, CommSpace> | ||
| int dst_rank = 1; | ||
|
|
||
| // Initiate a non-blocking send with a handle | ||
| auto req1 = send(handle, data, dest); | ||
| auto req1 = KokkosComm::send(comm, data, dst_rank); | ||
|
|
||
| // Initiate a non-blocking send with a default handle | ||
| auto req2 = send(data, dest); | ||
| // Simulate a blocking send by waiting immediately | ||
| KokkosComm::send(comm, data, dst_rank).wait(); | ||
|
|
||
| // Wait for the requests to complete (assuming a wait function exists) | ||
| // Wait for a requests to complete | ||
| KokkosComm::wait(req1); | ||
| KokkosComm::wait(req2); |
Uh oh!
There was an error while loading. Please reload this page.