1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4  *                         University Research and Technology
5  *                         Corporation.  All rights reserved.
6  * Copyright (c) 2004-2007 The University of Tennessee and The University
7  *                         of Tennessee Research Foundation.  All rights
8  *                         reserved.
9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10  *                         University of Stuttgart.  All rights reserved.
11  * Copyright (c) 2004-2005 The Regents of the University of California.
12  *                         All rights reserved.
13  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
14  *                         reserved.
15  * $COPYRIGHT$
16  *
17  * Additional copyrights may follow
18  *
19  * $HEADER$
20  */
21 
22 #include "orte_config.h"
23 #include "orte/constants.h"
24 
25 #include "orte/mca/mca.h"
26 #include "opal/mca/base/base.h"
27 
28 #include "orte/util/proc_info.h"
29 #include "orte/mca/errmgr/errmgr.h"
30 
31 #include "orte/mca/iof/iof.h"
32 #include "orte/mca/iof/base/base.h"
33 
34 /**
35  * Call the query function on all available components to find out if
36  * they want to run.  Select the single component with the highest
37  * priority.
38  */
orte_iof_base_select(void)39 int orte_iof_base_select(void)
40 {
41     orte_iof_base_component_t *best_component = NULL;
42     orte_iof_base_module_t *best_module = NULL;
43     int rc;
44 
45     /*
46      * Select the best component
47      */
48     if( OPAL_SUCCESS != mca_base_select("iof", orte_iof_base_framework.framework_output,
49                                         &orte_iof_base_framework.framework_components,
50                                         (mca_base_module_t **) &best_module,
51                                         (mca_base_component_t **) &best_component, NULL) ) {
52         /* this is a problem */
53         return ORTE_ERR_NOT_FOUND;
54     }
55 
56     /* Save the winner */
57     orte_iof = *best_module;
58     /* init it */
59     if (NULL != orte_iof.init) {
60         if (ORTE_SUCCESS != (rc = orte_iof.init())) {
61             ORTE_ERROR_LOG(rc);
62             return rc;
63         }
64     }
65 
66     return ORTE_SUCCESS;
67 }
68 
69