pmi.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. /*****************************************************************************\
  2. * pmi.h - Process Management Interface for MPICH2, implemented by SLURM
  3. * See http://www-unix.mcs.anl.gov/mpi/mpich2/
  4. *
  5. * NOTE: Dynamic Process Management functions (PMI part 2) are not supported
  6. * at this time. Functions required for MPI-1 (PMI part 1) are supported.
  7. *****************************************************************************
  8. * COPYRIGHT
  9. *
  10. * The following is a notice of limited availability of the code, and
  11. * disclaimer which must be included in the prologue of the code and in all
  12. * source listings of the code.
  13. *
  14. * Copyright Notice + 2002 University of Chicago
  15. *
  16. * Permission is hereby granted to use, reproduce, prepare derivative
  17. * works, and to redistribute to others. This software was authored by:
  18. *
  19. * Argonne National Laboratory Group
  20. * W. Gropp: (630) 252-4318; FAX: (630) 252-5986; e-mail: gropp@mcs.anl.gov
  21. * E. Lusk: (630) 252-7852; FAX: (630) 252-5986; e-mail: lusk@mcs.anl.gov
  22. * Mathematics and Computer Science Division Argonne National Laboratory,
  23. * Argonne IL 60439
  24. *
  25. * GOVERNMENT LICENSE
  26. *
  27. * Portions of this material resulted from work developed under a U.S.
  28. * Government Contract and are subject to the following license: the
  29. * Government is granted for itself and others acting on its behalf a
  30. * paid-up, nonexclusive, irrevocable worldwide license in this computer
  31. * software to reproduce, prepare derivative works, and perform publicly
  32. * and display publicly.
  33. *
  34. * DISCLAIMER
  35. *
  36. * This computer code material was prepared, in part, as an account of work
  37. * sponsored by an agency of the United States Government. Neither the
  38. * United States, nor the University of Chicago, nor any of their
  39. * employees, makes any warranty express or implied, or assumes any legal
  40. * liability or responsibility for the accuracy, completeness, or
  41. * usefulness of any information, apparatus, product, or process disclosed,
  42. * or represents that its use would not infringe privately owned rights.
  43. *
  44. * MCS Division <http://www.mcs.anl.gov> Argonne National Laboratory
  45. * <http://www.anl.gov> University of Chicago <http://www.uchicago.edu>
  46. \*****************************************************************************/
  47. #ifndef PMI_H
  48. #define PMI_H
  49. /* prototypes for the PMI interface in MPICH2 */
  50. #if defined(__cplusplus)
  51. extern "C" {
  52. #endif
  53. /*D
  54. PMI_CONSTANTS - PMI definitions
  55. Error Codes:
  56. + PMI_SUCCESS - operation completed successfully
  57. . PMI_FAIL - operation failed
  58. . PMI_ERR_NOMEM - input buffer not large enough
  59. . PMI_ERR_INIT - PMI not initialized
  60. . PMI_ERR_INVALID_ARG - invalid argument
  61. . PMI_ERR_INVALID_KEY - invalid key argument
  62. . PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
  63. . PMI_ERR_INVALID_VAL - invalid val argument
  64. . PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
  65. . PMI_ERR_INVALID_LENGTH - invalid length argument
  66. . PMI_ERR_INVALID_NUM_ARGS - invalid number of arguments
  67. . PMI_ERR_INVALID_ARGS - invalid args argument
  68. . PMI_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
  69. . PMI_ERR_INVALID_KEYVALP - invalid keyvalp argument
  70. - PMI_ERR_INVALID_SIZE - invalid size argument
  71. Booleans:
  72. + PMI_TRUE - true
  73. - PMI_FALSE - false
  74. D*/
  75. #define PMI_SUCCESS 0
  76. #define PMI_FAIL -1
  77. #define PMI_ERR_INIT 1
  78. #define PMI_ERR_NOMEM 2
  79. #define PMI_ERR_INVALID_ARG 3
  80. #define PMI_ERR_INVALID_KEY 4
  81. #define PMI_ERR_INVALID_KEY_LENGTH 5
  82. #define PMI_ERR_INVALID_VAL 6
  83. #define PMI_ERR_INVALID_VAL_LENGTH 7
  84. #define PMI_ERR_INVALID_LENGTH 8
  85. #define PMI_ERR_INVALID_NUM_ARGS 9
  86. #define PMI_ERR_INVALID_ARGS 10
  87. #define PMI_ERR_INVALID_NUM_PARSED 11
  88. #define PMI_ERR_INVALID_KEYVALP 12
  89. #define PMI_ERR_INVALID_SIZE 13
  90. #define PMI_ERR_INVALID_KVS 14
  91. typedef int PMI_BOOL;
  92. #define PMI_TRUE 1
  93. #define PMI_FALSE 0
  94. /* PMI Group functions */
  95. /*@
  96. PMI_Init - initialize the Process Manager Interface
  97. Output Parameter:
  98. . spawned - spawned flag
  99. Return values:
  100. + PMI_SUCCESS - initialization completed successfully
  101. . PMI_ERR_INVALID_ARG - invalid argument
  102. - PMI_FAIL - initialization failed
  103. Notes:
  104. Initialize PMI for this process group. The value of spawned indicates whether
  105. this process was created by 'PMI_Spawn_multiple'. 'spawned' will be 'PMI_TRUE' if
  106. this process group has a parent and 'PMI_FALSE' if it does not.
  107. @*/
  108. int PMI_Init( int *spawned );
  109. /*@
  110. PMI_Initialized - check if PMI has been initialized
  111. Output Parameter:
  112. . initialized - boolean value
  113. Return values:
  114. + PMI_SUCCESS - initialized successfully set
  115. . PMI_ERR_INVALID_ARG - invalid argument
  116. - PMI_FAIL - unable to set the variable
  117. Notes:
  118. On successful output, initialized will either be 'PMI_TRUE' or 'PMI_FALSE'.
  119. + PMI_TRUE - initialize has been called.
  120. - PMI_FALSE - initialize has not been called or previously failed.
  121. @*/
  122. int PMI_Initialized( PMI_BOOL *initialized );
  123. /*@
  124. PMI_Finalize - finalize the Process Manager Interface
  125. Return values:
  126. + PMI_SUCCESS - finalization completed successfully
  127. - PMI_FAIL - finalization failed
  128. Notes:
  129. Finalize PMI for this process group.
  130. @*/
  131. int PMI_Finalize( void );
  132. /*@
  133. PMI_Get_size - obtain the size of the process group
  134. Output Parameters:
  135. . size - pointer to an integer that receives the size of the process group
  136. Return values:
  137. + PMI_SUCCESS - size successfully obtained
  138. . PMI_ERR_INVALID_ARG - invalid argument
  139. - PMI_FAIL - unable to return the size
  140. Notes:
  141. This function returns the size of the process group to which the local process
  142. belongs.
  143. @*/
  144. int PMI_Get_size( int *size );
  145. /*@
  146. PMI_Get_rank - obtain the rank of the local process in the process group
  147. Output Parameters:
  148. . rank - pointer to an integer that receives the rank in the process group
  149. Return values:
  150. + PMI_SUCCESS - rank successfully obtained
  151. . PMI_ERR_INVALID_ARG - invalid argument
  152. - PMI_FAIL - unable to return the rank
  153. Notes:
  154. This function returns the rank of the local process in its process group.
  155. @*/
  156. int PMI_Get_rank( int *rank );
  157. /*@
  158. PMI_Get_universe_size - obtain the universe size
  159. Output Parameters:
  160. . size - pointer to an integer that receives the size
  161. Return values:
  162. + PMI_SUCCESS - size successfully obtained
  163. . PMI_ERR_INVALID_ARG - invalid argument
  164. - PMI_FAIL - unable to return the size
  165. @*/
  166. int PMI_Get_universe_size( int *size );
  167. /*@
  168. PMI_Get_appnum - obtain the application number
  169. Output parameters:
  170. . appnum - pointer to an integer that receives the appnum
  171. Return values:
  172. + PMI_SUCCESS - appnum successfully obtained
  173. . PMI_ERR_INVALID_ARG - invalid argument
  174. - PMI_FAIL - unable to return the size
  175. @*/
  176. int PMI_Get_appnum( int *appnum );
  177. /*@
  178. PMI_Publish_name - publish a name
  179. Input parameters:
  180. . service_name - string representing the service being published
  181. . port - string representing the port on which to contact the service
  182. Return values:
  183. + PMI_SUCCESS - port for service successfully published
  184. . PMI_ERR_INVALID_ARG - invalid argument
  185. - PMI_FAIL - unable to publish service
  186. @*/
  187. int PMI_Publish_name( const char service_name[], const char port[] );
  188. /*@
  189. PMI_Unpublish_name - unpublish a name
  190. Input parameters:
  191. . service_name - string representing the service being unpublished
  192. Return values:
  193. + PMI_SUCCESS - port for service successfully published
  194. . PMI_ERR_INVALID_ARG - invalid argument
  195. - PMI_FAIL - unable to unpublish service
  196. @*/
  197. int PMI_Unpublish_name( const char service_name[] );
  198. /*@
  199. PMI_Lookup_name - lookup a service by name
  200. Input parameters:
  201. . service_name - string representing the service being published
  202. Output parameters:
  203. . port - string representing the port on which to contact the service
  204. Return values:
  205. + PMI_SUCCESS - port for service successfully obtained
  206. . PMI_ERR_INVALID_ARG - invalid argument
  207. - PMI_FAIL - unable to lookup service
  208. @*/
  209. int PMI_Lookup_name( const char service_name[], char port[] );
  210. /*@
  211. PMI_Get_id - obtain the id of the process group
  212. Input Parameter:
  213. . length - length of the id_str character array
  214. Output Parameter:
  215. . id_str - character array that receives the id of the process group
  216. Return values:
  217. + PMI_SUCCESS - id successfully obtained
  218. . PMI_ERR_INVALID_ARG - invalid rank argument
  219. . PMI_ERR_INVALID_LENGTH - invalid length argument
  220. - PMI_FAIL - unable to return the id
  221. Notes:
  222. This function returns a string that uniquely identifies the process group
  223. that the local process belongs to. The string passed in must be at least
  224. as long as the number returned by 'PMI_Get_id_length_max()'.
  225. @*/
  226. int PMI_Get_id( char id_str[], int length );
  227. /*@
  228. PMI_Get_kvs_domain_id - obtain the id of the PMI domain
  229. Input Parameter:
  230. . length - length of id_str character array
  231. Output Parameter:
  232. . id_str - character array that receives the id of the PMI domain
  233. Return values:
  234. + PMI_SUCCESS - id successfully obtained
  235. . PMI_ERR_INVALID_ARG - invalid argument
  236. . PMI_ERR_INVALID_LENGTH - invalid length argument
  237. - PMI_FAIL - unable to return the id
  238. Notes:
  239. This function returns a string that uniquely identifies the PMI domain
  240. where keyval spaces can be shared. The string passed in must be at least
  241. as long as the number returned by 'PMI_Get_id_length_max()'.
  242. @*/
  243. int PMI_Get_kvs_domain_id( char id_str[], int length );
  244. /*@
  245. PMI_Get_id_length_max - obtain the maximum length of an id string
  246. Output Parameters:
  247. . length - the maximum length of an id string
  248. Return values:
  249. + PMI_SUCCESS - length successfully set
  250. . PMI_ERR_INVALID_ARG - invalid argument
  251. - PMI_FAIL - unable to return the maximum length
  252. Notes:
  253. This function returns the maximum length of a process group id string.
  254. @*/
  255. int PMI_Get_id_length_max( int *length );
  256. /*@
  257. PMI_Barrier - barrier across the process group
  258. Return values:
  259. + PMI_SUCCESS - barrier successfully finished
  260. - PMI_FAIL - barrier failed
  261. Notes:
  262. This function is a collective call across all processes in the process group
  263. the local process belongs to. It will not return until all the processes
  264. have called 'PMI_Barrier()'.
  265. @*/
  266. int PMI_Barrier( void );
  267. /*@
  268. PMI_Get_clique_size - obtain the number of processes on the local node
  269. Output Parameters:
  270. . size - pointer to an integer that receives the size of the clique
  271. Return values:
  272. + PMI_SUCCESS - size successfully obtained
  273. . PMI_ERR_INVALID_ARG - invalid argument
  274. - PMI_FAIL - unable to return the clique size
  275. Notes:
  276. This function returns the number of processes in the local process group that
  277. are on the local node along with the local process. This is a simple topology
  278. function to distinguish between processes that can communicate through IPC
  279. mechanisms (e.g., shared memory) and other network mechanisms.
  280. @*/
  281. int PMI_Get_clique_size( int *size );
  282. /*@
  283. PMI_Get_clique_ranks - get the ranks of the local processes in the process group
  284. Input Parameters:
  285. . length - length of the ranks array
  286. Output Parameters:
  287. . ranks - pointer to an array of integers that receive the local ranks
  288. Return values:
  289. + PMI_SUCCESS - ranks successfully obtained
  290. . PMI_ERR_INVALID_ARG - invalid argument
  291. . PMI_ERR_INVALID_LENGTH - invalid length argument
  292. - PMI_FAIL - unable to return the ranks
  293. Notes:
  294. This function returns the ranks of the processes on the local node. The array
  295. must be at least as large as the size returned by 'PMI_Get_clique_size()'. This
  296. is a simple topology function to distinguish between processes that can
  297. communicate through IPC mechanisms (e.g., shared memory) and other network
  298. mechanisms.
  299. @*/
  300. int PMI_Get_clique_ranks( int ranks[], int length);
  301. /*@
  302. PMI_Abort - abort the process group associated with this process
  303. Input Parameters:
  304. + exit_code - exit code to be returned by this process
  305. - error_msg - error message to be printed
  306. Return values:
  307. . none - this function should not return
  308. @*/
  309. int PMI_Abort(int exit_code, const char error_msg[]);
  310. /* PMI Keymap functions */
  311. /*@
  312. PMI_KVS_Get_my_name - obtain the name of the keyval space the local process group has access to
  313. Input Parameters:
  314. . length - length of the kvsname character array
  315. Output Parameters:
  316. . kvsname - a string that receives the keyval space name
  317. Return values:
  318. + PMI_SUCCESS - kvsname successfully obtained
  319. . PMI_ERR_INVALID_ARG - invalid argument
  320. . PMI_ERR_INVALID_LENGTH - invalid length argument
  321. - PMI_FAIL - unable to return the kvsname
  322. Notes:
  323. This function returns the name of the keyval space that this process and all
  324. other processes in the process group have access to. The output parameter,
  325. kvsname, must be at least as long as the value returned by
  326. 'PMI_KVS_Get_name_length_max()'.
  327. @*/
  328. int PMI_KVS_Get_my_name( char kvsname[], int length );
  329. /*@
  330. PMI_KVS_Get_name_length_max - obtain the length necessary to store a kvsname
  331. Output Parameter:
  332. . length - maximum length required to hold a keyval space name
  333. Return values:
  334. + PMI_SUCCESS - length successfully set
  335. . PMI_ERR_INVALID_ARG - invalid argument
  336. - PMI_FAIL - unable to set the length
  337. Notes:
  338. This function returns the string length required to store a keyval space name.
  339. A routine is used rather than setting a maximum value in 'pmi.h' to allow
  340. different implementations of PMI to be used with the same executable. These
  341. different implementations may allow different maximum lengths; by using a
  342. routine here, we can interface with a variety of implementations of PMI.
  343. @*/
  344. int PMI_KVS_Get_name_length_max( int *length );
  345. /*@
  346. PMI_KVS_Get_key_length_max - obtain the length necessary to store a key
  347. Output Parameter:
  348. . length - maximum length required to hold a key string.
  349. Return values:
  350. + PMI_SUCCESS - length successfully set
  351. . PMI_ERR_INVALID_ARG - invalid argument
  352. - PMI_FAIL - unable to set the length
  353. Notes:
  354. This function returns the string length required to store a key.
  355. @*/
  356. int PMI_KVS_Get_key_length_max( int *length );
  357. /*@
  358. PMI_KVS_Get_value_length_max - obtain the length necessary to store a value
  359. Output Parameter:
  360. . length - maximum length required to hold a keyval space value
  361. Return values:
  362. + PMI_SUCCESS - length successfully set
  363. . PMI_ERR_INVALID_ARG - invalid argument
  364. - PMI_FAIL - unable to set the length
  365. Notes:
  366. This function returns the string length required to store a value from a
  367. keyval space.
  368. @*/
  369. int PMI_KVS_Get_value_length_max( int *length );
  370. /*@
  371. PMI_KVS_Create - create a new keyval space
  372. Input Parameter:
  373. . length - length of the kvsname character array
  374. Output Parameters:
  375. . kvsname - a string that receives the keyval space name
  376. Return values:
  377. + PMI_SUCCESS - keyval space successfully created
  378. . PMI_ERR_INVALID_ARG - invalid argument
  379. . PMI_ERR_INVALID_LENGTH - invalid length argument
  380. - PMI_FAIL - unable to create a new keyval space
  381. Notes:
  382. This function creates a new keyval space. Everyone in the same process group
  383. can access this keyval space by the name returned by this function. The
  384. function is not collective. Only one process calls this function. The output
  385. parameter, kvsname, must be at least as long as the value returned by
  386. 'PMI_KVS_Get_name_length_max()'.
  387. @*/
  388. int PMI_KVS_Create( char kvsname[], int length );
  389. /*@
  390. PMI_KVS_Destroy - destroy keyval space
  391. Input Parameters:
  392. . kvsname - keyval space name
  393. Return values:
  394. + PMI_SUCCESS - keyval space successfully destroyed
  395. . PMI_ERR_INVALID_ARG - invalid argument
  396. - PMI_FAIL - unable to destroy the keyval space
  397. Notes:
  398. This function destroys a keyval space created by 'PMI_KVS_Create()'.
  399. @*/
  400. int PMI_KVS_Destroy( const char kvsname[] );
  401. /*@
  402. PMI_KVS_Put - put a key/value pair in a keyval space
  403. Input Parameters:
  404. + kvsname - keyval space name
  405. . key - key
  406. - value - value
  407. Return values:
  408. + PMI_SUCCESS - keyval pair successfully put in keyval space
  409. . PMI_ERR_INVALID_KVS - invalid kvsname argument
  410. . PMI_ERR_INVALID_KEY - invalid key argument
  411. . PMI_ERR_INVALID_VAL - invalid val argument
  412. - PMI_FAIL - put failed
  413. Notes:
  414. This function puts the key/value pair in the specified keyval space. The
  415. value is not visible to other processes until 'PMI_KVS_Commit()' is called.
  416. The function may complete locally. After 'PMI_KVS_Commit()' is called, the
  417. value may be retrieved by calling 'PMI_KVS_Get()'. All keys put to a keyval
  418. space must be unique to the keyval space. You may not put more than once
  419. with the same key.
  420. @*/
  421. int PMI_KVS_Put( const char kvsname[], const char key[], const char value[]);
  422. /*@
  423. PMI_KVS_Commit - commit all previous puts to the keyval space
  424. Input Parameters:
  425. . kvsname - keyval space name
  426. Return values:
  427. + PMI_SUCCESS - commit succeeded
  428. . PMI_ERR_INVALID_ARG - invalid argument
  429. - PMI_FAIL - commit failed
  430. Notes:
  431. This function commits all previous puts since the last 'PMI_KVS_Commit()' into
  432. the specified keyval space. It is a process local operation.
  433. @*/
  434. int PMI_KVS_Commit( const char kvsname[] );
  435. /*@
  436. PMI_KVS_Get - get a key/value pair from a keyval space
  437. Input Parameters:
  438. + kvsname - keyval space name
  439. . key - key
  440. - length - length of value character array
  441. Output Parameters:
  442. . value - value
  443. Return values:
  444. + PMI_SUCCESS - get succeeded
  445. . PMI_ERR_INVALID_KVS - invalid kvsname argument
  446. . PMI_ERR_INVALID_KEY - invalid key argument
  447. . PMI_ERR_INVALID_VAL - invalid val argument
  448. . PMI_ERR_INVALID_LENGTH - invalid length argument
  449. - PMI_FAIL - get failed
  450. Notes:
  451. This function gets the value of the specified key in the keyval space.
  452. @*/
  453. int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int length);
  454. /*@
  455. PMI_KVS_Iter_first - initialize the iterator and get the first value
  456. Input Parameters:
  457. + kvsname - keyval space name
  458. . key_len - length of key character array
  459. - val_len - length of val character array
  460. Output Parameters:
  461. + key - key
  462. - value - value
  463. Return values:
  464. + PMI_SUCCESS - keyval pair successfully retrieved from the keyval space
  465. . PMI_ERR_INVALID_KVS - invalid kvsname argument
  466. . PMI_ERR_INVALID_KEY - invalid key argument
  467. . PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
  468. . PMI_ERR_INVALID_VAL - invalid val argument
  469. . PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
  470. - PMI_FAIL - failed to initialize the iterator and get the first keyval pair
  471. Notes:
  472. This function initializes the iterator for the specified keyval space and
  473. retrieves the first key/val pair. The end of the keyval space is specified
  474. by returning an empty key string. key and val must be at least as long as
  475. the values returned by 'PMI_KVS_Get_key_length_max()' and
  476. 'PMI_KVS_Get_value_length_max()'.
  477. @*/
  478. int PMI_KVS_Iter_first(const char kvsname[], char key[], int key_len, char val[], int val_len);
  479. /*@
  480. PMI_KVS_Iter_next - get the next keyval pair from the keyval space
  481. Input Parameters:
  482. + kvsname - keyval space name
  483. . key_len - length of key character array
  484. - val_len - length of val character array
  485. Output Parameters:
  486. + key - key
  487. - value - value
  488. Return values:
  489. + PMI_SUCCESS - keyval pair successfully retrieved from the keyval space
  490. . PMI_ERR_INVALID_KVS - invalid kvsname argument
  491. . PMI_ERR_INVALID_KEY - invalid key argument
  492. . PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
  493. . PMI_ERR_INVALID_VAL - invalid val argument
  494. . PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
  495. - PMI_FAIL - failed to get the next keyval pair
  496. Notes:
  497. This function retrieves the next keyval pair from the specified keyval space.
  498. 'PMI_KVS_Iter_first()' must have been previously called. The end of the keyval
  499. space is specified by returning an empty key string. The output parameters,
  500. key and val, must be at least as long as the values returned by
  501. 'PMI_KVS_Get_key_length_max()' and 'PMI_KVS_Get_value_length_max()'.
  502. @*/
  503. int PMI_KVS_Iter_next(const char kvsname[], char key[], int key_len, char val[], int val_len);
  504. /* PMI Process Creation functions */
  505. /*S
  506. PMI_keyval_t - keyval structure used by PMI_Spawn_mulitiple
  507. Fields:
  508. + key - name of the key
  509. - val - value of the key
  510. S*/
  511. typedef struct PMI_keyval_t
  512. {
  513. char * key;
  514. char * val;
  515. } PMI_keyval_t;
  516. /*@
  517. PMI_Spawn_multiple - spawn a new set of processes
  518. Input Parameters:
  519. + count - count of commands
  520. . cmds - array of command strings
  521. . argvs - array of argv arrays for each command string
  522. . maxprocs - array of maximum processes to spawn for each command string
  523. . info_keyval_sizes - array giving the number of elements in each of the
  524. 'info_keyval_vectors'
  525. . info_keyval_vectors - array of keyval vector arrays
  526. . preput_keyval_size - Number of elements in 'preput_keyval_vector'
  527. - preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space
  528. Output Parameter:
  529. . errors - array of errors for each command
  530. Return values:
  531. + PMI_SUCCESS - spawn successful
  532. . PMI_ERR_INVALID_ARG - invalid argument
  533. - PMI_FAIL - spawn failed
  534. Notes:
  535. This function spawns a set of processes into a new process group. The 'count'
  536. field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs',
  537. 'info_keyval_sizes' and 'info_keyval_vectors'. The 'preput_keyval_size' refers
  538. to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector'
  539. contains keyval pairs that will be put in the keyval space of the newly
  540. created process group before the processes are started. The 'maxprocs' array
  541. specifies the desired number of processes to create for each 'cmd' string.
  542. The actual number of processes may be less than the numbers specified in
  543. maxprocs. The acceptable number of processes spawned may be controlled by
  544. ``soft'' keyvals in the info arrays. The ``soft'' option is specified by
  545. mpiexec in the MPI-2 standard. Environment variables may be passed to the
  546. spawned processes through PMI implementation specific 'info_keyval' parameters.
  547. @*/
  548. int PMI_Spawn_multiple(int count,
  549. const char * cmds[],
  550. const char ** argvs[],
  551. const int maxprocs[],
  552. const int info_keyval_sizesp[],
  553. const PMI_keyval_t * info_keyval_vectors[],
  554. int preput_keyval_size,
  555. const PMI_keyval_t preput_keyval_vector[],
  556. int errors[]);
  557. /*@
  558. PMI_Parse_option - create keyval structures from a single command line argument
  559. Input Parameters:
  560. + num_args - length of args array
  561. - args - array of command line arguments starting with the argument to be parsed
  562. Output Parameters:
  563. + num_parsed - number of elements of the argument array parsed
  564. . keyvalp - pointer to an array of keyvals
  565. - size - size of the allocated array
  566. Return values:
  567. + PMI_SUCCESS - success
  568. . PMI_ERR_INVALID_NUM_ARGS - invalid number of arguments
  569. . PMI_ERR_INVALID_ARGS - invalid args argument
  570. . PMI_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
  571. . PMI_ERR_INVALID_KEYVALP - invalid keyvalp argument
  572. . PMI_ERR_INVALID_SIZE - invalid size argument
  573. - PMI_FAIL - fail
  574. Notes:
  575. This function removes one PMI specific argument from the command line and
  576. creates the corresponding 'PMI_keyval_t' structure for it. It returns
  577. an array and size to the caller. The array must be freed by 'PMI_Free_keyvals()'.
  578. If the first element of the args array is not a PMI specific argument, the function
  579. returns success and sets num_parsed to zero. If there are multiple PMI specific
  580. arguments in the args array, this function may parse more than one argument as long
  581. as the options are contiguous in the args array.
  582. @*/
  583. int PMI_Parse_option(int num_args, char *args[], int *num_parsed, PMI_keyval_t **keyvalp, int *size);
  584. /*@
  585. PMI_Args_to_keyval - create keyval structures from command line arguments
  586. Input Parameters:
  587. + argcp - pointer to argc
  588. - argvp - pointer to argv
  589. Output Parameters:
  590. + keyvalp - pointer to an array of keyvals
  591. - size - size of the allocated array
  592. Return values:
  593. + PMI_SUCCESS - success
  594. . PMI_ERR_INVALID_ARG - invalid argument
  595. - PMI_FAIL - fail
  596. Notes:
  597. This function removes PMI specific arguments from the command line and
  598. creates the corresponding 'PMI_keyval_t' structures for them. It returns
  599. an array and size to the caller that can then be passed to 'PMI_Spawn_multiple()'.
  600. The array can be freed by 'PMI_Free_keyvals()'. The routine 'free()' should
  601. not be used to free this array as there is no requirement that the array be
  602. allocated with 'malloc()'.
  603. @*/
  604. int PMI_Args_to_keyval(int *argcp, char *((*argvp)[]), PMI_keyval_t **keyvalp, int *size);
  605. /*@
  606. PMI_Free_keyvals - free the keyval structures created by PMI_Args_to_keyval
  607. Input Parameters:
  608. + keyvalp - array of keyvals
  609. - size - size of the array
  610. Return values:
  611. + PMI_SUCCESS - success
  612. . PMI_ERR_INVALID_ARG - invalid argument
  613. - PMI_FAIL - fail
  614. Notes:
  615. This function frees the data returned by 'PMI_Args_to_keyval' and 'PMI_Parse_option'.
  616. Using this routine instead of 'free' allows the PMI package to track
  617. allocation of storage or to use interal storage as it sees fit.
  618. @*/
  619. int PMI_Free_keyvals(PMI_keyval_t keyvalp[], int size);
  620. /*@
  621. PMI_Get_options - get a string of command line argument descriptions that may be printed to the user
  622. Input Parameters:
  623. . length - length of str
  624. Output Parameters:
  625. + str - description string
  626. - length - length of string or necessary length if input is not large enough
  627. Return values:
  628. + PMI_SUCCESS - success
  629. . PMI_ERR_INVALID_ARG - invalid argument
  630. . PMI_ERR_INVALID_LENGTH - invalid length argument
  631. . PMI_ERR_NOMEM - input length too small
  632. - PMI_FAIL - fail
  633. Notes:
  634. This function returns the command line options specific to the pmi implementation
  635. @*/
  636. int PMI_Get_options(char *str, int *length);
  637. #if defined(__cplusplus)
  638. }
  639. #endif
  640. #endif