1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
4 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
5 * reserved.
6 * Copyright (c) 2016-2018 Cisco Systems, Inc. All rights reserved
7 * Copyright (c) 2018 Research Organization for Information Science
8 * and Technology (RIST). All rights reserved.
9 * $COPYRIGHT$
10 *
11 * Additional copyrights may follow
12 *
13 * $HEADER$
14 */
15
16
17 #include "opal_config.h"
18
19 #include "opal/constants.h"
20 #include "opal/mca/mca.h"
21 #include "opal/mca/base/base.h"
22 #include "opal/mca/pmix/pmix.h"
23 #include "opal/mca/pmix/base/base.h"
24 #include "opal/util/opal_environ.h"
25
26 /*
27 * Globals
28 */
29
30 int opal_pmix_base_select(void)
31 {
32 opal_pmix_base_component_t *best_component = NULL;
33 opal_pmix_base_module_t *best_module = NULL;
34
35 // Set the PMIx component_show_load_errors MCA param based on the
36 // value of OPAL's mca_base_component_show_load_errors (i.e., the
37 // bool variable behind Open MPI's mca_component_show_load_errors
38 // MCA param).
39 char *pmix_show_load_errors_env = mca_base_component_show_load_errors ? "1" : "0";
40 opal_setenv("PMIX_MCA_mca_base_component_show_load_errors", pmix_show_load_errors_env, true, &environ);
41
42 /*
43 * Select the best component
44 */
45 if( OPAL_SUCCESS != mca_base_select("pmix", opal_pmix_base_framework.framework_output,
46 &opal_pmix_base_framework.framework_components,
47 (mca_base_module_t **) &best_module,
48 (mca_base_component_t **) &best_component, NULL) ) {
49 /* notify caller that no available component found */
50 return OPAL_ERR_NOT_FOUND;
51 }
52
53 /* Save the winner */
54 opal_pmix = *best_module;
55
56 /* do not initialize the module here as the type
57 * of process determines which init (client or server)
58 * should be done */
59
60 return OPAL_SUCCESS;
61 }