root/ompi/mca/sharedfp/base/sharedfp_base_find_available.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_sharedfp_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$
  14  *
  15  * Additional copyrights may follow
  16  *
  17  * $HEADER$
  18  */
  19 
  20 #include "ompi_config.h"
  21 
  22 #include <stdio.h>
  23 #include <stdlib.h>
  24 
  25 #include "mpi.h"
  26 #include "ompi/constants.h"
  27 #include "opal/class/opal_list.h"
  28 #include "opal/util/output.h"
  29 #include "ompi/mca/mca.h"
  30 #include "opal/mca/base/base.h"
  31 #include "opal/mca/base/mca_base_component_repository.h"
  32 #include "ompi/mca/sharedfp/sharedfp.h"
  33 #include "ompi/mca/sharedfp/base/base.h"
  34 
  35 static int init_query(const mca_base_component_t *m,
  36                       mca_base_component_list_item_t *entry,
  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                             mca_base_component_list_item_t *entry,
  41                             bool enable_progress_threads,
  42                             bool enable_mpi_threads);
  43 
  44 int mca_sharedfp_base_find_available(bool enable_progress_threads,
  45                                      bool enable_mpi_threads)
  46 {
  47     opal_list_item_t *item, *next;
  48     mca_base_component_list_item_t *cli;
  49 
  50     /* The list of components which we should check is already present
  51        in ompi_sharedfp_base_framework.framework_components, which was established in
  52        mca_sharedfp_base_open */
  53 
  54     item = opal_list_get_first(&ompi_sharedfp_base_framework.framework_components);
  55     while (item != opal_list_get_end(&ompi_sharedfp_base_framework.framework_components)) {
  56         next = opal_list_get_next(item);
  57          cli = (mca_base_component_list_item_t*)item;
  58 
  59          /* Now for this entry, we have to determine the thread level. Call
  60             a subroutine to do the job for us */
  61 
  62          if (OMPI_SUCCESS != init_query(cli->cli_component, cli,
  63                                         enable_progress_threads,
  64                                         enable_mpi_threads)) {
  65              /* The component does not want to run, so close it. Its close()
  66                 has already been invoked. Close it out of the DSO repository
  67                 (if it is there in the repository) */
  68              mca_base_component_repository_release(cli->cli_component);
  69              OBJ_RELEASE(item);
  70          }
  71          item = next;
  72      }
  73 
  74      /* There should at least be one sharedfp component which was available */
  75     if (0 == opal_list_get_size(&ompi_sharedfp_base_framework.framework_components)) {
  76          opal_output_verbose (10, ompi_sharedfp_base_framework.framework_output,
  77                               "sharedfp:find_available: no sharedfp components available!");
  78          return OMPI_ERROR;
  79      }
  80 
  81      /* All done */
  82      return OMPI_SUCCESS;
  83 }
  84 
  85 
  86 static int init_query(const mca_base_component_t *m,
  87                       mca_base_component_list_item_t *entry,
  88                       bool enable_progress_threads,
  89                       bool enable_mpi_threads)
  90 {
  91     int ret;
  92 
  93     opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output,
  94                         "sharedfp:find_available: querying sharedfp component %s",
  95                         m->mca_component_name);
  96 
  97     /* This component has been successfully opened, now try to query it */
  98     if (2 == m->mca_type_major_version &&
  99         0 == m->mca_type_minor_version &&
 100         0 == m->mca_type_release_version) {
 101         ret = init_query_2_0_0(m, entry, enable_progress_threads,
 102                                enable_mpi_threads);
 103     } else {
 104         /* unrecognised API version */
 105         opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output,
 106                             "sharedfp:find_available:unrecognised sharedfp API version (%d.%d.%d)",
 107                             m->mca_type_major_version,
 108                             m->mca_type_minor_version,
 109                             m->mca_type_release_version);
 110         return OMPI_ERROR;
 111     }
 112 
 113     /* Query done -- look at return value to see what happened */
 114     if (OMPI_SUCCESS != ret) {
 115         opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output,
 116                             "sharedfp:find_available sharedfp component %s is not available",
 117                             m->mca_component_name);
 118         if (NULL != m->mca_close_component) {
 119             m->mca_close_component();
 120         }
 121     } else {
 122         opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output,
 123                             "sharedfp:find_avalable: sharedfp component %s is available",
 124                             m->mca_component_name);
 125 
 126     }
 127     /* All done */
 128     return ret;
 129 }
 130 
 131 
 132 static int init_query_2_0_0(const mca_base_component_t *component,
 133                             mca_base_component_list_item_t *entry,
 134                             bool enable_progress_threads,
 135                             bool enable_mpi_threads)
 136 {
 137     mca_sharedfp_base_component_2_0_0_t *sharedfp =
 138         (mca_sharedfp_base_component_2_0_0_t *) component;
 139 
 140     return sharedfp->sharedfpm_init_query(enable_progress_threads,
 141                               enable_mpi_threads);
 142 }

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