root/ompi/mca/pml/crcpw/pml_crcpw_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_pml_crcpw_component_register
  2. mca_pml_crcpw_component_open
  3. mca_pml_crcpw_component_close
  4. mca_pml_crcpw_component_init
  5. mca_pml_crcpw_component_finalize

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2006 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2006 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2010      Cisco Systems, Inc. All rights reserved.
  14  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  15  *                         reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  */
  22 
  23 #include "ompi_config.h"
  24 #include "opal/runtime/opal.h"
  25 #include "opal/util/output.h"
  26 #include "opal/mca/event/event.h"
  27 #include "opal/mca/btl/base/base.h"
  28 
  29 #include "mpi.h"
  30 #include "ompi/mca/pml/pml.h"
  31 #include "ompi/mca/pml/base/pml_base_bsend.h"
  32 #include "ompi/mca/pml/crcpw/pml_crcpw.h"
  33 #include "ompi/mca/bml/base/base.h"
  34 
  35 static int mca_pml_crcpw_component_register(void);
  36 
  37 mca_pml_crcpw_component_t mca_pml_crcpw_component = {
  38     {
  39         /* First, the mca_base_component_t struct containing meta
  40            information about the component itself */
  41 
  42         .pmlm_version = {
  43             MCA_PML_BASE_VERSION_2_0_0,
  44 
  45             .mca_component_name = "crcpw",
  46             MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
  47                                   OMPI_RELEASE_VERSION),
  48             .mca_open_component = mca_pml_crcpw_component_open,
  49             .mca_close_component = mca_pml_crcpw_component_close,
  50             .mca_register_component_params = mca_pml_crcpw_component_register,
  51         },
  52         .pmlm_data = {
  53             /* The component is checkpoint ready */
  54             MCA_BASE_METADATA_PARAM_CHECKPOINT
  55         },
  56 
  57         .pmlm_init = mca_pml_crcpw_component_init,
  58         .pmlm_finalize = mca_pml_crcpw_component_finalize,
  59     },
  60     /* Verbosity */
  61     0,
  62     /* Priority */
  63     PML_SELECT_WRAPPER_PRIORITY,
  64     /* Are we being used as a wrapper? */
  65     false
  66 };
  67 
  68 opal_free_list_t pml_state_list;
  69 bool pml_crcpw_is_finalized = false;
  70 
  71 static int mca_pml_crcpw_component_register(void)
  72 {
  73     /*
  74      * Register some MCA parameters
  75      */
  76     mca_pml_crcpw_component.priority = PML_SELECT_WRAPPER_PRIORITY;
  77     (void) mca_base_component_var_register(&mca_pml_crcpw_component.super.pmlm_version, "priority",
  78                                            "Priority of the PML crcpw component",
  79                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  80                                            OPAL_INFO_LVL_9,
  81                                            MCA_BASE_VAR_SCOPE_READONLY,
  82                                            &mca_pml_crcpw_component.priority);
  83 
  84     mca_pml_crcpw_component.verbose = 0;
  85     (void) mca_base_component_var_register(&mca_pml_crcpw_component.super.pmlm_version, "verbose",
  86                                            "Verbose level for the PML crcpw component",
  87                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  88                                            OPAL_INFO_LVL_9,
  89                                            MCA_BASE_VAR_SCOPE_READONLY,
  90                                            &mca_pml_crcpw_component.verbose);
  91 
  92     return OMPI_SUCCESS;
  93 }
  94 
  95 int mca_pml_crcpw_component_open(void)
  96 {
  97     opal_output_verbose( 10, mca_pml_crcpw_component.output_handle,
  98                          "pml:crcpw: component_open: Open");
  99 
 100     mca_pml_crcpw_component.output_handle = opal_output_open(NULL);
 101     if ( 0 != mca_pml_crcpw_component.verbose) {
 102         opal_output_set_verbosity(mca_pml_crcpw_component.output_handle,
 103                                   mca_pml_crcpw_component.verbose);
 104     }
 105 
 106     /*
 107      * Debug Output
 108      */
 109     opal_output_verbose(10, mca_pml_crcpw_component.output_handle,
 110                         "pml:crcpw: open()");
 111     opal_output_verbose(20, mca_pml_crcpw_component.output_handle,
 112                         "pml:crcpw: open: priority   = %d",
 113                         mca_pml_crcpw_component.priority);
 114     opal_output_verbose(20, mca_pml_crcpw_component.output_handle,
 115                         "pml:crcpw: open: verbosity  = %d",
 116                         mca_pml_crcpw_component.verbose);
 117 
 118     return OMPI_SUCCESS;
 119 }
 120 
 121 
 122 int mca_pml_crcpw_component_close(void)
 123 {
 124     opal_output_verbose( 20, mca_pml_crcpw_component.output_handle,
 125                          "pml:crcpw: component_close: Close");
 126 
 127     return OMPI_SUCCESS;
 128 }
 129 
 130 
 131 mca_pml_base_module_t* mca_pml_crcpw_component_init(int* priority,
 132                                                      bool enable_progress_threads,
 133                                                      bool enable_mpi_threads)
 134 {
 135     /* We use the PML_SELECT_WRAPPER_PRIORITY to indicate when this
 136      * component should wrap around what is already selected
 137      * If it is not set to this seminal value, then we are doing a
 138      * normal selection operation
 139      */
 140     if(*priority == PML_SELECT_WRAPPER_PRIORITY ) {
 141         opal_output_verbose( 20, mca_pml_crcpw_component.output_handle,
 142                              "pml:crcpw: component_init: Wrap the selected component %s",
 143                              mca_pml_base_selected_component.pmlm_version.mca_component_name);
 144 
 145         mca_pml_crcpw_module.wrapped_pml_component = mca_pml_base_selected_component;
 146         mca_pml_crcpw_module.wrapped_pml_module    = mca_pml;
 147         mca_pml_crcpw_component.pml_crcp_wrapped = true;
 148 
 149         opal_output_verbose( 20, mca_pml_crcpw_component.output_handle,
 150                              "pml:crcpw: component_init: Initalize Wrapper");
 151 
 152         OBJ_CONSTRUCT(&pml_state_list, opal_free_list_t);
 153         opal_free_list_init (&pml_state_list,
 154                              sizeof(ompi_crcp_base_pml_state_t),
 155                              opal_cache_line_size,
 156                              OBJ_CLASS(ompi_crcp_base_pml_state_t),
 157                              0,opal_cache_line_size,
 158                              5,  /* Initial number */
 159                              -1, /* Max = Unlimited */
 160                              64, /* Increment by */
 161                              NULL, 0, NULL, NULL, NULL);
 162     }
 163     else {
 164         opal_output_verbose( 20, mca_pml_crcpw_component.output_handle,
 165                              "pml:crcpw: component_init: Priority %d",
 166                              mca_pml_crcpw_component.priority);
 167     }
 168 
 169 
 170     *priority = mca_pml_crcpw_component.priority;
 171 
 172     pml_crcpw_is_finalized = false;
 173 
 174     return &mca_pml_crcpw_module.super;
 175 }
 176 
 177 int mca_pml_crcpw_component_finalize(void)
 178 {
 179     opal_output_verbose( 20, mca_pml_crcpw_component.output_handle,
 180                          "pml:crcpw: component_finalize: Finalize");
 181 
 182     OBJ_DESTRUCT(&pml_state_list);
 183 
 184     pml_crcpw_is_finalized = true;
 185 
 186     if(mca_pml_crcpw_component.pml_crcp_wrapped) {
 187         return mca_pml_crcpw_module.wrapped_pml_component.pmlm_finalize();
 188     }
 189 
 190     return OMPI_SUCCESS;
 191 }
 192 

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