char *inbuf;
MPI_Status status;
- rank = smpi_comm_rank(comm);
- size = smpi_comm_size(comm);
+ rank = comm->rank();
+ size = comm->size();
/* If not root, send data to the root. */
extent = smpi_datatype_get_extent(dtype);
if (rank != root) {
- smpi_mpi_send(sbuf, count, dtype, root, tag, comm);
+ Request::send(sbuf, count, dtype, root, tag, comm);
return 0;
}
/* Initialize the receive buffer. */
if (rank == (size - 1))
- smpi_mpi_sendrecv(sbuf, count, dtype, rank, tag,
+ Request::sendrecv(sbuf, count, dtype, rank, tag,
rbuf, count, dtype, rank, tag, comm, &status);
else
- smpi_mpi_recv(rbuf, count, dtype, size - 1, tag, comm, &status);
+ Request::recv(rbuf, count, dtype, size - 1, tag, comm, &status);
/* Loop receiving and calling reduction function (C or Fortran). */
if (rank == i)
inbuf = static_cast<char*>(sbuf);
else {
- smpi_mpi_recv(origin, count, dtype, i, tag, comm, &status);
+ Request::recv(origin, count, dtype, i, tag, comm, &status);
inbuf = origin;
}
/* Call reduction function. */
- smpi_op_apply(op, inbuf, rbuf, &count, &dtype);
+ if(op!=MPI_OP_NULL) op->apply( inbuf, rbuf, &count, dtype);
}