root/ompi/mca/fbtl/base/fbtl_base_find_available.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_fbtl_base_find_available
  2. init_query
  3. init_query_2_0_0

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2011 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2008-2011 University of Houston. All rights reserved.
  13  * Copyright (c) 2015      Research Organization for Information Science
  14  *                         and Technology (RIST). All rights reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 #include "ompi_config.h"
  23 
  24 #include <stdio.h>
  25 #include <stdlib.h>
  26 
  27 #include "mpi.h"
  28 #include "ompi/constants.h"
  29 #include "opal/class/opal_list.h"
  30 #include "opal/util/output.h"
  31 #include "ompi/mca/mca.h"
  32 #include "opal/mca/base/base.h"
  33 #include "ompi/mca/fbtl/fbtl.h"
  34 #include "ompi/mca/fbtl/base/base.h"
  35 
  36 static int init_query(const mca_base_component_t *m,
  37                       bool enable_progress_threads,
  38                       bool enable_mpi_threads);
  39 static int init_query_2_0_0(const mca_base_component_t *component,
  40                             bool enable_progress_threads,
  41                             bool enable_mpi_threads);
  42 
  43 int mca_fbtl_base_find_available(bool enable_progress_threads,
  44                                bool enable_mpi_threads)
  45 {
  46     mca_base_component_list_item_t *cli, *next;
  47 
  48     /* The list of components which we should check is already present
  49        in mca_fbtl_base_components_opened, which was established in
  50        mca_fbtl_base_open */
  51 
  52     OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_fbtl_base_framework.framework_components, mca_base_component_list_item_t) {
  53          /* Now for this entry, we have to determine the thread level. Call
  54             a subroutine to do the job for us */
  55 
  56          if (OMPI_SUCCESS != init_query(cli->cli_component,
  57                                         enable_progress_threads,
  58                                         enable_mpi_threads)) {
  59              mca_base_component_close(cli->cli_component, ompi_fbtl_base_framework.framework_output);
  60              opal_list_remove_item(&ompi_fbtl_base_framework.framework_components, &cli->super);
  61              OBJ_RELEASE(cli);
  62          }
  63      }
  64 
  65     /* There should atleast be one fbtl component which was available */
  66     if (0 == opal_list_get_size(&ompi_fbtl_base_framework.framework_components)) {
  67          opal_output_verbose (10, ompi_fbtl_base_framework.framework_output,
  68                               "fbtl:find_available: no fbtl components available!");
  69          return OMPI_ERROR;
  70      }
  71 
  72      /* All done */
  73      return OMPI_SUCCESS;
  74 }
  75 
  76 
  77 static int init_query(const mca_base_component_t *m,
  78                       bool enable_progress_threads,
  79                       bool enable_mpi_threads)
  80 {
  81     int ret;
  82 
  83     opal_output_verbose(10, ompi_fbtl_base_framework.framework_output,
  84                         "fbtl:find_available: querying fbtl component %s",
  85                         m->mca_component_name);
  86 
  87     /* This component has been successfully opened, now try to query it */
  88     if (2 == m->mca_type_major_version &&
  89         0 == m->mca_type_minor_version &&
  90         0 == m->mca_type_release_version) {
  91         ret = init_query_2_0_0(m, enable_progress_threads,
  92                                enable_mpi_threads);
  93     } else {
  94         /* unrecognised API version */
  95         opal_output_verbose(10, ompi_fbtl_base_framework.framework_output,
  96                             "fbtl:find_available:unrecognised fbtl API version (%d.%d.%d)",
  97                             m->mca_type_major_version,
  98                             m->mca_type_minor_version,
  99                             m->mca_type_release_version);
 100         return OMPI_ERROR;
 101     }
 102 
 103     /* Query done -- look at return value to see what happened */
 104     if (OMPI_SUCCESS != ret) {
 105         opal_output_verbose(10, ompi_fbtl_base_framework.framework_output,
 106                             "fbtl:find_available fbtl component %s is not available",
 107                             m->mca_component_name);
 108     } else {
 109         opal_output_verbose(10, ompi_fbtl_base_framework.framework_output,
 110                             "fbtl:find_avalable: fbtl component %s is available",
 111                             m->mca_component_name);
 112 
 113     }
 114     /* All done */
 115     return ret;
 116 }
 117 
 118 
 119 static int init_query_2_0_0(const mca_base_component_t *component,
 120                             bool enable_progress_threads,
 121                             bool enable_mpi_threads)
 122 {
 123     mca_fbtl_base_component_2_0_0_t *fbtl =
 124         (mca_fbtl_base_component_2_0_0_t *) component;
 125 
 126     return fbtl->fbtlm_init_query(enable_progress_threads,
 127                                   enable_mpi_threads);
 128 }

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