-
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
Open
dssgabriel
wants to merge
30
commits into
kokkos:develop
Choose a base branch
from
dssgabriel:refactor/handles
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
d740238
refactor(core): rename `Handle` to `Communicator`
dssgabriel 3e637e1
chore(core): propagate file name change
dssgabriel 498c3b7
feat(core): add `Rank` strong type
dssgabriel bcf9857
docs(core): start `Communicator` doc update
dssgabriel 11eab36
style: don't bin pack arguments w/ clang-format
dssgabriel 1b512ce
wip: communicator impl
dssgabriel e482389
revert(core): remove `Rank` strong type and `Color`/`Key` alias
dssgabriel db0153f
refactor: rework communicator impls
dssgabriel c2d87fe
docs(core): document communicators
dssgabriel c7702ae
refactor(mpi): propagate Communicator changes to MPI backend
dssgabriel 40d9bd8
refactor(nccl): propagate Communicator changes to NCCL backend
dssgabriel f98e15a
tests: refactor all tests to pass with the new Communicators
dssgabriel fc8687f
tests(core): enable missing `broadcast` and `all-gather` tests
dssgabriel 5f6128e
fix(perf_tests): forward args by reference in `do_iteration`
dssgabriel 30badf1
fix(nccl): can't use member variables in factory `duplicate`
dssgabriel b01d939
refactor(nccl): avoid recomputing the rank in member `duplicate`
dssgabriel c25d889
fix(nccl): missed `using` decl with wrong type name
dssgabriel e1832ae
tests(nccl): fix missed P2P test
dssgabriel d6461fb
tests(nccl): fix missed all-gather test
dssgabriel ae80875
tests(core): add a set of unit tests for Communicators
dssgabriel a621a5b
docs(core): add missing accessors for Communicator specializatn
dssgabriel 266c409
docs: propagate `Communicator` changes everywhere
dssgabriel b49867d
docs(core): fix indent to prevent Sphinx from seeing duplicates
dssgabriel 63bfc20
refactor: default t-params for Communicators
dssgabriel f76ed39
fix(core): define `DefaultCommunicationSpace` once and only once
dssgabriel b959aa0
refactor(mpi): use more descriptive t-param names
dssgabriel e594754
docs: use defaulted t-params for communicators in code examples
dssgabriel 72038ae
refactor(Comms): append `_from_raw` to static member functions
dssgabriel a24e308
tests(core): add missing Communicator tests
dssgabriel 9447ef8
docs(api): fix NCCL Communicator template specialization parameter
dssgabriel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,22 @@ | ||
| #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; | ||
|
|
||
| // Source rank | ||
| int src = 1; | ||
|
|
||
| // Create a handle | ||
| KokkosComm::Handle<> handle; // Same as Handle<Execspace, CommSpace> | ||
| // Create an execution space instance | ||
| auto exec = Kokkos::DefaultExecutionSpace(); | ||
| // Create a communicator | ||
| auto comm = KokkosComm::Communicator<>::duplicate_from_raw(raw_comm_handle, exec).value(); | ||
|
|
||
| // Allocate a view to receive the data | ||
| Kokkos::View<double*> data("recv_view", 100); | ||
|
|
||
| // Source rank | ||
| int src_rank = 1; | ||
|
|
||
| // 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,28 @@ | ||
| #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; | ||
| // Create an execution space instance | ||
| auto exec = Kokkos::DefaultExecutionSpace(); | ||
| // Create a communicator | ||
| auto comm = KokkosComm::Communicator<>::duplicate_from_raw(raw_comm_handle, exec).value(); | ||
|
|
||
| // Create a Kokkos view | ||
| Kokkos::View<double*> data("data", 100); | ||
| Kokkos::View<double*> data("send_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); | ||
| }); | ||
| 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 request to complete | ||
| KokkosComm::wait(req1); | ||
| KokkosComm::wait(req2); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For later, @hmt23 can you confirm this is also correct from a MPI point-of-view?