root/orte/mca/sstore/stage/sstore_stage_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. sstore_stage_register
  2. sstore_stage_open
  3. sstore_stage_close

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c)      2010 The Trustees of Indiana University.
   4  *                         All rights reserved.
   5  * Copyright (c) 2014      Hochschule Esslingen.  All rights reserved.
   6  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
   7  *                         reserved.
   8  * $COPYRIGHT$
   9  *
  10  * Additional copyrights may follow
  11  *
  12  * $HEADER$
  13  */
  14 
  15 #include "orte_config.h"
  16 #include "opal/util/output.h"
  17 #include "opal/util/opal_environ.h"
  18 #include "orte/constants.h"
  19 
  20 #include "orte/mca/sstore/sstore.h"
  21 #include "orte/mca/sstore/base/base.h"
  22 #include "sstore_stage.h"
  23 
  24 /*
  25  * Public string for version number
  26  */
  27 const char *orte_sstore_stage_component_version_string =
  28     "ORTE SSTORE stage MCA component version " ORTE_VERSION;
  29 
  30 /*
  31  * Local functionality
  32  */
  33 static int sstore_stage_register (void);
  34 static int sstore_stage_open(void);
  35 static int sstore_stage_close(void);
  36 
  37 /*
  38  * Instantiate the public struct with all of our public information
  39  * and pointer to our public functions in it
  40  */
  41 orte_sstore_stage_component_t mca_sstore_stage_component = {
  42     /* First do the base component stuff */
  43     {
  44         /* Handle the general mca_component_t struct containing
  45          *  meta information about the component itstage
  46          */
  47         .base_version = {
  48             ORTE_SSTORE_BASE_VERSION_2_0_0,
  49             /* Component name and version */
  50             .mca_component_name = "stage",
  51             MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
  52                                   ORTE_RELEASE_VERSION),
  53 
  54             /* Component open and close functions */
  55             .mca_open_component = sstore_stage_open,
  56             .mca_close_component = sstore_stage_close,
  57             .mca_query_component = orte_sstore_stage_component_query,
  58             .mca_register_component_params = sstore_stage_register,
  59         },
  60         .base_data = {
  61             /* The component is checkpoint ready */
  62             MCA_BASE_METADATA_PARAM_CHECKPOINT
  63         },
  64 
  65         .verbose = 0,
  66         .output_handle = -1,
  67     },
  68 };
  69 
  70 char * orte_sstore_stage_local_snapshot_dir = NULL;
  71 bool   orte_sstore_stage_global_is_shared = false;
  72 bool   orte_sstore_stage_skip_filem = false;
  73 bool   orte_sstore_stage_enabled_caching = false;
  74 bool   orte_sstore_stage_enabled_compression = false;
  75 int    orte_sstore_stage_compress_delay = 0;
  76 int    orte_sstore_stage_progress_meter = 0;
  77 
  78 static int sstore_stage_register(void)
  79 {
  80     mca_base_component_t *component = &mca_sstore_stage_component.super.base_version;
  81     int ret;
  82 
  83     /*
  84      * The local directory to use when staging checkpoints back to central storage
  85      */
  86     orte_sstore_stage_local_snapshot_dir = strdup (opal_tmp_directory());
  87     ret = mca_base_component_var_register(component, "local_snapshot_dir",
  88                                           "The temporary base directory to use when storing local snapshots before they are moved.",
  89                                           MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_INTERNAL,
  90                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
  91                                           &orte_sstore_stage_local_snapshot_dir);
  92 
  93     if (0 > ret) {
  94         return ret;
  95     }
  96 
  97     ret = mca_base_var_register_synonym(ret, "orte", "crs", "base", "snapshot_dir",
  98                                         MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
  99 
 100     if (0 > ret) {
 101         return ret;
 102     }
 103 
 104     /*
 105      * If the global storage is just on a different file system, then we pass
 106      * this hint on to FileM.
 107      */
 108     orte_sstore_stage_global_is_shared = false;
 109     ret = mca_base_component_var_register(component, "global_is_shared",
 110                                           "If the global_snapshot_dir is on a shared file system all nodes can access, "
 111                                           "then the checkpoint files can be copied more efficiently when FileM is used."
 112                                           " [Default = disabled]", MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
 113                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
 114                                           &orte_sstore_stage_global_is_shared);
 115 
 116     if (0 > ret) {
 117         return ret;
 118     }
 119 
 120     ret = mca_base_var_register_synonym(ret, "orte", "snapc", "base", "global_shared",
 121                                         MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
 122 
 123     if (0 > ret) {
 124         return ret;
 125     }
 126 
 127     /*
 128      * Debugging option to skip the filem step
 129      * Warning: Will not produce a usable global snapshot
 130      */
 131     orte_sstore_stage_skip_filem = false;
 132     ret = mca_base_component_var_register(component, "skip_filem",
 133                                           "Not for general use! For debugging only! "
 134                                           "Pretend to move files. [Default = disabled]",
 135                                           MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
 136                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
 137                                           &orte_sstore_stage_skip_filem);
 138     if (0 > ret) {
 139         return ret;
 140     }
 141 
 142     ret = mca_base_var_register_synonym(ret, "orte", "snapc", "base","skip_filem",
 143                                         MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
 144 
 145     if (0 > ret) {
 146         return ret;
 147     }
 148 
 149     /*
 150      * Maintain a local cache of checkpoints taken, so that automatic recovery
 151      * does not require a transfer from central storage.
 152      */
 153     orte_sstore_stage_enabled_caching = false;
 154     ret = mca_base_component_var_register(component, "caching",
 155                                           "Maintain a node local cache of last checkpoint. [Default = disabled]",
 156                                           MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
 157                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
 158                                           &orte_sstore_stage_enabled_caching);
 159 
 160     if (0 > ret) {
 161         return ret;
 162     }
 163 
 164     /*
 165      * Compress checkpoints before/after transfer
 166      */
 167     orte_sstore_stage_enabled_compression = false;
 168     ret = mca_base_component_var_register(component, "compress",
 169                                           "Compress local snapshots. [Default = disabled]",
 170                                           MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
 171                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
 172                                           &orte_sstore_stage_enabled_compression);
 173 
 174     if (0 > ret) {
 175         return ret;
 176     }
 177 
 178     /*
 179      * Number of seconds to delay the start of compression when sync'ing
 180      */
 181     orte_sstore_stage_compress_delay = 0;
 182     ret = mca_base_component_var_register(component, "compress_delay",
 183                                           "Seconds to delay the start of compression on sync() "
 184                                           " [Default = 0]",
 185                                           MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 186                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
 187                                           &orte_sstore_stage_compress_delay);
 188 
 189     if (0 > ret) {
 190         return ret;
 191     }
 192 
 193     /*
 194      * A progress meter
 195      */
 196     orte_sstore_stage_progress_meter = 0;
 197     ret = mca_base_component_var_register(component, "progress_meter",
 198                                           "Display Progress every X percentage done. [Default = 0/off]",
 199                                           MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 200                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
 201                                           &orte_sstore_stage_progress_meter);
 202 
 203     if (0 > ret) {
 204         return ret;
 205     }
 206 
 207     orte_sstore_stage_progress_meter = (orte_sstore_stage_progress_meter % 101);
 208 
 209     /*
 210      * Priority
 211      */
 212     mca_sstore_stage_component.super.priority = 10;
 213     ret = mca_base_component_var_register(component, "priority", "Priority of the SSTORE stage component",
 214                                           MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 215                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
 216                                           &mca_sstore_stage_component.super.priority);
 217 
 218     if (0 > ret) {
 219         return ret;
 220     }
 221 
 222     /*
 223      * Verbose Level
 224      */
 225     ret = mca_base_component_var_register(component, "verbose",
 226                                           "Verbose level for the SSTORE stage component",
 227                                           MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 228                                           OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
 229                                           &mca_sstore_stage_component.super.verbose);
 230 
 231     if (0 > ret) {
 232         return ret;
 233     }
 234 
 235     return ORTE_SUCCESS;
 236 }
 237 
 238 static int sstore_stage_open(void)
 239 {
 240     /* If there is a custom verbose level for this component than use it
 241      * otherwise take our parents level and output channel
 242      */
 243     if ( 0 != mca_sstore_stage_component.super.verbose) {
 244         mca_sstore_stage_component.super.output_handle = opal_output_open(NULL);
 245         opal_output_set_verbosity(mca_sstore_stage_component.super.output_handle,
 246                                   mca_sstore_stage_component.super.verbose);
 247     } else {
 248         mca_sstore_stage_component.super.output_handle = orte_sstore_base_framework.framework_output;
 249     }
 250 
 251     /*
 252      * Debug Output
 253      */
 254     opal_output_verbose(10, mca_sstore_stage_component.super.output_handle,
 255                         "sstore:stage: open()");
 256     opal_output_verbose(20, mca_sstore_stage_component.super.output_handle,
 257                         "sstore:stage: open: priority   = %d",
 258                         mca_sstore_stage_component.super.priority);
 259     opal_output_verbose(20, mca_sstore_stage_component.super.output_handle,
 260                         "sstore:stage: open: verbosity  = %d",
 261                         mca_sstore_stage_component.super.verbose);
 262     opal_output_verbose(20, mca_sstore_stage_component.super.output_handle,
 263                         "sstore:stage: open: Local snapshot directory = %s",
 264                         orte_sstore_stage_local_snapshot_dir);
 265     opal_output_verbose(20, mca_sstore_stage_component.super.output_handle,
 266                         "sstore:stage: open: Is Global dir. shared    = %s",
 267                         (orte_sstore_stage_global_is_shared ? "True" : "False"));
 268     opal_output_verbose(20, mca_sstore_stage_component.super.output_handle,
 269                         "sstore:stage: open: Node Local Caching       = %s",
 270                         (orte_sstore_stage_enabled_caching ? "Enabled" : "Disabled"));
 271     opal_output_verbose(20, mca_sstore_stage_component.super.output_handle,
 272                         "sstore:stage: open: Compression              = %s",
 273                         (orte_sstore_stage_enabled_compression ? "Enabled" : "Disabled"));
 274     opal_output_verbose(20, mca_sstore_stage_component.super.output_handle,
 275                         "sstore:stage: open: Compression Delay        = %d",
 276                         orte_sstore_stage_compress_delay);
 277     opal_output_verbose(20, mca_sstore_stage_component.super.output_handle,
 278                         "sstore:stage: open: Skip FileM (Debug Only)  = %s",
 279                         (orte_sstore_stage_skip_filem ? "True" : "False"));
 280 
 281     return ORTE_SUCCESS;
 282 }
 283 
 284 static int sstore_stage_close(void)
 285 {
 286     opal_output_verbose(10, mca_sstore_stage_component.super.output_handle,
 287                         "sstore:stage: close()");
 288 
 289     return ORTE_SUCCESS;
 290 }

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