root/ompi/mca/osc/base/osc_base_init.c

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_osc_base_select

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University.
   4  *                         All rights reserved.
   5  * Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
   6  *                         All rights reserved.
   7  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   8  *                         University of Stuttgart.  All rights reserved.
   9  * Copyright (c) 2004-2005 The Regents of the University of California.
  10  *                         All rights reserved.
  11  * Copyright (c) 2014      Los Alamos National Security, LLC. All rights
  12  *                         reserved.
  13  * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
  14  * $COPYRIGHT$
  15  *
  16  * Additional copyrights may follow
  17  *
  18  * $HEADER$
  19  */
  20 
  21 #include "ompi_config.h"
  22 
  23 #include "ompi/constants.h"
  24 #include "ompi/mca/mca.h"
  25 #include "opal/mca/base/base.h"
  26 #include "ompi/mca/osc/osc.h"
  27 #include "ompi/mca/osc/base/base.h"
  28 #include "ompi/info/info.h"
  29 #include "ompi/communicator/communicator.h"
  30 #include "ompi/win/win.h"
  31 
  32 int
  33 ompi_osc_base_select(ompi_win_t *win,
  34                      void **base,
  35                      size_t size,
  36                      int disp_unit,
  37                      ompi_communicator_t *comm,
  38                      opal_info_t *info,
  39                      int flavor,
  40                      int *model)
  41 {
  42     opal_list_item_t *item;
  43     ompi_osc_base_component_t *best_component = NULL;
  44     int best_priority = -1, priority;
  45 
  46     if (opal_list_get_size(&ompi_osc_base_framework.framework_components) <= 0) {
  47         /* we don't have any components to support us... */
  48         return OMPI_ERR_NOT_SUPPORTED;
  49     }
  50 
  51     for (item = opal_list_get_first(&ompi_osc_base_framework.framework_components) ;
  52          item != opal_list_get_end(&ompi_osc_base_framework.framework_components) ;
  53          item = opal_list_get_next(item)) {
  54         ompi_osc_base_component_t *component = (ompi_osc_base_component_t*)
  55             ((mca_base_component_list_item_t*) item)->cli_component;
  56 
  57         priority = component->osc_query(win, base, size, disp_unit, comm, info, flavor);
  58         if (priority < 0) {
  59             if (MPI_WIN_FLAVOR_SHARED == flavor && OMPI_ERR_RMA_SHARED == priority) {
  60                 /* NTH: quick fix to return OMPI_ERR_RMA_SHARED */
  61                 return OMPI_ERR_RMA_SHARED;
  62             }
  63             continue;
  64         }
  65 
  66         if (priority > best_priority) {
  67             best_component = component;
  68             best_priority = priority;
  69         }
  70     }
  71 
  72     if (NULL == best_component) return OMPI_ERR_NOT_SUPPORTED;
  73 
  74     opal_output_verbose( 10, ompi_osc_base_framework.framework_output,
  75                          "select: component %s selected",
  76                          best_component->osc_version.mca_component_name );
  77 
  78     return best_component->osc_select(win, base, size, disp_unit, comm, info, flavor, model);
  79 }

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