def _stableTimeStep(self, mesh, integrators): """ Get stable time step. """ dtStable = 1.0e+30 for integrator in integrators: dt = integrator.stableTimeStep(mesh) if dt < dtStable: dtStable = dt import pylith.mpi.mpi as mpi comm = mesh.comm() dtStableAll = mpi.allreduce_scalar_double(dtStable, mpi.mpi_min(), comm.handle) return dtStableAll
def test_allreduce_scalar_int(self): """ Test allreduce_int(). """ value = 3 result = mpi.allreduce_scalar_int(value, mpi.mpi_sum(), mpi.petsc_comm_world()) self.assertEqual(value, result) result = mpi.allreduce_scalar_int(value, mpi.mpi_min(), mpi.petsc_comm_self()) self.assertEqual(value, result) result = mpi.allreduce_scalar_int(value, mpi.mpi_max(), mpi.petsc_comm_world()) self.assertEqual(value, result) return
def test_allreduce_scalar_int(self): value = 3 result = mpi.allreduce_scalar_int(value, mpi.mpi_sum(), mpi.petsc_comm_world()) self.assertEqual(value, result) result = mpi.allreduce_scalar_int(value, mpi.mpi_min(), mpi.petsc_comm_self()) self.assertEqual(value, result) result = mpi.allreduce_scalar_int(value, mpi.mpi_max(), mpi.petsc_comm_world()) self.assertEqual(value, result) return
def test_allreduce_scalar_double(self): """ Test allreduce_double(). """ value = 2.0 result = mpi.allreduce_scalar_double(value, mpi.mpi_sum(), mpi.petsc_comm_world()) self.assertEqual(value, result) result = mpi.allreduce_scalar_double(value, mpi.mpi_min(), mpi.petsc_comm_self()) self.assertEqual(value, result) result = mpi.allreduce_scalar_double(value, mpi.mpi_max(), mpi.petsc_comm_world()) self.assertEqual(value, result) return