X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/32b45cab9d4731c6cc648f79f1bebce2d1c7ca9a..ac58039b1a8b9328b70a7809e30daa0284c5b72e:/src/smpi/colls/reduce-ompi.c diff --git a/src/smpi/colls/reduce-ompi.c b/src/smpi/colls/reduce-ompi.c index 6dc846cd59..0b71d60ea3 100644 --- a/src/smpi/colls/reduce-ompi.c +++ b/src/smpi/colls/reduce-ompi.c @@ -18,7 +18,6 @@ #include "colls_private.h" #include "coll_tuned_topo.h" -#define MCA_COLL_BASE_TAG_REDUCE 555 @@ -48,7 +47,6 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi char *accumbuf = NULL, *accumbuf_free = NULL; char *local_op_buffer = NULL, *sendtmpbuf = NULL; ptrdiff_t extent, lower_bound, segment_increment; - size_t typelng; MPI_Request reqs[2] = {MPI_REQUEST_NULL, MPI_REQUEST_NULL}; int num_segments, line, ret, segindex, i, rank; int recvcount, prevcount, inbi; @@ -58,7 +56,6 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi * sent per operation */ smpi_datatype_extent( datatype, &lower_bound, &extent); - typelng = smpi_datatype_size( datatype ); num_segments = (original_count + count_by_segment - 1) / count_by_segment; segment_increment = count_by_segment * extent; @@ -94,8 +91,8 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi sendbuf to the accumbuf, in order to simplfy the loops */ if (!smpi_op_is_commute(op)) { smpi_datatype_copy( - (char*)accumbuf, original_count, datatype, - (char*)sendtmpbuf, original_count, datatype); + (char*)sendtmpbuf, original_count, datatype, + (char*)accumbuf, original_count, datatype); } /* Allocate two buffers for incoming segments */ real_segment_size = true_extent + (count_by_segment - 1) * extent; @@ -153,7 +150,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi reqs[inbi]=smpi_mpi_irecv(local_recvbuf, recvcount, datatype, tree->tree_next[i], - MCA_COLL_BASE_TAG_REDUCE, comm + COLL_TAG_REDUCE, comm ); } /* wait for previous req to complete, if any. @@ -197,7 +194,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi /* send combined/accumulated data to parent */ smpi_mpi_send( accumulator, prevcount, datatype, tree->tree_prev, - MCA_COLL_BASE_TAG_REDUCE, + COLL_TAG_REDUCE, comm); } @@ -244,7 +241,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi segindex * segment_increment, count_by_segment, datatype, tree->tree_prev, - MCA_COLL_BASE_TAG_REDUCE, + COLL_TAG_REDUCE, comm) ; segindex++; original_count -= count_by_segment; @@ -272,7 +269,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi segindex * segment_increment, count_by_segment, datatype, tree->tree_prev, - MCA_COLL_BASE_TAG_REDUCE, + COLL_TAG_REDUCE, comm); original_count -= count_by_segment; } @@ -290,7 +287,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi segindex * segment_increment, count_by_segment, datatype, tree->tree_prev, - MCA_COLL_BASE_TAG_REDUCE, + COLL_TAG_REDUCE, comm ); creq = (creq + 1) % max_outstanding_reqs; segindex++; @@ -305,6 +302,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi free(sreq); } } + free(tree); return MPI_SUCCESS; error_hndl: /* error handler */ @@ -523,8 +521,8 @@ int smpi_coll_tuned_reduce_ompi_in_order_binary( void *sendbuf, void *recvbuf, return MPI_ERR_INTERN; } smpi_datatype_copy ( - (char*)tmpbuf, count, datatype, - (char*)recvbuf, count, datatype); + (char*)recvbuf, count, datatype, + (char*)tmpbuf, count, datatype); use_this_sendbuf = tmpbuf; } else if (io_root == rank) { tmpbuf = (char *) malloc(text + (count - 1) * ext); @@ -547,7 +545,7 @@ int smpi_coll_tuned_reduce_ompi_in_order_binary( void *sendbuf, void *recvbuf, if (root == rank) { /* Receive result from rank io_root to recvbuf */ smpi_mpi_recv(recvbuf, count, datatype, io_root, - MCA_COLL_BASE_TAG_REDUCE, comm, + COLL_TAG_REDUCE, comm, MPI_STATUS_IGNORE); if (MPI_IN_PLACE == sendbuf) { free(use_this_sendbuf); @@ -556,7 +554,7 @@ int smpi_coll_tuned_reduce_ompi_in_order_binary( void *sendbuf, void *recvbuf, } else if (io_root == rank) { /* Send result from use_this_recvbuf to root */ smpi_mpi_send(use_this_recvbuf, count, datatype, root, - MCA_COLL_BASE_TAG_REDUCE, + COLL_TAG_REDUCE, comm); free(use_this_recvbuf); } @@ -612,7 +610,7 @@ smpi_coll_tuned_reduce_ompi_basic_linear(void *sbuf, void *rbuf, int count, if (rank != root) { smpi_mpi_send(sbuf, count, dtype, root, - MCA_COLL_BASE_TAG_REDUCE, + COLL_TAG_REDUCE, comm); return -1; } @@ -641,11 +639,10 @@ smpi_coll_tuned_reduce_ompi_basic_linear(void *sbuf, void *rbuf, int count, /* Initialize the receive buffer. */ if (rank == (size - 1)) { - smpi_datatype_copy((char*)rbuf, count, dtype, - (char*)sbuf, count, dtype); + smpi_datatype_copy((char*)sbuf, count, dtype,(char*)rbuf, count, dtype); } else { smpi_mpi_recv(rbuf, count, dtype, size - 1, - MCA_COLL_BASE_TAG_REDUCE, comm, + COLL_TAG_REDUCE, comm, MPI_STATUS_IGNORE); } @@ -656,7 +653,7 @@ smpi_coll_tuned_reduce_ompi_basic_linear(void *sbuf, void *rbuf, int count, inbuf = (char*)sbuf; } else { smpi_mpi_recv(pml_buffer, count, dtype, i, - MCA_COLL_BASE_TAG_REDUCE, comm, + COLL_TAG_REDUCE, comm, MPI_STATUS_IGNORE); inbuf = pml_buffer; } @@ -666,8 +663,8 @@ smpi_coll_tuned_reduce_ompi_basic_linear(void *sbuf, void *rbuf, int count, } if (NULL != inplace_temp) { - smpi_datatype_copy((char*)sbuf, count, dtype, - inplace_temp,count , dtype); + smpi_datatype_copy(inplace_temp, count, dtype,(char*)sbuf + ,count , dtype); free(inplace_temp); } if (NULL != free_buffer) {