diff --git a/ompi/mpi/tool/finalize.c b/ompi/mpi/tool/finalize.c index 7efec79f3e..38a0ce31ee 100644 --- a/ompi/mpi/tool/finalize.c +++ b/ompi/mpi/tool/finalize.c @@ -37,6 +37,15 @@ int MPI_T_finalize (void) if (0 == --mpit_init_count) { (void) ompi_info_close_components (); + + if ((!ompi_mpi_initialized || ompi_mpi_finalized) && + (NULL != ompi_mpi_main_thread)) { + /* we are not between MPI_Init and MPI_Finalize so we + * have to free the ompi_mpi_main_thread */ + OBJ_RELEASE(ompi_mpi_main_thread); + ompi_mpi_main_thread = NULL; + } + (void) opal_finalize_util (); } diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index dbc800b2d2..81fef2a163 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana * University Research and Technology @@ -10,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2006-2013 Los Alamos National Security, LLC. All rights + * Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2006-2009 University of Houston. All rights reserved. * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. @@ -342,7 +343,10 @@ void ompi_mpi_thread_level(int requested, int *provided) ompi_mpi_thread_provided = *provided = requested; } } - ompi_mpi_main_thread = opal_thread_get_self(); + + if (!ompi_mpi_main_thread) { + ompi_mpi_main_thread = opal_thread_get_self(); + } ompi_mpi_thread_multiple = (ompi_mpi_thread_provided == MPI_THREAD_MULTIPLE); diff --git a/opal/mca/base/mca_base_var.c b/opal/mca/base/mca_base_var.c index 67511f3351..fe6a87ec34 100644 --- a/opal/mca/base/mca_base_var.c +++ b/opal/mca/base/mca_base_var.c @@ -67,7 +67,8 @@ static char *mca_base_var_file_prefix = NULL; static char *mca_base_envar_file_prefix = NULL; static char *mca_base_param_file_path = NULL; static char *mca_base_env_list = NULL; -static char *mca_base_env_list_sep = ";"; +#define MCA_BASE_ENV_LIST_SEP_DEFAULT ";" +static char *mca_base_env_list_sep = MCA_BASE_ENV_LIST_SEP_DEFAULT; static char *mca_base_env_list_internal = NULL; static bool mca_base_var_suppress_override_warning = false; static opal_list_t mca_base_var_file_values; @@ -273,6 +274,8 @@ int mca_base_var_init(void) "Set SHELL env variables", MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_READONLY, &mca_base_env_list); + + mca_base_env_list_sep = MCA_BASE_ENV_LIST_SEP_DEFAULT; (void)mca_base_var_register ("opal", "mca", "base", "env_list_delimiter", "Set SHELL env variables delimiter. Default: semicolon ';'", MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_3, @@ -430,6 +433,7 @@ static int mca_base_var_cache_files(bool rel_path_search) if (OPAL_SUCCESS != ret) { return ret; } + mca_base_envar_files = strdup(mca_base_var_files); (void) mca_base_var_register_synonym (ret, "opal", "mca", NULL, "param_files", @@ -1131,11 +1135,15 @@ int mca_base_var_finalize(void) if (NULL != mca_base_var_file_list) { opal_argv_free(mca_base_var_file_list); } + mca_base_var_file_list = NULL; (void) mca_base_var_group_finalize (); (void) mca_base_pvar_finalize (); OBJ_DESTRUCT(&mca_base_var_index_hash); + + free (mca_base_envar_files); + mca_base_envar_files = NULL; } /* All done */ @@ -1241,15 +1249,31 @@ static int fixup_files(char **file_list, char * path, bool rel_path_search, char static int read_files(char *file_list, opal_list_t *file_values, char sep) { - int i, count; + char **tmp = opal_argv_split(file_list, sep); + int i, count, ret; + + if (!tmp) { + return OPAL_ERR_OUT_OF_RESOURCE; + } + + if (mca_base_var_file_list) { + count = opal_argv_count (mca_base_var_file_list); + ret = opal_argv_insert (&mca_base_var_file_list, count, tmp); + if (OPAL_SUCCESS != ret) { + return ret; + } + + opal_argv_free (tmp); + } else { + mca_base_var_file_list = tmp; + } + + count = opal_argv_count(mca_base_var_file_list); /* Iterate through all the files passed in -- read them in reverse order so that we preserve unix/shell path-like semantics (i.e., the entries farthest to the left get precedence) */ - mca_base_var_file_list = opal_argv_split(file_list, sep); - count = opal_argv_count(mca_base_var_file_list); - for (i = count - 1; i >= 0; --i) { mca_base_parse_paramfile(mca_base_var_file_list[i], file_values); } diff --git a/opal/mca/btl/vader/btl_vader_component.c b/opal/mca/btl/vader/btl_vader_component.c index 646f4f4fa3..2dc4d7ff39 100644 --- a/opal/mca/btl/vader/btl_vader_component.c +++ b/opal/mca/btl/vader/btl_vader_component.c @@ -209,6 +209,7 @@ static int mca_btl_vader_component_register (void) "single_copy_mechanism", "Single copy mechanism to use (defaults to best available)", MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_GROUP, &mca_btl_vader_component.single_copy_mechanism); + OBJ_RELEASE(new_enum); #if OPAL_BTL_VADER_HAVE_KNEM /* Currently disabling DMA mode by default; it's not clear that this is useful in all applications and architectures. */ diff --git a/opal/mca/installdirs/base/installdirs_base_components.c b/opal/mca/installdirs/base/installdirs_base_components.c index 33a92db135..4ae3a0f236 100644 --- a/opal/mca/installdirs/base/installdirs_base_components.c +++ b/opal/mca/installdirs/base/installdirs_base_components.c @@ -164,6 +164,7 @@ opal_installdirs_base_close(void) free(opal_install_dirs.opaldatadir); free(opal_install_dirs.opallibdir); free(opal_install_dirs.opalincludedir); + memset (&opal_install_dirs, 0, sizeof (opal_install_dirs)); return mca_base_framework_components_close (&opal_installdirs_base_framework, NULL); } diff --git a/opal/runtime/opal_finalize.c b/opal/runtime/opal_finalize.c index b6d67bd075..5a123989e8 100644 --- a/opal/runtime/opal_finalize.c +++ b/opal/runtime/opal_finalize.c @@ -104,6 +104,9 @@ opal_finalize_util(void) /* finalize the class/object system */ opal_class_finalize(); + free (opal_process_info.nodename); + opal_process_info.nodename = NULL; + return OPAL_SUCCESS; } diff --git a/opal/runtime/opal_init.c b/opal/runtime/opal_init.c index 89d6600590..7ae32a4b41 100644 --- a/opal/runtime/opal_init.c +++ b/opal/runtime/opal_init.c @@ -303,11 +303,6 @@ opal_init_util(int* pargc, char*** pargv) goto return_error; } - if (OPAL_SUCCESS != (ret = opal_net_init())) { - error = "opal_net_init"; - goto return_error; - } - /* Setup the parameter system */ if (OPAL_SUCCESS != (ret = mca_base_var_init())) { error = "mca_base_var_init"; @@ -320,6 +315,11 @@ opal_init_util(int* pargc, char*** pargv) goto return_error; } + if (OPAL_SUCCESS != (ret = opal_net_init())) { + error = "opal_net_init"; + goto return_error; + } + /* pretty-print stack handlers */ if (OPAL_SUCCESS != (ret = opal_util_register_stackhandlers())) { error = "opal_util_register_stackhandlers"; diff --git a/opal/runtime/opal_params.c b/opal/runtime/opal_params.c index 3b4d4a7c2c..ff28a0cf84 100644 --- a/opal/runtime/opal_params.c +++ b/opal/runtime/opal_params.c @@ -231,6 +231,7 @@ int opal_register_params(void) } #if OPAL_ENABLE_TIMING + opal_timing_sync_file = NULL; (void) mca_base_var_register ("opal", "opal", NULL, "timing_sync_file", "Clock synchronisation information generated by mpisync tool. You don't need to touch this if you use mpirun_prof tool.", MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, @@ -240,12 +241,14 @@ int opal_register_params(void) opal_output(0, "Cannot read file %s containing clock synchronisation information\n", opal_timing_sync_file); } + opal_timing_output = NULL; (void) mca_base_var_register ("opal", "opal", NULL, "timing_output", "The name of output file for timing information. If this parameter is not set then output will be directed into OPAL debug channel.", MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL, &opal_timing_output); + opal_timing_overhead = true; (void) mca_base_var_register ("opal", "opal", NULL, "timing_overhead", "Timing framework introduce additional overhead (malloc's mostly)." " The time spend in such costly routines is measured and may be accounted" @@ -280,9 +283,6 @@ int opal_register_params(void) int opal_deregister_params(void) { - opal_signal_string = NULL; - opal_net_private_ipv4 = NULL; - opal_set_max_sys_limits = NULL; opal_register_done = false; return OPAL_SUCCESS; diff --git a/orte/runtime/orte_init.c b/orte/runtime/orte_init.c index cc47927ec3..678a66cedd 100644 --- a/orte/runtime/orte_init.c +++ b/orte/runtime/orte_init.c @@ -182,7 +182,8 @@ int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags) if (NULL != opal_process_info.nodename) { free(opal_process_info.nodename); } - opal_process_info.nodename = orte_process_info.nodename; + /* opal_finalize_util will call free on this pointer so set from strdup */ + opal_process_info.nodename = strdup (orte_process_info.nodename); /* setup the dstore framework */ if (ORTE_SUCCESS != (ret = mca_base_framework_open(&opal_dstore_base_framework, 0))) {