Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /* -*- Mode: C; c-basic-offset:4 ; -*- */
0002 /*
0003  *  (C) 2007 by Argonne National Laboratory.
0004  *      See COPYRIGHT in top-level directory.
0005  */
0006 
0007 #ifndef PMI2_H_INCLUDED
0008 #define PMI2_H_INCLUDED
0009 
0010 #ifndef USE_PMI2_API
0011 /*#error This header file defines the PMI2 API, but PMI2 was not selected*/
0012 #endif
0013 
0014 #define PMI2_MAX_KEYLEN 64
0015 #define PMI2_MAX_VALLEN 1024
0016 #define PMI2_MAX_ATTRVALUE 1024
0017 #define PMI2_ID_NULL -1
0018 
0019 #define PMII_COMMANDLEN_SIZE 6
0020 #define PMII_MAX_COMMAND_LEN (64*1024)
0021 
0022 #if defined(__cplusplus)
0023 extern "C" {
0024 #endif
0025 
0026 static const char FULLINIT_CMD[]          = "fullinit";
0027 static const char FULLINITRESP_CMD[]      = "fullinit-response";
0028 static const char FINALIZE_CMD[]          = "finalize";
0029 static const char FINALIZERESP_CMD[]      = "finalize-response";
0030 static const char ABORT_CMD[]             = "abort";
0031 static const char JOBGETID_CMD[]          = "job-getid";
0032 static const char JOBGETIDRESP_CMD[]      = "job-getid-response";
0033 static const char JOBCONNECT_CMD[]        = "job-connect";
0034 static const char JOBCONNECTRESP_CMD[]    = "job-connect-response";
0035 static const char JOBDISCONNECT_CMD[]     = "job-disconnect";
0036 static const char JOBDISCONNECTRESP_CMD[] = "job-disconnect-response";
0037 static const char KVSPUT_CMD[]            = "kvs-put";
0038 static const char KVSPUTRESP_CMD[]        = "kvs-put-response";
0039 static const char KVSFENCE_CMD[]          = "kvs-fence";
0040 static const char KVSFENCERESP_CMD[]      = "kvs-fence-response";
0041 static const char KVSGET_CMD[]            = "kvs-get";
0042 static const char KVSGETRESP_CMD[]        = "kvs-get-response";
0043 static const char GETNODEATTR_CMD[]       = "info-getnodeattr";
0044 static const char GETNODEATTRRESP_CMD[]   = "info-getnodeattr-response";
0045 static const char PUTNODEATTR_CMD[]       = "info-putnodeattr";
0046 static const char PUTNODEATTRRESP_CMD[]   = "info-putnodeattr-response";
0047 static const char GETJOBATTR_CMD[]        = "info-getjobattr";
0048 static const char GETJOBATTRRESP_CMD[]    = "info-getjobattr-response";
0049 static const char NAMEPUBLISH_CMD[]       = "name-publish";
0050 static const char NAMEPUBLISHRESP_CMD[]   = "name-publish-response";
0051 static const char NAMEUNPUBLISH_CMD[]     = "name-unpublish";
0052 static const char NAMEUNPUBLISHRESP_CMD[] = "name-unpublish-response";
0053 static const char NAMELOOKUP_CMD[]        = "name-lookup";
0054 static const char NAMELOOKUPRESP_CMD[]    = "name-lookup-response";
0055 static const char RING_CMD[]              = "ring";
0056 static const char RINGRESP_CMD[]          = "ring-response";
0057 
0058 static const char PMIJOBID_KEY[]          = "pmijobid";
0059 static const char PMIRANK_KEY[]           = "pmirank";
0060 static const char SRCID_KEY[]             = "srcid";
0061 static const char THREADED_KEY[]          = "threaded";
0062 static const char RC_KEY[]                = "rc";
0063 static const char ERRMSG_KEY[]            = "errmsg";
0064 static const char PMIVERSION_KEY[]        = "pmi-version";
0065 static const char PMISUBVER_KEY[]         = "pmi-subversion";
0066 static const char RANK_KEY[]              = "rank";
0067 static const char SIZE_KEY[]              = "size";
0068 static const char APPNUM_KEY[]            = "appnum";
0069 static const char SPAWNERJOBID_KEY[]      = "spawner-jobid";
0070 static const char DEBUGGED_KEY[]          = "debugged";
0071 static const char PMIVERBOSE_KEY[]        = "pmiverbose";
0072 static const char ISWORLD_KEY[]           = "isworld";
0073 static const char MSG_KEY[]               = "msg";
0074 static const char JOBID_KEY[]             = "jobid";
0075 static const char KVSCOPY_KEY[]           = "kvscopy";
0076 static const char KEY_KEY[]               = "key";
0077 static const char VALUE_KEY[]             = "value";
0078 static const char FOUND_KEY[]             = "found";
0079 static const char WAIT_KEY[]              = "wait";
0080 static const char NAME_KEY[]              = "name";
0081 static const char PORT_KEY[]              = "port";
0082 static const char THRID_KEY[]             = "thrid";
0083 static const char INFOKEYCOUNT_KEY[]      = "infokeycount";
0084 static const char INFOKEY_KEY[]           = "infokey%d";
0085 static const char INFOVAL_KEY[]           = "infoval%d";
0086 static const char RING_COUNT_KEY[]        = "ring-count";
0087 static const char RING_LEFT_KEY[]         = "ring-left";
0088 static const char RING_RIGHT_KEY[]        = "ring-right";
0089 
0090 static const char TRUE_VAL[]              = "TRUE";
0091 static const char FALSE_VAL[]             = "FALSE";
0092 
0093 /* Local types */
0094 
0095 /* Parse commands are in this structure.  Fields in this structure are
0096    dynamically allocated as necessary */
0097 typedef struct PMI2_Keyvalpair {
0098     const char *key;
0099     const char *value;
0100     int         valueLen;  /* Length of a value (values may contain nulls, so
0101                               we need this) */
0102     int         isCopy;    /* The value is a copy (and will need to be freed)
0103                               if this is true, otherwise,
0104                               it is a null-terminated string in the original
0105                               buffer */
0106 } PMI2_Keyvalpair;
0107 
0108 typedef struct PMI2_Command {
0109     int               nPairs;   /* Number of key=value pairs */
0110     char             *command;  /* Overall command buffer */
0111     PMI2_Keyvalpair **pairs;    /* Array of pointers to pairs */
0112     int               complete;
0113 } PMI2_Command;
0114 
0115 
0116 /*D
0117 PMI2_CONSTANTS - PMI2 definitions
0118 
0119 Error Codes:
0120 + PMI2_SUCCESS - operation completed successfully
0121 . PMI2_FAIL - operation failed
0122 . PMI2_ERR_NOMEM - input buffer not large enough
0123 . PMI2_ERR_INIT - PMI not initialized
0124 . PMI2_ERR_INVALID_ARG - invalid argument
0125 . PMI2_ERR_INVALID_KEY - invalid key argument
0126 . PMI2_ERR_INVALID_KEY_LENGTH - invalid key length argument
0127 . PMI2_ERR_INVALID_VAL - invalid val argument
0128 . PMI2_ERR_INVALID_VAL_LENGTH - invalid val length argument
0129 . PMI2_ERR_INVALID_LENGTH - invalid length argument
0130 . PMI2_ERR_INVALID_NUM_ARGS - invalid number of arguments
0131 . PMI2_ERR_INVALID_ARGS - invalid args argument
0132 . PMI2_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
0133 . PMI2_ERR_INVALID_KEYVALP - invalid keyvalp argument
0134 . PMI2_ERR_INVALID_SIZE - invalid size argument
0135 - PMI2_ERR_OTHER - other unspecified error
0136 
0137 D*/
0138 #define PMI2_SUCCESS                0
0139 #define PMI2_FAIL                   -1
0140 #define PMI2_ERR_INIT               1
0141 #define PMI2_ERR_NOMEM              2
0142 #define PMI2_ERR_INVALID_ARG        3
0143 #define PMI2_ERR_INVALID_KEY        4
0144 #define PMI2_ERR_INVALID_KEY_LENGTH 5
0145 #define PMI2_ERR_INVALID_VAL        6
0146 #define PMI2_ERR_INVALID_VAL_LENGTH 7
0147 #define PMI2_ERR_INVALID_LENGTH     8
0148 #define PMI2_ERR_INVALID_NUM_ARGS   9
0149 #define PMI2_ERR_INVALID_ARGS       10
0150 #define PMI2_ERR_INVALID_NUM_PARSED 11
0151 #define PMI2_ERR_INVALID_KEYVALP    12
0152 #define PMI2_ERR_INVALID_SIZE       13
0153 #define PMI2_ERR_OTHER              14
0154 
0155 /* This is here to allow spawn multiple functions to compile.  This
0156    needs to be removed once those functions are fixed for pmi2 */
0157 /*
0158 typedef struct PMI_keyval_t
0159 {
0160     char * key;
0161     char * val;
0162 } PMI_keyval_t;
0163 */
0164 
0165 /*@
0166   PMI2_Connect_comm_t - connection structure used when connecting to other jobs
0167 
0168   Fields:
0169   + read - Read from a connection to the leader of the job to which
0170     this process will be connecting. Returns 0 on success or an MPI
0171     error code on failure.
0172   . write - Write to a connection to the leader of the job to which
0173     this process will be connecting. Returns 0 on success or an MPI
0174     error code on failure.
0175   . ctx - An anonymous pointer to data that may be used by the read
0176     and write members.
0177   - isMaster - Indicates which process is the "master"; may have the
0178     values 1 (is the master), 0 (is not the master), or -1 (neither is
0179     designated as the master). The two processes must agree on which
0180     process is the master, or both must select -1 (neither is the
0181     master).
0182 
0183   Notes:
0184   A typical implementation of these functions will use the read and
0185   write calls on a pre-established file descriptor (fd) between the
0186   two leading processes. This will be needed only if the PMI server
0187   cannot access the KVS spaces of another job (this may happen, for
0188   example, if each mpiexec creates the KVS spaces for the processes
0189   that it manages).
0190   
0191 @*/
0192 typedef struct PMI2_Connect_comm {
0193     int (*read)( void *buf, int maxlen, void *ctx );
0194     int (*write)( const void *buf, int len, void *ctx );
0195     void *ctx;
0196     int  isMaster;
0197 } PMI2_Connect_comm_t;
0198 
0199 
0200 /*S
0201   MPID_Info - Structure of an MPID info
0202 
0203   Notes:
0204   There is no reference count because 'MPI_Info' values, unlike other MPI
0205   objects, may be changed after they are passed to a routine without
0206   changing the routine''s behavior.  In other words, any routine that uses
0207   an 'MPI_Info' object must make a copy or otherwise act on any info value
0208   that it needs.
0209 
0210   A linked list is used because the typical 'MPI_Info' list will be short
0211   and a simple linked list is easy to implement and to maintain.  Similarly,
0212   a single structure rather than separate header and element structures are
0213   defined for simplicity.  No separate thread lock is provided because
0214   info routines are not performance critical; they may use the single
0215   critical section lock in the 'MPIR_Process' structure when they need a
0216   thread lock.
0217 
0218   This particular form of linked list (in particular, with this particular
0219   choice of the first two members) is used because it allows us to use
0220   the same routines to manage this list as are used to manage the
0221   list of free objects (in the file 'src/util/mem/handlemem.c').  In
0222   particular, if lock-free routines for updating a linked list are
0223   provided, they can be used for managing the 'MPID_Info' structure as well.
0224 
0225   The MPI standard requires that keys can be no less that 32 characters and
0226   no more than 255 characters.  There is no mandated limit on the size
0227   of values.
0228 
0229   Module:
0230   Info-DS
0231   S*/
0232 typedef struct MPID_Info {
0233     int                 handle;
0234     int                 pobj_mutex;
0235     int                 ref_count;
0236     struct MPID_Info    *next;
0237     char                *key;
0238     char                *value;
0239 } MPID_Info;
0240 
0241 #define PMI2U_Info MPID_Info
0242 
0243 /*@
0244   PMI2_Init - initialize the Process Manager Interface
0245 
0246   Output Parameter:
0247   + spawned - spawned flag
0248   . size - number of processes in the job
0249   . rank - rank of this process in the job
0250   - appnum - which executable is this on the mpiexec commandline
0251   
0252   Return values:
0253   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0254   
0255   Notes:
0256   Initialize PMI for this process group. The value of spawned indicates whether
0257   this process was created by 'PMI2_Spawn_multiple'.  'spawned' will be non-zero
0258   iff this process group has a parent.
0259 
0260 @*/
0261 int PMI2_Init(int *spawned, int *size, int *rank, int *appnum);
0262 
0263 /*@
0264   PMI2_Finalize - finalize the Process Manager Interface
0265   
0266   Return values:
0267   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0268   
0269   Notes:
0270   Finalize PMI for this job.
0271   
0272 @*/
0273 int PMI2_Finalize(void);
0274 
0275 /*@
0276   PMI2_Initialized - check if PMI has been initialized
0277 
0278   Return values:
0279   Non-zero if PMI2_Initialize has been called successfully, zero otherwise.
0280   
0281 @*/
0282 int PMI2_Initialized(void);
0283 
0284 /*@
0285   PMI2_Abort - abort the process group associated with this process
0286   
0287   Input Parameters:
0288   + flag - non-zero if all processes in this job should abort, zero otherwise
0289   - error_msg - error message to be printed
0290   
0291   Return values:
0292   If the abort succeeds this function will not return.  Returns an MPI
0293   error code otherwise.
0294 
0295 @*/
0296 int PMI2_Abort(int flag, const char msg[]);
0297 
0298 /*@
0299   PMI2_Spawn - spawn a new set of processes
0300 
0301   Input Parameters:
0302   + count - count of commands
0303   . cmds - array of command strings
0304   . argcs - size of argv arrays for each command string
0305   . argvs - array of argv arrays for each command string
0306   . maxprocs - array of maximum processes to spawn for each command string
0307   . info_keyval_sizes - array giving the number of elements in each of the 
0308     'info_keyval_vectors'
0309   . info_keyval_vectors - array of keyval vector arrays
0310   . preput_keyval_size - Number of elements in 'preput_keyval_vector'
0311   . preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space
0312   - jobIdSize - size of the buffer provided in jobId
0313 
0314   Output Parameter:
0315   + jobId - job id of the spawned processes
0316   - errors - array of errors for each command
0317 
0318   Return values:
0319   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0320 
0321   Notes:
0322   This function spawns a set of processes into a new job.  The 'count'
0323   field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs',
0324   'info_keyval_sizes' and 'info_keyval_vectors'.  The 'preput_keyval_size' refers
0325   to the size of the 'preput_keyval_vector' array.  The 'preput_keyval_vector'
0326   contains keyval pairs that will be put in the keyval space of the newly
0327   created job before the processes are started.  The 'maxprocs' array
0328   specifies the desired number of processes to create for each 'cmd' string.  
0329   The actual number of processes may be less than the numbers specified in
0330   maxprocs.  The acceptable number of processes spawned may be controlled by
0331   ``soft'' keyvals in the info arrays.  The ``soft'' option is specified by
0332   mpiexec in the MPI-2 standard.  Environment variables may be passed to the
0333   spawned processes through PMI implementation specific 'info_keyval' parameters.
0334 @*/
0335 int PMI2_Job_Spawn(int count, const char * cmds[],
0336                    int argcs[], const char ** argvs[],
0337                    const int maxprocs[],
0338                    const int info_keyval_sizes[],
0339                    const struct MPID_Info *info_keyval_vectors[],
0340                    int preput_keyval_size,
0341                    const struct MPID_Info *preput_keyval_vector[],
0342                    char jobId[], int jobIdSize,
0343                    int errors[]);
0344 
0345 
0346 /*@
0347   PMI2_Job_GetId - get job id of this job 
0348 
0349   Input parameters:
0350   . jobid_size - size of buffer provided in jobid
0351 
0352   Output parameters:
0353   . jobid - the job id of this job
0354   
0355   Return values:
0356   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0357 
0358 @*/
0359 int PMI2_Job_GetId(char jobid[], int jobid_size);
0360 
0361 /*@
0362   PMI2_Job_GetRank - get rank of this job
0363 
0364   Output parameters:
0365   . rank - the rank of this job
0366 
0367   Return values:
0368   Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
0369 
0370 @*/
0371 int PMI2_Job_GetRank(int* rank);
0372 
0373 /*@
0374   PMI2_Info_GetSize - get the number of processes on the node
0375 
0376   Output parameters:
0377   . size - the number of processes on the node
0378 
0379   Return values:
0380   Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
0381 @*/
0382 int PMI2_Info_GetSize(int* size);
0383 
0384 /*@
0385   PMI2_Job_Connect - connect to the parallel job with ID jobid
0386 
0387   Input parameters:
0388   . jobid - job id of the job to connect to
0389 
0390   Output parameters:
0391   . conn - connection structure used to establish communication with
0392     the remote job
0393   
0394   Return values:
0395   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0396 
0397   Notes:
0398   This just "registers" the other parallel job as part of a parallel
0399   program, and is used in the PMI2_KVS_xxx routines (see below). This
0400   is not a collective call and establishes a connection between all
0401   processes that are connected to the calling processes (on the one
0402   side) and that are connected to the named jobId on the other
0403   side. Processes that are already connected may call this routine.
0404 
0405 @*/
0406 int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn);
0407 
0408 /*@
0409   PMI2_Job_Disconnect - disconnects from the job with ID jobid
0410 
0411   Input parameters:
0412   . jobid - job id of the job to connect to
0413 
0414   Return values:
0415   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0416 
0417 @*/
0418 int PMI2_Job_Disconnect(const char jobid[]);
0419 
0420 /*@
0421   PMIX_Ring - execute ring exchange over processes in group
0422 
0423   Input Parameters:
0424   + value    - input string
0425   - maxvalue - max size of input and output strings
0426  
0427   Output Parameters:
0428   + rank  - returns caller's rank within ring
0429   . ranks - returns number of procs within ring
0430   . left  - buffer to receive value provided by (rank - 1) % ranks
0431   - right - buffer to receive value provided by (rank + 1) % ranks
0432  
0433   Return values:
0434   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0435  
0436   Notes:
0437   This function is collective, but not necessarily synchronous,
0438   across all processes in the process group to which the calling
0439   process belongs.  All processes in the group must call this
0440   function, but a process may return before all processes have called
0441   the function.
0442 
0443   The rank of a process within the ring may not be the same as its
0444   rank returned by PMI2_Init.
0445 
0446   For a process group consisting of a single process, this function
0447   returns rank=0, ranks=1, and the input string in the value buffer
0448   shall be copied to the left and right output buffers.  This same
0449   behavior holds when the function is called in singleton mode.
0450 
0451 @*/
0452 #define HAVE_PMIX_RING 1 /* so one can conditionally compile with this function */
0453 int PMIX_Ring(const char value[], int *rank, int *ranks, char left[], char right[], int maxvalue);
0454 
0455 /*@
0456   PMI2_KVS_Put - put a key/value pair in the keyval space for this job
0457 
0458   Input Parameters:
0459   + key - key
0460   - value - value
0461   
0462   Return values:
0463   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0464 
0465   Notes:
0466   If multiple PMI2_KVS_Put calls are made with the same key between
0467   calls to PMI2_KVS_Fence, the behavior is undefined. That is, the
0468   value returned by PMI2_KVS_Get for that key after the PMI2_KVS_Fence
0469   is not defined.
0470 
0471 @*/
0472 int PMI2_KVS_Put(const char key[], const char value[]);
0473 /*@
0474   PMI2_KVS_Fence - commit all PMI2_KVS_Put calls made before this fence
0475 
0476   Return values:
0477   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0478 
0479   Notes:
0480   This is a collective call across the job.  It has semantics that are
0481   similar to those for MPI_Win_fence and hence is most easily
0482   implemented as a barrier across all of the processes in the job.
0483   Specifically, all PMI2_KVS_Put operations performed by any process in
0484   the same job must be visible to all processes (by using PMI2_KVS_Get)
0485   after PMI2_KVS_Fence completes.  However, a PMI implementation could
0486   make this a lazy operation by not waiting for all processes to enter
0487   their corresponding PMI2_KVS_Fence until some process issues a
0488   PMI2_KVS_Get. This might be appropriate for some wide-area
0489   implementations.
0490   
0491 @*/
0492 int PMI2_KVS_Fence(void);
0493 
0494 /*@
0495   PMI2_KVS_Get - returns the value associated with key in the key-value
0496       space associated with the job ID jobid
0497 
0498   Input Parameters:
0499   + jobid - the job id identifying the key-value space in which to look
0500     for key.  If jobid is NULL, look in the key-value space of this job.
0501   . src_pmi_id - the pmi id of the process which put this keypair.  This
0502     is just a hint to the server.  PMI2_ID_NULL should be passed if no
0503     hint is provided.
0504   . key - key
0505   - maxvalue - size of the buffer provided in value
0506 
0507   Output Parameters:
0508   + value - value associated with key
0509   - vallen - length of the returned value, or, if the length is longer
0510     than maxvalue, the negative of the required length is returned
0511   
0512   Return values:
0513   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0514 
0515 @*/
0516 int PMI2_KVS_Get(const char *jobid, int src_pmi_id, const char key[], char value [], int maxvalue, int *vallen);
0517 
0518 /*@
0519   PMI2_Info_GetNodeAttr - returns the value of the attribute associated
0520       with this node
0521 
0522   Input Parameters:
0523   + name - name of the node attribute
0524   . valuelen - size of the buffer provided in value
0525   - waitfor - if non-zero, the function will not return until the
0526     attribute is available
0527 
0528   Output Parameters:
0529   + value - value of the attribute
0530   - found - non-zero indicates that the attribute was found
0531   
0532   Return values:
0533   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0534 
0535   Notes:
0536   This provides a way, when combined with PMI2_Info_PutNodeAttr, for
0537   processes on the same node to share information without requiring a
0538   more general barrier across the entire job.
0539 
0540   If waitfor is non-zero, the function will never return with found
0541   set to zero.
0542 
0543   Predefined attributes:
0544   + memPoolType - If the process manager allocated a shared memory
0545     pool for the MPI processes in this job and on this node, return
0546     the type of that pool. Types include sysv, anonmmap and ntshm.
0547   . memSYSVid - Return the SYSV memory segment id if the memory pool
0548     type is sysv. Returned as a string.
0549   . memAnonMMAPfd - Return the FD of the anonymous mmap segment. The
0550     FD is returned as a string.
0551   - memNTName - Return the name of the Windows NT shared memory
0552     segment, file mapping object backed by system paging
0553     file.  Returned as a string.
0554 
0555 @*/
0556 int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *found, int waitfor);
0557 
0558 /*@
0559   PMI2_Info_GetNodeAttrIntArray - returns the value of the attribute associated
0560       with this node.  The value must be an array of integers.
0561 
0562   Input Parameters:
0563   + name - name of the node attribute
0564   - arraylen - number of elements in array
0565 
0566   Output Parameters:
0567   + array - value of attribute
0568   . outlen - number of elements returned
0569   - found - non-zero if attribute was found
0570   
0571   Return values:
0572   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0573 
0574   Notes:
0575   Notice that, unlike PMI2_Info_GetNodeAttr, this function does not
0576   have a waitfor parameter, and will return immediately with found=0
0577   if the attribute was not found.
0578 
0579   Predefined array attribute names:
0580   + localRanksCount - Return the number of local ranks that will be
0581     returned by the key localRanks.
0582   . localRanks - Return the ranks in MPI_COMM_WORLD of the processes
0583     that are running on this node.
0584   - cartCoords - Return the Cartesian coordinates of this process in
0585     the underlying network topology. The coordinates are indexed from
0586     zero. Value only if the Job attribute for physTopology includes
0587     cartesian.
0588 
0589 @*/
0590 int PMI2_Info_GetNodeAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found);
0591 
0592 /*@
0593   PMI2_Info_PutNodeAttr - stores the value of the named attribute
0594   associated with this node
0595 
0596   Input Parameters:
0597   + name - name of the node attribute
0598   - value - the value of the attribute
0599 
0600   Return values:
0601   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0602 
0603   Notes:
0604   For example, it might be used to share segment ids with other
0605   processes on the same SMP node.
0606   
0607 @*/
0608 int PMI2_Info_PutNodeAttr(const char name[], const char value[]);
0609 
0610 /*@
0611   PMI2_Info_GetJobAttr - returns the value of the attribute associated
0612   with this job
0613 
0614   Input Parameters:
0615   + name - name of the job attribute
0616   - valuelen - size of the buffer provided in value
0617 
0618   Output Parameters:
0619   + value - value of the attribute
0620   - found - non-zero indicates that the attribute was found
0621   
0622   Return values:
0623   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0624 
0625 @*/
0626 int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *found);
0627 
0628 /*@
0629   PMI2_Info_GetJobAttrIntArray - returns the value of the attribute associated
0630       with this job.  The value must be an array of integers.
0631 
0632   Input Parameters:
0633   + name - name of the job attribute
0634   - arraylen - number of elements in array
0635 
0636   Output Parameters:
0637   + array - value of attribute
0638   . outlen - number of elements returned
0639   - found - non-zero if attribute was found
0640   
0641   Return values:
0642   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0643 
0644   Predefined array attribute names:
0645 
0646   + universeSize - The size of the "universe" (defined for the MPI
0647     attribute MPI_UNIVERSE_SIZE
0648 
0649   . hasNameServ - The value hasNameServ is true if the PMI2 environment
0650     supports the name service operations (publish, lookup, and
0651     unpublish).
0652     
0653   . physTopology - Return the topology of the underlying network. The
0654     valid topology types include cartesian, hierarchical, complete,
0655     kautz, hypercube; additional types may be added as necessary. If
0656     the type is hierarchical, then additional attributes may be
0657     queried to determine the details of the topology. For example, a
0658     typical cluster has a hierarchical physical topology, consisting
0659     of two levels of complete networks - the switched Ethernet or
0660     Infiniband and the SMP nodes. Other systems, such as IBM BlueGene,
0661     have one level that is cartesian (and in virtual node mode, have a
0662     single-level physical topology).
0663 
0664   . physTopologyLevels - Return a string describing the topology type
0665     for each level of the underlying network. Only valid if the
0666     physTopology is hierarchical. The value is a comma-separated list
0667     of physical topology types (except for hierarchical). The levels
0668     are ordered starting at the top, with the network closest to the
0669     processes last. The lower level networks may connect only a subset
0670     of processes. For example, for a cartesian mesh of SMPs, the value
0671     is cartesian,complete. All processes are connected by the
0672     cartesian part of this, but for each complete network, only the
0673     processes on the same node are connected.
0674     
0675   . cartDims - Return a string of comma-separated values describing
0676     the dimensions of the Cartesian topology. This must be consistent
0677     with the value of cartCoords that may be returned by
0678     PMI2_Info_GetNodeAttrIntArray.
0679 
0680     These job attributes are just a start, but they provide both an
0681     example of the sort of external data that is available through the
0682     PMI interface and how extensions can be added within the same API
0683     and wire protocol. For example, adding more complex network
0684     topologies requires only adding new keys, not new routines.
0685     
0686   . isHeterogeneous - The value isHeterogeneous is true if the
0687     processes belonging to the job are running on nodes with different
0688     underlying data models.
0689 
0690 @*/
0691 int PMI2_Info_GetJobAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found);
0692 
0693 /*@
0694   PMI2_Nameserv_publish - publish a name 
0695 
0696   Input parameters:
0697   + service_name - string representing the service being published
0698   . info_ptr -
0699   - port - string representing the port on which to contact the service
0700 
0701   Return values:
0702   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0703 
0704 @*/
0705 int PMI2_Nameserv_publish(const char service_name[], const struct MPID_Info *info_ptr, const char port[]);
0706 
0707 /*@
0708   PMI2_Nameserv_lookup - lookup a service by name
0709 
0710   Input parameters:
0711   + service_name - string representing the service being published
0712   . info_ptr -
0713   - portLen - size of buffer provided in port
0714   
0715   Output parameters:
0716   . port - string representing the port on which to contact the service
0717 
0718   Return values:
0719   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0720 
0721 @*/
0722 int PMI2_Nameserv_lookup(const char service_name[], const struct MPID_Info *info_ptr,
0723                         char port[], int portLen);
0724 /*@
0725   PMI2_Nameserv_unpublish - unpublish a name
0726 
0727   Input parameters:
0728   + service_name - string representing the service being unpublished
0729   - info_ptr -
0730 
0731   Return values:
0732   Returns 'MPI_SUCCESS' on success and an MPI error code on failure.
0733 
0734 @*/
0735 int PMI2_Nameserv_unpublish(const char service_name[], 
0736                            const struct MPID_Info *info_ptr);
0737 
0738 
0739 
0740 #if defined(__cplusplus)
0741 }
0742 #endif
0743 
0744 #endif /* PMI2_H_INCLUDED */