is_commutative = (op==MPI_OP_NULL || op->is_commutative());
/* need to allocate temporary buffer to store incoming data */
- smpi_datatype_extent(datatype, &true_lb, &true_extent);
- extent = smpi_datatype_get_extent(datatype);
+ datatype->extent(&true_lb, &true_extent);
+ extent = datatype->get_extent();
tmp_buf_free= smpi_get_tmp_recvbuffer(count * (MAX(extent, true_extent)));
/* copy local data into recvbuf */
if (sendbuf != MPI_IN_PLACE) {
mpi_errno =
- smpi_datatype_copy(sendbuf, count, datatype, recvbuf, count,
+ Datatype::copy(sendbuf, count, datatype, recvbuf, count,
datatype);
}
/* do the reduction on received data. since the
ordering is right, it doesn't matter whether
the operation is commutative or not. */
- if(op!=MPI_OP_NULL) op->apply( tmp_buf, recvbuf, &count, &datatype);
+ if(op!=MPI_OP_NULL) op->apply( tmp_buf, recvbuf, &count, datatype);
/* change the rank */
newrank = rank / 2;
}
if (is_commutative || (dst < rank)) {
/* op is commutative OR the order is already right */
- if(op!=MPI_OP_NULL) op->apply( tmp_buf, recvbuf, &count, &datatype);
+ if(op!=MPI_OP_NULL) op->apply( tmp_buf, recvbuf, &count, datatype);
} else {
/* op is noncommutative and the order is not right */
- if(op!=MPI_OP_NULL) op->apply( recvbuf, tmp_buf, &count, &datatype);
+ if(op!=MPI_OP_NULL) op->apply( recvbuf, tmp_buf, &count, datatype);
/* copy result back into recvbuf */
- mpi_errno = smpi_datatype_copy(tmp_buf, count, datatype,
+ mpi_errno = Datatype::copy(tmp_buf, count, datatype,
recvbuf, count, datatype);
}
mask <<= 1;
if(op!=MPI_OP_NULL) op->apply( (char *) tmp_buf + disps[recv_idx] * extent,
(char *) recvbuf + disps[recv_idx] * extent,
- &recv_cnt, &datatype);
+ &recv_cnt, datatype);
/* update send_idx for next iteration */
send_idx = recv_idx;