Skip to content

Commit

Permalink
Shift location of barrier until after numpy wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
tskisner committed Mar 14, 2024
1 parent bd34283 commit 7a265c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pshmem/shmem.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ def __init__(self, shape, dtype, comm, comm_node=None, comm_node_rank=None):
print(msg, flush=True)
raise

# Wait for other processes to attach
if self._nodecomm is not None:
self._nodecomm.barrier()

# Create a numpy array which acts as a view of the buffer.
self._flat = np.ndarray(
self._n,
Expand All @@ -230,6 +226,10 @@ def __init__(self, shape, dtype, comm, comm_node=None, comm_node_rank=None):
# Wrap
self.data = self._flat.reshape(self._shape)

# Wait for other processes to attach and wrap
if self._nodecomm is not None:
self._nodecomm.barrier()

# Now the rank zero process will call remove() to mark the shared
# memory segment for removal. However, this will not actually
# be removed until all processes detach.
Expand Down

0 comments on commit 7a265c3

Please sign in to comment.