Exemple #1
0
 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
Exemple #2
0
 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
Exemple #3
0
  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
Exemple #4
0
    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
Exemple #5
0
    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