char *result_buf = NULL, *result_buf_free = NULL;
/* Initialize */
- rank = smpi_comm_rank(comm);
- size = smpi_comm_size(comm);
+ rank = comm->rank();
+ size = comm->size();
XBT_DEBUG("coll:tuned:reduce_scatter_ompi_basic_recursivehalving, rank %d", rank);
- if(!smpi_op_is_commute(op))
+ if( (op!=MPI_OP_NULL && !op->is_commutative()))
THROWF(arg_error,0, " reduce_scatter ompi_basic_recursivehalving can only be used for commutative operations! ");
/* Find displacements and the like */
two procs to do the rest of the algorithm */
if (rank < 2 * remain) {
if ((rank & 1) == 0) {
- smpi_mpi_send(result_buf, count, dtype, rank + 1,
+ Request::send(result_buf, count, dtype, rank + 1,
COLL_TAG_REDUCE_SCATTER,
comm);
/* we don't participate from here on out */
tmp_rank = -1;
} else {
- smpi_mpi_recv(recv_buf, count, dtype, rank - 1,
+ Request::recv(recv_buf, count, dtype, rank - 1,
COLL_TAG_REDUCE_SCATTER,
comm, MPI_STATUS_IGNORE);
/* integrate their results into our temp results */
- smpi_op_apply(op, recv_buf, result_buf, &count, &dtype);
+ if(op!=MPI_OP_NULL) op->apply( recv_buf, result_buf, &count, &dtype);
/* adjust rank to be the bottom "remain" ranks */
tmp_rank = rank / 2;
/* actual data transfer. Send from result_buf,
receive into recv_buf */
if (send_count > 0 && recv_count != 0) {
- request=smpi_mpi_irecv(recv_buf + (ptrdiff_t)tmp_disps[recv_index] * extent,
+ request=Request::irecv(recv_buf + (ptrdiff_t)tmp_disps[recv_index] * extent,
recv_count, dtype, peer,
COLL_TAG_REDUCE_SCATTER,
comm);
}
}
if (recv_count > 0 && send_count != 0) {
- smpi_mpi_send(result_buf + (ptrdiff_t)tmp_disps[send_index] * extent,
+ Request::send(result_buf + (ptrdiff_t)tmp_disps[send_index] * extent,
send_count, dtype, peer,
COLL_TAG_REDUCE_SCATTER,
comm);
}
}
if (send_count > 0 && recv_count != 0) {
- smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
+ Request::wait(&request, MPI_STATUS_IGNORE);
}
/* if we received something on this step, push it into
the results buffer */
if (recv_count > 0) {
- smpi_op_apply(op,
+ if(op!=MPI_OP_NULL) op->apply(
recv_buf + (ptrdiff_t)tmp_disps[recv_index] * extent,
result_buf + (ptrdiff_t)tmp_disps[recv_index] * extent,
&recv_count, &dtype);
if (rank < (2 * remain)) {
if ((rank & 1) == 0) {
if (rcounts[rank]) {
- smpi_mpi_recv(rbuf, rcounts[rank], dtype, rank + 1,
+ Request::recv(rbuf, rcounts[rank], dtype, rank + 1,
COLL_TAG_REDUCE_SCATTER,
comm, MPI_STATUS_IGNORE);
}
} else {
if (rcounts[rank - 1]) {
- smpi_mpi_send(result_buf + disps[rank - 1] * extent,
+ Request::send(result_buf + disps[rank - 1] * extent,
rcounts[rank - 1], dtype, rank - 1,
COLL_TAG_REDUCE_SCATTER,
comm);
ptrdiff_t true_lb, true_extent, lb, extent, max_real_segsize;
MPI_Request reqs[2] = {NULL, NULL};
- size = smpi_comm_size(comm);
- rank = smpi_comm_rank(comm);
+ size = comm->size();
+ rank = comm->rank();
XBT_DEBUG( "coll:tuned:reduce_scatter_ompi_ring rank %d, size %d",
rank, size);
inbi = 0;
/* Initialize first receive from the neighbor on the left */
- reqs[inbi]=smpi_mpi_irecv(inbuf[inbi], max_block_count, dtype, recv_from,
+ reqs[inbi]=Request::irecv(inbuf[inbi], max_block_count, dtype, recv_from,
COLL_TAG_REDUCE_SCATTER, comm
);
tmpsend = accumbuf + (ptrdiff_t)displs[recv_from] * extent;
- smpi_mpi_send(tmpsend, rcounts[recv_from], dtype, send_to,
+ Request::send(tmpsend, rcounts[recv_from], dtype, send_to,
COLL_TAG_REDUCE_SCATTER,
comm);
inbi = inbi ^ 0x1;
/* Post irecv for the current block */
- reqs[inbi]=smpi_mpi_irecv(inbuf[inbi], max_block_count, dtype, recv_from,
+ reqs[inbi]=Request::irecv(inbuf[inbi], max_block_count, dtype, recv_from,
COLL_TAG_REDUCE_SCATTER, comm
);
/* Wait on previous block to arrive */
- smpi_mpi_wait(&reqs[inbi ^ 0x1], MPI_STATUS_IGNORE);
+ Request::wait(&reqs[inbi ^ 0x1], MPI_STATUS_IGNORE);
/* Apply operation on previous block: result goes to rbuf
rbuf[prevblock] = inbuf[inbi ^ 0x1] (op) rbuf[prevblock]
*/
tmprecv = accumbuf + (ptrdiff_t)displs[prevblock] * extent;
- smpi_op_apply(op, inbuf[inbi ^ 0x1], tmprecv, &(rcounts[prevblock]), &dtype);
+ if(op!=MPI_OP_NULL) op->apply( inbuf[inbi ^ 0x1], tmprecv, &(rcounts[prevblock]), &dtype);
/* send previous block to send_to */
- smpi_mpi_send(tmprecv, rcounts[prevblock], dtype, send_to,
+ Request::send(tmprecv, rcounts[prevblock], dtype, send_to,
COLL_TAG_REDUCE_SCATTER,
comm);
}
/* Wait on the last block to arrive */
- smpi_mpi_wait(&reqs[inbi], MPI_STATUS_IGNORE);
+ Request::wait(&reqs[inbi], MPI_STATUS_IGNORE);
/* Apply operation on the last block (my block)
rbuf[rank] = inbuf[inbi] (op) rbuf[rank] */
tmprecv = accumbuf + (ptrdiff_t)displs[rank] * extent;
- smpi_op_apply(op, inbuf[inbi], tmprecv, &(rcounts[rank]), &dtype);
+ if(op!=MPI_OP_NULL) op->apply( inbuf[inbi], tmprecv, &(rcounts[rank]), &dtype);
/* Copy result from tmprecv to rbuf */
ret = smpi_datatype_copy(tmprecv, rcounts[rank], dtype, (char*)rbuf, rcounts[rank], dtype);