Skip to content

Commit 682f511

Browse files
Merge pull request #2781 from ggouaillardet/topic/misc_fixes_and_plugs
fix misc bugs and plug misc memory leaks
2 parents b9b96f1 + d54e545 commit 682f511

File tree

16 files changed

+140
-45
lines changed

16 files changed

+140
-45
lines changed

ompi/mca/coll/libnbc/nbc_iallgather.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Corporation. All rights reserved.
66
* Copyright (c) 2006 The Technical University of Chemnitz. All
77
* rights reserved.
8-
* Copyright (c) 2014-2016 Research Organization for Information Science
8+
* Copyright (c) 2014-2017 Research Organization for Information Science
99
* and Technology (RIST). All rights reserved.
1010
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1111
* reserved.
@@ -74,6 +74,10 @@ int ompi_coll_libnbc_iallgather(const void* sendbuf, int sendcount, MPI_Datatype
7474
return res;
7575
}
7676
}
77+
if (1 == p) {
78+
*request = &ompi_request_empty;
79+
return OMPI_SUCCESS;
80+
}
7781

7882
#ifdef NBC_CACHE_SCHEDULE
7983
/* search schedule in communicator specific tree */

ompi/mca/coll/libnbc/nbc_iallreduce.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* rights reserved.
88
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
99
* reserved.
10-
* Copyright (c) 2014-2016 Research Organization for Information Science
10+
* Copyright (c) 2014-2017 Research Organization for Information Science
1111
* and Technology (RIST). All rights reserved.
1212
*
1313
* Author(s): Torsten Hoefler <[email protected]>
@@ -82,6 +82,19 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, M
8282
return res;
8383
}
8484

85+
if (1 == p) {
86+
if (!inplace) {
87+
/* for a single node - copy data to receivebuf */
88+
res = NBC_Copy(sendbuf, count, datatype, recvbuf, count, datatype, comm);
89+
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
90+
NBC_Return_handle (handle);
91+
return res;
92+
}
93+
}
94+
*request = &ompi_request_empty;
95+
return OMPI_SUCCESS;
96+
}
97+
8598
res = NBC_Init_handle (comm, &handle, libnbc_module);
8699
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
87100
return res;
@@ -94,15 +107,6 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, M
94107
return OMPI_ERR_OUT_OF_RESOURCE;
95108
}
96109

97-
if ((p == 1) && !inplace) {
98-
/* for a single node - copy data to receivebuf */
99-
res = NBC_Copy(sendbuf, count, datatype, recvbuf, count, datatype, comm);
100-
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
101-
NBC_Return_handle (handle);
102-
return res;
103-
}
104-
}
105-
106110
/* algorithm selection */
107111
if(p < 4 || size*count < 65536 || !ompi_op_is_commute(op) || inplace) {
108112
alg = NBC_ARED_BINOMIAL;

ompi/mca/coll/libnbc/nbc_ibcast.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Corporation. All rights reserved.
66
* Copyright (c) 2006 The Technical University of Chemnitz. All
77
* rights reserved.
8-
* Copyright (c) 2014-2015 Research Organization for Information Science
8+
* Copyright (c) 2014-2017 Research Organization for Information Science
99
* and Technology (RIST). All rights reserved.
1010
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1111
* reserved.
@@ -58,6 +58,11 @@ int ompi_coll_libnbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int
5858
rank = ompi_comm_rank (comm);
5959
p = ompi_comm_size (comm);
6060

61+
if (1 == p) {
62+
*request = &ompi_request_empty;
63+
return OMPI_SUCCESS;
64+
}
65+
6166
res = ompi_datatype_type_size(datatype, &size);
6267
if (MPI_SUCCESS != res) {
6368
NBC_Error("MPI Error in ompi_datatype_type_size() (%i)", res);

ompi/mca/coll/libnbc/nbc_ireduce.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* rights reserved.
88
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
99
* reserved.
10-
* Copyright (c) 2014-2016 Research Organization for Information Science
10+
* Copyright (c) 2014-2017 Research Organization for Information Science
1111
* and Technology (RIST). All rights reserved.
1212
*
1313
* Author(s): Torsten Hoefler <[email protected]>
@@ -80,12 +80,13 @@ int ompi_coll_libnbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_
8080
}
8181

8282
/* only one node -> copy data */
83-
if ((p == 1) && !inplace) {
84-
res = NBC_Copy (sendbuf, count, datatype, recvbuf, count, datatype, comm);
85-
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
86-
return res;
83+
if (p == 1) {
84+
if (!inplace) {
85+
res = NBC_Copy (sendbuf, count, datatype, recvbuf, count, datatype, comm);
86+
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
87+
return res;
88+
}
8789
}
88-
8990
*request = &ompi_request_empty;
9091
return OMPI_SUCCESS;
9192
}

ompi/mca/common/ompio/common_ompio_file_open.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2008-2017 University of Houston. All rights reserved.
13-
* Copyright (c) 2015 Research Organization for Information Science
13+
* Copyright (c) 2015-2017 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
1616
* $COPYRIGHT$
@@ -307,6 +307,10 @@ int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh)
307307
ompio_fh->f_io_array = NULL;
308308
}
309309

310+
if (NULL != ompio_fh->f_init_aggr_list) {
311+
free (ompio_fh->f_init_aggr_list);
312+
ompio_fh->f_init_aggr_list = NULL;
313+
}
310314
if (NULL != ompio_fh->f_init_procs_in_group) {
311315
free (ompio_fh->f_init_procs_in_group);
312316
ompio_fh->f_init_procs_in_group = NULL;
@@ -358,7 +362,7 @@ int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh)
358362
}
359363

360364

361-
if (MPI_COMM_NULL != ompio_fh->f_comm && (ompio_fh->f_flags & OMPIO_SHAREDFP_IS_SET) ) {
365+
if (MPI_COMM_NULL != ompio_fh->f_comm) {
362366
ompi_comm_free (&ompio_fh->f_comm);
363367
}
364368

ompi/mca/io/ompio/io_ompio_aggregators.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
1414
* Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2012-2013 Inria. All rights reserved.
16-
* Copyright (c) 2015-2016 Research Organization for Information Science
16+
* Copyright (c) 2015-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -315,6 +315,9 @@ int mca_io_ompio_finalize_initial_grouping(mca_io_ompio_file_t *fh,
315315
int y = 0;
316316

317317
fh->f_init_num_aggrs = num_groups;
318+
if (NULL != fh->f_init_aggr_list) {
319+
free(fh->f_init_aggr_list);
320+
}
318321
fh->f_init_aggr_list = (int*)malloc (fh->f_init_num_aggrs * sizeof(int));
319322
if (NULL == fh->f_init_aggr_list) {
320323
opal_output (1, "OUT OF MEMORY\n");
@@ -325,6 +328,9 @@ int mca_io_ompio_finalize_initial_grouping(mca_io_ompio_file_t *fh,
325328
for( y = 0; y < contg_groups[z].procs_per_contg_group; y++){
326329
if ( fh->f_rank == contg_groups[z].procs_in_contg_group[y] ) {
327330
fh->f_init_procs_per_group = contg_groups[z].procs_per_contg_group;
331+
if (NULL != fh->f_init_procs_in_group) {
332+
free(fh->f_init_procs_in_group);
333+
}
328334
fh->f_init_procs_in_group = (int*)malloc (fh->f_init_procs_per_group * sizeof(int));
329335
if (NULL == fh->f_init_procs_in_group) {
330336
opal_output (1, "OUT OF MEMORY\n");

ompi/mpiext/affinity/c/mpiext_affinity_str.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
77
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
88
* reserved.
9-
* Copyright (c) 2015 Research Organization for Information Science
9+
* Copyright (c) 2015-2017 Research Organization for Information Science
1010
* and Technology (RIST). All rights reserved.
1111
* Copyright (c) 2015 Intel, Inc. All rights reserved.
1212
* $COPYRIGHT$
@@ -59,6 +59,7 @@ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type,
5959

6060
memset(ompi_bound, 0, OMPI_AFFINITY_STRING_MAX);
6161
memset(current_binding, 0, OMPI_AFFINITY_STRING_MAX);
62+
memset(exists, 0, OMPI_AFFINITY_STRING_MAX);
6263

6364
/* If we have no hwloc support, return nothing */
6465
if (NULL == opal_hwloc_topology) {

opal/mca/pmix/pmix2x/pmix2x.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
4-
* Copyright (c) 2014-2016 Research Organization for Information Science
4+
* Copyright (c) 2014-2017 Research Organization for Information Science
55
* and Technology (RIST). All rights reserved.
66
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
77
* All rights reserved.
@@ -223,6 +223,8 @@ static void _event_hdlr(int sd, short args, void *cbdata)
223223
if (NULL != cd->pmixcbfunc) {
224224
cd->pmixcbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cd->cbdata);
225225
}
226+
OPAL_LIST_RELEASE(cd->info);
227+
OBJ_RELEASE(cd);
226228
return;
227229
}
228230

opal/mca/pmix/pmix2x/pmix2x_client.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ int pmix2x_publish(opal_list_t *info)
585585
}
586586

587587
ret = PMIx_Publish(pinfo, sz);
588+
if (0 < sz) {
589+
PMIX_INFO_FREE(pinfo, sz);
590+
}
588591

589592
return pmix2x_convert_rc(ret);
590593
}
@@ -621,6 +624,9 @@ int pmix2x_publishnb(opal_list_t *info,
621624
}
622625

623626
ret = PMIx_Publish_nb(op->info, op->sz, opcbfunc, op);
627+
if (0 < op->sz) {
628+
PMIX_INFO_FREE(op->info, op->sz);
629+
}
624630

625631
return pmix2x_convert_rc(ret);
626632
}
@@ -931,6 +937,9 @@ int pmix2x_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
931937
job->jobid = *jobid;
932938
opal_list_append(&mca_pmix_pmix2x_component.jobids, &job->super);
933939
}
940+
if (0 < ninfo) {
941+
PMIX_INFO_FREE(pinfo, ninfo);
942+
}
934943
PMIX_APP_FREE(papps, napps);
935944

936945
return pmix2x_convert_rc(ret);

opal/mca/pmix/pmix2x/pmix2x_server_north.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
4-
* Copyright (c) 2014-2016 Research Organization for Information Science
4+
* Copyright (c) 2014-2017 Research Organization for Information Science
55
* and Technology (RIST). All rights reserved.
66
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
77
* All rights reserved.
@@ -433,6 +433,7 @@ static void opal_lkupcbfunc(int status,
433433
}
434434
}
435435
opalcaddy->lkupcbfunc(rc, d, nd, opalcaddy->cbdata);
436+
PMIX_PDATA_FREE(d, nd);
436437
}
437438
OBJ_RELEASE(opalcaddy);
438439
}

0 commit comments

Comments
 (0)