root/orte/mca/snapc/base/snapc_base_select.c

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

DEFINITIONS

This source file includes following definitions.
  1. orte_snapc_base_select

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2010 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) 2013-2015 Los Alamos National Security, LLC. All rights
  12  *                         reserved.
  13  * $COPYRIGHT$
  14  *
  15  * Additional copyrights may follow
  16  *
  17  * $HEADER$
  18  */
  19 
  20 #include "orte_config.h"
  21 
  22 #include <string.h>
  23 
  24 #include "orte/constants.h"
  25 
  26 #include "orte/mca/mca.h"
  27 #include "opal/util/output.h"
  28 #include "opal/mca/base/base.h"
  29 
  30 #include "orte/mca/sstore/sstore.h"
  31 #include "orte/mca/sstore/base/base.h"
  32 
  33 #include "orte/mca/snapc/snapc.h"
  34 #include "orte/mca/snapc/base/base.h"
  35 
  36 
  37 static orte_snapc_base_module_t none_module = {
  38     /** Initialization Function */
  39     orte_snapc_base_module_init,
  40     /** Finalization Function */
  41     orte_snapc_base_module_finalize,
  42     orte_snapc_base_none_setup_job,
  43     orte_snapc_base_none_release_job,
  44     orte_snapc_base_none_ft_event,
  45     orte_snapc_base_none_start_ckpt,
  46     orte_snapc_base_none_end_ckpt
  47 };
  48 
  49 int orte_snapc_base_select(bool seed, bool app)
  50 {
  51     int exit_status = OPAL_SUCCESS;
  52     orte_snapc_base_component_t *best_component = NULL;
  53     orte_snapc_base_module_t *best_module = NULL;
  54     const char **include_list = NULL;
  55     int var_id;
  56 
  57     /*
  58      * Register the framework MCA param and look up include list
  59      */
  60     /* XXX -- TODO -- framework_subsytem -- this shouldn't be necessary once the framework system is in place */
  61     var_id = mca_base_var_find(NULL, "snapc", NULL, NULL);
  62     mca_base_var_get_value(var_id, &include_list, NULL, NULL);
  63 
  64     if(NULL != include_list && NULL != include_list[0] &&
  65        0 == strncmp(include_list[0], "none", strlen("none")) ){
  66         opal_output_verbose(10, orte_snapc_base_framework.framework_output,
  67                             "snapc:select: Using %s component",
  68                             include_list[0]);
  69         best_module    = &none_module;
  70         /* Close all components since none will be used */
  71         mca_base_components_close(0, /* Pass 0 to keep this from closing the output handle */
  72                                   &orte_snapc_base_framework.framework_components,
  73                                   NULL);
  74         /* JJH: Todo: Check if none is in the list */
  75         goto skip_select;
  76     }
  77 
  78     /*
  79      * Select the best component
  80      */
  81     if( OPAL_SUCCESS != mca_base_select("snapc", orte_snapc_base_framework.framework_output,
  82                                         &orte_snapc_base_framework.framework_components,
  83                                         (mca_base_module_t **) &best_module,
  84                                         (mca_base_component_t **) &best_component, NULL) ) {
  85         /* This will only happen if no component was selected */
  86         exit_status = ORTE_ERROR;
  87         goto cleanup;
  88     }
  89 
  90  skip_select:
  91     /* Save the winner */
  92     orte_snapc = *best_module;
  93 
  94     /* Initialize the winner */
  95     if (NULL != best_module) {
  96         if (OPAL_SUCCESS != orte_snapc.snapc_init(seed, app)) {
  97             exit_status = OPAL_ERROR;
  98             goto cleanup;
  99         }
 100     }
 101 
 102  cleanup:
 103 
 104     return exit_status;
 105 }

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