1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
4 * University Research and Technology
5 * Corporation. All rights reserved.
6 * Copyright (c) 2004-2006 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) 2007 Cisco Systems, Inc. All rights reserved.
14 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
15 * reserved.
16 * $COPYRIGHT$
17 *
18 * Additional copyrights may follow
19 *
20 * $HEADER$
21 */
22
23
24 #include "opal_config.h"
25
26 #include "opal/constants.h"
27 #include "opal/mca/mca.h"
28 #include "opal/mca/base/base.h"
29 #include "opal/mca/pstat/pstat.h"
30 #include "opal/mca/pstat/base/base.h"
31
32 /*
33 * Globals
34 */
35
36 int opal_pstat_base_select(void)
37 {
38 int ret, exit_status = OPAL_SUCCESS;
39 opal_pstat_base_component_t *best_component = NULL;
40 opal_pstat_base_module_t *best_module = NULL;
41
42 /*
43 * Select the best component
44 */
45 if( OPAL_SUCCESS != mca_base_select("pstat", opal_pstat_base_framework.framework_output,
46 &opal_pstat_base_framework.framework_components,
47 (mca_base_module_t **) &best_module,
48 (mca_base_component_t **) &best_component, NULL) ) {
49 /* It is okay if we don't find a runnable component - default
50 * to the unsupported default.
51 */
52 goto cleanup;
53 }
54
55 /* Save the winner */
56 opal_pstat_base_component = best_component;
57 opal_pstat = *best_module;
58
59 /* Initialize the winner */
60 if (OPAL_SUCCESS != (ret = opal_pstat.init()) ) {
61 exit_status = ret;
62 goto cleanup;
63 }
64
65 cleanup:
66 return exit_status;
67 }