OpenMPI  0.1.1
types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2007 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 /** @file */
19 
20 #ifndef ORTE_TYPES_H
21 #define ORTE_TYPES_H
22 
23 #include "orte_config.h"
24 
25 #ifdef HAVE_SYS_TYPES_H
26 #include <sys/types.h>
27 #endif
28 #include "opal/dss/dss_types.h"
29 
30 /**
31  * Supported datatypes for messaging and storage operations.
32  */
33 
34 typedef int32_t orte_std_cntr_t; /** standard counters used in ORTE */
35 #define ORTE_STD_CNTR_T OPAL_INT32
36 #define ORTE_STD_CNTR_MAX INT32_MAX
37 #define ORTE_STD_CNTR_MIN INT32_MIN
38 #define ORTE_STD_CNTR_INVALID -1
39 
40 /** rank on node, used for both local and node rank. We
41  * don't send these around on their own, so don't create
42  * dedicated type support for them - we are defining them
43  * here solely for readability in the code and so we have
44  * one place where any future changes can be made
45  */
46 typedef uint16_t orte_local_rank_t;
47 typedef uint16_t orte_node_rank_t;
48 #define ORTE_LOCAL_RANK OPAL_UINT16
49 #define ORTE_NODE_RANK OPAL_UINT16
50 #define ORTE_LOCAL_RANK_MAX UINT16_MAX-1
51 #define ORTE_NODE_RANK_MAX UINT16_MAX-1
52 #define ORTE_LOCAL_RANK_INVALID UINT16_MAX
53 #define ORTE_NODE_RANK_INVALID UINT16_MAX
54 
55 /* index for app_contexts */
56 typedef uint32_t orte_app_idx_t;
57 #define ORTE_APP_IDX OPAL_UINT32
58 #define ORTE_APP_IDX_MAX UINT32_MAX
59 
60 /*
61  * general typedefs & structures
62  */
63 /** Set the allowed range for ids in each space
64  *
65  * NOTE: Be sure to update the ORTE_NAME_ARGS #define (above) and all
66  * uses of it if these types change to be larger than (long)! The
67  * HTON and NTOH macros below must be updated, as well as the MIN /
68  * MAX macros below and the datatype packing representations in
69  * orte/mca/plm/base/plm_private.h
70  *
71  * NOTE: Be sure to keep the jobid and vpid types the same size! Due
72  * to padding rules, it won't save anything to have one larger than
73  * the other, and it will cause problems in the communication subsystems
74  */
75 
76 typedef uint32_t orte_jobid_t;
77 #define ORTE_JOBID_T OPAL_UINT32
78 #define ORTE_JOBID_MAX UINT32_MAX-2
79 #define ORTE_JOBID_MIN 0
80 typedef uint32_t orte_vpid_t;
81 #define ORTE_VPID_T OPAL_UINT32
82 #define ORTE_VPID_MAX UINT32_MAX-2
83 #define ORTE_VPID_MIN 0
84 
85 #if ORTE_ENABLE_EPOCH
86 typedef uint32_t orte_epoch_t;
87 #define ORTE_EPOCH_T OPAL_UINT32
88 #define ORTE_EPOCH_MAX UINT32_MAX-2
89 #define ORTE_EPOCH_MIN 0
90 #endif
91 
92 #if ORTE_ENABLE_EPOCH
93 #define ORTE_PROCESS_NAME_HTON(n) \
94 do { \
95  n.jobid = htonl(n.jobid); \
96  n.vpid = htonl(n.vpid); \
97  n.epoch = htonl(n.epoch); \
98 } while (0)
99 #else
100 #define ORTE_PROCESS_NAME_HTON(n) \
101 do { \
102  n.jobid = htonl(n.jobid); \
103  n.vpid = htonl(n.vpid); \
104 } while (0)
105 #endif
106 
107 #if ORTE_ENABLE_EPOCH
108 #define ORTE_PROCESS_NAME_NTOH(n) \
109 do { \
110  n.jobid = ntohl(n.jobid); \
111  n.vpid = ntohl(n.vpid); \
112  n.epoch = ntohl(n.epoch); \
113 } while (0)
114 #else
115 #define ORTE_PROCESS_NAME_NTOH(n) \
116 do { \
117  n.jobid = ntohl(n.jobid); \
118  n.vpid = ntohl(n.vpid); \
119 } while (0)
120 #endif
121 
122 #define ORTE_NAME_ARGS(n) \
123  (unsigned long) ((NULL == n) ? (unsigned long)ORTE_JOBID_INVALID : (unsigned long)(n)->jobid), \
124  (unsigned long) ((NULL == n) ? (unsigned long)ORTE_VPID_INVALID : (unsigned long)(n)->vpid) \
125  (unsigned long) ((NULL == n) ? (unsigned long)ORTE_EPOCH_INVALID : (unsigned long)(n)->epoch)
126 
127 /*
128  * define invalid values
129  */
130 #define ORTE_JOBID_INVALID (ORTE_JOBID_MAX + 2)
131 #define ORTE_VPID_INVALID (ORTE_VPID_MAX + 2)
132 #define ORTE_EPOCH_INVALID (ORTE_EPOCH_MAX + 2)
133 #define ORTE_LOCAL_JOBID_INVALID (ORTE_JOBID_INVALID & 0x0000FFFF)
134 
135 /*
136  * define wildcard values
137  */
138 #define ORTE_JOBID_WILDCARD (ORTE_JOBID_MAX + 1)
139 #define ORTE_VPID_WILDCARD (ORTE_VPID_MAX + 1)
140 #define ORTE_EPOCH_WILDCARD (ORTE_EPOCH_MAX + 1)
141 #define ORTE_LOCAL_JOBID_WILDCARD (ORTE_JOBID_WILDCARD & 0x0000FFFF)
142 
143 /*
144  * define the process name structure
145  */
147  orte_jobid_t jobid; /**< Job number */
148  orte_vpid_t vpid; /**< Process id - equivalent to rank */
149 #if ORTE_ENABLE_EPOCH
150  orte_epoch_t epoch; /**< Epoch - used to measure the generation of a recovered process.
151  * The epoch will start at ORTE_EPOCH_MIN and
152  * increment every time the process is detected as
153  * having stopped (including normal shutdown). The
154  * HNP will be responsible for informing all
155  * processes that did not directly detect the
156  * failure to increment their epochs.
157  */
158 #endif
159 };
161 
162 
163 /**
164  * handle differences in iovec
165  */
166 
167 #if defined(__APPLE__) || defined(__WINDOWS__)
168 typedef char* orte_iov_base_ptr_t;
169 #else
170 typedef void* orte_iov_base_ptr_t;
171 #endif
172 
173 
174 /* General ORTE types - support handled within DSS */
175 #define ORTE_STD_CNTR (OPAL_DSS_ID_DYNAMIC + 1) /**< standard counter type */
176 /* PLM types */
177  /* Name-related types */
178 #define ORTE_NAME (OPAL_DSS_ID_DYNAMIC + 2) /**< an orte_process_name_t */
179 #define ORTE_VPID (OPAL_DSS_ID_DYNAMIC + 3) /**< a vpid */
180 #define ORTE_JOBID (OPAL_DSS_ID_DYNAMIC + 4) /**< a jobid */
181 
182 #if ORTE_ENABLE_EPOCH
183 #define ORTE_EPOCH (OPAL_DSS_ID_DYNAMIC + 5) /**< an epoch */
184 #endif
185 
186 #if !ORTE_DISABLE_FULL_SUPPORT
187  /* State-related types */
188 #define ORTE_NODE_STATE (OPAL_DSS_ID_DYNAMIC + 6) /**< node status flag */
189 #define ORTE_PROC_STATE (OPAL_DSS_ID_DYNAMIC + 7) /**< process/resource status */
190 #define ORTE_JOB_STATE (OPAL_DSS_ID_DYNAMIC + 8) /**< job status flag */
191 #define ORTE_EXIT_CODE (OPAL_DSS_ID_DYNAMIC + 9) /**< process exit code */
192  /* Data-passing types */
193 #define ORTE_VALUE (OPAL_DSS_ID_DYNAMIC + 10) /**< registry return value */
194  /* Resource types */
195 #define ORTE_APP_CONTEXT (OPAL_DSS_ID_DYNAMIC + 11) /**< argv and enviro arrays */
196 #define ORTE_NODE_DESC (OPAL_DSS_ID_DYNAMIC + 12) /**< describes capabilities of nodes */
197 #define ORTE_SLOT_DESC (OPAL_DSS_ID_DYNAMIC + 13) /**< describes slot allocations/reservations */
198 #define ORTE_JOB (OPAL_DSS_ID_DYNAMIC + 14) /**< job information */
199 #define ORTE_NODE (OPAL_DSS_ID_DYNAMIC + 15) /**< node information */
200 #define ORTE_PROC (OPAL_DSS_ID_DYNAMIC + 16) /**< process information */
201 #define ORTE_JOB_MAP (OPAL_DSS_ID_DYNAMIC + 17) /**< map of process locations */
202 
203 /* RML types */
204 #define ORTE_RML_TAG (OPAL_DSS_ID_DYNAMIC + 18) /**< tag for sending/receiving messages */
205 /* DAEMON command type */
206 #define ORTE_DAEMON_CMD (OPAL_DSS_ID_DYNAMIC + 19) /**< command flag for communicating with the daemon */
207 
208 /* GRPCOMM types */
209 #define ORTE_GRPCOMM_MODE (OPAL_DSS_ID_DYNAMIC + 20)
210 
211 /* IOF types */
212 #define ORTE_IOF_TAG (OPAL_DSS_ID_DYNAMIC + 21)
213 
214 
215 /* provide a boundary for others to use */
216 #define ORTE_DSS_ID_DYNAMIC (OPAL_DSS_ID_DYNAMIC + 50)
217 
218 #endif /* !ORTE_DISABLE_FULL_SUPPORT */
219 
220 #endif
orte_vpid_t vpid
Process id - equivalent to rank.
Definition: types.h:148
uint32_t orte_jobid_t
Set the allowed range for ids in each space.
Definition: types.h:76
Definition: types.h:146
int32_t orte_std_cntr_t
Supported datatypes for messaging and storage operations.
Definition: types.h:34
void * orte_iov_base_ptr_t
handle differences in iovec
Definition: types.h:170
Buffer management types.
uint16_t orte_local_rank_t
rank on node, used for both local and node rank.
Definition: types.h:46
orte_jobid_t jobid
Job number.
Definition: types.h:147