Skip to content
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

Add wrapper functions for ncclGroupStart() and ncclGroupEnd() #742

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cpp/include/raft/comms/detail/mpi_comms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ class mpi_comms : public comms_iface {
RAFT_NCCL_TRY(ncclGroupEnd());
}

void group_start() const { RAFT_NCCL_TRY(ncclGroupStart()); }

void group_end() const { RAFT_NCCL_TRY(ncclGroupEnd()); }

private:
bool owns_mpi_comm_;
MPI_Comm mpi_comm_;
Expand Down
4 changes: 4 additions & 0 deletions cpp/include/raft/comms/detail/std_comms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ class std_comms : public comms_iface {
RAFT_NCCL_TRY(ncclGroupEnd());
}

void group_start() const { RAFT_NCCL_TRY(ncclGroupStart()); }

void group_end() const { RAFT_NCCL_TRY(ncclGroupEnd()); }

private:
ncclComm_t nccl_comm_;
cudaStream_t stream_;
Expand Down
18 changes: 18 additions & 0 deletions cpp/include/raft/core/comms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ class comms_iface {
std::vector<size_t> const& recvoffsets,
std::vector<int> const& sources,
cudaStream_t stream) const = 0;

virtual void group_start() const = 0;

virtual void group_end() const = 0;
};

class comms_t {
Expand Down Expand Up @@ -625,6 +629,20 @@ class comms_t {
stream);
}

/**
* Multiple collectives & device send/receive operations placed between group_start() and
* group_end() are merged into one big operation. Internally, this function is a wrapper for
* ncclGroupStart().
*/
void group_start() const { impl_->group_start(); }

/**
* Multiple collectives & device send/receive operations placed between group_start() and
* group_end() are merged into one big operation. Internally, this function is a wrapper for
* ncclGroupEnd().
*/
void group_end() const { impl_->group_end(); }

private:
std::unique_ptr<comms_iface> impl_;
};
Expand Down