root/opal/mca/pmix/pmix4x/pmix/src/mca/ptl/base/ptl_base_select.c

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

DEFINITIONS

This source file includes following definitions.
  1. pmix_ptl_base_select

   1 /*
   2  * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 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) 2016-2017 Intel, Inc. All rights reserved.
  13  * $COPYRIGHT$
  14  *
  15  * Additional copyrights may follow
  16  *
  17  * $HEADER$
  18  */
  19 
  20 #include <src/include/pmix_config.h>
  21 #include <pmix_common.h>
  22 
  23 #include <string.h>
  24 
  25 #include "src/mca/mca.h"
  26 #include "src/mca/base/base.h"
  27 #include "src/util/error.h"
  28 #include "src/util/show_help.h"
  29 
  30 #include "src/mca/ptl/base/base.h"
  31 
  32 static bool selected = false;
  33 
  34 /* Function for selecting a prioritized list of components
  35  * from all those that are available. */
  36 int pmix_ptl_base_select(void)
  37 {
  38     pmix_mca_base_component_list_item_t *cli = NULL;
  39     pmix_ptl_base_component_t *component = NULL;
  40     pmix_ptl_base_active_t *newactive, *active;
  41     pmix_mca_base_module_t *mod;
  42     int pri;
  43     bool inserted;
  44 
  45     if (selected) {
  46         /* ensure we don't do this twice */
  47         return PMIX_SUCCESS;
  48     }
  49     selected = true;
  50 
  51     /* Query all available components and ask if they have a module */
  52     PMIX_LIST_FOREACH(cli, &pmix_ptl_base_framework.framework_components, pmix_mca_base_component_list_item_t) {
  53         component = (pmix_ptl_base_component_t *) cli->cli_component;
  54 
  55         pmix_output_verbose(5, pmix_ptl_base_framework.framework_output,
  56                             "mca:ptl:select: checking available component %s",
  57                             component->base.pmix_mca_component_name);
  58 
  59         /* get the module for this component */
  60         if (PMIX_SUCCESS != component->base.pmix_mca_query_component(&mod, &pri)) {
  61             continue;
  62         }
  63 
  64         /* add to our prioritized list of available actives */
  65         newactive = PMIX_NEW(pmix_ptl_base_active_t);
  66         newactive->pri = component->priority;
  67         newactive->component = component;
  68         newactive->module = (pmix_ptl_module_t*)mod;
  69 
  70         /* maintain priority order */
  71         inserted = false;
  72         PMIX_LIST_FOREACH(active, &pmix_ptl_globals.actives, pmix_ptl_base_active_t) {
  73             if (newactive->pri > active->pri) {
  74                 pmix_list_insert_pos(&pmix_ptl_globals.actives,
  75                                      &active->super, &newactive->super);
  76                 inserted = true;
  77                 break;
  78             }
  79         }
  80         if (!inserted) {
  81             /* must be lowest priority - add to end */
  82             pmix_list_append(&pmix_ptl_globals.actives, &newactive->super);
  83         }
  84     }
  85 
  86     /* if no modules were found, then that's an error as we require at least one */
  87     if (0 == pmix_list_get_size(&pmix_ptl_globals.actives)) {
  88         pmix_show_help("help-pmix-runtime.txt", "no-plugins", true, "PTL");
  89         return PMIX_ERR_SILENT;
  90     }
  91 
  92     if (4 < pmix_output_get_verbosity(pmix_ptl_base_framework.framework_output)) {
  93         pmix_output(0, "Final PTL priorities");
  94         /* show the prioritized list */
  95         PMIX_LIST_FOREACH(active, &pmix_ptl_globals.actives, pmix_ptl_base_active_t) {
  96             pmix_output(0, "\tPTL: %s Priority: %d",
  97                         active->component->base.pmix_mca_component_name, active->pri);
  98         }
  99     }
 100 
 101     return PMIX_SUCCESS;;
 102 }

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