Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-20 08:46:36

0001 /*****************************************************************************\
0002  *  pmi.h - Process Management Interface for MPICH2, implemented by SLURM
0003  *  See http://www-unix.mcs.anl.gov/mpi/mpich2/
0004  *
0005  *  NOTE: Dynamic Process Management functions (PMI part 2) are not supported
0006  *  at this time. Functions required for MPI-1 (PMI part 1) are supported.
0007  *****************************************************************************
0008  *  COPYRIGHT
0009  *
0010  *  The following is a notice of limited availability of the code, and
0011  *  disclaimer which must be included in the prologue of the code and in all
0012  *  source listings of the code.
0013  *
0014  *  Copyright Notice + 2002 University of Chicago
0015  *
0016  *  Permission is hereby granted to use, reproduce, prepare derivative
0017  *  works, and to redistribute to others. This software was authored by:
0018  *
0019  *  Argonne National Laboratory Group
0020  *  W. Gropp: (630) 252-4318; FAX: (630) 252-5986; e-mail: gropp@mcs.anl.gov
0021  *  E. Lusk: (630) 252-7852; FAX: (630) 252-5986; e-mail: lusk@mcs.anl.gov
0022  *  Mathematics and Computer Science Division Argonne National Laboratory,
0023  *  Argonne IL 60439
0024  *
0025  *  GOVERNMENT LICENSE
0026  *
0027  *  Portions of this material resulted from work developed under a U.S.
0028  *  Government Contract and are subject to the following license: the
0029  *  Government is granted for itself and others acting on its behalf a
0030  *  paid-up, nonexclusive, irrevocable worldwide license in this computer
0031  *  software to reproduce, prepare derivative works, and perform publicly
0032  *  and display publicly.
0033  *
0034  *  DISCLAIMER
0035  *
0036  *  This computer code material was prepared, in part, as an account of work
0037  *  sponsored by an agency of the United States Government. Neither the
0038  *  United States, nor the University of Chicago, nor any of their
0039  *  employees, makes any warranty express or implied, or assumes any legal
0040  *  liability or responsibility for the accuracy, completeness, or
0041  *  usefulness of any information, apparatus, product, or process disclosed,
0042  *  or represents that its use would not infringe privately owned rights.
0043  *
0044  *  MCS Division <http://www.mcs.anl.gov>        Argonne National Laboratory
0045  *  <http://www.anl.gov>     University of Chicago <http://www.uchicago.edu>
0046 \*****************************************************************************/
0047 
0048 #ifndef PMI_H
0049 #define PMI_H
0050 
0051 /* prototypes for the PMI interface in MPICH2 */
0052 
0053 #if defined(__cplusplus)
0054 extern "C" {
0055 #endif
0056 
0057 /*D
0058 PMI_CONSTANTS - PMI definitions
0059 
0060 Error Codes:
0061 + PMI_SUCCESS - operation completed successfully
0062 . PMI_FAIL - operation failed
0063 . PMI_ERR_NOMEM - input buffer not large enough
0064 . PMI_ERR_INIT - PMI not initialized
0065 . PMI_ERR_INVALID_ARG - invalid argument
0066 . PMI_ERR_INVALID_KEY - invalid key argument
0067 . PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
0068 . PMI_ERR_INVALID_VAL - invalid val argument
0069 . PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
0070 . PMI_ERR_INVALID_LENGTH - invalid length argument
0071 . PMI_ERR_INVALID_NUM_ARGS - invalid number of arguments
0072 . PMI_ERR_INVALID_ARGS - invalid args argument
0073 . PMI_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
0074 . PMI_ERR_INVALID_KEYVALP - invalid keyvalp argument
0075 - PMI_ERR_INVALID_SIZE - invalid size argument
0076 
0077 Booleans:
0078 + PMI_TRUE - true
0079 - PMI_FALSE - false
0080 
0081 D*/
0082 #define PMI_SUCCESS                  0
0083 #define PMI_FAIL                    -1
0084 #define PMI_ERR_INIT                 1
0085 #define PMI_ERR_NOMEM                2
0086 #define PMI_ERR_INVALID_ARG          3
0087 #define PMI_ERR_INVALID_KEY          4
0088 #define PMI_ERR_INVALID_KEY_LENGTH   5
0089 #define PMI_ERR_INVALID_VAL          6
0090 #define PMI_ERR_INVALID_VAL_LENGTH   7
0091 #define PMI_ERR_INVALID_LENGTH       8
0092 #define PMI_ERR_INVALID_NUM_ARGS     9
0093 #define PMI_ERR_INVALID_ARGS        10
0094 #define PMI_ERR_INVALID_NUM_PARSED  11
0095 #define PMI_ERR_INVALID_KEYVALP     12
0096 #define PMI_ERR_INVALID_SIZE        13
0097 #define PMI_ERR_INVALID_KVS         14
0098 
0099 typedef int PMI_BOOL;
0100 #define PMI_TRUE     1
0101 #define PMI_FALSE    0
0102 
0103 /* PMI Group functions */
0104 
0105 /*@
0106 PMI_Init - initialize the Process Manager Interface
0107 
0108 Output Parameter:
0109 . spawned - spawned flag
0110 
0111 Return values:
0112 + PMI_SUCCESS - initialization completed successfully
0113 . PMI_ERR_INVALID_ARG - invalid argument
0114 - PMI_FAIL - initialization failed
0115 
0116 Notes:
0117 Initialize PMI for this process group. The value of spawned indicates whether
0118 this process was created by 'PMI_Spawn_multiple'.  'spawned' will be 'PMI_TRUE' if
0119 this process group has a parent and 'PMI_FALSE' if it does not.
0120 
0121 @*/
0122 int PMI_Init( int *spawned );
0123 
0124 /*@
0125 PMI_Initialized - check if PMI has been initialized
0126 
0127 Output Parameter:
0128 . initialized - boolean value
0129 
0130 Return values:
0131 + PMI_SUCCESS - initialized successfully set
0132 . PMI_ERR_INVALID_ARG - invalid argument
0133 - PMI_FAIL - unable to set the variable
0134 
0135 Notes:
0136 On successful output, initialized will either be 'PMI_TRUE' or 'PMI_FALSE'.
0137 
0138 + PMI_TRUE - initialize has been called.
0139 - PMI_FALSE - initialize has not been called or previously failed.
0140 
0141 @*/
0142 int PMI_Initialized( PMI_BOOL *initialized );
0143 
0144 /*@
0145 PMI_Finalize - finalize the Process Manager Interface
0146 
0147 Return values:
0148 + PMI_SUCCESS - finalization completed successfully
0149 - PMI_FAIL - finalization failed
0150 
0151 Notes:
0152  Finalize PMI for this process group.
0153 
0154 @*/
0155 int PMI_Finalize( void );
0156 
0157 /*@
0158 PMI_Get_size - obtain the size of the process group
0159 
0160 Output Parameters:
0161 . size - pointer to an integer that receives the size of the process group
0162 
0163 Return values:
0164 + PMI_SUCCESS - size successfully obtained
0165 . PMI_ERR_INVALID_ARG - invalid argument
0166 - PMI_FAIL - unable to return the size
0167 
0168 Notes:
0169 This function returns the size of the process group to which the local process
0170 belongs.
0171 
0172 @*/
0173 int PMI_Get_size( int *size );
0174 
0175 /*@
0176 PMI_Get_rank - obtain the rank of the local process in the process group
0177 
0178 Output Parameters:
0179 . rank - pointer to an integer that receives the rank in the process group
0180 
0181 Return values:
0182 + PMI_SUCCESS - rank successfully obtained
0183 . PMI_ERR_INVALID_ARG - invalid argument
0184 - PMI_FAIL - unable to return the rank
0185 
0186 Notes:
0187 This function returns the rank of the local process in its process group.
0188 
0189 @*/
0190 int PMI_Get_rank( int *rank );
0191 
0192 /*@
0193 PMI_Get_universe_size - obtain the universe size
0194 
0195 Output Parameters:
0196 . size - pointer to an integer that receives the size
0197 
0198 Return values:
0199 + PMI_SUCCESS - size successfully obtained
0200 . PMI_ERR_INVALID_ARG - invalid argument
0201 - PMI_FAIL - unable to return the size
0202 
0203 
0204 @*/
0205 int PMI_Get_universe_size( int *size );
0206 
0207 /*@
0208 PMI_Get_appnum - obtain the application number
0209 
0210 Output parameters:
0211 . appnum - pointer to an integer that receives the appnum
0212 
0213 Return values:
0214 + PMI_SUCCESS - appnum successfully obtained
0215 . PMI_ERR_INVALID_ARG - invalid argument
0216 - PMI_FAIL - unable to return the size
0217 
0218 
0219 @*/
0220 int PMI_Get_appnum( int *appnum );
0221 
0222 /*@
0223 PMI_Publish_name - publish a name 
0224 
0225 Input parameters:
0226 . service_name - string representing the service being published
0227 . port - string representing the port on which to contact the service
0228 
0229 Return values:
0230 + PMI_SUCCESS - port for service successfully published
0231 . PMI_ERR_INVALID_ARG - invalid argument
0232 - PMI_FAIL - unable to publish service
0233 
0234 
0235 @*/
0236 int PMI_Publish_name( const char service_name[], const char port[] );
0237 
0238 /*@
0239 PMI_Unpublish_name - unpublish a name
0240 
0241 Input parameters:
0242 . service_name - string representing the service being unpublished
0243 
0244 Return values:
0245 + PMI_SUCCESS - port for service successfully published
0246 . PMI_ERR_INVALID_ARG - invalid argument
0247 - PMI_FAIL - unable to unpublish service
0248 
0249 
0250 @*/
0251 int PMI_Unpublish_name( const char service_name[] );
0252 
0253 /*@
0254 PMI_Lookup_name - lookup a service by name
0255 
0256 Input parameters:
0257 . service_name - string representing the service being published
0258 
0259 Output parameters:
0260 . port - string representing the port on which to contact the service
0261 
0262 Return values:
0263 + PMI_SUCCESS - port for service successfully obtained
0264 . PMI_ERR_INVALID_ARG - invalid argument
0265 - PMI_FAIL - unable to lookup service
0266 
0267 
0268 @*/
0269 int PMI_Lookup_name( const char service_name[], char port[] );
0270 
0271 /*@
0272 PMI_Get_id - obtain the id of the process group
0273 
0274 Input Parameter:
0275 . length - length of the id_str character array
0276 
0277 Output Parameter:
0278 . id_str - character array that receives the id of the process group
0279 
0280 Return values:
0281 + PMI_SUCCESS - id successfully obtained
0282 . PMI_ERR_INVALID_ARG - invalid rank argument
0283 . PMI_ERR_INVALID_LENGTH - invalid length argument
0284 - PMI_FAIL - unable to return the id
0285 
0286 Notes:
0287 This function returns a string that uniquely identifies the process group
0288 that the local process belongs to.  The string passed in must be at least
0289 as long as the number returned by 'PMI_Get_id_length_max()'.
0290 
0291 @*/
0292 int PMI_Get_id( char id_str[], int length );
0293 
0294 /*@
0295 PMI_Get_kvs_domain_id - obtain the id of the PMI domain
0296 
0297 Input Parameter:
0298 . length - length of id_str character array
0299 
0300 Output Parameter:
0301 . id_str - character array that receives the id of the PMI domain
0302 
0303 Return values:
0304 + PMI_SUCCESS - id successfully obtained
0305 . PMI_ERR_INVALID_ARG - invalid argument
0306 . PMI_ERR_INVALID_LENGTH - invalid length argument
0307 - PMI_FAIL - unable to return the id
0308 
0309 Notes:
0310 This function returns a string that uniquely identifies the PMI domain
0311 where keyval spaces can be shared.  The string passed in must be at least
0312 as long as the number returned by 'PMI_Get_id_length_max()'.
0313 
0314 @*/
0315 int PMI_Get_kvs_domain_id( char id_str[], int length );
0316 
0317 /*@
0318 PMI_Get_id_length_max - obtain the maximum length of an id string
0319 
0320 Output Parameters:
0321 . length - the maximum length of an id string
0322 
0323 Return values:
0324 + PMI_SUCCESS - length successfully set
0325 . PMI_ERR_INVALID_ARG - invalid argument
0326 - PMI_FAIL - unable to return the maximum length
0327 
0328 Notes:
0329 This function returns the maximum length of a process group id string.
0330 
0331 @*/
0332 int PMI_Get_id_length_max( int *length );
0333 
0334 /*@
0335 PMI_Barrier - barrier across the process group
0336 
0337 Return values:
0338 + PMI_SUCCESS - barrier successfully finished
0339 - PMI_FAIL - barrier failed
0340 
0341 Notes:
0342 This function is a collective call across all processes in the process group
0343 the local process belongs to.  It will not return until all the processes
0344 have called 'PMI_Barrier()'.
0345 
0346 @*/
0347 int PMI_Barrier( void );
0348 
0349 /*@
0350 PMI_Get_clique_size - obtain the number of processes on the local node
0351 
0352 Output Parameters:
0353 . size - pointer to an integer that receives the size of the clique
0354 
0355 Return values:
0356 + PMI_SUCCESS - size successfully obtained
0357 . PMI_ERR_INVALID_ARG - invalid argument
0358 - PMI_FAIL - unable to return the clique size
0359 
0360 Notes:
0361 This function returns the number of processes in the local process group that
0362 are on the local node along with the local process.  This is a simple topology
0363 function to distinguish between processes that can communicate through IPC
0364 mechanisms (e.g., shared memory) and other network mechanisms.
0365 
0366 @*/
0367 int PMI_Get_clique_size( int *size );
0368 
0369 /*@
0370 PMI_Get_clique_ranks - get the ranks of the local processes in the process group
0371 
0372 Input Parameters:
0373 . length - length of the ranks array
0374 
0375 Output Parameters:
0376 . ranks - pointer to an array of integers that receive the local ranks
0377 
0378 Return values:
0379 + PMI_SUCCESS - ranks successfully obtained
0380 . PMI_ERR_INVALID_ARG - invalid argument
0381 . PMI_ERR_INVALID_LENGTH - invalid length argument
0382 - PMI_FAIL - unable to return the ranks
0383 
0384 Notes:
0385 This function returns the ranks of the processes on the local node.  The array
0386 must be at least as large as the size returned by 'PMI_Get_clique_size()'.  This
0387 is a simple topology function to distinguish between processes that can
0388 communicate through IPC mechanisms (e.g., shared memory) and other network
0389 mechanisms.
0390 
0391 @*/
0392 int PMI_Get_clique_ranks( int ranks[], int length);
0393 
0394 /*@
0395 PMI_Abort - abort the process group associated with this process
0396 
0397 Input Parameters:
0398 + exit_code - exit code to be returned by this process
0399 - error_msg - error message to be printed
0400 
0401 Return values:
0402 . none - this function should not return
0403 @*/
0404 int PMI_Abort(int exit_code, const char error_msg[]);
0405 
0406 /* PMI Keymap functions */
0407 /*@
0408 PMI_KVS_Get_my_name - obtain the name of the keyval space the local process group has access to
0409 
0410 Input Parameters:
0411 . length - length of the kvsname character array
0412 
0413 Output Parameters:
0414 . kvsname - a string that receives the keyval space name
0415 
0416 Return values:
0417 + PMI_SUCCESS - kvsname successfully obtained
0418 . PMI_ERR_INVALID_ARG - invalid argument
0419 . PMI_ERR_INVALID_LENGTH - invalid length argument
0420 - PMI_FAIL - unable to return the kvsname
0421 
0422 Notes:
0423 This function returns the name of the keyval space that this process and all
0424 other processes in the process group have access to.  The output parameter,
0425 kvsname, must be at least as long as the value returned by
0426 'PMI_KVS_Get_name_length_max()'.
0427 
0428 @*/
0429 int PMI_KVS_Get_my_name( char kvsname[], int length );
0430 
0431 /*@
0432 PMI_KVS_Get_name_length_max - obtain the length necessary to store a kvsname
0433 
0434 Output Parameter:
0435 . length - maximum length required to hold a keyval space name
0436 
0437 Return values:
0438 + PMI_SUCCESS - length successfully set
0439 . PMI_ERR_INVALID_ARG - invalid argument
0440 - PMI_FAIL - unable to set the length
0441 
0442 Notes:
0443 This function returns the string length required to store a keyval space name.
0444 
0445 A routine is used rather than setting a maximum value in 'pmi.h' to allow
0446 different implementations of PMI to be used with the same executable.  These
0447 different implementations may allow different maximum lengths; by using a 
0448 routine here, we can interface with a variety of implementations of PMI.
0449 
0450 @*/
0451 int PMI_KVS_Get_name_length_max( int *length );
0452 
0453 /*@
0454 PMI_KVS_Get_key_length_max - obtain the length necessary to store a key
0455 
0456 Output Parameter:
0457 . length - maximum length required to hold a key string.
0458 
0459 Return values:
0460 + PMI_SUCCESS - length successfully set
0461 . PMI_ERR_INVALID_ARG - invalid argument
0462 - PMI_FAIL - unable to set the length
0463 
0464 Notes:
0465 This function returns the string length required to store a key.
0466 
0467 @*/
0468 int PMI_KVS_Get_key_length_max( int *length );
0469 
0470 /*@
0471 PMI_KVS_Get_value_length_max - obtain the length necessary to store a value
0472 
0473 Output Parameter:
0474 . length - maximum length required to hold a keyval space value
0475 
0476 Return values:
0477 + PMI_SUCCESS - length successfully set
0478 . PMI_ERR_INVALID_ARG - invalid argument
0479 - PMI_FAIL - unable to set the length
0480 
0481 Notes:
0482 This function returns the string length required to store a value from a
0483 keyval space.
0484 
0485 @*/
0486 int PMI_KVS_Get_value_length_max( int *length );
0487 
0488 /*@
0489 PMI_KVS_Create - create a new keyval space
0490 
0491 Input Parameter:
0492 . length - length of the kvsname character array
0493 
0494 Output Parameters:
0495 . kvsname - a string that receives the keyval space name
0496 
0497 Return values:
0498 + PMI_SUCCESS - keyval space successfully created
0499 . PMI_ERR_INVALID_ARG - invalid argument
0500 . PMI_ERR_INVALID_LENGTH - invalid length argument
0501 - PMI_FAIL - unable to create a new keyval space
0502 
0503 Notes:
0504 This function creates a new keyval space.  Everyone in the same process group
0505 can access this keyval space by the name returned by this function.  The
0506 function is not collective.  Only one process calls this function.  The output
0507 parameter, kvsname, must be at least as long as the value returned by
0508 'PMI_KVS_Get_name_length_max()'.
0509 
0510 @*/
0511 int PMI_KVS_Create( char kvsname[], int length );
0512 
0513 /*@
0514 PMI_KVS_Destroy - destroy keyval space
0515 
0516 Input Parameters:
0517 . kvsname - keyval space name
0518 
0519 Return values:
0520 + PMI_SUCCESS - keyval space successfully destroyed
0521 . PMI_ERR_INVALID_ARG - invalid argument
0522 - PMI_FAIL - unable to destroy the keyval space
0523 
0524 Notes:
0525 This function destroys a keyval space created by 'PMI_KVS_Create()'.
0526 
0527 @*/
0528 int PMI_KVS_Destroy( const char kvsname[] );
0529 
0530 /*@
0531 PMI_KVS_Put - put a key/value pair in a keyval space
0532 
0533 Input Parameters:
0534 + kvsname - keyval space name
0535 . key - key
0536 - value - value
0537 
0538 Return values:
0539 + PMI_SUCCESS - keyval pair successfully put in keyval space
0540 . PMI_ERR_INVALID_KVS - invalid kvsname argument
0541 . PMI_ERR_INVALID_KEY - invalid key argument
0542 . PMI_ERR_INVALID_VAL - invalid val argument
0543 - PMI_FAIL - put failed
0544 
0545 Notes:
0546 This function puts the key/value pair in the specified keyval space.  The
0547 value is not visible to other processes until 'PMI_KVS_Commit()' is called.  
0548 The function may complete locally.  After 'PMI_KVS_Commit()' is called, the
0549 value may be retrieved by calling 'PMI_KVS_Get()'.  All keys put to a keyval
0550 space must be unique to the keyval space.  You may not put more than once
0551 with the same key.
0552 
0553 @*/
0554 int PMI_KVS_Put( const char kvsname[], const char key[], const char value[]);
0555 
0556 /*@
0557 PMI_KVS_Commit - commit all previous puts to the keyval space
0558 
0559 Input Parameters:
0560 . kvsname - keyval space name
0561 
0562 Return values:
0563 + PMI_SUCCESS - commit succeeded
0564 . PMI_ERR_INVALID_ARG - invalid argument
0565 - PMI_FAIL - commit failed
0566 
0567 Notes:
0568 This function commits all previous puts since the last 'PMI_KVS_Commit()' into
0569 the specified keyval space. It is a process local operation.
0570 
0571 @*/
0572 int PMI_KVS_Commit( const char kvsname[] );
0573 
0574 /*@
0575 PMI_KVS_Get - get a key/value pair from a keyval space
0576 
0577 Input Parameters:
0578 + kvsname - keyval space name
0579 . key - key
0580 - length - length of value character array
0581 
0582 Output Parameters:
0583 . value - value
0584 
0585 Return values:
0586 + PMI_SUCCESS - get succeeded
0587 . PMI_ERR_INVALID_KVS - invalid kvsname argument
0588 . PMI_ERR_INVALID_KEY - invalid key argument
0589 . PMI_ERR_INVALID_VAL - invalid val argument
0590 . PMI_ERR_INVALID_LENGTH - invalid length argument
0591 - PMI_FAIL - get failed
0592 
0593 Notes:
0594 This function gets the value of the specified key in the keyval space.
0595 
0596 @*/
0597 int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int length);
0598 
0599 /*@
0600 PMI_KVS_Iter_first - initialize the iterator and get the first value
0601 
0602 Input Parameters:
0603 + kvsname - keyval space name
0604 . key_len - length of key character array
0605 - val_len - length of val character array
0606 
0607 Output Parameters:
0608 + key - key
0609 - value - value
0610 
0611 Return values:
0612 + PMI_SUCCESS - keyval pair successfully retrieved from the keyval space
0613 . PMI_ERR_INVALID_KVS - invalid kvsname argument
0614 . PMI_ERR_INVALID_KEY - invalid key argument
0615 . PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
0616 . PMI_ERR_INVALID_VAL - invalid val argument
0617 . PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
0618 - PMI_FAIL - failed to initialize the iterator and get the first keyval pair
0619 
0620 Notes:
0621 This function initializes the iterator for the specified keyval space and
0622 retrieves the first key/val pair.  The end of the keyval space is specified
0623 by returning an empty key string.  key and val must be at least as long as
0624 the values returned by 'PMI_KVS_Get_key_length_max()' and
0625 'PMI_KVS_Get_value_length_max()'.
0626 
0627 @*/
0628 int PMI_KVS_Iter_first(const char kvsname[], char key[], int key_len, char val[], int val_len);
0629 
0630 /*@
0631 PMI_KVS_Iter_next - get the next keyval pair from the keyval space
0632 
0633 Input Parameters:
0634 + kvsname - keyval space name
0635 . key_len - length of key character array
0636 - val_len - length of val character array
0637 
0638 Output Parameters:
0639 + key - key
0640 - value - value
0641 
0642 Return values:
0643 + PMI_SUCCESS - keyval pair successfully retrieved from the keyval space
0644 . PMI_ERR_INVALID_KVS - invalid kvsname argument
0645 . PMI_ERR_INVALID_KEY - invalid key argument
0646 . PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
0647 . PMI_ERR_INVALID_VAL - invalid val argument
0648 . PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
0649 - PMI_FAIL - failed to get the next keyval pair
0650 
0651 Notes:
0652 This function retrieves the next keyval pair from the specified keyval space.  
0653 'PMI_KVS_Iter_first()' must have been previously called.  The end of the keyval
0654 space is specified by returning an empty key string.  The output parameters,
0655 key and val, must be at least as long as the values returned by
0656 'PMI_KVS_Get_key_length_max()' and 'PMI_KVS_Get_value_length_max()'.
0657 
0658 @*/
0659 int PMI_KVS_Iter_next(const char kvsname[], char key[], int key_len, char val[], int val_len);
0660 
0661 /* PMI Process Creation functions */
0662 
0663 /*S
0664 PMI_keyval_t - keyval structure used by PMI_Spawn_mulitiple
0665 
0666 Fields:
0667 + key - name of the key
0668 - val - value of the key
0669 
0670 S*/
0671 typedef struct PMI_keyval_t
0672 {
0673     char * key;
0674     char * val;
0675 } PMI_keyval_t;
0676 
0677 /*@
0678 PMI_Spawn_multiple - spawn a new set of processes
0679 
0680 Input Parameters:
0681 + count - count of commands
0682 . cmds - array of command strings
0683 . argvs - array of argv arrays for each command string
0684 . maxprocs - array of maximum processes to spawn for each command string
0685 . info_keyval_sizes - array giving the number of elements in each of the 
0686   'info_keyval_vectors'
0687 . info_keyval_vectors - array of keyval vector arrays
0688 . preput_keyval_size - Number of elements in 'preput_keyval_vector'
0689 - preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space
0690 
0691 Output Parameter:
0692 . errors - array of errors for each command
0693 
0694 Return values:
0695 + PMI_SUCCESS - spawn successful
0696 . PMI_ERR_INVALID_ARG - invalid argument
0697 - PMI_FAIL - spawn failed
0698 
0699 Notes:
0700 This function spawns a set of processes into a new process group.  The 'count'
0701 field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs',
0702 'info_keyval_sizes' and 'info_keyval_vectors'.  The 'preput_keyval_size' refers
0703 to the size of the 'preput_keyval_vector' array.  The 'preput_keyval_vector'
0704 contains keyval pairs that will be put in the keyval space of the newly
0705 created process group before the processes are started.  The 'maxprocs' array
0706 specifies the desired number of processes to create for each 'cmd' string.  
0707 The actual number of processes may be less than the numbers specified in
0708 maxprocs.  The acceptable number of processes spawned may be controlled by
0709 ``soft'' keyvals in the info arrays.  The ``soft'' option is specified by
0710 mpiexec in the MPI-2 standard.  Environment variables may be passed to the
0711 spawned processes through PMI implementation specific 'info_keyval' parameters.
0712 @*/
0713 int PMI_Spawn_multiple(int count,
0714                        const char * cmds[],
0715                        const char ** argvs[],
0716                        const int maxprocs[],
0717                        const int info_keyval_sizesp[],
0718                        const PMI_keyval_t * info_keyval_vectors[],
0719                        int preput_keyval_size,
0720                        const PMI_keyval_t preput_keyval_vector[],
0721                        int errors[]);
0722 
0723 
0724 /*@
0725 PMI_Parse_option - create keyval structures from a single command line argument
0726 
0727 Input Parameters:
0728 + num_args - length of args array
0729 - args - array of command line arguments starting with the argument to be parsed
0730 
0731 Output Parameters:
0732 + num_parsed - number of elements of the argument array parsed
0733 . keyvalp - pointer to an array of keyvals
0734 - size - size of the allocated array
0735 
0736 Return values:
0737 + PMI_SUCCESS - success
0738 . PMI_ERR_INVALID_NUM_ARGS - invalid number of arguments
0739 . PMI_ERR_INVALID_ARGS - invalid args argument
0740 . PMI_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
0741 . PMI_ERR_INVALID_KEYVALP - invalid keyvalp argument
0742 . PMI_ERR_INVALID_SIZE - invalid size argument
0743 - PMI_FAIL - fail
0744 
0745 Notes:
0746 This function removes one PMI specific argument from the command line and
0747 creates the corresponding 'PMI_keyval_t' structure for it.  It returns
0748 an array and size to the caller.  The array must be freed by 'PMI_Free_keyvals()'.
0749 If the first element of the args array is not a PMI specific argument, the function
0750 returns success and sets num_parsed to zero.  If there are multiple PMI specific
0751 arguments in the args array, this function may parse more than one argument as long
0752 as the options are contiguous in the args array.
0753 
0754 @*/
0755 int PMI_Parse_option(int num_args, char *args[], int *num_parsed, PMI_keyval_t **keyvalp, int *size);
0756 
0757 /*@
0758 PMI_Args_to_keyval - create keyval structures from command line arguments
0759 
0760 Input Parameters:
0761 + argcp - pointer to argc
0762 - argvp - pointer to argv
0763 
0764 Output Parameters:
0765 + keyvalp - pointer to an array of keyvals
0766 - size - size of the allocated array
0767 
0768 Return values:
0769 + PMI_SUCCESS - success
0770 . PMI_ERR_INVALID_ARG - invalid argument
0771 - PMI_FAIL - fail
0772 
0773 Notes:
0774 This function removes PMI specific arguments from the command line and
0775 creates the corresponding 'PMI_keyval_t' structures for them.  It returns
0776 an array and size to the caller that can then be passed to 'PMI_Spawn_multiple()'.
0777 The array can be freed by 'PMI_Free_keyvals()'.  The routine 'free()' should 
0778 not be used to free this array as there is no requirement that the array be
0779 allocated with 'malloc()'.
0780 
0781 @*/
0782 int PMI_Args_to_keyval(int *argcp, char *((*argvp)[]), PMI_keyval_t **keyvalp, int *size);
0783 
0784 /*@
0785 PMI_Free_keyvals - free the keyval structures created by PMI_Args_to_keyval
0786 
0787 Input Parameters:
0788 + keyvalp - array of keyvals
0789 - size - size of the array
0790 
0791 Return values:
0792 + PMI_SUCCESS - success
0793 . PMI_ERR_INVALID_ARG - invalid argument
0794 - PMI_FAIL - fail
0795 
0796 Notes:
0797  This function frees the data returned by 'PMI_Args_to_keyval' and 'PMI_Parse_option'.
0798  Using this routine instead of 'free' allows the PMI package to track 
0799  allocation of storage or to use interal storage as it sees fit.
0800 @*/
0801 int PMI_Free_keyvals(PMI_keyval_t keyvalp[], int size);
0802 
0803 /*@
0804 PMI_Get_options - get a string of command line argument descriptions that may be printed to the user
0805 
0806 Input Parameters:
0807 . length - length of str
0808 
0809 Output Parameters:
0810 + str - description string
0811 - length - length of string or necessary length if input is not large enough
0812 
0813 Return values:
0814 + PMI_SUCCESS - success
0815 . PMI_ERR_INVALID_ARG - invalid argument
0816 . PMI_ERR_INVALID_LENGTH - invalid length argument
0817 . PMI_ERR_NOMEM - input length too small
0818 - PMI_FAIL - fail
0819 
0820 Notes:
0821  This function returns the command line options specific to the pmi implementation
0822 @*/
0823 int PMI_Get_options(char *str, int *length);
0824 
0825 #if defined(__cplusplus)
0826 }
0827 #endif
0828 
0829 #endif