Commit 130122a9 authored by Chenggang Zhao's avatar Chenggang Zhao
Browse files

Add `self.group`

parent 24324cc5
...@@ -54,13 +54,14 @@ class Buffer: ...@@ -54,13 +54,14 @@ class Buffer:
explicitly_destroy: If this flag is set to True, you need to explicitly call `destroy()` to release resources; explicitly_destroy: If this flag is set to True, you need to explicitly call `destroy()` to release resources;
otherwise, the resources will be released by the destructor. otherwise, the resources will be released by the destructor.
Note: Releasing resources in the destructor may cause Python's exception handling process to hang. Note: Releasing resources in the destructor may cause Python's exception handling process to hang.
comm: the mpi4py.MPI.Comm communicator to use in case the group parameter is absent. comm: the `mpi4py.MPI.Comm` communicator to use in case the group parameter is absent.
""" """
check_nvlink_connections(group) check_nvlink_connections(group)
# Initialize the CPP runtime # Initialize the CPP runtime
if group is not None: if group is not None:
self.rank = group.rank() self.rank = group.rank()
self.group = group
self.group_size = group.size() self.group_size = group.size()
def all_gather_object(obj): def all_gather_object(obj):
...@@ -69,6 +70,7 @@ class Buffer: ...@@ -69,6 +70,7 @@ class Buffer:
return object_list return object_list
elif comm is not None: elif comm is not None:
self.rank = comm.Get_rank() self.rank = comm.Get_rank()
self.group = comm
self.group_size = comm.Get_size() self.group_size = comm.Get_size()
def all_gather_object(obj): def all_gather_object(obj):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment