root/opal/mca/crs/self/crs_self_component.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. crs_self_register
  2. crs_self_open
  3. crs_self_close

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2009 The Trustees of Indiana University.
   4  *                         All rights reserved.
   5  * Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
   6  *                         All rights reserved.
   7  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   8  *                         University of Stuttgart.  All rights reserved.
   9  * Copyright (c) 2004-2005 The Regents of the University of California.
  10  *                         All rights reserved.
  11  * Copyright (c) 2015      Los Alamos National Security, Inc.  All rights
  12  *                         reserved.
  13  * $COPYRIGHT$
  14  *
  15  * Additional copyrights may follow
  16  *
  17  * $HEADER$
  18  */
  19 
  20 #include "opal_config.h"
  21 
  22 #include "opal/constants.h"
  23 #include "opal/mca/crs/crs.h"
  24 #include "opal/mca/crs/base/base.h"
  25 #include "opal/util/output.h"
  26 #include "crs_self.h"
  27 
  28 /*
  29  * Public string for version number
  30  */
  31 const char *opal_crs_self_component_version_string =
  32 "OPAL CRS self MCA component version " OPAL_VERSION;
  33 
  34 /*
  35  * Local functionality
  36  */
  37 static int crs_self_register (void);
  38 static int crs_self_open(void);
  39 static int crs_self_close(void);
  40 
  41 /*
  42  * Instantiate the public struct with all of our public information
  43  * and pointer to our public functions in it
  44  */
  45 opal_crs_self_component_t mca_crs_self_component = {
  46     /* First do the base component stuff */
  47     {
  48         /* Handle the general mca_component_t struct containing
  49          *  meta information about the component itself
  50          */
  51         .base_version = {
  52             OPAL_CRS_BASE_VERSION_2_0_0,
  53 
  54             /* Component name and version */
  55             .mca_component_name = "self",
  56             MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
  57                                   OPAL_RELEASE_VERSION),
  58 
  59             /* Component open and close functions */
  60             .mca_open_component = crs_self_open,
  61             .mca_close_component = crs_self_close,
  62             .mca_query_component = opal_crs_self_component_query,
  63             .mca_register_component_params = crs_self_register,
  64         },
  65         {
  66             /* The component is checkpoint ready */
  67             MCA_BASE_METADATA_PARAM_CHECKPOINT
  68         },
  69 
  70         /* Verbosity level */
  71         0,
  72         /* opal_output handler */
  73         -1
  74     },
  75     /* Default prefix */
  76     PREFIX_DEFAULT,
  77     /* If we are restarting right out of the gate */
  78     false,
  79     /* Checkpointing enabled */
  80     true,
  81     /* Callbacks */
  82     NULL,
  83     NULL,
  84     NULL
  85 };
  86 
  87 static int crs_self_register (void)
  88 {
  89     int ret;
  90 
  91     /* Default priority */
  92     mca_crs_self_component.super.priority = 20;
  93     ret = mca_base_component_var_register (&mca_crs_self_component.super.base_version,
  94                                            "priority", "Priority of the CRS self component "
  95                                            "(default: 20)", MCA_BASE_VAR_TYPE_INT, NULL, 0,
  96                                            MCA_BASE_VAR_FLAG_SETTABLE,
  97                                            OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ,
  98                                            &mca_crs_self_component.super.priority);
  99     if (0 > ret) {
 100         return ret;
 101     }
 102 
 103     mca_crs_self_component.super.verbose = 0;
 104     ret = mca_base_component_var_register (&mca_crs_self_component.super.base_version,
 105                                            "verbose",
 106                                            "Verbose level for the CRS self component",
 107                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 108                                            OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
 109                                            &mca_crs_self_component.super.verbose);
 110     if (0 > ret) {
 111         return ret;
 112     }
 113 
 114     /*
 115      * Handler names
 116      */
 117     mca_crs_self_component.prefix = NULL;
 118     ret = mca_base_component_var_register (&mca_crs_self_component.super.base_version,
 119                                            "prefix",
 120                                            "Prefix for user defined callback functions",
 121                                            MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 122                                            OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
 123                                            &mca_crs_self_component.prefix);
 124     if (0 > ret) {
 125         return ret;
 126     }
 127 
 128     ret = mca_base_component_var_register (&mca_crs_self_component.super.base_version,
 129                                            "do_restart",
 130                                            "Start execution by calling restart callback",
 131                                            MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 132                                            OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
 133                                            &mca_crs_self_component.do_restart);
 134     return (0 > ret) ? ret : OPAL_SUCCESS;
 135 }
 136 
 137 static int crs_self_open(void)
 138 {
 139     /*
 140      * This should be the last componet to ever get used since
 141      * it doesn't do anything.
 142      */
 143 
 144     /* If there is a custom verbose level for this component than use it
 145      * otherwise take our parents level and output channel
 146      */
 147     if ( 0 != mca_crs_self_component.super.verbose) {
 148         mca_crs_self_component.super.output_handle = opal_output_open(NULL);
 149         opal_output_set_verbosity(mca_crs_self_component.super.output_handle,
 150                                   mca_crs_self_component.super.verbose);
 151     } else {
 152         mca_crs_self_component.super.output_handle = opal_crs_base_framework.framework_output;
 153     }
 154 
 155     /*
 156      * Debug Output
 157      */
 158     opal_output_verbose(10, mca_crs_self_component.super.output_handle,
 159                         "crs:self: open()");
 160     opal_output_verbose(20, mca_crs_self_component.super.output_handle,
 161                         "crs:self: open: priority   = %d",
 162                         mca_crs_self_component.super.priority);
 163     opal_output_verbose(20, mca_crs_self_component.super.output_handle,
 164                         "crs:self: open: verbosity  = %d",
 165                         mca_crs_self_component.super.verbose);
 166     opal_output_verbose(20, mca_crs_self_component.super.output_handle,
 167                         "crs:self: open: prefix     = %s",
 168                         mca_crs_self_component.prefix);
 169     opal_output_verbose(20, mca_crs_self_component.super.output_handle,
 170                         "crs:self: open: do_restart = %d",
 171                         mca_crs_self_component.do_restart);
 172 
 173     return OPAL_SUCCESS;
 174 }
 175 
 176 static int crs_self_close(void)
 177 {
 178     opal_output_verbose(10, mca_crs_self_component.super.output_handle,
 179                         "crs:self: close()");
 180 
 181     return OPAL_SUCCESS;
 182 }

/* [<][>][^][v][top][bottom][index][help] */