1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2001 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
/* prototypes for the PMI interface in MPICH */
extern "C" PMI_ATTRIBUTE_VISIBILITY
/*D
PMI_CONSTANTS - PMI definitions
Error Codes:
+ PMI_SUCCESS - operation completed successfully
. PMI_FAIL - operation failed
. PMI_ERR_NOMEM - input buffer not large enough
. PMI_ERR_INIT - PMI not initialized
. PMI_ERR_INVALID_ARG - invalid argument
. PMI_ERR_INVALID_KEY - invalid key argument
. PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
. PMI_ERR_INVALID_VAL - invalid val argument
. PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
. PMI_ERR_INVALID_NUM_ARGS - invalid number of arguments
. PMI_ERR_INVALID_ARGS - invalid args argument
. PMI_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
. PMI_ERR_INVALID_KEYVALP - invalid keyvalp argument
- PMI_ERR_INVALID_SIZE - invalid size argument
Booleans:
+ PMI_TRUE - true
- PMI_FALSE - false
D*/
/* PMI Group functions */
/*@
PMI_Init - initialize the Process Manager Interface
Output Parameter:
. spawned - spawned flag
Return values:
+ PMI_SUCCESS - initialization completed successfully
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - initialization failed
Notes:
Initialize PMI for this process group. The value of spawned indicates whether
this process was created by 'PMI_Spawn_multiple'. 'spawned' will be 'PMI_TRUE' if
this process group has a parent and 'PMI_FALSE' if it does not.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Initialized - check if PMI has been initialized
Output Parameter:
. initialized - boolean value
Return values:
+ PMI_SUCCESS - initialized successfully set
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to set the variable
Notes:
On successful output, initialized will either be 'PMI_TRUE' or 'PMI_FALSE'.
+ PMI_TRUE - initialize has been called.
- PMI_FALSE - initialize has not been called or previously failed.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Finalize - finalize the Process Manager Interface
Return values:
+ PMI_SUCCESS - finalization completed successfully
- PMI_FAIL - finalization failed
Notes:
Finalize PMI for this process group.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Get_size - obtain the size of the process group
Output Parameters:
. size - pointer to an integer that receives the size of the process group
Return values:
+ PMI_SUCCESS - size successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the size
Notes:
This function returns the size of the process group to which the local process
belongs.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Get_rank - obtain the rank of the local process in the process group
Output Parameters:
. rank - pointer to an integer that receives the rank in the process group
Return values:
+ PMI_SUCCESS - rank successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the rank
Notes:
This function returns the rank of the local process in its process group.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Get_universe_size - obtain the universe size
Output Parameters:
. size - pointer to an integer that receives the size
Return values:
+ PMI_SUCCESS - size successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the size
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Get_appnum - obtain the application number
Output parameters:
. appnum - pointer to an integer that receives the appnum
Return values:
+ PMI_SUCCESS - appnum successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the size
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Publish_name - publish a name
Input parameters:
. service_name - string representing the service being published
. port - string representing the port on which to contact the service
Return values:
+ PMI_SUCCESS - port for service successfully published
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to publish service
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Unpublish_name - unpublish a name
Input parameters:
. service_name - string representing the service being unpublished
Return values:
+ PMI_SUCCESS - port for service successfully published
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to unpublish service
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Lookup_name - lookup a service by name
Input parameters:
. service_name - string representing the service being published
Output parameters:
. port - string representing the port on which to contact the service
Return values:
+ PMI_SUCCESS - port for service successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to lookup service
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Barrier - barrier across the process group
Return values:
+ PMI_SUCCESS - barrier successfully finished
- PMI_FAIL - barrier failed
Notes:
This function is a collective call across all processes in the process group
the local process belongs to. It will not return until all the processes
have called 'PMI_Barrier()'.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_Abort - abort the process group associated with this process
Input Parameters:
+ exit_code - exit code to be returned by this process
- error_msg - error message to be printed
Return values:
. none - this function should not return
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/* PMI Keymap functions */
/*@
PMI_KVS_Get_my_name - obtain the name of the keyval space the local process group has access to
Input Parameters:
. length - length of the kvsname character array
Output Parameters:
. kvsname - a string that receives the keyval space name
Return values:
+ PMI_SUCCESS - kvsname successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
- PMI_FAIL - unable to return the kvsname
Notes:
This function returns the name of the keyval space that this process and all
other processes in the process group have access to. The output parameter,
kvsname, must be at least as long as the value returned by
'PMI_KVS_Get_name_length_max()'.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_KVS_Get_name_length_max - obtain the length necessary to store a kvsname
Output Parameter:
. length - maximum length required to hold a keyval space name
Return values:
+ PMI_SUCCESS - length successfully set
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to set the length
Notes:
This function returns the string length required to store a keyval space name.
A routine is used rather than setting a maximum value in 'pmi.h' to allow
different implementations of PMI to be used with the same executable. These
different implementations may allow different maximum lengths; by using a
routine here, we can interface with a variety of implementations of PMI.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_KVS_Get_key_length_max - obtain the length necessary to store a key
Output Parameter:
. length - maximum length required to hold a key string.
Return values:
+ PMI_SUCCESS - length successfully set
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to set the length
Notes:
This function returns the string length required to store a key.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_KVS_Get_value_length_max - obtain the length necessary to store a value
Output Parameter:
. length - maximum length required to hold a keyval space value
Return values:
+ PMI_SUCCESS - length successfully set
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to set the length
Notes:
This function returns the string length required to store a value from a
keyval space.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_KVS_Put - put a key/value pair in a keyval space
Input Parameters:
+ kvsname - keyval space name
. key - key
- value - value
Return values:
+ PMI_SUCCESS - keyval pair successfully put in keyval space
. PMI_ERR_INVALID_KVS - invalid kvsname argument
. PMI_ERR_INVALID_KEY - invalid key argument
. PMI_ERR_INVALID_VAL - invalid val argument
- PMI_FAIL - put failed
Notes:
This function puts the key/value pair in the specified keyval space. The
value is not visible to other processes until 'PMI_KVS_Commit()' is called.
The function may complete locally. After 'PMI_KVS_Commit()' is called, the
value may be retrieved by calling 'PMI_KVS_Get()'. All keys put to a keyval
space must be unique to the keyval space. You may not put more than once
with the same key.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_KVS_Commit - commit all previous puts to the keyval space
Input Parameters:
. kvsname - keyval space name
Return values:
+ PMI_SUCCESS - commit succeeded
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - commit failed
Notes:
This function commits all previous puts since the last 'PMI_KVS_Commit()' into
the specified keyval space. It is a process local operation.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/*@
PMI_KVS_Get - get a key/value pair from a keyval space
Input Parameters:
+ kvsname - keyval space name
. key - key
- length - length of value character array
Output Parameters:
. value - value
Return values:
+ PMI_SUCCESS - get succeeded
. PMI_ERR_INVALID_KVS - invalid kvsname argument
. PMI_ERR_INVALID_KEY - invalid key argument
. PMI_ERR_INVALID_VAL - invalid val argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
- PMI_FAIL - get failed
Notes:
This function gets the value of the specified key in the keyval space.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
/* PMI Process Creation functions */
/*S
PMI_keyval_t - keyval structure used by PMI_Spawn_mulitiple
Fields:
+ key - name of the key
- val - value of the key
S*/
typedef struct PMI_keyval_t
PMI_keyval_t;
/*@
PMI_Spawn_multiple - spawn a new set of processes
Input Parameters:
+ count - count of commands
. cmds - array of command strings
. argvs - array of argv arrays for each command string
. maxprocs - array of maximum processes to spawn for each command string
. info_keyval_sizes - array giving the number of elements in each of the
'info_keyval_vectors'
. info_keyval_vectors - array of keyval vector arrays
. preput_keyval_size - Number of elements in 'preput_keyval_vector'
- preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space
Output Parameter:
. errors - array of errors for each command
Return values:
+ PMI_SUCCESS - spawn successful
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - spawn failed
Notes:
This function spawns a set of processes into a new process group. The 'count'
field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs',
'info_keyval_sizes' and 'info_keyval_vectors'. The 'preput_keyval_size' refers
to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector'
contains keyval pairs that will be put in the keyval space of the newly
created process group before the processes are started. The 'maxprocs' array
specifies the desired number of processes to create for each 'cmd' string.
The actual number of processes may be less than the numbers specified in
maxprocs. The acceptable number of processes spawned may be controlled by
``soft'' keyvals in the info arrays. The ``soft'' option is specified by
mpiexec in the MPI-2 standard. Environment variables may be passed to the
spawned processes through PMI implementation specific 'info_keyval' parameters.
@*/
int PMI_FUNCTION_ATTRIBUTES ;
}