coll/tuned: fix memory leaks and misc issues
as reported by Coverity with CIDs 70132, 70265, 70267, 70268, 70322, 70400, 70580, 70615, 1269934, 1269944, 1269968, 1269982, 1269983
Этот коммит содержится в:
родитель
f7c28ea706
Коммит
bda8058f39
@ -13,6 +13,8 @@
|
||||
* Copyright (c) 2009 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -201,6 +203,8 @@ int ompi_coll_tuned_allgatherv_intra_bruck(void *sbuf, int scount,
|
||||
rbuf, 1, new_rdtype, recvfrom,
|
||||
MCA_COLL_BASE_TAG_ALLGATHERV,
|
||||
comm, MPI_STATUS_IGNORE, rank);
|
||||
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
|
||||
|
||||
ompi_datatype_destroy(&new_sdtype);
|
||||
ompi_datatype_destroy(&new_rdtype);
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -345,10 +345,8 @@ int ompi_coll_tuned_alltoall_intra_bruck(void *sbuf, int scount,
|
||||
"%s:%4d\tError occurred %d, rank %2d", __FILE__, line, err,
|
||||
rank));
|
||||
if (tmpbuf != NULL) free(tmpbuf_free);
|
||||
if (weallocated) {
|
||||
if (displs != NULL) free(displs);
|
||||
if (blen != NULL) free(blen);
|
||||
}
|
||||
if (displs != NULL) free(displs);
|
||||
if (blen != NULL) free(blen);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -67,6 +69,8 @@ ompi_coll_tuned_sendrecv_zero(int dest, int stag,
|
||||
/* post new irecv */
|
||||
err = MCA_PML_CALL(irecv( NULL, 0, MPI_BYTE, source, rtag,
|
||||
comm, &reqs[0]));
|
||||
/* try to silence CID 1269934 */
|
||||
assert( MPI_ERR_IN_STATUS != err );
|
||||
if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
|
||||
|
||||
/* send data to children */
|
||||
|
@ -10,6 +10,8 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -96,6 +98,11 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**
|
||||
/* make space and init the algorithm rules for each of the n_collectives MPI collectives */
|
||||
alg_rules = ompi_coll_tuned_mk_alg_rules (n_collectives);
|
||||
|
||||
if (NULL == alg_rules) {
|
||||
OPAL_OUTPUT((ompi_coll_tuned_stream,"cannot cannot allocate rules for file [%s]\n", fname));
|
||||
goto on_file_error;
|
||||
}
|
||||
|
||||
X = (int)getnext(fptr);
|
||||
if (X<0) {
|
||||
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read number of collectives in configuration file around line %d\n", fileline));
|
||||
@ -120,7 +127,9 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**
|
||||
|
||||
if (alg_rules[CI].alg_rule_id != CI) {
|
||||
OPAL_OUTPUT((ompi_coll_tuned_stream, "Internal error in handling collective ID %d\n", CI));
|
||||
ompi_coll_tuned_free_all_rules (*rules, n_collectives);
|
||||
fclose(fptr);
|
||||
ompi_coll_tuned_free_all_rules (alg_rules, n_collectives);
|
||||
*rules = (ompi_coll_alg_rule_t*) NULL;
|
||||
return (-4);
|
||||
}
|
||||
OPAL_OUTPUT((ompi_coll_tuned_stream, "Reading dynamic rule for collective ID %d\n", CI));
|
||||
@ -277,6 +286,7 @@ static long getnext (FILE *fptr)
|
||||
if (1 == rc) return val;
|
||||
/* in all other cases, skip to the end */
|
||||
rc = fread(&trash, 1, 1, fptr);
|
||||
if (rc == EOF) return MYEOF;
|
||||
if ('\n' == trash) fileline++;
|
||||
if ('#' == trash) skiptonewline (fptr);
|
||||
} while (1);
|
||||
|
@ -12,6 +12,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -230,6 +232,7 @@ ompi_coll_tuned_gather_intra_linear_sync(void *sbuf, int scount,
|
||||
int i, ret, line, rank, size, first_segment_count;
|
||||
MPI_Aint extent, lb;
|
||||
size_t typelng;
|
||||
ompi_request_t **reqs = NULL;
|
||||
|
||||
size = ompi_comm_size(comm);
|
||||
rank = ompi_comm_rank(comm);
|
||||
@ -278,7 +281,7 @@ ompi_coll_tuned_gather_intra_linear_sync(void *sbuf, int scount,
|
||||
- Waitall for all the second segments to complete.
|
||||
*/
|
||||
char *ptmp;
|
||||
ompi_request_t **reqs = NULL, *first_segment_req;
|
||||
ompi_request_t *first_segment_req;
|
||||
reqs = (ompi_request_t**) calloc(size, sizeof(ompi_request_t*));
|
||||
if (NULL == reqs) { ret = -1; line = __LINE__; goto error_hndl; }
|
||||
|
||||
@ -340,6 +343,9 @@ ompi_coll_tuned_gather_intra_linear_sync(void *sbuf, int scount,
|
||||
|
||||
return MPI_SUCCESS;
|
||||
error_hndl:
|
||||
if (NULL != reqs) {
|
||||
free(reqs);
|
||||
}
|
||||
OPAL_OUTPUT (( ompi_coll_tuned_stream,
|
||||
"ERROR_HNDL: node %d file %s line %d error %d\n",
|
||||
rank, __FILE__, line, ret ));
|
||||
|
@ -12,6 +12,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -705,8 +707,9 @@ ompi_coll_tuned_reduce_intra_basic_linear(void *sbuf, void *rbuf, int count,
|
||||
if (NULL != inplace_temp) {
|
||||
err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)sbuf,
|
||||
inplace_temp);
|
||||
} else {
|
||||
err = MPI_SUCCESS;
|
||||
}
|
||||
err = MPI_SUCCESS;
|
||||
|
||||
exit:
|
||||
if (NULL != inplace_temp) {
|
||||
|
@ -9,6 +9,8 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -371,6 +373,7 @@ ompi_coll_tuned_topo_build_bmtree( struct ompi_communicator_t* comm,
|
||||
if( remote >= size ) remote -= size;
|
||||
if (childs==MAXTREEFANOUT) {
|
||||
OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d", MAXTREEFANOUT, childs));
|
||||
free(bmtree);
|
||||
return NULL;
|
||||
}
|
||||
bmtree->tree_next[childs] = remote;
|
||||
@ -442,6 +445,7 @@ ompi_coll_tuned_topo_build_in_order_bmtree( struct ompi_communicator_t* comm,
|
||||
OPAL_OUTPUT((ompi_coll_tuned_stream,
|
||||
"coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d",
|
||||
MAXTREEFANOUT, childs));
|
||||
free (bmtree);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -576,12 +580,14 @@ ompi_coll_tuned_topo_build_chain( int fanout,
|
||||
chain->tree_nextsize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Unshift values
|
||||
*/
|
||||
if( rank == root ) {
|
||||
chain->tree_prev = (chain->tree_prev+root)%size;
|
||||
if( chain->tree_next[0] != -1 ) {
|
||||
chain->tree_next[0] = (chain->tree_next[0]+root)%size;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Unshift values
|
||||
*/
|
||||
chain->tree_prev = -1;
|
||||
chain->tree_next[0] = (root+1)%size;
|
||||
for( i = 1; i < fanout; i++ ) {
|
||||
@ -592,11 +598,6 @@ ompi_coll_tuned_topo_build_chain( int fanout,
|
||||
chain->tree_next[i] %= size;
|
||||
}
|
||||
chain->tree_nextsize = fanout;
|
||||
} else {
|
||||
chain->tree_prev = (chain->tree_prev+root)%size;
|
||||
if( chain->tree_next[0] != -1 ) {
|
||||
chain->tree_next[0] = (chain->tree_next[0]+root)%size;
|
||||
}
|
||||
}
|
||||
|
||||
return chain;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user