You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Large data count support for MPI Communication (#1765)
* trick to send large data
* added tests
* Fixes for allreduce
* fixed large counts for allreduce, now trying to fix non-contiguous data types
* Custom operations for allreduce
* bench fixes
* perun fix
* correct inplace contiguous (sorry fabian)
* remove print statements
* benchmark fixes and debug output
* Incorrect move to acc if not CUDA_AWARE_MPI
* added tests for the Allreduce case
* tests were too large
* Update test_communication.py
---------
Co-authored-by: Hoppe <[email protected]>
Co-authored-by: Fabian Hoppe <[email protected]>
# Uses vector type to get around the MAX_INT limit on certain MPI implementations
297
+
# This is at the moment only applied when sending contiguous data, as the construction of data types to get around non-contiguous data naturally aliviates the problem to a certain extent.
298
+
# Thanks to: J. R. Hammond, A. Schäfer and R. Latham, "To INT_MAX... and Beyond! Exploring Large-Count Support in MPI," 2014 Workshop on Exascale MPI at Supercomputing Conference, New Orleans, LA, USA, 2014, pp. 1-8, doi: 10.1109/ExaMPI.2014.5. keywords: {Vectors;Standards;Libraries;Optimization;Context;Memory management;Open area test sites},
Buffer address where to store the result of the reduction
895
+
op: MPI.Op
896
+
Operation to apply during the reduction.
804
897
"""
805
898
sbuf=None
806
899
rbuf=None
@@ -815,56 +908,59 @@ def __reduce_like(
815
908
# harmonize the input and output buffers
816
909
# MPI requires send and receive buffers to be of same type and length. If the torch tensors are either not both
817
910
# contiguous or differently strided, they have to be made matching (if possible) first.
818
-
ifisinstance(sendbuf, torch.Tensor):
819
-
# convert the send buffer to a pointer, number of elements and type are identical to the receive buffer
820
-
dummy= (
821
-
sendbuf.contiguous()
822
-
) # make a contiguous copy and reassign the storage, old will be collected
823
-
# In PyTorch Version >= 2.0.0 we can use untyped_storage() instead of storage
824
-
# to keep backward compatibility with earlier PyTorch versions (where no untyped_storage() exists) we use a try/except
825
-
# (this applies to all places of Heat where untyped_storage() is used without further comment)
826
-
try:
827
-
sendbuf.set_(
828
-
dummy.untyped_storage(),
829
-
dummy.storage_offset(),
830
-
size=dummy.shape,
831
-
stride=dummy.stride(),
832
-
)
833
-
exceptAttributeError:
834
-
sendbuf.set_(
835
-
dummy.storage(),
836
-
dummy.storage_offset(),
837
-
size=dummy.shape,
838
-
stride=dummy.stride(),
839
-
)
840
-
sbuf=sendbufifCUDA_AWARE_MPIelsesendbuf.cpu()
841
-
sendbuf=self.as_buffer(sbuf)
911
+
ifsendbufisnotMPI.IN_PLACE:
912
+
# Send and recv buffer need the same number of elements.
913
+
ifsendbuf.numel() !=recvbuf.numel():
914
+
raiseValueError("Send and recv buffers need the same number of elements.")
915
+
916
+
# Stride and offset should be the same to create the same datatype and operation. If they differ, they should be made contiguous (at the expense of memory)
0 commit comments