Skip to content

Commit

Permalink
Update OPAL frameworks to use the MCA framework system.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjelmn committed Mar 20, 2013
1 parent 8577ab4 commit e44d6aa
Show file tree
Hide file tree
Showing 81 changed files with 518 additions and 1,599 deletions.
41 changes: 5 additions & 36 deletions opal/mca/backtrace/base/backtrace_component.c
Expand Up @@ -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) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -19,13 +21,8 @@

#include "opal_config.h"

#include "opal/constants.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/backtrace/backtrace.h"
#include "opal/mca/backtrace/base/base.h"


/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
Expand All @@ -37,35 +34,7 @@
/*
* Globals
*/
opal_list_t opal_backtrace_base_components_opened;


int
opal_backtrace_base_open(void)
{
/* Open up all available components */
if (OPAL_SUCCESS !=
mca_base_components_open("backtrace", 0,
mca_backtrace_base_static_components,
&opal_backtrace_base_components_opened,
true)) {
return OPAL_ERROR;
}

/* All done */
return OPAL_SUCCESS;
}


int
opal_backtrace_base_close(void)
{
/* Close all components that are still open */
mca_base_components_close(0,
&opal_backtrace_base_components_opened,
NULL);
OBJ_DESTRUCT(&opal_backtrace_base_components_opened);

/* All done */
return OPAL_SUCCESS;
}
/* Uses default register/open/close functions */
MCA_BASE_FRAMEWORK_DECLARE(opal, backtrace, NULL, NULL, NULL, NULL,
mca_backtrace_base_static_components, 0);
41 changes: 3 additions & 38 deletions opal/mca/backtrace/base/base.h
Expand Up @@ -22,52 +22,17 @@

#include "opal_config.h"

#include "opal/mca/backtrace/backtrace.h"
#include "opal/mca/base/mca_base_framework.h"

#include "opal/mca/backtrace/backtrace.h"

/*
* Global functions for MCA overall backtrace open and close
*/

BEGIN_C_DECLS

/**
* Initialize the backtrace MCA framework
*
* @retval OPAL_SUCCESS Upon success
* @retval OPAL_ERROR Upon failure
*
* This must be the first function invoked in the backtrace MCA
* framework. It initializes the backtrace MCA framework, finds
* and opens backtrace components, etc.
*
* This function is invoked during opal_init() and during the
* initialization of the special case of the laminfo command.
*
* This function fills in the internal global variable
* opal_backtrace_base_components_opened, which is a list of all
* backtrace components that were successfully opened. This
* variable should \em only be used by other backtrace base
* functions -- it is not considered a public interface member --
* and is only mentioned here for completeness.
*/
OPAL_DECLSPEC int opal_backtrace_base_open(void);


/**
* Shut down the backtrace MCA framework.
*
* @retval OPAL_SUCCESS Always
*
* This function shuts down everything in the backtrace MCA
* framework, and is called during opal_finalize() and the
* special case of the laminfo command.
*
* It must be the last function invoked on the backtrace MCA framework.
*/
OPAL_DECLSPEC int opal_backtrace_base_close(void);
OPAL_DECLSPEC extern mca_base_framework_t opal_backtrace_base_framework;

OPAL_DECLSPEC extern opal_list_t opal_backtrace_base_components_opened;

END_C_DECLS
#endif /* OPAL_BASE_BACKTRACE_H */
7 changes: 4 additions & 3 deletions opal/mca/compress/base/base.h
Expand Up @@ -17,6 +17,8 @@
#include "opal/util/opal_environ.h"
#include "opal/runtime/opal_cr.h"

#include "opal/mca/base/base.h"

/*
* Global functions for MCA overall COMPRESS
*/
Expand All @@ -33,7 +35,7 @@ extern "C" {
*
* This function is invoked during opal_init();
*/
OPAL_DECLSPEC int opal_compress_base_open(void);
OPAL_DECLSPEC int opal_compress_base_open(mca_base_open_flag_t flags);

/**
* Select an available component.
Expand All @@ -58,8 +60,7 @@ extern "C" {
/**
* Globals
*/
OPAL_DECLSPEC extern int opal_compress_base_output;
OPAL_DECLSPEC extern opal_list_t opal_compress_base_components_available;
OPAL_DECLSPEC extern mca_base_framework_t opal_compress_base_framework;
OPAL_DECLSPEC extern opal_compress_base_component_t opal_compress_base_selected_component;
OPAL_DECLSPEC extern opal_compress_base_module_t opal_compress;

Expand Down
12 changes: 2 additions & 10 deletions opal/mca/compress/base/compress_base_close.c
Expand Up @@ -21,7 +21,7 @@ int opal_compress_base_close(void)
{
/* Compression currently only used with C/R */
if( !opal_cr_is_enabled ) {
opal_output_verbose(10, opal_compress_base_output,
opal_output_verbose(10, opal_compress_base_framework.framework_output,
"compress:open: FT is not enabled, skipping!");
return OPAL_SUCCESS;
}
Expand All @@ -32,13 +32,5 @@ int opal_compress_base_close(void)
}

/* Close all available modules that are open */
mca_base_components_close(opal_compress_base_output,
&opal_compress_base_components_available,
NULL);

/* Close the framework output */
opal_output_close (opal_compress_base_output);
opal_compress_base_output = -1;

return OPAL_SUCCESS;
return mca_base_framework_components_close (&opal_compress_base_framework, NULL);
}
62 changes: 17 additions & 45 deletions opal/mca/compress/base/compress_base_open.c
@@ -1,8 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
*
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
* All rights reserved.
* $COPYRIGHT$
*
Expand All @@ -26,7 +27,6 @@
/*
* Globals
*/
int opal_compress_base_output = -1;
opal_compress_base_module_t opal_compress = {
NULL, /* init */
NULL, /* finalize */
Expand All @@ -35,21 +35,22 @@ opal_compress_base_module_t opal_compress = {
NULL, /* decompress */
NULL /* decompress_nb */
};
opal_list_t opal_compress_base_components_available;

opal_compress_base_component_t opal_compress_base_selected_component;

static int opal_compress_base_verbose = 0;
static int opal_compress_base_register (mca_base_register_flag_t flags);

MCA_BASE_FRAMEWORK_DECLARE(opal, compress, NULL, opal_compress_base_register, opal_compress_base_open,
opal_compress_base_close, mca_compress_base_static_components, 0);

static int opal_compress_base_register(int flags)
static int opal_compress_base_register (mca_base_register_flag_t flags)
{
/* Debugging/Verbose output */
opal_compress_base_verbose = 0;
(void) mca_base_var_register("opal", "compress", "base", "verbose",
"Verbosity level of the COMPRESS framework",
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY,
&opal_compress_base_verbose);
/* Compression currently only used with C/R */
if( !opal_cr_is_enabled ) {
opal_output_verbose(10, opal_compress_base_framework.framework_output,
"compress:open: FT is not enabled, skipping!");
return OPAL_ERR_NOT_AVAILABLE;
}

return OPAL_SUCCESS;
}
Expand All @@ -58,44 +59,15 @@ static int opal_compress_base_register(int flags)
* Function for finding and opening either all MCA components,
* or the one that was specifically requested via a MCA parameter.
*/
int opal_compress_base_open(void)
int opal_compress_base_open(mca_base_open_flag_t flags)
{
int ret, exit_status = OPAL_SUCCESS;

(void) opal_compress_base_register(0);

if(0 != opal_compress_base_verbose) {
opal_compress_base_output = opal_output_open(NULL);
} else {
opal_compress_base_output = -1;
}
opal_output_set_verbosity(opal_compress_base_output, opal_compress_base_verbose);

/* Compression currently only used with C/R */
if( !opal_cr_is_enabled ) {
opal_output_verbose(10, opal_compress_base_output,
opal_output_verbose(10, opal_compress_base_framework.framework_output,
"compress:open: FT is not enabled, skipping!");
return OPAL_SUCCESS;
}

/* Open up all available components */
if (OPAL_SUCCESS != (ret = mca_base_components_open("compress",
opal_compress_base_output,
mca_compress_base_static_components,
&opal_compress_base_components_available,
true)) ) {
exit_status = OPAL_ERROR;
if( OPAL_ERR_NOT_FOUND == ret) {
const char **str_value = NULL;

ret = mca_base_var_find("opal", "compress", NULL, NULL);
mca_base_var_get_value(ret, &str_value, NULL, NULL);
if (NULL != str_value && NULL != str_value[0] &&
0 == strncmp(str_value[0], "none", strlen("none"))) {
exit_status = OPAL_SUCCESS;
}
}
}

return exit_status;
return mca_base_framework_components_open (&opal_compress_base_framework, flags);
}
6 changes: 3 additions & 3 deletions opal/mca/compress/base/compress_base_select.c
Expand Up @@ -30,16 +30,16 @@ int opal_compress_base_select(void)

/* Compression currently only used with C/R */
if( !opal_cr_is_enabled ) {
opal_output_verbose(10, opal_compress_base_output,
opal_output_verbose(10, opal_compress_base_framework.framework_output,
"compress:open: FT is not enabled, skipping!");
return OPAL_SUCCESS;
}

/*
* Select the best component
*/
if( OPAL_SUCCESS != mca_base_select("compress", opal_compress_base_output,
&opal_compress_base_components_available,
if( OPAL_SUCCESS != mca_base_select("compress", opal_compress_base_framework.framework_output,
&opal_compress_base_framework.framework_components,
(mca_base_module_t **) &best_module,
(mca_base_component_t **) &best_component) ) {
/* This will only happen if no component was selected */
Expand Down
2 changes: 1 addition & 1 deletion opal/mca/compress/bzip/compress_bzip_component.c
Expand Up @@ -117,7 +117,7 @@ static int compress_bzip_open(void)
opal_output_set_verbosity(mca_compress_bzip_component.super.output_handle,
mca_compress_bzip_component.super.verbose);
} else {
mca_compress_bzip_component.super.output_handle = opal_compress_base_output;
mca_compress_bzip_component.super.output_handle = opal_compress_base_framework.framework_output;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion opal/mca/compress/gzip/compress_gzip_component.c
Expand Up @@ -118,7 +118,7 @@ static int compress_gzip_open(void)
opal_output_set_verbosity(mca_compress_gzip_component.super.output_handle,
mca_compress_gzip_component.super.verbose);
} else {
mca_compress_gzip_component.super.output_handle = opal_compress_base_output;
mca_compress_gzip_component.super.output_handle = opal_compress_base_framework.framework_output;
}

/*
Expand Down
6 changes: 3 additions & 3 deletions opal/mca/crs/base/base.h
Expand Up @@ -21,6 +21,7 @@
#define OPAL_CRS_BASE_H

#include "opal_config.h"
#include "opal/mca/base/base.h"
#include "opal/mca/crs/crs.h"
#include "opal/util/opal_environ.h"
#include "opal/runtime/opal_cr.h"
Expand All @@ -47,7 +48,7 @@ BEGIN_C_DECLS
*
* This function is invoked during opal_init();
*/
OPAL_DECLSPEC int opal_crs_base_open(void);
OPAL_DECLSPEC int opal_crs_base_open(mca_base_open_flag_t flags);

/**
* Select an available component.
Expand All @@ -72,8 +73,7 @@ BEGIN_C_DECLS
/**
* Globals
*/
OPAL_DECLSPEC extern int opal_crs_base_output;
OPAL_DECLSPEC extern opal_list_t opal_crs_base_components_available;
OPAL_DECLSPEC extern mca_base_framework_t opal_crs_base_framework;
OPAL_DECLSPEC extern opal_crs_base_component_t opal_crs_base_selected_component;
OPAL_DECLSPEC extern opal_crs_base_module_t opal_crs;

Expand Down
13 changes: 3 additions & 10 deletions opal/mca/crs/base/crs_base_close.c
Expand Up @@ -25,7 +25,7 @@
int opal_crs_base_close(void)
{
if( !opal_cr_is_enabled ) {
opal_output_verbose(10, opal_crs_base_output,
opal_output_verbose(10, opal_crs_base_framework.framework_output,
"crs:close: FT is not enabled, skipping!");
return OPAL_SUCCESS;
}
Expand All @@ -36,13 +36,6 @@ int opal_crs_base_close(void)
}

/* Close all available modules that are open */
mca_base_components_close(opal_crs_base_output,
&opal_crs_base_components_available,
NULL);

/* Close the framework output */
opal_output_close (opal_crs_base_output);
opal_crs_base_output = -1;

return OPAL_SUCCESS;
return mca_base_framework_components_close (&opal_crs_base_framework,
NULL);
}

0 comments on commit e44d6aa

Please sign in to comment.