1
1

Merge pull request #2781 from ggouaillardet/topic/misc_fixes_and_plugs

fix misc bugs and plug misc memory leaks
Этот коммит содержится в:
Gilles Gouaillardet 2017-01-24 14:41:45 +09:00 коммит произвёл GitHub
родитель b9b96f13ca d54e54538a
Коммит 682f5116aa
16 изменённых файлов: 140 добавлений и 45 удалений

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

@ -5,7 +5,7 @@
* Corporation. All rights reserved.
* Copyright (c) 2006 The Technical University of Chemnitz. All
* rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
@ -74,6 +74,10 @@ int ompi_coll_libnbc_iallgather(const void* sendbuf, int sendcount, MPI_Datatype
return res;
}
}
if (1 == p) {
*request = &ompi_request_empty;
return OMPI_SUCCESS;
}
#ifdef NBC_CACHE_SCHEDULE
/* search schedule in communicator specific tree */

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

@ -7,7 +7,7 @@
* rights reserved.
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* Author(s): Torsten Hoefler <htor@cs.indiana.edu>
@ -82,6 +82,19 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, M
return res;
}
if (1 == p) {
if (!inplace) {
/* for a single node - copy data to receivebuf */
res = NBC_Copy(sendbuf, count, datatype, recvbuf, count, datatype, comm);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
NBC_Return_handle (handle);
return res;
}
}
*request = &ompi_request_empty;
return OMPI_SUCCESS;
}
res = NBC_Init_handle (comm, &handle, libnbc_module);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
return res;
@ -94,15 +107,6 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, M
return OMPI_ERR_OUT_OF_RESOURCE;
}
if ((p == 1) && !inplace) {
/* for a single node - copy data to receivebuf */
res = NBC_Copy(sendbuf, count, datatype, recvbuf, count, datatype, comm);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
NBC_Return_handle (handle);
return res;
}
}
/* algorithm selection */
if(p < 4 || size*count < 65536 || !ompi_op_is_commute(op) || inplace) {
alg = NBC_ARED_BINOMIAL;

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

@ -5,7 +5,7 @@
* Corporation. All rights reserved.
* Copyright (c) 2006 The Technical University of Chemnitz. All
* rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
@ -58,6 +58,11 @@ int ompi_coll_libnbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int
rank = ompi_comm_rank (comm);
p = ompi_comm_size (comm);
if (1 == p) {
*request = &ompi_request_empty;
return OMPI_SUCCESS;
}
res = ompi_datatype_type_size(datatype, &size);
if (MPI_SUCCESS != res) {
NBC_Error("MPI Error in ompi_datatype_type_size() (%i)", res);

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

@ -7,7 +7,7 @@
* rights reserved.
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* Author(s): Torsten Hoefler <htor@cs.indiana.edu>
@ -80,12 +80,13 @@ int ompi_coll_libnbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_
}
/* only one node -> copy data */
if ((p == 1) && !inplace) {
res = NBC_Copy (sendbuf, count, datatype, recvbuf, count, datatype, comm);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
return res;
if (p == 1) {
if (!inplace) {
res = NBC_Copy (sendbuf, count, datatype, recvbuf, count, datatype, comm);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
return res;
}
}
*request = &ompi_request_empty;
return OMPI_SUCCESS;
}

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

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2017 University of Houston. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
@ -307,6 +307,10 @@ int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh)
ompio_fh->f_io_array = NULL;
}
if (NULL != ompio_fh->f_init_aggr_list) {
free (ompio_fh->f_init_aggr_list);
ompio_fh->f_init_aggr_list = NULL;
}
if (NULL != ompio_fh->f_init_procs_in_group) {
free (ompio_fh->f_init_procs_in_group);
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)
}
if (MPI_COMM_NULL != ompio_fh->f_comm && (ompio_fh->f_flags & OMPIO_SHAREDFP_IS_SET) ) {
if (MPI_COMM_NULL != ompio_fh->f_comm) {
ompi_comm_free (&ompio_fh->f_comm);
}

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

@ -13,7 +13,7 @@
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
* Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Inria. All rights reserved.
* Copyright (c) 2015-2016 Research Organization for Information Science
* Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
@ -315,6 +315,9 @@ int mca_io_ompio_finalize_initial_grouping(mca_io_ompio_file_t *fh,
int y = 0;
fh->f_init_num_aggrs = num_groups;
if (NULL != fh->f_init_aggr_list) {
free(fh->f_init_aggr_list);
}
fh->f_init_aggr_list = (int*)malloc (fh->f_init_num_aggrs * sizeof(int));
if (NULL == fh->f_init_aggr_list) {
opal_output (1, "OUT OF MEMORY\n");
@ -325,6 +328,9 @@ int mca_io_ompio_finalize_initial_grouping(mca_io_ompio_file_t *fh,
for( y = 0; y < contg_groups[z].procs_per_contg_group; y++){
if ( fh->f_rank == contg_groups[z].procs_in_contg_group[y] ) {
fh->f_init_procs_per_group = contg_groups[z].procs_per_contg_group;
if (NULL != fh->f_init_procs_in_group) {
free(fh->f_init_procs_in_group);
}
fh->f_init_procs_in_group = (int*)malloc (fh->f_init_procs_per_group * sizeof(int));
if (NULL == fh->f_init_procs_in_group) {
opal_output (1, "OUT OF MEMORY\n");

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

@ -6,7 +6,7 @@
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
@ -59,6 +59,7 @@ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type,
memset(ompi_bound, 0, OMPI_AFFINITY_STRING_MAX);
memset(current_binding, 0, OMPI_AFFINITY_STRING_MAX);
memset(exists, 0, OMPI_AFFINITY_STRING_MAX);
/* If we have no hwloc support, return nothing */
if (NULL == opal_hwloc_topology) {

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

@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
* All rights reserved.
@ -223,6 +223,8 @@ static void _event_hdlr(int sd, short args, void *cbdata)
if (NULL != cd->pmixcbfunc) {
cd->pmixcbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cd->cbdata);
}
OPAL_LIST_RELEASE(cd->info);
OBJ_RELEASE(cd);
return;
}

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

@ -585,6 +585,9 @@ int pmix2x_publish(opal_list_t *info)
}
ret = PMIx_Publish(pinfo, sz);
if (0 < sz) {
PMIX_INFO_FREE(pinfo, sz);
}
return pmix2x_convert_rc(ret);
}
@ -621,6 +624,9 @@ int pmix2x_publishnb(opal_list_t *info,
}
ret = PMIx_Publish_nb(op->info, op->sz, opcbfunc, op);
if (0 < op->sz) {
PMIX_INFO_FREE(op->info, op->sz);
}
return pmix2x_convert_rc(ret);
}
@ -931,6 +937,9 @@ int pmix2x_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
job->jobid = *jobid;
opal_list_append(&mca_pmix_pmix2x_component.jobids, &job->super);
}
if (0 < ninfo) {
PMIX_INFO_FREE(pinfo, ninfo);
}
PMIX_APP_FREE(papps, napps);
return pmix2x_convert_rc(ret);

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

@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
* All rights reserved.
@ -433,6 +433,7 @@ static void opal_lkupcbfunc(int status,
}
}
opalcaddy->lkupcbfunc(rc, d, nd, opalcaddy->cbdata);
PMIX_PDATA_FREE(d, nd);
}
OBJ_RELEASE(opalcaddy);
}

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

@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
@ -242,6 +242,7 @@ static void _reg_nspace(int sd, short args, void *cbdata)
pmix2x_value_load(&pmap[m].value, k2);
++m;
}
OPAL_LIST_RELEASE(pmapinfo);
} else {
pmix2x_value_load(&pinfo[n].value, kv);
}

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

@ -13,7 +13,7 @@
* Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved
* $COPYRIGHT$
@ -35,6 +35,7 @@
#include "opal/util/argv.h"
#include "opal/util/cmd_line.h"
#include "opal/util/output.h"
#include "opal/util/opal_environ.h"
#include "opal/mca/base/mca_base_var.h"
#include "opal/constants.h"
@ -1158,7 +1159,6 @@ static int set_dest(cmd_line_option_t *option, char *sval)
{
int ival = atol(sval);
long lval = strtoul(sval, NULL, 10);
char *str = NULL;
size_t i;
/* Set MCA param. We do this in the environment because the MCA
@ -1176,17 +1176,14 @@ static int set_dest(cmd_line_option_t *option, char *sval)
case OPAL_CMD_LINE_TYPE_STRING:
case OPAL_CMD_LINE_TYPE_INT:
case OPAL_CMD_LINE_TYPE_SIZE_T:
asprintf(&str, "%s=%s", option->clo_mca_param_env_var, sval);
opal_setenv(option->clo_mca_param_env_var, sval, true, &environ);
break;
case OPAL_CMD_LINE_TYPE_BOOL:
asprintf(&str, "%s=1", option->clo_mca_param_env_var);
opal_setenv(option->clo_mca_param_env_var, "1", true, &environ);
break;
default:
break;
}
if (NULL != str) {
putenv(str);
}
}
/* Set variable */

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

@ -6,7 +6,7 @@
* reserved.
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014-2016 Intel Corporation. All rights reserved.
* Copyright (c) 2015-2016 Research Organization for Information Science
* Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
@ -312,6 +312,10 @@ void orte_rml_API_recv_cancel(orte_process_name_t* peer, orte_rml_tag_t tag)
"%s rml_recv_cancel for peer %s tag %d",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(peer), tag);
if (!orte_event_base_active) {
/* no event will be processed any more, so simply return. */
return;
}
/* push the request into the event base so we can remove
* the receive from our list of posted recvs */

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

@ -588,7 +588,7 @@ int orte_submit_init(int argc, char *argv[],
void orte_submit_finalize(void)
{
trackr_t *trk;
int i;
int i, rc;
for (i=0; i < tool_jobs.size; i++) {
if (NULL != (trk = (trackr_t*)opal_pointer_array_get_item(&tool_jobs, i))) {
@ -597,6 +597,17 @@ void orte_submit_finalize(void)
}
OBJ_DESTRUCT(&tool_jobs);
/* close the SCHIZO framework */
if (ORTE_SUCCESS != (rc = mca_base_framework_close(&orte_schizo_base_framework))) {
ORTE_ERROR_LOG(rc);
return;
}
/* finalize only the util portion of OPAL */
if (OPAL_SUCCESS != (rc = opal_finalize_util())) {
return;
}
/* destruct the cmd line object */
if (NULL != orte_cmd_line) {
OBJ_RELEASE(orte_cmd_line);
@ -615,6 +626,12 @@ void orte_submit_finalize(void)
if (NULL != orte_cmd_options.prefix) {
free(orte_cmd_options.prefix);
}
if (NULL != orte_launch_environ) {
opal_argv_free(orte_launch_environ);
}
if (NULL != orte_basename) {
free(orte_basename);
}
}
int orte_submit_cancel(int index) {
@ -706,10 +723,8 @@ int orte_submit_job(char *argv[], int *index,
/* reset the globals every time thru as the argv
* will modify them */
if (NULL != orte_cmd_options.prefix) {
free(orte_cmd_options.prefix);
}
memset(&orte_cmd_options, 0, sizeof(orte_cmd_options));
init_globals();
argc = opal_argv_count(argv);
/* parse the cmd line - do this every time thru so we can
@ -1099,20 +1114,60 @@ static int init_globals(void)
orte_cmd_options.num_procs = 0;
if (NULL != orte_cmd_options.appfile) {
free(orte_cmd_options.appfile);
orte_cmd_options.appfile = NULL;
}
orte_cmd_options.appfile = NULL;
if (NULL != orte_cmd_options.wdir) {
free(orte_cmd_options.wdir);
orte_cmd_options.wdir = NULL;
}
orte_cmd_options.set_cwd_to_session_dir = false;
orte_cmd_options.wdir = NULL;
if (NULL != orte_cmd_options.path) {
free(orte_cmd_options.path);
orte_cmd_options.path = NULL;
}
if (NULL != orte_cmd_options.hnp) {
free(orte_cmd_options.hnp);
orte_cmd_options.hnp = NULL;
}
if (NULL != orte_cmd_options.stdin_target) {
free(orte_cmd_options.stdin_target);
orte_cmd_options.stdin_target = NULL ;
}
if (NULL != orte_cmd_options.output_filename) {
free(orte_cmd_options.output_filename);
orte_cmd_options.output_filename = NULL ;
}
if (NULL != orte_cmd_options.binding_policy) {
free(orte_cmd_options.binding_policy);
orte_cmd_options.binding_policy = NULL;
}
if (NULL != orte_cmd_options.mapping_policy) {
free(orte_cmd_options.mapping_policy);
orte_cmd_options.mapping_policy = NULL;
}
if (NULL != orte_cmd_options.ranking_policy) {
free(orte_cmd_options.ranking_policy);
orte_cmd_options.ranking_policy = NULL;
}
orte_cmd_options.path = NULL;
if (NULL != orte_cmd_options.report_pid) {
free(orte_cmd_options.report_pid);
orte_cmd_options.report_pid = NULL;
}
if (NULL != orte_cmd_options.report_uri) {
free(orte_cmd_options.report_uri);
orte_cmd_options.report_uri = NULL;
}
if (NULL != orte_cmd_options.slot_list) {
free(orte_cmd_options.slot_list);
orte_cmd_options.slot_list= NULL;
}
orte_cmd_options.preload_binaries = false;
orte_cmd_options.preload_files = NULL;
if (NULL != orte_cmd_options.preload_files) {
free(orte_cmd_options.preload_files);
orte_cmd_options.preload_files = NULL;
}
/* All done */
return ORTE_SUCCESS;

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

@ -1,6 +1,8 @@
/*
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -51,7 +53,6 @@ struct orte_cmd_options_t {
bool terminate;
bool debugger;
int num_procs;
char *env_val;
char *appfile;
char *wdir;
bool set_cwd_to_session_dir;
@ -69,7 +70,6 @@ struct orte_cmd_options_t {
bool index_argv;
bool run_as_root;
char *personality;
char **personalities;
bool create_dvm;
bool terminate_dvm;
bool nolocal;

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

@ -493,6 +493,7 @@ void orte_data_server(int status, orte_process_name_t* sender,
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
"%s data server:lookup: pushing request to wait",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
OBJ_RELEASE(answer);
req = OBJ_NEW(orte_data_req_t);
req->room_number = room_number;
req->requestor = *sender;