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
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
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