Esempio n. 1
0
T Comm::allreduce(T x, Omega_h_Op op) const {
#ifdef OMEGA_H_USE_MPI
  CALL(MPI_Allreduce(
      MPI_IN_PLACE, &x, 1, MpiTraits<T>::datatype(), mpi_op(op), impl_));
#else
  (void)op;
#endif
  return x;
}
Esempio n. 2
0
 void
 scan_impl(const communicator& comm, const T* in_values, int n, T* out_values,
           Op op, mpl::false_ /*is_mpi_op*/, mpl::true_ /*is_mpi_datatype*/)
 {
   user_op<Op, T> mpi_op(op);
   BOOST_MPI_CHECK_RESULT(MPI_Scan,
                          (const_cast<T*>(in_values), out_values, n,
                           boost::mpi::get_mpi_datatype<T>(*in_values),
                           mpi_op.get_mpi_op(), comm));
 }
Esempio n. 3
0
 void
 reduce_impl(const communicator& comm, const T* in_values, int n, Op op, 
             int root, mpl::false_/*is_mpi_op*/, mpl::true_/*is_mpi_datatype*/)
 {
   user_op<Op, T> mpi_op(op);
   BOOST_MPI_CHECK_RESULT(MPI_Reduce,
                          (const_cast<T*>(in_values), 0, n,
                           boost::mpi::get_mpi_datatype<T>(*in_values),
                           mpi_op.get_mpi_op(), root, comm));
 }
Esempio n. 4
0
T Comm::exscan(T x, Omega_h_Op op) const {
#ifdef OMEGA_H_USE_MPI
  CALL(MPI_Exscan(
      MPI_IN_PLACE, &x, 1, MpiTraits<T>::datatype(), mpi_op(op), impl_));
  if (rank() == 0) x = 0;
  return x;
#else
  (void)op;
  (void)x;
  return 0;
#endif
}