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-2005 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) 2011-2015 Los Alamos National Security, LLC.
14 * All rights reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 *
21 * These symbols are in a file by themselves to provide nice linker
22 * semantics. Since linkers generally pull in symbols by object
23 * files, keeping these symbols as the only symbols in this file
24 * prevents utility programs such as "ompi_info" from having to import
25 * entire components just to query their version and parameters.
26 */
27
28 #include "orte_config.h"
29 #include "orte/constants.h"
30 #include "orte/runtime/orte_globals.h"
31 #include "orte/util/proc_info.h"
32 #include "orte/mca/common/alps/common_alps.h"
33 #include "orte/mca/ess/ess.h"
34 #include "orte/mca/ess/base/base.h"
35 #include "orte/mca/ess/alps/ess_alps.h"
36
37 #include <sys/syscall.h>
38
39
40 /*
41 * Instantiate the public struct with all of our public information
42 * and pointers to our public functions in it
43 */
44 orte_ess_base_component_t mca_ess_alps_component = {
45 /* First, the mca_component_t struct containing meta information
46 about the component itself */
47 .base_version = {
48 ORTE_ESS_BASE_VERSION_3_0_0,
49
50 /* Component name and version */
51 .mca_component_name = "alps",
52 MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
53 ORTE_RELEASE_VERSION),
54
55 /* Component open and close functions */
56 .mca_open_component = orte_ess_alps_component_open,
57 .mca_close_component = orte_ess_alps_component_close,
58 .mca_query_component = orte_ess_alps_component_query,
59 },
60 .base_data = {
61 /* The component is not checkpoint ready */
62 MCA_BASE_METADATA_PARAM_NONE
63 },
64 };
65
66 int
67 orte_ess_alps_component_open(void)
68 {
69 return ORTE_SUCCESS;
70 }
71
72 int orte_ess_alps_component_query(mca_base_module_t **module, int *priority)
73 {
74 int rc = ORTE_SUCCESS;
75 bool flag;
76
77 /*
78 * don't use the alps ess component if an app proc
79 */
80
81 if (ORTE_PROC_IS_APP) {
82 *priority = 0;
83 *module = NULL;
84 return ORTE_ERROR;
85 }
86
87 /*
88 * make sure we're in a Cray PAGG container, and that we are also on
89 * a compute node (i.e. we are thought of as an application task by
90 * the cray job kernel module - the thing that creates the PAGG)
91 */
92
93 rc = orte_common_alps_proc_in_pagg(&flag);
94 if ((ORTE_SUCCESS == rc) && flag) {
95 *priority = 35; /* take precendence over base */
96 *module = (mca_base_module_t *) &orte_ess_alps_module;
97 }
98
99 return rc;
100 }
101
102 int
103 orte_ess_alps_component_close(void)
104 {
105 return ORTE_SUCCESS;
106 }
107