1 /*
2 * Copyright (c) 2004-2005 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) 2011-2013 Los Alamos National Security, LLC.
13 * All rights reserved.
14 * Copyright (c) 2015-2017 Research Organization for Information Science
15 * and Technology (RIST). All rights reserved.
16 * $COPYRIGHT$
17 *
18 * Additional copyrights may follow
19 *
20 * $HEADER$
21 */
22
23
24 #include "orte_config.h"
25 #include "orte/constants.h"
26
27 #include "opal/util/output.h"
28 #include "orte/mca/mca.h"
29 #include "opal/mca/base/base.h"
30
31 #include "orte/mca/errmgr/errmgr.h"
32 #include "orte/mca/plm/plm.h"
33 #include "orte/mca/plm/base/plm_private.h"
34 #include "orte/mca/plm/base/base.h"
35
36 /*
37 * The following file was created by configure. It contains extern
38 * statements and the definition of an array of pointers to each
39 * module's public mca_base_module_t struct.
40 */
41
42 #include "orte/mca/plm/base/static-components.h"
43
44 /*
45 * Global variables for use within PLM frameworks
46 */
47 orte_plm_globals_t orte_plm_globals = {0};
48
49 /*
50 * The default module
51 */
52 orte_plm_base_module_t orte_plm = {0};
53
54
55 static int mca_plm_base_register(mca_base_register_flag_t flags)
56 {
57 orte_plm_globals.node_regex_threshold = 1024;
58 (void) mca_base_framework_var_register (&orte_plm_base_framework, "node_regex_threshold",
59 "Only pass the node regex on the orted command line if smaller than this threshold",
60 MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0,
61 MCA_BASE_VAR_FLAG_INTERNAL,
62 OPAL_INFO_LVL_9,
63 MCA_BASE_VAR_SCOPE_READONLY,
64 &orte_plm_globals.node_regex_threshold);
65 return ORTE_SUCCESS;
66 }
67
68 static int orte_plm_base_close(void)
69 {
70 int rc;
71
72 /* Close the selected component */
73 if( NULL != orte_plm.finalize ) {
74 orte_plm.finalize();
75 }
76
77 /* if we are the HNP, then stop our receive */
78 if (ORTE_PROC_IS_HNP) {
79 if (ORTE_SUCCESS != (rc = orte_plm_base_comm_stop())) {
80 ORTE_ERROR_LOG(rc);
81 return rc;
82 }
83 }
84
85 return mca_base_framework_components_close(&orte_plm_base_framework, NULL);
86 }
87
88 /**
89 * Function for finding and opening either all MCA components,
90 * or the one that was specifically requested via a MCA parameter.
91 */
92 static int orte_plm_base_open(mca_base_open_flag_t flags)
93 {
94 /* init the next jobid */
95 orte_plm_globals.next_jobid = 1;
96
97 /* default to assigning daemons to nodes at launch */
98 orte_plm_globals.daemon_nodes_assigned_at_launch = true;
99
100 /* Open up all available components */
101 return mca_base_framework_components_open(&orte_plm_base_framework, flags);
102 }
103
104 MCA_BASE_FRAMEWORK_DECLARE(orte, plm, NULL, mca_plm_base_register, orte_plm_base_open, orte_plm_base_close,
105 mca_plm_base_static_components, 0);