1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved.
4 * Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
5 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
6 * reserved.
7 *
8 * $COPYRIGHT$
9 *
10 * Additional copyrights may follow
11 *
12 * $HEADER$
13 *
14 * These symbols are in a file by themselves to provide nice linker
15 * semantics. Since linkers generally pull in symbols by object
16 * files, keeping these symbols as the only symbols in this file
17 * prevents utility programs such as "ompi_info" from having to import
18 * entire components just to query their version and parameters.
19 */
20
21 #include "ompi_config.h"
22 #include "ompi/constants.h"
23
24 #include "opal/threads/threads.h"
25 #include "opal/class/opal_list.h"
26
27 #include "orte/mca/rml/rml.h"
28 #include "orte/mca/grpcomm/base/base.h"
29
30 #include "ompi/mca/rte/rte.h"
31 #include "rte_orte.h"
32
33 /*
34 * Public string showing the component version number
35 */
36 const char *ompi_rte_orte_component_version_string =
37 "OMPI orte rte MCA component version " OMPI_VERSION;
38
39 /*
40 * Local function
41 */
42 static int rte_orte_open(void);
43 static int rte_orte_close(void);
44
45 /*
46 * Instantiate the public struct with all of our public information
47 * and pointers to our public functions in it
48 */
49
50 ompi_rte_orte_component_t mca_rte_orte_component = {
51 {
52 /* First, the mca_component_t struct containing meta information
53 about the component itself */
54
55 .base_version = {
56 OMPI_RTE_BASE_VERSION_1_0_0,
57
58 /* Component name and version */
59 .mca_component_name = "orte",
60 MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
61 OMPI_RELEASE_VERSION),
62
63 /* Component open and close functions */
64 .mca_open_component = rte_orte_open,
65 .mca_close_component = rte_orte_close,
66 },
67 .base_data = {
68 /* The component is checkpoint ready */
69 MCA_BASE_METADATA_PARAM_CHECKPOINT
70 },
71 }
72 };
73
rte_orte_open(void)74 static int rte_orte_open(void)
75 {
76 OBJ_CONSTRUCT(&mca_rte_orte_component.lock, opal_mutex_t);
77 OBJ_CONSTRUCT(&mca_rte_orte_component.modx_reqs, opal_list_t);
78
79 return OMPI_SUCCESS;
80 }
81
rte_orte_close(void)82 static int rte_orte_close(void)
83 {
84 opal_mutex_lock(&mca_rte_orte_component.lock);
85 OPAL_LIST_DESTRUCT(&mca_rte_orte_component.modx_reqs);
86 opal_mutex_unlock(&mca_rte_orte_component.lock);
87 OBJ_DESTRUCT(&mca_rte_orte_component.lock);
88
89 return OMPI_SUCCESS;
90 }
91
con(ompi_orte_tracker_t * p)92 static void con(ompi_orte_tracker_t *p)
93 {
94 p->active = true;
95 OBJ_CONSTRUCT(&p->lock, opal_mutex_t);
96 OBJ_CONSTRUCT(&p->cond, opal_condition_t);
97 }
des(ompi_orte_tracker_t * p)98 static void des(ompi_orte_tracker_t *p)
99 {
100 OBJ_DESTRUCT(&p->lock);
101 OBJ_DESTRUCT(&p->cond);
102 }
103 OBJ_CLASS_INSTANCE(ompi_orte_tracker_t,
104 opal_list_item_t,
105 con, des);
106