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