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) 2007-2009 Cisco Systems, Inc. All rights reserved.
14 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
15 * reserved.
16 * $COPYRIGHT$
17 *
18 * Additional copyrights may follow
19 *
20 * $HEADER$
21 */
22
23 #include "orte_config.h"
24 #include "orte/constants.h"
25
26 #include <lsf/lsbatch.h>
27
28 #include "opal/mca/base/base.h"
29
30 #include "ras_lsf.h"
31
32 /*
33 * Local functions
34 */
35
36 static int orte_ras_lsf_open(void);
37 static int orte_ras_lsf_close(void);
38 static int orte_ras_lsf_component_query(mca_base_module_t **module, int *priority);
39
40
41 orte_ras_base_component_t mca_ras_lsf_component = {
42 .base_version = {
43 /* Indicate that we are a ras v2.0.0 component (which also
44 implies a specific MCA version) */
45
46 ORTE_RAS_BASE_VERSION_2_0_0,
47
48 .mca_component_name = "lsf",
49 MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
50 ORTE_RELEASE_VERSION),
51 .mca_open_component = orte_ras_lsf_open,
52 .mca_close_component = orte_ras_lsf_close,
53 .mca_query_component = orte_ras_lsf_component_query,
54 },
55 .base_data = {
56 /* The component is checkpoint ready */
57 MCA_BASE_METADATA_PARAM_CHECKPOINT
58 },
59 };
60
61
62 /**
63 * component open/close/init function
64 */
65 static int orte_ras_lsf_open(void)
66 {
67 return ORTE_SUCCESS;
68 }
69
70
71 static int orte_ras_lsf_component_query(mca_base_module_t **module, int *priority)
72 {
73 /* check if lsf is running here */
74 if (NULL == getenv("LSB_JOBID") || lsb_init("ORTE launcher") < 0) {
75 /* nope, not here */
76 *module = NULL;
77 return ORTE_ERROR;
78 }
79
80 *priority = 75;
81 *module = (mca_base_module_t *) &orte_ras_lsf_module;
82 return ORTE_SUCCESS;
83 }
84
85 /**
86 * Close all subsystems.
87 */
88
89 static int orte_ras_lsf_close(void)
90 {
91 return ORTE_SUCCESS;
92 }
93
94