int mpi_errno = MPI_SUCCESS;
int total_count, dst, src;
int is_commutative;
- comm_size = smpi_comm_size(comm);
- rank = smpi_comm_rank(comm);
+ comm_size = comm->size();
+ rank = comm->rank();
extent =smpi_datatype_get_extent(datatype);
smpi_datatype_extent(datatype, &true_lb, &true_extent);
- if (smpi_op_is_commute(op)) {
+ if (op->is_commutative()) {
is_commutative = 1;
}
/* send the data that dst needs. recv data that this process
needs from src into tmp_recvbuf */
if (sendbuf != MPI_IN_PLACE)
- smpi_mpi_sendrecv(((char *)sendbuf+disps[dst]*extent),
+ Request::sendrecv(((char *)sendbuf+disps[dst]*extent),
recvcounts[dst], datatype, dst,
COLL_TAG_SCATTER, tmp_recvbuf,
recvcounts[rank], datatype, src,
COLL_TAG_SCATTER, comm,
MPI_STATUS_IGNORE);
else
- smpi_mpi_sendrecv(((char *)recvbuf+disps[dst]*extent),
+ Request::sendrecv(((char *)recvbuf+disps[dst]*extent),
recvcounts[dst], datatype, dst,
COLL_TAG_SCATTER, tmp_recvbuf,
recvcounts[rank], datatype, src,
if (is_commutative || (src < rank)) {
if (sendbuf != MPI_IN_PLACE) {
- smpi_op_apply( op,
+ if(op!=MPI_OP_NULL) op->apply(
tmp_recvbuf, recvbuf, &recvcounts[rank],
- &datatype);
+ datatype);
}
else {
- smpi_op_apply(op,
+ if(op!=MPI_OP_NULL) op->apply(
tmp_recvbuf, ((char *)recvbuf+disps[rank]*extent),
- &recvcounts[rank], &datatype);
+ &recvcounts[rank], datatype);
/* we can't store the result at the beginning of
recvbuf right here because there is useful data
there that other process/processes need. at the
}
else {
if (sendbuf != MPI_IN_PLACE) {
- smpi_op_apply(op,
- recvbuf, tmp_recvbuf, &recvcounts[rank], &datatype);
+ if(op!=MPI_OP_NULL) op->apply(
+ recvbuf, tmp_recvbuf, &recvcounts[rank], datatype);
/* copy result back into recvbuf */
mpi_errno = smpi_datatype_copy(tmp_recvbuf, recvcounts[rank],
datatype, recvbuf,
if (mpi_errno) return(mpi_errno);
}
else {
- smpi_op_apply(op,
+ if(op!=MPI_OP_NULL) op->apply(
((char *)recvbuf+disps[rank]*extent),
- tmp_recvbuf, &recvcounts[rank], &datatype);
+ tmp_recvbuf, &recvcounts[rank], datatype);
/* copy result back into recvbuf */
mpi_errno = smpi_datatype_copy(tmp_recvbuf, recvcounts[rank],
datatype,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int mpi_errno = MPI_SUCCESS;
- int comm_size = smpi_comm_size(comm) ;
- int rank = smpi_comm_rank(comm);
+ int comm_size = comm->size() ;
+ int rank = comm->rank();
int pof2;
int log2_comm_size;
int i, k;
send_offset += size;
}
- smpi_mpi_sendrecv(outgoing_data + send_offset*true_extent,
+ Request::sendrecv(outgoing_data + send_offset*true_extent,
size, datatype, peer, COLL_TAG_SCATTER,
incoming_data + recv_offset*true_extent,
size, datatype, peer, COLL_TAG_SCATTER,
is now our peer's responsibility */
if (rank > peer) {
/* higher ranked value so need to call op(received_data, my_data) */
- smpi_op_apply(op,
+ if(op!=MPI_OP_NULL) op->apply(
incoming_data + recv_offset*true_extent,
outgoing_data + recv_offset*true_extent,
- &size, &datatype );
+ &size, datatype );
/* buf0_was_inout = buf0_was_inout; */
}
else {
/* lower ranked value so need to call op(my_data, received_data) */
- smpi_op_apply( op,
+ if(op!=MPI_OP_NULL) op->apply(
outgoing_data + recv_offset*true_extent,
incoming_data + recv_offset*true_extent,
- &size, &datatype);
+ &size, datatype);
buf0_was_inout = !buf0_was_inout;
}
int received;
MPI_Datatype sendtype, recvtype;
int nprocs_completed, tmp_mask, tree_root, is_commutative=0;
- comm_size = smpi_comm_size(comm);
- rank = smpi_comm_rank(comm);
+ comm_size = comm->size();
+ rank = comm->rank();
extent =smpi_datatype_get_extent(datatype);
smpi_datatype_extent(datatype, &true_lb, &true_extent);
- if (smpi_op_is_commute(op)) {
+ if ((op==MPI_OP_NULL) || op->is_commutative()) {
is_commutative = 1;
}
received in tmp_recvbuf and then accumulated into
tmp_results. accumulation is done later below. */
- smpi_mpi_sendrecv(tmp_results, 1, sendtype, dst,
+ Request::sendrecv(tmp_results, 1, sendtype, dst,
COLL_TAG_SCATTER,
tmp_recvbuf, 1, recvtype, dst,
COLL_TAG_SCATTER, comm,
(rank < tree_root + nprocs_completed)
&& (dst >= tree_root + nprocs_completed)) {
/* send the current result */
- smpi_mpi_send(tmp_recvbuf, 1, recvtype,
+ Request::send(tmp_recvbuf, 1, recvtype,
dst, COLL_TAG_SCATTER,
comm);
}
else if ((dst < rank) &&
(dst < tree_root + nprocs_completed) &&
(rank >= tree_root + nprocs_completed)) {
- smpi_mpi_recv(tmp_recvbuf, 1, recvtype, dst,
+ Request::recv(tmp_recvbuf, 1, recvtype, dst,
COLL_TAG_SCATTER,
comm, MPI_STATUS_IGNORE);
received = 1;
if (received) {
if (is_commutative || (dst_tree_root < my_tree_root)) {
{
- smpi_op_apply(op,
+ if(op!=MPI_OP_NULL) op->apply(
tmp_recvbuf, tmp_results, &blklens[0],
- &datatype);
- smpi_op_apply(op,
+ datatype);
+ if(op!=MPI_OP_NULL) op->apply(
((char *)tmp_recvbuf + dis[1]*extent),
((char *)tmp_results + dis[1]*extent),
- &blklens[1], &datatype);
+ &blklens[1], datatype);
}
}
else {
{
- smpi_op_apply(op,
+ if(op!=MPI_OP_NULL) op->apply(
tmp_results, tmp_recvbuf, &blklens[0],
- &datatype);
- smpi_op_apply(op,
+ datatype);
+ if(op!=MPI_OP_NULL) op->apply(
((char *)tmp_results + dis[1]*extent),
((char *)tmp_recvbuf + dis[1]*extent),
- &blklens[1], &datatype);
+ &blklens[1], datatype);
}
/* copy result back into tmp_results */
mpi_errno = smpi_datatype_copy(tmp_recvbuf, 1, recvtype,