MCPcopy Create free account
hub / github.com/DedalusProject/dedalus / allreduce_data_norm

Method allreduce_data_norm

dedalus/core/field.py:820–839  ·  view source on GitHub ↗
(self, layout=None, order=2)

Source from the content-addressed store, hash-verified

818 return np.block(combined.reshape(ext_mesh).tolist())
819
820 def allreduce_data_norm(self, layout=None, order=2):
821 # Change layout
822 if layout is not None:
823 self.change_layout(layout)
824 # Compute local data
825 if self.data.size == 0:
826 norm = 0
827 elif order == np.inf:
828 norm = np.max(np.abs(self.data))
829 else:
830 norm = np.sum(np.abs(self.data)**order)
831 # Reduce
832 if order == np.inf:
833 if self.dist.comm.size > 1:
834 norm = self.dist.comm.allreduce(norm, op=MPI.MAX)
835 else:
836 if self.dist.comm.size > 1:
837 norm = self.dist.comm.allreduce(norm, op=MPI.SUM)
838 norm = norm ** (1 / order)
839 return norm
840
841 def allreduce_data_max(self, layout=None):
842 return self.allreduce_data_norm(layout=layout, order=np.inf)

Callers 3

allreduce_data_maxMethod · 0.95
lane_emden.pyFile · 0.80
test_sin_jacobiFunction · 0.80

Calls 2

change_layoutMethod · 0.95
maxMethod · 0.80

Tested by 1

test_sin_jacobiFunction · 0.64