1
1

Fixes trac:692 in trunk: receive buffer in MPI_Reduce operation is no longer overwritten on non-root nodes.

This commit was SVN r13538.

The following Trac tickets were found above:
  Ticket 692 --> https://svn.open-mpi.org/trac/ompi/ticket/692
Этот коммит содержится в:
Jelena Pjesivac-Grbovic 2007-02-07 18:57:03 +00:00
родитель ccff0a6e65
Коммит 6efca498ec

Просмотреть файл

@ -42,7 +42,7 @@ int ompi_coll_tuned_reduce_generic( void* sendbuf, void* recvbuf, int original_c
ompi_coll_tree_t* tree, int count_by_segment )
{
char *inbuf[2] = {(char*)NULL, (char*)NULL};
char *local_op_buffer, *accumbuf = NULL, *sendtmpbuf;
char *local_op_buffer = NULL, *accumbuf = NULL, *sendtmpbuf = NULL;
ptrdiff_t extent, lower_bound;
size_t typelng, realsegsize;
ompi_request_t* reqs[2] = {MPI_REQUEST_NULL, MPI_REQUEST_NULL};
@ -67,9 +67,10 @@ int ompi_coll_tuned_reduce_generic( void* sendbuf, void* recvbuf, int original_c
/* non-leaf nodes - wait for children to send me data & forward up (if needed) */
if( tree->tree_nextsize > 0 ) {
/* handle non existant recv buffer (i.e. its NULL.. like basic allreduce uses!) */
/* handle non existant recv buffer (i.e. its NULL) and
protect the recv buffer on non-root nodes */
accumbuf = (char*)recvbuf;
if( NULL == accumbuf ) {
if( (NULL == accumbuf) || (root != rank) ) {
accumbuf = (char*)malloc(realsegsize * num_segments); /* TO BE OPTIMIZED */
if (accumbuf == NULL) { line = __LINE__; ret = -1; goto error_hndl; }
}
@ -174,7 +175,7 @@ int ompi_coll_tuned_reduce_generic( void* sendbuf, void* recvbuf, int original_c
/* clean up */
if( inbuf[0] != NULL) free(inbuf[0]);
if( inbuf[1] != NULL) free(inbuf[1]);
if( NULL == recvbuf ) free(accumbuf);
if( (NULL == recvbuf) || (root != rank) ) free(accumbuf);
}
/* leaf nodes */