Exemplo n.º 1
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
Exemplo n.º 2
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
Exemplo n.º 3
0
 def _collectNeedNewJacobian(self, flagLocal):
   """
   Aggregate needNewJacobian results across processors.
   """
   if flagLocal:
     countLocal = 1
   else:
     countLocal = 0
   import pylith.mpi.mpi as mpi
   comm = self.mesh().comm()
   countAll = mpi.allreduce_scalar_int(countLocal, mpi.mpi_max(), comm.handle)
   
   return countAll > 0
Exemplo n.º 4
0
 def _collectNeedNewJacobian(self, flagLocal):
   """
   Aggregate needNewJacobian results across processors.
   """
   if flagLocal:
     countLocal = 1
   else:
     countLocal = 0
   import pylith.mpi.mpi as mpi
   comm = self.mesh().comm()
   countAll = mpi.allreduce_scalar_int(countLocal, mpi.mpi_max(), comm.handle)
   
   return countAll > 0