int comm_size, rank;
int mask, relrank, source;
int dst;
- int tag = 4321;
+ int tag = COLL_TAG_REDUCE;
MPI_Aint extent;
void *tmp_buf;
MPI_Aint true_lb, true_extent;
tmp_buf = (void *) xbt_malloc(count * extent);
int is_commutative = smpi_op_is_commute(op);
- smpi_mpi_sendrecv(sendbuf, count, datatype, rank, tag,
- recvbuf, count, datatype, rank, tag, comm, &status);
mask = 1;
int lroot;
mask <<= 1;
}
-if (!is_commutative && (root != 0)){
- if (rank == 0){
- smpi_mpi_send(recvbuf, count, datatype, root,tag, comm);
- }else if (rank == root){
- smpi_mpi_recv(recvbuf, count, datatype, 0, tag, comm, &status);
+ if (!is_commutative && (root != 0)){
+ if (rank == 0){
+ smpi_mpi_send(recvbuf, count, datatype, root,tag, comm);
+ }else if (rank == root){
+ smpi_mpi_recv(recvbuf, count, datatype, 0, tag, comm, &status);
+ }
}
-}
+ if (rank != root) {
+ xbt_free(recvbuf);
+ }
free(tmp_buf);
return 0;