Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions ompi/runtime/ompi_info_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2012 University of Houston. All rights reserved.
* Copyright (c) 2010-2013 Los Alamos National Security, LLC.
* Copyright (c) 2010-2015 Los Alamos National Security, LLC.
* All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -41,7 +41,7 @@
const char *ompi_info_type_ompi = "ompi";
const char *ompi_info_type_base = "base";

static bool ompi_info_registered = false;
static int ompi_info_registered = 0;

void ompi_info_register_types(opal_pointer_array_t *mca_types)
{
Expand All @@ -61,12 +61,10 @@ int ompi_info_register_framework_params(opal_pointer_array_t *component_map)
{
int rc;

if (ompi_info_registered) {
if (ompi_info_registered++) {
return OMPI_SUCCESS;
}

ompi_info_registered = true;

/* Register the MPI layer's MCA parameters */
if (OMPI_SUCCESS != (rc = ompi_mpi_register_params())) {
fprintf(stderr, "ompi_info_register: ompi_mpi_register_params failed\n");
Expand All @@ -92,6 +90,11 @@ void ompi_info_close_components(void)
{
int i;

assert(ompi_info_registered);
if (--ompi_info_registered) {
return;
}

/* Note that the order of shutdown here doesn't matter because
* we aren't *using* any components -- none were selected, so
* there are no dependencies between the frameworks. We list
Expand All @@ -109,6 +112,8 @@ void ompi_info_close_components(void)
/* close the ORTE components */
(void) orte_info_close_components();
#endif

(void) opal_info_close_components();
}

void ompi_info_show_ompi_version(const char *scope)
Expand Down
59 changes: 34 additions & 25 deletions opal/mca/base/mca_base_close.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
Expand All @@ -10,6 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -25,34 +28,40 @@
#include "opal/mca/base/mca_base_component_repository.h"
#include "opal/constants.h"

extern int mca_base_opened;

/*
* Main MCA shutdown.
*/
int mca_base_close(void)
{
extern bool mca_base_opened;
if (mca_base_opened) {

/* release the default paths */
if (NULL != mca_base_system_default_path) {
free(mca_base_system_default_path);
}
if (NULL != mca_base_user_default_path) {
free(mca_base_user_default_path);
}

/* Close down the component repository */
mca_base_component_repository_finalize();

/* Shut down the dynamic component finder */
mca_base_component_find_finalize();

/* Close opal output stream 0 */
opal_output_close(0);
}
mca_base_opened = false;

/* All done */

return OPAL_SUCCESS;
assert (mca_base_opened);
if (!--mca_base_opened) {
/* deregister all MCA base parameters */
int group_id = mca_base_var_group_find ("opal", "mca", "base");

if (-1 < group_id) {
mca_base_var_group_deregister (group_id);
}

/* release the default paths */
if (NULL != mca_base_system_default_path) {
free(mca_base_system_default_path);
}
if (NULL != mca_base_user_default_path) {
free(mca_base_user_default_path);
}

/* Close down the component repository */
mca_base_component_repository_finalize();

/* Shut down the dynamic component finder */
mca_base_component_find_finalize();

/* Close opal output stream 0 */
opal_output_close(0);
}

/* All done */
return OPAL_SUCCESS;
}
13 changes: 0 additions & 13 deletions opal/mca/base/mca_base_component_repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,6 @@ int mca_base_component_repository_init(void)
}
opal_dl_base_select();

/* Bump the refcount to indicate that this framework is "special"
-- it can't be finalized until all other frameworks have been
finalized. E.g., in opal/runtime/opal_info_support.c, there's
a loop calling mca_base_framework_close() on all OPAL
frameworks. But that function simply decrements each
framework's refcount, and if it's zero, closes it. This
additional increment ensures that the "dl" framework is not
closed as part of that loop. */
++opal_dl_base_framework.framework_refcnt;

OBJ_CONSTRUCT(&repository, opal_list_t);
#endif

Expand Down Expand Up @@ -265,9 +255,6 @@ void mca_base_component_repository_finalize(void)
}
} while (opal_list_get_size(&repository) > 0);

/* Close the dl framework (see comment about refcnt in
mca_base_component_repository_init()) */
--opal_dl_base_framework.framework_refcnt;
(void) mca_base_framework_close(&opal_dl_base_framework);
#endif

Expand Down
8 changes: 4 additions & 4 deletions opal/mca/base/mca_base_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -42,7 +44,7 @@
* Public variables
*/
char *mca_base_component_path = NULL;
bool mca_base_opened = false;
int mca_base_opened = 0;
char *mca_base_system_default_path = NULL;
char *mca_base_user_default_path = NULL;
bool mca_base_component_show_load_errors = true;
Expand All @@ -67,9 +69,7 @@ int mca_base_open(void)
char hostname[64];
int var_id;

if (!mca_base_opened) {
mca_base_opened = true;
} else {
if (mca_base_opened++) {
return OPAL_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions opal/mca/base/mca_base_pvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ int mca_base_pvar_finalize (void)
}
}

pvar_count = 0;

OBJ_DESTRUCT(&registered_pvars);
OBJ_DESTRUCT(&mca_base_pvar_index_hash);
}
Expand Down
5 changes: 1 addition & 4 deletions opal/mca/dl/dlopen/dl_dlopen_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,14 @@ opal_dl_dlopen_component_t mca_dl_dlopen_component = {
/* The dl framework members */
.priority = 80
},

/* Now fill in the dlopen component-specific members */
.filename_suffixes_mca_storage = ".so,.dylib,.dll,.sl",
.filename_suffixes = NULL
};


static int dlopen_component_register(void)
{
int ret;

mca_dl_dlopen_component.filename_suffixes_mca_storage = ".so,.dylib,.dll,.sl";
ret =
mca_base_component_var_register(&mca_dl_dlopen_component.base.base_version,
"filename_suffixes",
Expand Down
4 changes: 4 additions & 0 deletions opal/mca/shmem/base/shmem_base_close.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ opal_shmem_base_close(void)
opal_shmem_base_module->module_finalize();
}

opal_shmem_base_selected = false;
opal_shmem_base_component = NULL;
opal_shmem_base_module = NULL;

return mca_base_framework_components_close (&opal_shmem_base_framework,
NULL);
}
Expand Down
3 changes: 0 additions & 3 deletions opal/runtime/opal_finalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ opal_finalize(void)
#if OPAL_ENABLE_FT_CR == 1
(void) mca_base_framework_close(&opal_compress_base_framework);
#endif

/* close the shmem framework */
(void) mca_base_framework_close(&opal_shmem_base_framework);

(void) mca_base_framework_close(&opal_event_base_framework);

Expand Down
18 changes: 11 additions & 7 deletions opal/runtime/opal_info_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010-2013 Los Alamos National Security, LLC.
* Copyright (c) 2010-2015 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2011-2012 University of Houston. All rights reserved.
* $COPYRIGHT$
Expand Down Expand Up @@ -88,7 +88,7 @@ const char *opal_info_ver_mca = "mca";
const char *opal_info_ver_type = "type";
const char *opal_info_ver_component = "component";

static bool opal_info_registered = false;
static int opal_info_registered = 0;

static void component_map_construct(opal_info_component_map_t *map)
{
Expand Down Expand Up @@ -227,8 +227,6 @@ int opal_info_init(int argc, char **argv,

void opal_info_finalize(void)
{
opal_info_close_components ();
mca_base_close();
opal_finalize_util();
}

Expand Down Expand Up @@ -295,12 +293,10 @@ int opal_info_register_framework_params(opal_pointer_array_t *component_map)
{
int rc;

if (opal_info_registered) {
if (opal_info_registered++) {
return OPAL_SUCCESS;
}

opal_info_registered = true;

/* Register mca/base parameters */
if( OPAL_SUCCESS != mca_base_open() ) {
opal_show_help("help-opal_info.txt", "lib-call-fail", true, "mca_base_open", __FILE__, __LINE__ );
Expand All @@ -321,9 +317,17 @@ void opal_info_close_components(void)
{
int i;

assert(opal_info_registered);
if (--opal_info_registered) {
return;
}

for (i=0; NULL != opal_frameworks[i]; i++) {
(void) mca_base_framework_close(opal_frameworks[i]);
}

/* release our reference to MCA */
mca_base_close ();
}


Expand Down
11 changes: 11 additions & 0 deletions opal/util/output.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,6 +11,8 @@
* Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -481,10 +484,16 @@ void opal_output_finalize(void)
opal_output_close(verbose_stream);
}
free(verbose.lds_prefix);
verbose.lds_prefix = NULL;

verbose_stream = -1;

free (output_prefix);
output_prefix = NULL;

free (output_dir);
output_dir = NULL;

if(NULL != temp_str) {
free(temp_str);
temp_str = NULL;
Expand All @@ -493,6 +502,8 @@ void opal_output_finalize(void)
OBJ_DESTRUCT(&verbose);
OBJ_DESTRUCT(&mutex);
}

initialized = false;
}

/************************************************************************/
Expand Down
15 changes: 10 additions & 5 deletions orte/runtime/orte_info_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,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) 2010-2013 Los Alamos National Security, LLC.
* Copyright (c) 2010-2015 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2011-2012 University of Houston. All rights reserved.
* $COPYRIGHT$
Expand All @@ -38,7 +38,7 @@

const char *orte_info_type_orte = "orte";

static bool orte_info_registered = false;
static int orte_info_registered = 0;

void orte_info_register_types(opal_pointer_array_t *mca_types)
{
Expand All @@ -57,12 +57,10 @@ int orte_info_register_framework_params(opal_pointer_array_t *component_map)
{
int rc;

if (orte_info_registered) {
if (orte_info_registered++) {
return ORTE_SUCCESS;
}

orte_info_registered = true;

/* Register the ORTE layer's MCA parameters */

if (ORTE_SUCCESS != (rc = orte_register_params()) &&
Expand All @@ -83,9 +81,16 @@ void orte_info_close_components(void)
{
int i;

assert (orte_info_registered);
if (--orte_info_registered) {
return;
}

for (i=0; NULL != orte_frameworks[i]; i++) {
(void) mca_base_framework_close(orte_frameworks[i]);
}

opal_info_close_components ();
}

void orte_info_show_orte_version(const char *scope)
Expand Down