root/ompi/mca/fcoll/base/fcoll_base_find_available.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_fcoll_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 "ompi/mca/fcoll/fcoll.h"
  28 #include "ompi/mca/fcoll/base/base.h"
  29 #include "opal/util/output.h"
  30 
  31 static int init_query(const mca_base_component_t *m,
  32                       bool enable_progress_threads,
  33                       bool enable_mpi_threads);
  34 static int init_query_2_0_0(const mca_base_component_t *component,
  35                             bool enable_progress_threads,
  36                             bool enable_mpi_threads);
  37 
  38 int mca_fcoll_base_find_available(bool enable_progress_threads,
  39                                bool enable_mpi_threads)
  40 {
  41     mca_base_component_list_item_t *cli, *next;
  42 
  43     /* The list of components which we should check is already present
  44        in mca_fcoll_base_components_opened, which was established in
  45        mca_fcoll_base_open */
  46 
  47     OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_fcoll_base_framework.framework_components, mca_base_component_list_item_t) {
  48          /* Now for this entry, we have to determine the thread level. Call
  49             a subroutine to do the job for us */
  50 
  51          if (OMPI_SUCCESS != init_query(cli->cli_component,
  52                                         enable_progress_threads,
  53                                         enable_mpi_threads)) {
  54              /* The component does not want to run, so close it. Its close()
  55                 has already been invoked. Close it out of the DSO repository
  56                 (if it is there in the repository) */
  57              opal_list_remove_item(&ompi_fcoll_base_framework.framework_components, &cli->super);
  58              mca_base_component_close(cli->cli_component, ompi_fcoll_base_framework.framework_output);;
  59              OBJ_RELEASE(cli);
  60          }
  61     }
  62 
  63     /* There should atleast be one fcoll component which was available */
  64     if (0 == opal_list_get_size(&ompi_fcoll_base_framework.framework_components)) {
  65          opal_output_verbose (10, ompi_fcoll_base_framework.framework_output,
  66                               "fcoll:find_available: no fcoll components available!");
  67          return OMPI_ERROR;
  68      }
  69 
  70      /* All done */
  71      return OMPI_SUCCESS;
  72 }
  73 
  74 
  75 static int init_query(const mca_base_component_t *m,
  76                       bool enable_progress_threads,
  77                       bool enable_mpi_threads)
  78 {
  79     int ret;
  80 
  81     opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
  82                         "fcoll:find_available: querying fcoll component %s",
  83                         m->mca_component_name);
  84 
  85     /* This component has been successfully opened, now try to query it */
  86     if (2 == m->mca_type_major_version &&
  87         0 == m->mca_type_minor_version &&
  88         0 == m->mca_type_release_version) {
  89         ret = init_query_2_0_0(m, enable_progress_threads,
  90                                enable_mpi_threads);
  91     } else {
  92         /* unrecognised API version */
  93         opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
  94                             "fcoll:find_available:unrecognised fcoll API version (%d.%d.%d)",
  95                             m->mca_type_major_version,
  96                             m->mca_type_minor_version,
  97                             m->mca_type_release_version);
  98         return OMPI_ERROR;
  99     }
 100 
 101     /* Query done -- look at return value to see what happened */
 102     if (OMPI_SUCCESS != ret) {
 103         opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
 104                             "fcoll:find_available fcoll component %s is not available",
 105                             m->mca_component_name);
 106     } else {
 107         opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
 108                             "fcoll:find_avalable: fcoll component %s is available",
 109                             m->mca_component_name);
 110 
 111     }
 112     /* All done */
 113     return ret;
 114 }
 115 
 116 
 117 static int init_query_2_0_0(const mca_base_component_t *component,
 118                             bool enable_progress_threads,
 119                             bool enable_mpi_threads)
 120 {
 121     mca_fcoll_base_component_2_0_0_t *fcoll =
 122         (mca_fcoll_base_component_2_0_0_t *) component;
 123 
 124     return fcoll->fcollm_init_query(enable_progress_threads,
 125                               enable_mpi_threads);
 126 }

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