This source file includes following definitions.
- pmix_cray_component_open
- pmix_cray_component_query
- pmix_cray_component_close
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #include "opal_config.h"
21
22 #include "opal/constants.h"
23 #include "opal/mca/pmix/pmix.h"
24 #include "opal/util/show_help.h"
25 #include "pmix_cray.h"
26 #include <sys/syscall.h>
27 #include <pmi.h>
28
29
30
31
32 const char *opal_pmix_cray_component_version_string =
33 "OPAL cray pmix MCA component version " OPAL_VERSION;
34
35
36
37
38 static int pmix_cray_component_open(void);
39 static int pmix_cray_component_query(mca_base_module_t **module, int *priority);
40 static int pmix_cray_component_close(void);
41
42
43
44
45
46
47
48 opal_pmix_cray_component_t mca_pmix_cray_component = {
49 {
50
51
52
53 .base_version = {
54
55
56
57 OPAL_PMIX_BASE_VERSION_2_0_0,
58
59
60
61 .mca_component_name = "cray",
62 MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
63 OPAL_RELEASE_VERSION),
64
65
66
67 .mca_open_component = pmix_cray_component_open,
68 .mca_close_component = pmix_cray_component_close,
69 .mca_query_component = pmix_cray_component_query,
70 },
71
72 .base_data = {
73
74 MCA_BASE_METADATA_PARAM_CHECKPOINT
75 }
76 },
77 .cache_local = NULL,
78 .cache_global = NULL,
79 };
80
81 static int pmix_cray_component_open(void)
82 {
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99 #if OPAL_ENABLE_DLOPEN_SUPPORT
100 if (NULL == getenv("PMI_NO_FORK")) {
101 opal_show_help("help-pmix-cray.txt", "aprun-not-supported", true);
102 exit(-1);
103 }
104 #endif
105 return OPAL_SUCCESS;
106 }
107
108 static int pmix_cray_component_query(mca_base_module_t **module, int *priority)
109 {
110 int rc;
111 const char proc_job_file[]="/proc/job";
112 FILE *fd = NULL, *fd_task_is_app = NULL;
113 char task_is_app_fname[PATH_MAX];
114
115
116
117 fd = fopen(proc_job_file, "r");
118 if ((fd == NULL) || (getenv("OMPI_NO_USE_CRAY_PMI") != NULL)) {
119 *priority = 0;
120 *module = NULL;
121 rc = OPAL_ERROR;
122 } else {
123 snprintf(task_is_app_fname,sizeof(task_is_app_fname),
124 "/proc/self/task/%ld/task_is_app",syscall(SYS_gettid));
125 fd_task_is_app = fopen(task_is_app_fname, "r");
126 if (fd_task_is_app != NULL) {
127
128
129
130 *priority = 90;
131 *module = (mca_base_module_t *)&opal_pmix_cray_module;
132 fclose(fd_task_is_app);
133 rc = OPAL_SUCCESS;
134 }
135 fclose(fd);
136 }
137
138 return rc;
139 }
140
141 static int pmix_cray_component_close(void)
142 {
143 return OPAL_SUCCESS;
144 }