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 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 "orte/util/proc_info.h"
29
30 #include "orte/mca/ess/ess.h"
31 #include "orte/mca/ess/lsf/ess_lsf.h"
32
33 extern orte_ess_base_module_t orte_ess_lsf_module;
34
35 /*
36 * Instantiate the public struct with all of our public information
37 * and pointers to our public functions in it
38 */
39 orte_ess_base_component_t mca_ess_lsf_component = {
40 .base_version = {
41 ORTE_ESS_BASE_VERSION_3_0_0,
42
43 /* Component name and version */
44 .mca_component_name = "lsf",
45 MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
46 ORTE_RELEASE_VERSION),
47
48 /* Component open and close functions */
49 .mca_open_component = orte_ess_lsf_component_open,
50 .mca_close_component = orte_ess_lsf_component_close,
51 .mca_query_component = orte_ess_lsf_component_query,
52 },
53 .base_data = {
54 /* The component is not checkpoint ready */
55 MCA_BASE_METADATA_PARAM_NONE
56 },
57 };
58
59
60 int orte_ess_lsf_component_open(void)
61 {
62 return ORTE_SUCCESS;
63 }
64
65
66 int orte_ess_lsf_component_query(mca_base_module_t **module, int *priority)
67 {
68 /* Are we running under an LSF job? Were
69 * we given a path back to the HNP? If the
70 * answer to both is "yes", then we were launched
71 * by mpirun in an LSF world
72 */
73
74 if (ORTE_PROC_IS_DAEMON &&
75 NULL != getenv("LSB_JOBID") &&
76 NULL != orte_process_info.my_hnp_uri) {
77 *priority = 40;
78 *module = (mca_base_module_t *)&orte_ess_lsf_module;
79 return ORTE_SUCCESS;
80 }
81
82 /* nope, not here */
83 *priority = -1;
84 *module = NULL;
85 return ORTE_ERROR;
86 }
87
88
89 int orte_ess_lsf_component_close(void)
90 {
91 return ORTE_SUCCESS;
92 }
93