OpenMPI  0.1.1
base.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2006 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  *
19  */
20 
21 #ifndef OPAL_CARTO_BASE_H
22 #define OPAL_CARTO_BASE_H
23 
24 #include "opal_config.h"
25 
26 #include "opal/mca/carto/carto.h"
27 
28 /*
29  * Global functions for MCA overall carto open and close
30  */
31 
32 BEGIN_C_DECLS
33 
34 /**
35  * Initialize the carto MCA framework
36  *
37  * @retval OPAL_SUCCESS Upon success
38  * @retval OPAL_ERROR Upon failure
39  *
40  * This must be the first function invoked in the carto MCA
41  * framework. It initializes the carto MCA framework, finds
42  * and opens carto components, etc.
43  *
44  * This function is invoked during opal_init().
45  *
46  * This function fills in the internal global variable
47  * opal_carto_base_components_opened, which is a list of all
48  * carto components that were successfully opened. This
49  * variable should \em only be used by other carto base
50  * functions -- it is not considered a public interface member --
51  * and is only mentioned here for completeness.
52  */
53 OPAL_DECLSPEC int opal_carto_base_open(void);
54 
55 /**
56  * Select an available component.
57  *
58  * @return OPAL_SUCCESS Upon success.
59  * @return OPAL_NOT_FOUND If no component can be selected.
60  * @return OPAL_ERROR Upon other failure.
61  *
62  * This function invokes the selection process for carto components,
63  * which works as follows:
64  *
65  * - If the \em carto MCA parameter is not specified, the
66  * selection set is all available carto components.
67  * - If the \em carto MCA parameter is specified, the
68  * selection set is just that component.
69  * - All components in the selection set are queried to see if
70  * they want to run. All components that want to run are ranked
71  * by their priority and the highest priority component is
72  * selected. All non-selected components have their "close"
73  * function invoked to let them know that they were not selected.
74  * - The selected component will have its "init" function invoked to
75  * let it know that it was selected.
76  *
77  * If we fall through this entire process and no component is
78  * selected, then return OPAL_NOT_FOUND (this is not a fatal
79  * error).
80  *
81  * At the end of this process, we'll either have a single
82  * component that is selected and initialized, or no component was
83  * selected. If no component was selected, subsequent invocation
84  * of the carto wrapper functions will return an error.
85  */
86 OPAL_DECLSPEC int opal_carto_base_select(void);
87 
88 /**
89  * Shut down the carto MCA framework.
90  *
91  * @retval OPAL_SUCCESS Always
92  *
93  * This function shuts down everything in the carto MCA
94  * framework, and is called during opal_finalize().
95  *
96  * It must be the last function invoked on the carto MCA
97  * framework.
98  */
99 OPAL_DECLSPEC int opal_carto_base_close(void);
100 
101 /**
102  * Indication of whether a component was successfully selected or
103  * not
104  */
105 OPAL_DECLSPEC extern bool opal_carto_base_selected;
106 
107 /**
108  * Global component struct for the selected component
109  */
110 OPAL_DECLSPEC extern const opal_carto_base_component_2_0_0_t
111 *opal_carto_base_component;
112 
113 /**
114  * Global module struct for the selected module
115  */
116 OPAL_DECLSPEC extern const opal_carto_base_module_1_0_0_t
117 *opal_carto_base_module;
118 
119 /**
120  * Indicator as to whether the list of opened carto components
121  * is valid or not.
122  */
123 OPAL_DECLSPEC extern bool opal_carto_base_components_opened_valid;
124 
125 /**
126  * List of all opened components; created when the carto
127  * framework is initialized and destroyed when we reduce the list
128  * to all available carto components.
129  */
130 OPAL_DECLSPEC extern opal_list_t opal_carto_base_components_opened;
131 
132 
133 /**
134  * Get the local host graph. you can reduce the graph for only
135  * the nodes that interst you using the node type.
136  *
137  * @param graph
138  * @param graph_type
139  *
140  * @return OPAL_DECLSPEC int
141  */
142 OPAL_DECLSPEC int opal_carto_base_get_host_graph(opal_carto_graph_t **graph, const char *graph_type);
143 
144 
145 /**
146  * Frre a graph
147  *
148  * @param graph
149  *
150  * @return OPAL_DECLSPEC void
151  */
152 OPAL_DECLSPEC void opal_carto_base_free_graph(opal_carto_graph_t *graph);
153 
154 /**
155  * Get the distance (weight) from a start node to all other
156  * nodes. you can reduce the list to the list to the node types
157  * that intersts you.
158  *
159  * @param graph
160  * @param start
161  * @param node_type
162  * @param distance_
163  *
164  * @return OPAL_DECLSPEC int
165  */
166 OPAL_DECLSPEC int opal_carto_base_get_nodes_distance(opal_carto_graph_t *graph, opal_carto_base_node_t *start, const char *node_type, opal_value_array_t *distance_);
167 
168 /**
169  * find the distance between two nodes.
170  *
171  * @param graph
172  * @param start
173  * @param end
174  *
175  * @return OPAL_DECLSPEC uint32_t
176  */
177 OPAL_DECLSPEC uint32_t opal_carto_base_spf(opal_carto_graph_t *graph,opal_carto_base_node_t *start, opal_carto_base_node_t *end);
178 
179 /**
180  * Find a node in the graph
181  *
182  * @param graph
183  * @param node_name
184  *
185  * @return OPAL_DECLSPEC opal_carto_base_node_t
186  */
187 OPAL_DECLSPEC opal_carto_base_node_t *opal_carto_base_find_node(opal_carto_graph_t *graph, const char *node_name);
188 
189 
190 /**
191  * Debugging output stream
192  */
193 OPAL_DECLSPEC extern int opal_carto_base_output;
194 
195 OPAL_DECLSPEC extern opal_carto_graph_t *opal_carto_base_common_host_graph;
196 
197 OPAL_DECLSPEC extern opal_carto_base_module_1_0_0_t opal_carto_default_module;
198 
199 
200 END_C_DECLS
201 
202 #endif /* OPAL_BASE_CARTO_H */
The carto framework suplies an information of the the host structure and connection between the host ...
Structure for carto components.
Definition: carto.h:118
A graph class.
Definition: opal_graph.h:165
Definition: opal_list.h:147
Definition: carto.h:41
Definition: opal_value_array.h:38
Structure for carto modules.
Definition: carto.h:134