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) 2006-2007 Cisco Systems, Inc. All rights reserved.
14 * Copyright (c) 2008 Institut National de Recherche en Informatique
15 * et Automatique. All rights reserved.
16 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
17 * reserved.
18 * $COPYRIGHT$
19 *
20 * Additional copyrights may follow
21 *
22 * $HEADER$
23 *
24 * These symbols are in a file by themselves to provide nice linker
25 * semantics. Since linkers generally pull in symbols by object
26 * files, keeping these symbols as the only symbols in this file
27 * prevents utility programs such as "ompi_info" from having to import
28 * entire components just to query their version and parameters.
29 */
30
31 #include "orte_config.h"
32 #include "orte/constants.h"
33
34 #include <lsf/lsbatch.h>
35
36 #include "opal/util/output.h"
37
38
39 #include "orte/mca/plm/plm.h"
40 #include "orte/mca/plm/base/base.h"
41 #include "orte/mca/plm/base/plm_private.h"
42 #include "plm_lsf.h"
43
44
45 /*
46 * Public string showing the plm lsf component version number
47 */
48 const char *mca_plm_lsf_component_version_string =
49 "Open MPI lsf plm MCA component version " ORTE_VERSION;
50
51
52
53 /*
54 * Local function
55 */
56 static int plm_lsf_open(void);
57 static int plm_lsf_close(void);
58 static int orte_plm_lsf_component_query(mca_base_module_t **module, int *priority);
59
60
61 /*
62 * Instantiate the public struct with all of our public information
63 * and pointers to our public functions in it
64 */
65
66 orte_plm_lsf_component_t mca_plm_lsf_component = {
67 {
68 /* First, the mca_component_t struct containing meta information
69 about the component itself */
70
71 .base_version = {
72 ORTE_PLM_BASE_VERSION_2_0_0,
73
74 /* Component name and version */
75 .mca_component_name = "lsf",
76 MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
77 ORTE_RELEASE_VERSION),
78
79 /* Component open and close functions */
80 .mca_open_component = plm_lsf_open,
81 .mca_close_component = plm_lsf_close,
82 .mca_query_component = orte_plm_lsf_component_query,
83 },
84 .base_data = {
85 /* The component is checkpoint ready */
86 MCA_BASE_METADATA_PARAM_CHECKPOINT
87 },
88 }
89 };
90
91
92 static int plm_lsf_open(void)
93 {
94 return ORTE_SUCCESS;
95 }
96
97
98 static int plm_lsf_close(void)
99 {
100 return ORTE_SUCCESS;
101 }
102
103
104 static int orte_plm_lsf_component_query(mca_base_module_t **module, int *priority)
105 {
106
107 /* check if lsf is running here and make sure IBM CSM is NOT enabled */
108 if (NULL == getenv("LSB_JOBID") || getenv("CSM_ALLOCATION_ID") || lsb_init("ORTE launcher") < 0) {
109 /* nope, not here */
110 opal_output_verbose(10, orte_plm_base_framework.framework_output,
111 "plm:lsf: NOT available for selection");
112 *module = NULL;
113 return ORTE_ERROR;
114 }
115
116 *priority = 75;
117 *module = (mca_base_module_t *) &orte_plm_lsf_module;
118 return ORTE_SUCCESS;
119 }