root/ompi/mca/fs/base/fs_base_find_available.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_fs_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/mca.h"
  28 #include "opal/mca/base/base.h"
  29 #include "ompi/mca/fs/fs.h"
  30 #include "ompi/mca/fs/base/base.h"
  31 #include "opal/util/output.h"
  32 
  33 static int init_query(const mca_base_component_t *m,
  34                       bool enable_progress_threads,
  35                       bool enable_mpi_threads);
  36 static int init_query_2_0_0(const mca_base_component_t *component,
  37                             bool enable_progress_threads,
  38                             bool enable_mpi_threads);
  39 
  40 int mca_fs_base_find_available(bool enable_progress_threads,
  41                                bool enable_mpi_threads)
  42 {
  43     mca_base_component_list_item_t *cli, *next;
  44 
  45     /* The list of components which we should check is already present
  46        in mca_fs_base_components_opened, which was established in
  47        mca_fs_base_open */
  48 
  49     OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_fs_base_framework.framework_components, mca_base_component_list_item_t) {
  50         /* Now for this entry, we have to determine the thread level. Call
  51            a subroutine to do the job for us */
  52 
  53         if (OMPI_SUCCESS != init_query(cli->cli_component,
  54                                        enable_progress_threads,
  55                                        enable_mpi_threads)) {
  56             /* The component does not want to run, so close it. Its close()
  57                has already been invoked. Close it out of the DSO repository
  58                (if it is there in the repository) */
  59             opal_list_remove_item (&ompi_fs_base_framework.framework_components, &cli->super);
  60             mca_base_component_close(cli->cli_component, ompi_fs_base_framework.framework_output);
  61             OBJ_RELEASE(cli);
  62         }
  63     }
  64 
  65     /* There should atleast be one fs component which was available */
  66     if (0 == opal_list_get_size(&ompi_fs_base_framework.framework_components)) {
  67          opal_output_verbose (10, ompi_fs_base_framework.framework_output,
  68                               "fs:find_available: no fs 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_fs_base_framework.framework_output,
  84                         "fs:find_available: querying fs 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_fs_base_framework.framework_output,
  96                             "fs:find_available:unrecognised fs 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_fs_base_framework.framework_output,
 106                             "fs:find_available fs component %s is not available",
 107                             m->mca_component_name);
 108     } else {
 109         opal_output_verbose(10, ompi_fs_base_framework.framework_output,
 110                             "fs:find_avalable: fs 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_fs_base_component_2_0_0_t *fs =
 124         (mca_fs_base_component_2_0_0_t *) component;
 125 
 126     return fs->fsm_init_query(enable_progress_threads,
 127                               enable_mpi_threads);
 128 }

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