示例#1
0
def petsc_comm_self():
    """Python wrapper around PETSC_COMM_SELF.
    """
    global _petsc_self
    if _petsc_self is None:
        _petsc_self = Communicator(mpimodule.petsc_comm_self())
    return _petsc_self
示例#2
0
def petsc_comm_self():
  """
  Python wrapper around PETSC_COMM_SELF.
  """
  global _petsc_self
  if _petsc_self is None:
      _petsc_self = Communicator(mpimodule.petsc_comm_self())
  return _petsc_self
示例#3
0
文件: TestReduce.py 项目: jjle/pylith
  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
示例#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
示例#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