Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
feat: add reduce and allgather python interface
Browse files Browse the repository at this point in the history
  • Loading branch information
liuhatry authored and NOBLES5E committed Jul 1, 2021
1 parent 9434abb commit ff68a61
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bagua-core-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ impl BaguaSingleCommunicatorPy {
self.inner.broadcast(&mut tensor.inner, root_rank)
}

pub fn reduce(&self, tensor: &mut BaguaTensorPy, root_rank: i32) {
self.inner.reduce(&mut tensor.inner, root_rank)
}

pub fn send(&self, tensor: &mut BaguaTensorPy, peer_rank: i32) {
self.inner.send(&mut tensor.inner, peer_rank)
}
Expand Down Expand Up @@ -87,6 +91,15 @@ impl BaguaSingleCommunicatorPy {
)
}

pub fn allgather(&self, send_tensor: &mut BaguaTensorPy, recv_tensor: &mut BaguaTensorPy) {
self.inner
.allgather(&mut send_tensor.inner, &mut recv_tensor.inner)
}

pub fn barrier(&self) {
self.inner.barrier()
}

#[staticmethod]
pub fn generate_nccl_unique_id_str() -> String {
BaguaSingleCommunicator::generate_nccl_unique_id_str()
Expand Down

0 comments on commit ff68a61

Please sign in to comment.