pmi2.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2. /*
  3. * (C) 2007 by Argonne National Laboratory.
  4. * See COPYRIGHT in top-level directory.
  5. */
  6. #ifndef PMI2_H_INCLUDED
  7. #define PMI2_H_INCLUDED
  8. #ifndef USE_PMI2_API
  9. /*#error This header file defines the PMI2 API, but PMI2 was not selected*/
  10. #endif
  11. #define PMI2_MAX_KEYLEN 64
  12. #define PMI2_MAX_VALLEN 1024
  13. #define PMI2_MAX_ATTRVALUE 1024
  14. #define PMI2_ID_NULL -1
  15. #define PMII_COMMANDLEN_SIZE 6
  16. #define PMII_MAX_COMMAND_LEN (64*1024)
  17. #if defined(__cplusplus)
  18. extern "C" {
  19. #endif
  20. static const char FULLINIT_CMD[] = "fullinit";
  21. static const char FULLINITRESP_CMD[] = "fullinit-response";
  22. static const char FINALIZE_CMD[] = "finalize";
  23. static const char FINALIZERESP_CMD[] = "finalize-response";
  24. static const char ABORT_CMD[] = "abort";
  25. static const char JOBGETID_CMD[] = "job-getid";
  26. static const char JOBGETIDRESP_CMD[] = "job-getid-response";
  27. static const char JOBCONNECT_CMD[] = "job-connect";
  28. static const char JOBCONNECTRESP_CMD[] = "job-connect-response";
  29. static const char JOBDISCONNECT_CMD[] = "job-disconnect";
  30. static const char JOBDISCONNECTRESP_CMD[] = "job-disconnect-response";
  31. static const char KVSPUT_CMD[] = "kvs-put";
  32. static const char KVSPUTRESP_CMD[] = "kvs-put-response";
  33. static const char KVSFENCE_CMD[] = "kvs-fence";
  34. static const char KVSFENCERESP_CMD[] = "kvs-fence-response";
  35. static const char KVSGET_CMD[] = "kvs-get";
  36. static const char KVSGETRESP_CMD[] = "kvs-get-response";
  37. static const char GETNODEATTR_CMD[] = "info-getnodeattr";
  38. static const char GETNODEATTRRESP_CMD[] = "info-getnodeattr-response";
  39. static const char PUTNODEATTR_CMD[] = "info-putnodeattr";
  40. static const char PUTNODEATTRRESP_CMD[] = "info-putnodeattr-response";
  41. static const char GETJOBATTR_CMD[] = "info-getjobattr";
  42. static const char GETJOBATTRRESP_CMD[] = "info-getjobattr-response";
  43. static const char NAMEPUBLISH_CMD[] = "name-publish";
  44. static const char NAMEPUBLISHRESP_CMD[] = "name-publish-response";
  45. static const char NAMEUNPUBLISH_CMD[] = "name-unpublish";
  46. static const char NAMEUNPUBLISHRESP_CMD[] = "name-unpublish-response";
  47. static const char NAMELOOKUP_CMD[] = "name-lookup";
  48. static const char NAMELOOKUPRESP_CMD[] = "name-lookup-response";
  49. static const char RING_CMD[] = "ring";
  50. static const char RINGRESP_CMD[] = "ring-response";
  51. static const char PMIJOBID_KEY[] = "pmijobid";
  52. static const char PMIRANK_KEY[] = "pmirank";
  53. static const char SRCID_KEY[] = "srcid";
  54. static const char THREADED_KEY[] = "threaded";
  55. static const char RC_KEY[] = "rc";
  56. static const char ERRMSG_KEY[] = "errmsg";
  57. static const char PMIVERSION_KEY[] = "pmi-version";
  58. static const char PMISUBVER_KEY[] = "pmi-subversion";
  59. static const char RANK_KEY[] = "rank";
  60. static const char SIZE_KEY[] = "size";
  61. static const char APPNUM_KEY[] = "appnum";
  62. static const char SPAWNERJOBID_KEY[] = "spawner-jobid";
  63. static const char DEBUGGED_KEY[] = "debugged";
  64. static const char PMIVERBOSE_KEY[] = "pmiverbose";
  65. static const char ISWORLD_KEY[] = "isworld";
  66. static const char MSG_KEY[] = "msg";
  67. static const char JOBID_KEY[] = "jobid";
  68. static const char KVSCOPY_KEY[] = "kvscopy";
  69. static const char KEY_KEY[] = "key";
  70. static const char VALUE_KEY[] = "value";
  71. static const char FOUND_KEY[] = "found";
  72. static const char WAIT_KEY[] = "wait";
  73. static const char NAME_KEY[] = "name";
  74. static const char PORT_KEY[] = "port";
  75. static const char THRID_KEY[] = "thrid";
  76. static const char INFOKEYCOUNT_KEY[] = "infokeycount";
  77. static const char INFOKEY_KEY[] = "infokey%d";
  78. static const char INFOVAL_KEY[] = "infoval%d";
  79. static const char RING_COUNT_KEY[] = "ring-count";
  80. static const char RING_LEFT_KEY[] = "ring-left";
  81. static const char RING_RIGHT_KEY[] = "ring-right";
  82. static const char TRUE_VAL[] = "TRUE";
  83. static const char FALSE_VAL[] = "FALSE";
  84. /* Local types */
  85. /* Parse commands are in this structure. Fields in this structure are
  86. dynamically allocated as necessary */
  87. typedef struct PMI2_Keyvalpair {
  88. const char *key;
  89. const char *value;
  90. int valueLen; /* Length of a value (values may contain nulls, so
  91. we need this) */
  92. int isCopy; /* The value is a copy (and will need to be freed)
  93. if this is true, otherwise,
  94. it is a null-terminated string in the original
  95. buffer */
  96. } PMI2_Keyvalpair;
  97. typedef struct PMI2_Command {
  98. int nPairs; /* Number of key=value pairs */
  99. char *command; /* Overall command buffer */
  100. PMI2_Keyvalpair **pairs; /* Array of pointers to pairs */
  101. int complete;
  102. } PMI2_Command;
  103. /*D
  104. PMI2_CONSTANTS - PMI2 definitions
  105. Error Codes:
  106. + PMI2_SUCCESS - operation completed successfully
  107. . PMI2_FAIL - operation failed
  108. . PMI2_ERR_NOMEM - input buffer not large enough
  109. . PMI2_ERR_INIT - PMI not initialized
  110. . PMI2_ERR_INVALID_ARG - invalid argument
  111. . PMI2_ERR_INVALID_KEY - invalid key argument
  112. . PMI2_ERR_INVALID_KEY_LENGTH - invalid key length argument
  113. . PMI2_ERR_INVALID_VAL - invalid val argument
  114. . PMI2_ERR_INVALID_VAL_LENGTH - invalid val length argument
  115. . PMI2_ERR_INVALID_LENGTH - invalid length argument
  116. . PMI2_ERR_INVALID_NUM_ARGS - invalid number of arguments
  117. . PMI2_ERR_INVALID_ARGS - invalid args argument
  118. . PMI2_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
  119. . PMI2_ERR_INVALID_KEYVALP - invalid keyvalp argument
  120. . PMI2_ERR_INVALID_SIZE - invalid size argument
  121. - PMI2_ERR_OTHER - other unspecified error
  122. D*/
  123. #define PMI2_SUCCESS 0
  124. #define PMI2_FAIL -1
  125. #define PMI2_ERR_INIT 1
  126. #define PMI2_ERR_NOMEM 2
  127. #define PMI2_ERR_INVALID_ARG 3
  128. #define PMI2_ERR_INVALID_KEY 4
  129. #define PMI2_ERR_INVALID_KEY_LENGTH 5
  130. #define PMI2_ERR_INVALID_VAL 6
  131. #define PMI2_ERR_INVALID_VAL_LENGTH 7
  132. #define PMI2_ERR_INVALID_LENGTH 8
  133. #define PMI2_ERR_INVALID_NUM_ARGS 9
  134. #define PMI2_ERR_INVALID_ARGS 10
  135. #define PMI2_ERR_INVALID_NUM_PARSED 11
  136. #define PMI2_ERR_INVALID_KEYVALP 12
  137. #define PMI2_ERR_INVALID_SIZE 13
  138. #define PMI2_ERR_OTHER 14
  139. /* This is here to allow spawn multiple functions to compile. This
  140. needs to be removed once those functions are fixed for pmi2 */
  141. /*
  142. typedef struct PMI_keyval_t
  143. {
  144. char * key;
  145. char * val;
  146. } PMI_keyval_t;
  147. */
  148. /*@
  149. PMI2_Connect_comm_t - connection structure used when connecting to other jobs
  150. Fields:
  151. + read - Read from a connection to the leader of the job to which
  152. this process will be connecting. Returns 0 on success or an MPI
  153. error code on failure.
  154. . write - Write to a connection to the leader of the job to which
  155. this process will be connecting. Returns 0 on success or an MPI
  156. error code on failure.
  157. . ctx - An anonymous pointer to data that may be used by the read
  158. and write members.
  159. - isMaster - Indicates which process is the "master"; may have the
  160. values 1 (is the master), 0 (is not the master), or -1 (neither is
  161. designated as the master). The two processes must agree on which
  162. process is the master, or both must select -1 (neither is the
  163. master).
  164. Notes:
  165. A typical implementation of these functions will use the read and
  166. write calls on a pre-established file descriptor (fd) between the
  167. two leading processes. This will be needed only if the PMI server
  168. cannot access the KVS spaces of another job (this may happen, for
  169. example, if each mpiexec creates the KVS spaces for the processes
  170. that it manages).
  171. @*/
  172. typedef struct PMI2_Connect_comm {
  173. int (*read)( void *buf, int maxlen, void *ctx );
  174. int (*write)( const void *buf, int len, void *ctx );
  175. void *ctx;
  176. int isMaster;
  177. } PMI2_Connect_comm_t;
  178. /*S
  179. MPID_Info - Structure of an MPID info
  180. Notes:
  181. There is no reference count because 'MPI_Info' values, unlike other MPI
  182. objects, may be changed after they are passed to a routine without
  183. changing the routine''s behavior. In other words, any routine that uses
  184. an 'MPI_Info' object must make a copy or otherwise act on any info value
  185. that it needs.
  186. A linked list is used because the typical 'MPI_Info' list will be short
  187. and a simple linked list is easy to implement and to maintain. Similarly,
  188. a single structure rather than separate header and element structures are
  189. defined for simplicity. No separate thread lock is provided because
  190. info routines are not performance critical; they may use the single
  191. critical section lock in the 'MPIR_Process' structure when they need a
  192. thread lock.
  193. This particular form of linked list (in particular, with this particular
  194. choice of the first two members) is used because it allows us to use
  195. the same routines to manage this list as are used to manage the
  196. list of free objects (in the file 'src/util/mem/handlemem.c'). In
  197. particular, if lock-free routines for updating a linked list are
  198. provided, they can be used for managing the 'MPID_Info' structure as well.
  199. The MPI standard requires that keys can be no less that 32 characters and
  200. no more than 255 characters. There is no mandated limit on the size
  201. of values.
  202. Module:
  203. Info-DS
  204. S*/
  205. typedef struct MPID_Info {
  206. int handle;
  207. int pobj_mutex;
  208. int ref_count;
  209. struct MPID_Info *next;
  210. char *key;
  211. char *value;
  212. } MPID_Info;
  213. #define PMI2U_Info MPID_Info
  214. /*@
  215. PMI2_Init - initialize the Process Manager Interface
  216. Output Parameter:
  217. + spawned - spawned flag
  218. . size - number of processes in the job
  219. . rank - rank of this process in the job
  220. - appnum - which executable is this on the mpiexec commandline
  221. Return values:
  222. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  223. Notes:
  224. Initialize PMI for this process group. The value of spawned indicates whether
  225. this process was created by 'PMI2_Spawn_multiple'. 'spawned' will be non-zero
  226. iff this process group has a parent.
  227. @*/
  228. int PMI2_Init(int *spawned, int *size, int *rank, int *appnum);
  229. /*@
  230. PMI2_Finalize - finalize the Process Manager Interface
  231. Return values:
  232. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  233. Notes:
  234. Finalize PMI for this job.
  235. @*/
  236. int PMI2_Finalize(void);
  237. /*@
  238. PMI2_Initialized - check if PMI has been initialized
  239. Return values:
  240. Non-zero if PMI2_Initialize has been called successfully, zero otherwise.
  241. @*/
  242. int PMI2_Initialized(void);
  243. /*@
  244. PMI2_Abort - abort the process group associated with this process
  245. Input Parameters:
  246. + flag - non-zero if all processes in this job should abort, zero otherwise
  247. - error_msg - error message to be printed
  248. Return values:
  249. If the abort succeeds this function will not return. Returns an MPI
  250. error code otherwise.
  251. @*/
  252. int PMI2_Abort(int flag, const char msg[]);
  253. /*@
  254. PMI2_Spawn - spawn a new set of processes
  255. Input Parameters:
  256. + count - count of commands
  257. . cmds - array of command strings
  258. . argcs - size of argv arrays for each command string
  259. . argvs - array of argv arrays for each command string
  260. . maxprocs - array of maximum processes to spawn for each command string
  261. . info_keyval_sizes - array giving the number of elements in each of the
  262. 'info_keyval_vectors'
  263. . info_keyval_vectors - array of keyval vector arrays
  264. . preput_keyval_size - Number of elements in 'preput_keyval_vector'
  265. . preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space
  266. - jobIdSize - size of the buffer provided in jobId
  267. Output Parameter:
  268. + jobId - job id of the spawned processes
  269. - errors - array of errors for each command
  270. Return values:
  271. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  272. Notes:
  273. This function spawns a set of processes into a new job. The 'count'
  274. field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs',
  275. 'info_keyval_sizes' and 'info_keyval_vectors'. The 'preput_keyval_size' refers
  276. to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector'
  277. contains keyval pairs that will be put in the keyval space of the newly
  278. created job before the processes are started. The 'maxprocs' array
  279. specifies the desired number of processes to create for each 'cmd' string.
  280. The actual number of processes may be less than the numbers specified in
  281. maxprocs. The acceptable number of processes spawned may be controlled by
  282. ``soft'' keyvals in the info arrays. The ``soft'' option is specified by
  283. mpiexec in the MPI-2 standard. Environment variables may be passed to the
  284. spawned processes through PMI implementation specific 'info_keyval' parameters.
  285. @*/
  286. int PMI2_Job_Spawn(int count, const char * cmds[],
  287. int argcs[], const char ** argvs[],
  288. const int maxprocs[],
  289. const int info_keyval_sizes[],
  290. const struct MPID_Info *info_keyval_vectors[],
  291. int preput_keyval_size,
  292. const struct MPID_Info *preput_keyval_vector[],
  293. char jobId[], int jobIdSize,
  294. int errors[]);
  295. /*@
  296. PMI2_Job_GetId - get job id of this job
  297. Input parameters:
  298. . jobid_size - size of buffer provided in jobid
  299. Output parameters:
  300. . jobid - the job id of this job
  301. Return values:
  302. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  303. @*/
  304. int PMI2_Job_GetId(char jobid[], int jobid_size);
  305. /*@
  306. PMI2_Job_GetRank - get rank of this job
  307. Output parameters:
  308. . rank - the rank of this job
  309. Return values:
  310. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
  311. @*/
  312. int PMI2_Job_GetRank(int* rank);
  313. /*@
  314. PMI2_Info_GetSize - get the number of processes on the node
  315. Output parameters:
  316. . size - the number of processes on the node
  317. Return values:
  318. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
  319. @*/
  320. int PMI2_Info_GetSize(int* size);
  321. /*@
  322. PMI2_Job_Connect - connect to the parallel job with ID jobid
  323. Input parameters:
  324. . jobid - job id of the job to connect to
  325. Output parameters:
  326. . conn - connection structure used to establish communication with
  327. the remote job
  328. Return values:
  329. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  330. Notes:
  331. This just "registers" the other parallel job as part of a parallel
  332. program, and is used in the PMI2_KVS_xxx routines (see below). This
  333. is not a collective call and establishes a connection between all
  334. processes that are connected to the calling processes (on the one
  335. side) and that are connected to the named jobId on the other
  336. side. Processes that are already connected may call this routine.
  337. @*/
  338. int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn);
  339. /*@
  340. PMI2_Job_Disconnect - disconnects from the job with ID jobid
  341. Input parameters:
  342. . jobid - job id of the job to connect to
  343. Return values:
  344. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  345. @*/
  346. int PMI2_Job_Disconnect(const char jobid[]);
  347. /*@
  348. PMIX_Ring - execute ring exchange over processes in group
  349. Input Parameters:
  350. + value - input string
  351. - maxvalue - max size of input and output strings
  352. Output Parameters:
  353. + rank - returns caller's rank within ring
  354. . ranks - returns number of procs within ring
  355. . left - buffer to receive value provided by (rank - 1) % ranks
  356. - right - buffer to receive value provided by (rank + 1) % ranks
  357. Return values:
  358. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  359. Notes:
  360. This function is collective, but not necessarily synchronous,
  361. across all processes in the process group to which the calling
  362. process belongs. All processes in the group must call this
  363. function, but a process may return before all processes have called
  364. the function.
  365. The rank of a process within the ring may not be the same as its
  366. rank returned by PMI2_Init.
  367. For a process group consisting of a single process, this function
  368. returns rank=0, ranks=1, and the input string in the value buffer
  369. shall be copied to the left and right output buffers. This same
  370. behavior holds when the function is called in singleton mode.
  371. @*/
  372. #define HAVE_PMIX_RING 1 /* so one can conditionally compile with this function */
  373. int PMIX_Ring(const char value[], int *rank, int *ranks, char left[], char right[], int maxvalue);
  374. /*@
  375. PMI2_KVS_Put - put a key/value pair in the keyval space for this job
  376. Input Parameters:
  377. + key - key
  378. - value - value
  379. Return values:
  380. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  381. Notes:
  382. If multiple PMI2_KVS_Put calls are made with the same key between
  383. calls to PMI2_KVS_Fence, the behavior is undefined. That is, the
  384. value returned by PMI2_KVS_Get for that key after the PMI2_KVS_Fence
  385. is not defined.
  386. @*/
  387. int PMI2_KVS_Put(const char key[], const char value[]);
  388. /*@
  389. PMI2_KVS_Fence - commit all PMI2_KVS_Put calls made before this fence
  390. Return values:
  391. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  392. Notes:
  393. This is a collective call across the job. It has semantics that are
  394. similar to those for MPI_Win_fence and hence is most easily
  395. implemented as a barrier across all of the processes in the job.
  396. Specifically, all PMI2_KVS_Put operations performed by any process in
  397. the same job must be visible to all processes (by using PMI2_KVS_Get)
  398. after PMI2_KVS_Fence completes. However, a PMI implementation could
  399. make this a lazy operation by not waiting for all processes to enter
  400. their corresponding PMI2_KVS_Fence until some process issues a
  401. PMI2_KVS_Get. This might be appropriate for some wide-area
  402. implementations.
  403. @*/
  404. int PMI2_KVS_Fence(void);
  405. /*@
  406. PMI2_KVS_Get - returns the value associated with key in the key-value
  407. space associated with the job ID jobid
  408. Input Parameters:
  409. + jobid - the job id identifying the key-value space in which to look
  410. for key. If jobid is NULL, look in the key-value space of this job.
  411. . src_pmi_id - the pmi id of the process which put this keypair. This
  412. is just a hint to the server. PMI2_ID_NULL should be passed if no
  413. hint is provided.
  414. . key - key
  415. - maxvalue - size of the buffer provided in value
  416. Output Parameters:
  417. + value - value associated with key
  418. - vallen - length of the returned value, or, if the length is longer
  419. than maxvalue, the negative of the required length is returned
  420. Return values:
  421. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  422. @*/
  423. int PMI2_KVS_Get(const char *jobid, int src_pmi_id, const char key[], char value [], int maxvalue, int *vallen);
  424. /*@
  425. PMI2_Info_GetNodeAttr - returns the value of the attribute associated
  426. with this node
  427. Input Parameters:
  428. + name - name of the node attribute
  429. . valuelen - size of the buffer provided in value
  430. - waitfor - if non-zero, the function will not return until the
  431. attribute is available
  432. Output Parameters:
  433. + value - value of the attribute
  434. - found - non-zero indicates that the attribute was found
  435. Return values:
  436. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  437. Notes:
  438. This provides a way, when combined with PMI2_Info_PutNodeAttr, for
  439. processes on the same node to share information without requiring a
  440. more general barrier across the entire job.
  441. If waitfor is non-zero, the function will never return with found
  442. set to zero.
  443. Predefined attributes:
  444. + memPoolType - If the process manager allocated a shared memory
  445. pool for the MPI processes in this job and on this node, return
  446. the type of that pool. Types include sysv, anonmmap and ntshm.
  447. . memSYSVid - Return the SYSV memory segment id if the memory pool
  448. type is sysv. Returned as a string.
  449. . memAnonMMAPfd - Return the FD of the anonymous mmap segment. The
  450. FD is returned as a string.
  451. - memNTName - Return the name of the Windows NT shared memory
  452. segment, file mapping object backed by system paging
  453. file. Returned as a string.
  454. @*/
  455. int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *found, int waitfor);
  456. /*@
  457. PMI2_Info_GetNodeAttrIntArray - returns the value of the attribute associated
  458. with this node. The value must be an array of integers.
  459. Input Parameters:
  460. + name - name of the node attribute
  461. - arraylen - number of elements in array
  462. Output Parameters:
  463. + array - value of attribute
  464. . outlen - number of elements returned
  465. - found - non-zero if attribute was found
  466. Return values:
  467. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  468. Notes:
  469. Notice that, unlike PMI2_Info_GetNodeAttr, this function does not
  470. have a waitfor parameter, and will return immediately with found=0
  471. if the attribute was not found.
  472. Predefined array attribute names:
  473. + localRanksCount - Return the number of local ranks that will be
  474. returned by the key localRanks.
  475. . localRanks - Return the ranks in MPI_COMM_WORLD of the processes
  476. that are running on this node.
  477. - cartCoords - Return the Cartesian coordinates of this process in
  478. the underlying network topology. The coordinates are indexed from
  479. zero. Value only if the Job attribute for physTopology includes
  480. cartesian.
  481. @*/
  482. int PMI2_Info_GetNodeAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found);
  483. /*@
  484. PMI2_Info_PutNodeAttr - stores the value of the named attribute
  485. associated with this node
  486. Input Parameters:
  487. + name - name of the node attribute
  488. - value - the value of the attribute
  489. Return values:
  490. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  491. Notes:
  492. For example, it might be used to share segment ids with other
  493. processes on the same SMP node.
  494. @*/
  495. int PMI2_Info_PutNodeAttr(const char name[], const char value[]);
  496. /*@
  497. PMI2_Info_GetJobAttr - returns the value of the attribute associated
  498. with this job
  499. Input Parameters:
  500. + name - name of the job attribute
  501. - valuelen - size of the buffer provided in value
  502. Output Parameters:
  503. + value - value of the attribute
  504. - found - non-zero indicates that the attribute was found
  505. Return values:
  506. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  507. @*/
  508. int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *found);
  509. /*@
  510. PMI2_Info_GetJobAttrIntArray - returns the value of the attribute associated
  511. with this job. The value must be an array of integers.
  512. Input Parameters:
  513. + name - name of the job attribute
  514. - arraylen - number of elements in array
  515. Output Parameters:
  516. + array - value of attribute
  517. . outlen - number of elements returned
  518. - found - non-zero if attribute was found
  519. Return values:
  520. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  521. Predefined array attribute names:
  522. + universeSize - The size of the "universe" (defined for the MPI
  523. attribute MPI_UNIVERSE_SIZE
  524. . hasNameServ - The value hasNameServ is true if the PMI2 environment
  525. supports the name service operations (publish, lookup, and
  526. unpublish).
  527. . physTopology - Return the topology of the underlying network. The
  528. valid topology types include cartesian, hierarchical, complete,
  529. kautz, hypercube; additional types may be added as necessary. If
  530. the type is hierarchical, then additional attributes may be
  531. queried to determine the details of the topology. For example, a
  532. typical cluster has a hierarchical physical topology, consisting
  533. of two levels of complete networks - the switched Ethernet or
  534. Infiniband and the SMP nodes. Other systems, such as IBM BlueGene,
  535. have one level that is cartesian (and in virtual node mode, have a
  536. single-level physical topology).
  537. . physTopologyLevels - Return a string describing the topology type
  538. for each level of the underlying network. Only valid if the
  539. physTopology is hierarchical. The value is a comma-separated list
  540. of physical topology types (except for hierarchical). The levels
  541. are ordered starting at the top, with the network closest to the
  542. processes last. The lower level networks may connect only a subset
  543. of processes. For example, for a cartesian mesh of SMPs, the value
  544. is cartesian,complete. All processes are connected by the
  545. cartesian part of this, but for each complete network, only the
  546. processes on the same node are connected.
  547. . cartDims - Return a string of comma-separated values describing
  548. the dimensions of the Cartesian topology. This must be consistent
  549. with the value of cartCoords that may be returned by
  550. PMI2_Info_GetNodeAttrIntArray.
  551. These job attributes are just a start, but they provide both an
  552. example of the sort of external data that is available through the
  553. PMI interface and how extensions can be added within the same API
  554. and wire protocol. For example, adding more complex network
  555. topologies requires only adding new keys, not new routines.
  556. . isHeterogeneous - The value isHeterogeneous is true if the
  557. processes belonging to the job are running on nodes with different
  558. underlying data models.
  559. @*/
  560. int PMI2_Info_GetJobAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found);
  561. /*@
  562. PMI2_Nameserv_publish - publish a name
  563. Input parameters:
  564. + service_name - string representing the service being published
  565. . info_ptr -
  566. - port - string representing the port on which to contact the service
  567. Return values:
  568. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  569. @*/
  570. int PMI2_Nameserv_publish(const char service_name[], const struct MPID_Info *info_ptr, const char port[]);
  571. /*@
  572. PMI2_Nameserv_lookup - lookup a service by name
  573. Input parameters:
  574. + service_name - string representing the service being published
  575. . info_ptr -
  576. - portLen - size of buffer provided in port
  577. Output parameters:
  578. . port - string representing the port on which to contact the service
  579. Return values:
  580. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  581. @*/
  582. int PMI2_Nameserv_lookup(const char service_name[], const struct MPID_Info *info_ptr,
  583. char port[], int portLen);
  584. /*@
  585. PMI2_Nameserv_unpublish - unpublish a name
  586. Input parameters:
  587. + service_name - string representing the service being unpublished
  588. - info_ptr -
  589. Return values:
  590. Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
  591. @*/
  592. int PMI2_Nameserv_unpublish(const char service_name[],
  593. const struct MPID_Info *info_ptr);
  594. #if defined(__cplusplus)
  595. }
  596. #endif
  597. #endif /* PMI2_H_INCLUDED */