OpenMPI  0.1.1
dpm.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2011 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$
13  *
14  * Additional copyrights may follow
15  *
16  * $HEADER$
17  */
18 /**
19  * @file
20  *
21  * Dynamic Process Management Interface
22  *
23  */
24 
25 #ifndef OMPI_MCA_DPM_H
26 #define OMPI_MCA_DPM_H
27 
28 #include "ompi_config.h"
29 
30 #include "opal/mca/mca.h"
31 #include "opal/mca/base/base.h"
32 
33 #include "orte/mca/rml/rml_types.h"
34 #include "ompi/info/info.h"
35 #include "ompi/communicator/communicator.h"
36 
37 BEGIN_C_DECLS
38 
39 /* OMPI port definitions */
40 /* carry over the INVALID def */
41 #define OMPI_RML_TAG_INVALID ORTE_RML_TAG_INVALID
42 /* define a starting point to avoid conflicts */
43 #define OMPI_RML_TAG_BASE ORTE_RML_TAG_MAX
44 
45 #define OMPI_RML_TAG_UDAPL OMPI_RML_TAG_BASE+1
46 #define OMPI_RML_TAG_OPENIB OMPI_RML_TAG_BASE+2
47 #define OMPI_RML_TAG_XOPENIB OMPI_RML_TAG_BASE+3
48 #define OMPI_RML_TAG_COMM_CID_INTRA OMPI_RML_TAG_BASE+4
49 #define OMPI_RML_TAG_XOOB OMPI_RML_TAG_BASE+5
50 #define OMPI_RML_TAG_SM_BACK_FILE_CREATED OMPI_RML_TAG_BASE+6
51 #define OMPI_CRCP_COORD_BOOKMARK_TAG OMPI_RML_TAG_BASE+7
52 #define OMPI_COMM_JOIN_TAG OMPI_RML_TAG_BASE+8
53 
54 /* support for shared memory collectives */
55 #define OMPI_RML_TAG_COLL_SM2_BACK_FILE_CREATED OMPI_RML_TAG_BASE+9
56 /* common sm component query result index */
57 #define OMPI_RML_TAG_COMMON_SM_COMP_INDEX OMPI_RML_TAG_BASE+10
58 
59 #define OMPI_RML_TAG_DYNAMIC OMPI_RML_TAG_BASE+200
60 
61 
62 
63 
64 /*
65  * Initialize a module
66  */
67 typedef int (*ompi_dpm_base_module_init_fn_t)(void);
68 
69 /*
70  * Connect/accept communications
71  */
72 typedef int (*ompi_dpm_base_module_connect_accept_fn_t)(ompi_communicator_t *comm, int root,
73  char *port, bool send_first,
74  ompi_communicator_t **newcomm);
75 
76 /**
77  * Executes internally a disconnect on all dynamic communicators
78  * in case the user did not disconnect them.
79  */
81 
82 /*
83  * Dynamically spawn processes
84  */
85 typedef int (*ompi_dpm_base_module_spawn_fn_t)(int count, char **array_of_commands,
86  char ***array_of_argv,
87  int *array_of_maxprocs,
88  MPI_Info *array_of_info,
89  char *port_name);
90 
91 /*
92  * This routine checks, whether an application has been spawned
93  * by another MPI application, or has been independently started.
94  * If it has been spawned, it establishes the parent communicator.
95  * Since the routine has to communicate, it should be among the last
96  * steps in MPI_Init, to be sure that everything is already set up.
97  */
98 typedef int (*ompi_dpm_base_module_dyn_init_fn_t)(void);
99 
100 /*
101  * Interface for mpi_finalize to call to ensure dynamically spawned procs
102  * collectively finalize
103  */
104 typedef int (*ompi_dpm_base_module_dyn_finalize_fn_t)(void);
105 
106 /* this routine counts the number of different jobids of the processes
107  given in a certain communicator. If there is more than one jobid,
108  we mark the communicator as 'dynamic'. This is especially relevant
109  for the MPI_Comm_disconnect *and* for MPI_Finalize, where we have
110  to wait for all still connected processes.
111 */
112 typedef void (*ompi_dpm_base_module_mark_dyncomm_fn_t)(ompi_communicator_t *comm);
113 
114 /*
115  * Open a port to interface to a dynamically spawned job - if the
116  * specified tag is valid, then it will be used to form the port. Otherwise,
117  * a dynamically assigned tag that is unique to this request will be provided
118  */
119 typedef int (*ompi_dpm_base_module_open_port_fn_t)(char *port_name, orte_rml_tag_t tag);
120 
121 /*
122  * Converts an opaque port string to a RML process nane and tag.
123  */
124 typedef int (*ompi_dpm_base_module_parse_port_name_t)(char *port_name,
125  char **hnp_uri, char **rml_uri,
126  orte_rml_tag_t *tag);
127 
128 /*
129  * Update the routed component to make sure that the RML can send messages to
130  * the remote port
131  */
132 typedef int (*ompi_dpm_base_module_route_to_port_t)(char *rml_uri, orte_process_name_t *rproc);
133 
134 
135 /*
136  * Close a port
137  */
138 typedef int (*ompi_dpm_base_module_close_port_fn_t)(char *port_name);
139 
140 /*
141  * Finalize a module
142  */
143 typedef int (*ompi_dpm_base_module_finalize_fn_t)(void);
144 
145 /**
146 * Structure for DPM modules
147  */
149  /** Initialization Function */
150  ompi_dpm_base_module_init_fn_t init;
151  /* connect/accept */
152  ompi_dpm_base_module_connect_accept_fn_t connect_accept;
153  /* disconnect */
155  /* spawn processes */
156  ompi_dpm_base_module_spawn_fn_t spawn;
157  /* dyn_init */
158  ompi_dpm_base_module_dyn_init_fn_t dyn_init;
159  /* dyn_finalize */
160  ompi_dpm_base_module_dyn_finalize_fn_t dyn_finalize;
161  /* mark dyncomm */
162  ompi_dpm_base_module_mark_dyncomm_fn_t mark_dyncomm;
163  /* open port */
164  ompi_dpm_base_module_open_port_fn_t open_port;
165  /* parse port string */
166  ompi_dpm_base_module_parse_port_name_t parse_port;
167  /* update route to a port */
168  ompi_dpm_base_module_route_to_port_t route_to_port;
169  /* close port */
170  ompi_dpm_base_module_close_port_fn_t close_port;
171  /* finalize */
172  ompi_dpm_base_module_finalize_fn_t finalize;
173 };
176 
177 OMPI_DECLSPEC extern ompi_dpm_base_module_t ompi_dpm;
178 
179 
180 /**
181  * Structure for DPM components.
182  */
184  /** MCA base component */
186  /** MCA base data */
188 };
191 
192 /**
193  * Macro for use in components that are of type DPM
194  */
195 #define OMPI_DPM_BASE_VERSION_2_0_0 \
196  MCA_BASE_VERSION_2_0_0, \
197  "dpm", 2, 0, 0
198 
199 
200 END_C_DECLS
201 
202 #endif /* OMPI_MCA_DPM_H */
Structure for DPM modules.
Definition: dpm.h:148
Common type for all MCA components.
Definition: mca.h:250
Definition: types.h:146
Top-level interface for all MCA components.
Definition: info.h:38
mca_base_component_t base_version
MCA base component.
Definition: dpm.h:185
void(* ompi_dpm_base_module_disconnect_fn_t)(ompi_communicator_t *comm)
Executes internally a disconnect on all dynamic communicators in case the user did not disconnect the...
Definition: dpm.h:80
Meta data for MCA v2.0.0 components.
Definition: mca.h:309
uint32_t orte_rml_tag_t
Message matching tag.
Definition: rml_types.h:220
Structure for DPM components.
Definition: dpm.h:183
Definition: communicator.h:118
ompi_dpm_base_module_init_fn_t init
Initialization Function.
Definition: dpm.h:150
Contains the typedefs for the use of the rml.
mca_base_component_data_t base_data
MCA base data.
Definition: dpm.h:187