root/ompi/mca/crcp/base/crcp_base_select.c

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_crcp_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) 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 "ompi_config.h"
  21 
  22 #include "ompi/mca/mca.h"
  23 #include "opal/util/output.h"
  24 #include "opal/mca/base/base.h"
  25 
  26 #include "ompi/mca/crcp/crcp.h"
  27 #include "ompi/mca/crcp/base/base.h"
  28 
  29 
  30 static ompi_crcp_base_component_t none_component = {
  31     /* Handle the general mca_component_t struct containing
  32      *  meta information about the component itself
  33      */
  34     {
  35         OMPI_CRCP_BASE_VERSION_2_0_0,
  36 
  37         /* Component name and version */
  38         "none",
  39         OMPI_MAJOR_VERSION,
  40         OMPI_MINOR_VERSION,
  41         OMPI_RELEASE_VERSION,
  42 
  43         /* Component open and close functions */
  44         ompi_crcp_base_none_open,
  45         ompi_crcp_base_none_close,
  46         ompi_crcp_base_none_query
  47     },
  48     {
  49         /* Component is checkpointable */
  50         MCA_BASE_METADATA_PARAM_CHECKPOINT
  51     },
  52 
  53     /* Verbosity level */
  54     0,
  55     /* opal_output handler */
  56     -1,
  57     /* Default priority */
  58     1
  59 };
  60 
  61 static ompi_crcp_base_module_t none_module = {
  62     /** Initialization Function */
  63     ompi_crcp_base_module_init,
  64     /** Finalization Function */
  65     ompi_crcp_base_module_finalize,
  66 
  67     /** Quiesce interface */
  68     ompi_crcp_base_none_quiesce_start,
  69     ompi_crcp_base_none_quiesce_end,
  70 
  71     /** PML Wrapper */
  72     ompi_crcp_base_none_pml_enable,
  73 
  74     ompi_crcp_base_none_pml_add_comm,
  75     ompi_crcp_base_none_pml_del_comm,
  76 
  77     ompi_crcp_base_none_pml_add_procs,
  78     ompi_crcp_base_none_pml_del_procs,
  79 
  80     ompi_crcp_base_none_pml_progress,
  81 
  82     ompi_crcp_base_none_pml_iprobe,
  83     ompi_crcp_base_none_pml_probe,
  84 
  85     ompi_crcp_base_none_pml_isend_init,
  86     ompi_crcp_base_none_pml_isend,
  87     ompi_crcp_base_none_pml_send,
  88 
  89     ompi_crcp_base_none_pml_irecv_init,
  90     ompi_crcp_base_none_pml_irecv,
  91     ompi_crcp_base_none_pml_recv,
  92 
  93     ompi_crcp_base_none_pml_dump,
  94     ompi_crcp_base_none_pml_start,
  95     ompi_crcp_base_none_pml_ft_event,
  96 
  97     /** Request Wrapper */
  98     ompi_crcp_base_none_request_complete,
  99 
 100     /** BTL Wrapper */
 101     ompi_crcp_base_none_btl_add_procs,
 102     ompi_crcp_base_none_btl_del_procs,
 103 
 104     ompi_crcp_base_none_btl_register,
 105     ompi_crcp_base_none_btl_finalize,
 106 
 107     ompi_crcp_base_none_btl_alloc,
 108     ompi_crcp_base_none_btl_free,
 109 
 110     ompi_crcp_base_none_btl_prepare_src,
 111     ompi_crcp_base_none_btl_prepare_dst,
 112 
 113     ompi_crcp_base_none_btl_send,
 114     ompi_crcp_base_none_btl_put,
 115     ompi_crcp_base_none_btl_get,
 116 
 117     ompi_crcp_base_none_btl_dump,
 118     ompi_crcp_base_none_btl_ft_event
 119 };
 120 
 121 int ompi_crcp_base_select(void)
 122 {
 123     int ret;
 124     ompi_crcp_base_component_t *best_component = NULL;
 125     ompi_crcp_base_module_t *best_module = NULL;
 126     const char *include_list = NULL;
 127     const char **selection_value;
 128     int var_id;
 129 
 130     /*
 131      * Register the framework MCA param and look up include list
 132      */
 133     var_id = mca_base_var_find("ompi", "crcp", NULL, NULL);
 134 
 135     /* NTH: The old parameter code here set the selection to none if no file value
 136        or environment value was set. This effectively means include_list is never NULL. */
 137     selection_value = NULL;
 138     (void) mca_base_var_get_value(var_id, &selection_value, NULL, NULL);
 139     if (NULL == selection_value || NULL == selection_value[0]) {
 140         (void) mca_base_var_set_value(var_id, "none", 5, MCA_BASE_VAR_SOURCE_DEFAULT, NULL);
 141         include_list = "none";
 142     } else {
 143         include_list = selection_value[0];
 144     }
 145 
 146     if(0 == strncmp(include_list, "none", strlen("none")) ){
 147         opal_output_verbose(10, ompi_crcp_base_framework.framework_output,
 148                             "crcp:select: Using %s component",
 149                             include_list);
 150         best_component = &none_component;
 151         best_module    = &none_module;
 152         /* JJH: Todo: Check if none is in the list */
 153         /* Close all components since none will be used */
 154         mca_base_components_close(ompi_crcp_base_framework.framework_output,
 155                                   &ompi_crcp_base_framework.framework_components,
 156                                   NULL);
 157     } else
 158 
 159     /*
 160      * Select the best component
 161      */
 162     if( OPAL_SUCCESS != mca_base_select("crcp", ompi_crcp_base_framework.framework_output,
 163                                         &ompi_crcp_base_framework.framework_components,
 164                                         (mca_base_module_t **) &best_module,
 165                                         (mca_base_component_t **) &best_component, NULL) ) {
 166         /* This will only happen if no component was selected */
 167         return OMPI_ERROR;
 168     }
 169 
 170     /* Save the winner */
 171     ompi_crcp_base_selected_component = *best_component;
 172     ompi_crcp = *best_module;
 173 
 174     /* Initialize the winner */
 175     if (OPAL_SUCCESS != (ret = ompi_crcp.crcp_init()) ) {
 176         return ret;
 177     }
 178 
 179     return OMPI_SUCCESS;
 180 }

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