root/ompi/mca/mtl/base/mtl_base_frame.c

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_mtl_base_select
  2. ompi_mtl_base_close

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 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) 2015-2018 Los Alamos National Security, LLC.  All rights
  14  *                         reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 #include "ompi_config.h"
  23 
  24 #include "ompi/mca/mca.h"
  25 #include "opal/util/output.h"
  26 #include "opal/mca/base/base.h"
  27 
  28 
  29 #include "ompi/constants.h"
  30 #include "ompi/mca/mtl/mtl.h"
  31 #include "ompi/mca/mtl/base/base.h"
  32 
  33 /*
  34  * The following file was created by configure.  It contains extern
  35  * statements and the definition of an array of pointers to each
  36  * component's public mca_base_component_t struct.
  37  */
  38 
  39 #include "ompi/mca/mtl/base/static-components.h"
  40 
  41 mca_mtl_base_component_t *ompi_mtl_base_selected_component = NULL;
  42 mca_mtl_base_module_t *ompi_mtl = NULL;
  43 
  44 /*
  45  * Function for selecting one component from all those that are
  46  * available.
  47  *
  48  * For now, we take the first component that says it can run.  Might
  49  * need to reexamine this at a later time.
  50  */
  51 int
  52 ompi_mtl_base_select (bool enable_progress_threads,
  53                       bool enable_mpi_threads,
  54                       int *priority)
  55 {
  56     int ret = OMPI_ERR_NOT_FOUND;
  57     mca_mtl_base_component_t *best_component = NULL;
  58     mca_mtl_base_module_t *best_module = NULL;
  59     int best_priority;
  60 
  61     /*
  62      * Select the best component
  63      */
  64     if( OPAL_SUCCESS != mca_base_select("mtl", ompi_mtl_base_framework.framework_output,
  65                                         &ompi_mtl_base_framework.framework_components,
  66                                         (mca_base_module_t **) &best_module,
  67                                         (mca_base_component_t **) &best_component,
  68                                         &best_priority) ) {
  69         /* notify caller that no available component found */
  70         return ret;
  71     }
  72 
  73     opal_output_verbose( 10, ompi_mtl_base_framework.framework_output,
  74                          "select: initializing %s component %s",
  75                          best_component->mtl_version.mca_type_name,
  76                          best_component->mtl_version.mca_component_name );
  77 
  78     if (NULL == best_component->mtl_init(enable_progress_threads,
  79                                           enable_mpi_threads)) {
  80         opal_output_verbose( 10, ompi_mtl_base_framework.framework_output,
  81                              "select: init returned failure for component %s",
  82                              best_component->mtl_version.mca_component_name );
  83     } else {
  84         opal_output_verbose( 10, ompi_mtl_base_framework.framework_output,
  85                              "select: init returned success");
  86         ompi_mtl_base_selected_component = best_component;
  87         ompi_mtl = best_module;
  88         *priority = best_priority;
  89         ret = OMPI_SUCCESS;
  90     }
  91 
  92     /* All done */
  93     if (NULL == ompi_mtl) {
  94         opal_output_verbose( 10, ompi_mtl_base_framework.framework_output,
  95                              "select: no component selected");
  96     } else {
  97         opal_output_verbose( 10, ompi_mtl_base_framework.framework_output,
  98                              "select: component %s selected",
  99                              ompi_mtl_base_selected_component->
 100                              mtl_version.mca_component_name );
 101     }
 102     return ret;
 103 }
 104 
 105 
 106 static int
 107 ompi_mtl_base_close(void)
 108 {
 109     /* NTH: Should we be freeing the mtl module here? */
 110     ompi_mtl = NULL;
 111     ompi_mtl_base_selected_component = NULL;
 112 
 113     /* Close all remaining available modules (may be one if this is a
 114        OMPI RTE program, or [possibly] multiple if this is ompi_info) */
 115     return mca_base_framework_components_close(&ompi_mtl_base_framework, NULL);
 116 }
 117 
 118 MCA_BASE_FRAMEWORK_DECLARE(ompi, mtl, NULL, NULL, NULL, ompi_mtl_base_close,
 119                            mca_mtl_base_static_components, 0);

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