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) 2014-2015 Los Alamos National Security, LLC. All rights
14 * 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
31 #include <stdlib.h>
32 #ifdef HAVE_UNISTD_H
33 #include <unistd.h>
34 #endif
35 #include <ctype.h>
36 #include <sys/syscall.h>
37
38 #include "orte/mca/mca.h"
39 #include "opal/mca/base/base.h"
40
41 #include "orte/mca/common/alps/common_alps.h"
42 #include "orte/mca/odls/odls.h"
43 #include "orte/mca/odls/base/odls_private.h"
44 #include "orte/mca/odls/alps/odls_alps.h"
45
46 /*
47 * Instantiate the public struct with all of our public information
48 * and pointers to our public functions in it
49 */
50
51 orte_odls_base_component_t mca_odls_alps_component = {
52 /* First, the mca_component_t struct containing meta information
53 about the component itself */
54 .version = {
55 ORTE_ODLS_BASE_VERSION_2_0_0,
56 /* Component name and version */
57 .mca_component_name = "alps",
58 MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
59 ORTE_RELEASE_VERSION),
60
61 /* Component open and close functions */
62 .mca_open_component = orte_odls_alps_component_open,
63 .mca_close_component = orte_odls_alps_component_close,
64 .mca_query_component = orte_odls_alps_component_query,
65 },
66 .base_data = {
67 /* The component is checkpoint ready */
68 MCA_BASE_METADATA_PARAM_CHECKPOINT
69 },
70 };
71
72
73 int orte_odls_alps_component_open(void)
74 {
75 return ORTE_SUCCESS;
76 }
77
78 int orte_odls_alps_component_query(mca_base_module_t **module, int *priority)
79 {
80 int rc = ORTE_SUCCESS;
81 bool flag;
82
83 /*
84 * make sure we're in a daemon process
85 */
86
87 if (!ORTE_PROC_IS_DAEMON) {
88 *priority = 0;
89 *module = NULL;
90 rc = ORTE_ERROR;
91 }
92
93 /*
94 * make sure we're in a Cray PAGG container, and that we are also on
95 * a compute node (i.e. we are thought of as a application task by
96 * the cray job kernel module - the thing that creates the PAGG
97 */
98
99 rc = orte_common_alps_proc_in_pagg(&flag);
100 if ((ORTE_SUCCESS == rc) && flag) {
101 *priority = 10; /* take precendence over base */
102 *module = (mca_base_module_t *) &orte_odls_alps_module;
103 }
104
105 return rc;
106 }
107
108
109 int orte_odls_alps_component_close(void)
110 {
111 return ORTE_SUCCESS;
112 }
113
114