extent = smpi_datatype_get_extent(datatype);
tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
- int is_commutative = smpi_op_is_commute(op);
+ int is_commutative = (op==MPI_OP_NULL || op->is_commutative());
mask = 1;
int lroot;
source = (relrank | mask);
if (source < comm_size) {
source = (source + lroot) % comm_size;
- smpi_mpi_recv(tmp_buf, count, datatype, source, tag, comm, &status);
+ Request::recv(tmp_buf, count, datatype, source, tag, comm, &status);
if (is_commutative) {
- smpi_op_apply(op, tmp_buf, recvbuf, &count, &datatype);
+ if(op!=MPI_OP_NULL) op->apply( tmp_buf, recvbuf, &count, datatype);
} else {
- smpi_op_apply(op, recvbuf, tmp_buf, &count, &datatype);
+ if(op!=MPI_OP_NULL) op->apply( recvbuf, tmp_buf, &count, datatype);
smpi_datatype_copy(tmp_buf, count, datatype,recvbuf, count, datatype);
}
}
} else {
dst = ((relrank & (~mask)) + lroot) % comm_size;
- smpi_mpi_send(recvbuf, count, datatype, dst, tag, comm);
+ Request::send(recvbuf, count, datatype, dst, tag, comm);
break;
}
mask <<= 1;
if (!is_commutative && (root != 0)){
if (rank == 0){
- smpi_mpi_send(recvbuf, count, datatype, root,tag, comm);
+ Request::send(recvbuf, count, datatype, root,tag, comm);
}else if (rank == root){
- smpi_mpi_recv(recvbuf, count, datatype, 0, tag, comm, &status);
+ Request::recv(recvbuf, count, datatype, 0, tag, comm, &status);
}
}