Created
April 10, 2017 21:45
-
-
Save hppritcha/8b3a5734feb6d58a42000a103b314ea0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 73474b98d33cb7d56daaa93d77bef54269db99e1 Mon Sep 17 00:00:00 2001 | |
From: Ken Raffenetti <raffenet@mcs.anl.gov> | |
Date: Wed, 22 Feb 2017 15:13:34 -0600 | |
Subject: [PATCH 1/5] pmi: Move headers out of top-level include dir | |
If we are building with an external pmi library, we should be using the | |
external version of the pmi.h/pmi2.h. Move the MPICH copies into subdirs | |
that will be conditionally added to CPPFLAGS based on configure options. | |
--- | |
src/include/Makefile.mk | 2 - | |
src/include/pmi.h | 473 ---------------------------------- | |
src/include/pmi2.h | 550 ---------------------------------------- | |
src/pmi/include/pmi.h | 473 ++++++++++++++++++++++++++++++++++ | |
src/pmi/pmi2/include/pmi2.h | 550 ++++++++++++++++++++++++++++++++++++++++ | |
src/pmi/pmi2/simple/Makefile.mk | 4 +- | |
src/pmi/simple/Makefile.mk | 4 +- | |
7 files changed, 1029 insertions(+), 1027 deletions(-) | |
delete mode 100644 src/include/pmi.h | |
delete mode 100644 src/include/pmi2.h | |
create mode 100644 src/pmi/include/pmi.h | |
create mode 100644 src/pmi/pmi2/include/pmi2.h | |
diff --git a/src/include/Makefile.mk b/src/include/Makefile.mk | |
index 7e685fe..c9040ef 100644 | |
--- a/src/include/Makefile.mk | |
+++ b/src/include/Makefile.mk | |
@@ -69,8 +69,6 @@ noinst_HEADERS += \ | |
src/include/mpir_win.h \ | |
src/include/mpir_pt2pt.h \ | |
src/include/nopackage.h \ | |
- src/include/pmi.h \ | |
- src/include/pmi2.h \ | |
src/include/rlog.h \ | |
src/include/rlog_macros.h \ | |
src/include/mpir_op_util.h | |
diff --git a/src/include/pmi.h b/src/include/pmi.h | |
deleted file mode 100644 | |
index eeb1f8e..0000000 | |
--- a/src/include/pmi.h | |
+++ /dev/null | |
@@ -1,473 +0,0 @@ | |
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ | |
-/* | |
- * (C) 2001 by Argonne National Laboratory. | |
- * See COPYRIGHT in top-level directory. | |
- */ | |
- | |
-#ifndef PMI_H_INCLUDED | |
-#define PMI_H_INCLUDED | |
- | |
-#ifdef USE_PMI2_API | |
-#error This header file defines the PMI v1 API, but PMI2 was selected | |
-#endif | |
- | |
-/* prototypes for the PMI interface in MPICH */ | |
- | |
-#if defined(__cplusplus) | |
-extern "C" { | |
-#endif | |
- | |
-/*D | |
-PMI_CONSTANTS - PMI definitions | |
- | |
-Error Codes: | |
-+ PMI_SUCCESS - operation completed successfully | |
-. PMI_FAIL - operation failed | |
-. PMI_ERR_NOMEM - input buffer not large enough | |
-. PMI_ERR_INIT - PMI not initialized | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-. PMI_ERR_INVALID_KEY - invalid key argument | |
-. PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument | |
-. PMI_ERR_INVALID_VAL - invalid val argument | |
-. PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument | |
-. PMI_ERR_INVALID_LENGTH - invalid length argument | |
-. PMI_ERR_INVALID_NUM_ARGS - invalid number of arguments | |
-. PMI_ERR_INVALID_ARGS - invalid args argument | |
-. PMI_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument | |
-. PMI_ERR_INVALID_KEYVALP - invalid keyvalp argument | |
-- PMI_ERR_INVALID_SIZE - invalid size argument | |
- | |
-Booleans: | |
-+ PMI_TRUE - true | |
-- PMI_FALSE - false | |
- | |
-D*/ | |
-#define PMI_SUCCESS 0 | |
-#define PMI_FAIL -1 | |
-#define PMI_ERR_INIT 1 | |
-#define PMI_ERR_NOMEM 2 | |
-#define PMI_ERR_INVALID_ARG 3 | |
-#define PMI_ERR_INVALID_KEY 4 | |
-#define PMI_ERR_INVALID_KEY_LENGTH 5 | |
-#define PMI_ERR_INVALID_VAL 6 | |
-#define PMI_ERR_INVALID_VAL_LENGTH 7 | |
-#define PMI_ERR_INVALID_LENGTH 8 | |
-#define PMI_ERR_INVALID_NUM_ARGS 9 | |
-#define PMI_ERR_INVALID_ARGS 10 | |
-#define PMI_ERR_INVALID_NUM_PARSED 11 | |
-#define PMI_ERR_INVALID_KEYVALP 12 | |
-#define PMI_ERR_INVALID_SIZE 13 | |
- | |
-/* PMI Group functions */ | |
- | |
-/*@ | |
-PMI_Init - initialize the Process Manager Interface | |
- | |
-Output Parameter: | |
-. spawned - spawned flag | |
- | |
-Return values: | |
-+ PMI_SUCCESS - initialization completed successfully | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - initialization failed | |
- | |
-Notes: | |
-Initialize PMI for this process group. The value of spawned indicates whether | |
-this process was created by 'PMI_Spawn_multiple'. 'spawned' will be 'PMI_TRUE' if | |
-this process group has a parent and 'PMI_FALSE' if it does not. | |
- | |
-@*/ | |
-int PMI_Init( int *spawned ); | |
- | |
-/*@ | |
-PMI_Initialized - check if PMI has been initialized | |
- | |
-Output Parameter: | |
-. initialized - boolean value | |
- | |
-Return values: | |
-+ PMI_SUCCESS - initialized successfully set | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to set the variable | |
- | |
-Notes: | |
-On successful output, initialized will either be 'PMI_TRUE' or 'PMI_FALSE'. | |
- | |
-+ PMI_TRUE - initialize has been called. | |
-- PMI_FALSE - initialize has not been called or previously failed. | |
- | |
-@*/ | |
-int PMI_Initialized( int *initialized ); | |
- | |
-/*@ | |
-PMI_Finalize - finalize the Process Manager Interface | |
- | |
-Return values: | |
-+ PMI_SUCCESS - finalization completed successfully | |
-- PMI_FAIL - finalization failed | |
- | |
-Notes: | |
- Finalize PMI for this process group. | |
- | |
-@*/ | |
-int PMI_Finalize( void ); | |
- | |
-/*@ | |
-PMI_Get_size - obtain the size of the process group | |
- | |
-Output Parameters: | |
-. size - pointer to an integer that receives the size of the process group | |
- | |
-Return values: | |
-+ PMI_SUCCESS - size successfully obtained | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to return the size | |
- | |
-Notes: | |
-This function returns the size of the process group to which the local process | |
-belongs. | |
- | |
-@*/ | |
-int PMI_Get_size( int *size ); | |
- | |
-/*@ | |
-PMI_Get_rank - obtain the rank of the local process in the process group | |
- | |
-Output Parameters: | |
-. rank - pointer to an integer that receives the rank in the process group | |
- | |
-Return values: | |
-+ PMI_SUCCESS - rank successfully obtained | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to return the rank | |
- | |
-Notes: | |
-This function returns the rank of the local process in its process group. | |
- | |
-@*/ | |
-int PMI_Get_rank( int *rank ); | |
- | |
-/*@ | |
-PMI_Get_universe_size - obtain the universe size | |
- | |
-Output Parameters: | |
-. size - pointer to an integer that receives the size | |
- | |
-Return values: | |
-+ PMI_SUCCESS - size successfully obtained | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to return the size | |
- | |
- | |
-@*/ | |
-int PMI_Get_universe_size( int *size ); | |
- | |
-/*@ | |
-PMI_Get_appnum - obtain the application number | |
- | |
-Output parameters: | |
-. appnum - pointer to an integer that receives the appnum | |
- | |
-Return values: | |
-+ PMI_SUCCESS - appnum successfully obtained | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to return the size | |
- | |
- | |
-@*/ | |
-int PMI_Get_appnum( int *appnum ); | |
- | |
-/*@ | |
-PMI_Publish_name - publish a name | |
- | |
-Input parameters: | |
-. service_name - string representing the service being published | |
-. port - string representing the port on which to contact the service | |
- | |
-Return values: | |
-+ PMI_SUCCESS - port for service successfully published | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to publish service | |
- | |
- | |
-@*/ | |
-int PMI_Publish_name( const char service_name[], const char port[] ); | |
- | |
-/*@ | |
-PMI_Unpublish_name - unpublish a name | |
- | |
-Input parameters: | |
-. service_name - string representing the service being unpublished | |
- | |
-Return values: | |
-+ PMI_SUCCESS - port for service successfully published | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to unpublish service | |
- | |
- | |
-@*/ | |
-int PMI_Unpublish_name( const char service_name[] ); | |
- | |
-/*@ | |
-PMI_Lookup_name - lookup a service by name | |
- | |
-Input parameters: | |
-. service_name - string representing the service being published | |
- | |
-Output parameters: | |
-. port - string representing the port on which to contact the service | |
- | |
-Return values: | |
-+ PMI_SUCCESS - port for service successfully obtained | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to lookup service | |
- | |
- | |
-@*/ | |
-int PMI_Lookup_name( const char service_name[], char port[] ); | |
- | |
-/*@ | |
-PMI_Barrier - barrier across the process group | |
- | |
-Return values: | |
-+ PMI_SUCCESS - barrier successfully finished | |
-- PMI_FAIL - barrier failed | |
- | |
-Notes: | |
-This function is a collective call across all processes in the process group | |
-the local process belongs to. It will not return until all the processes | |
-have called 'PMI_Barrier()'. | |
- | |
-@*/ | |
-int PMI_Barrier( void ); | |
- | |
-/*@ | |
-PMI_Abort - abort the process group associated with this process | |
- | |
-Input Parameters: | |
-+ exit_code - exit code to be returned by this process | |
-- error_msg - error message to be printed | |
- | |
-Return values: | |
-. none - this function should not return | |
-@*/ | |
-int PMI_Abort(int exit_code, const char error_msg[]); | |
- | |
-/* PMI Keymap functions */ | |
-/*@ | |
-PMI_KVS_Get_my_name - obtain the name of the keyval space the local process group has access to | |
- | |
-Input Parameters: | |
-. length - length of the kvsname character array | |
- | |
-Output Parameters: | |
-. kvsname - a string that receives the keyval space name | |
- | |
-Return values: | |
-+ PMI_SUCCESS - kvsname successfully obtained | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-. PMI_ERR_INVALID_LENGTH - invalid length argument | |
-- PMI_FAIL - unable to return the kvsname | |
- | |
-Notes: | |
-This function returns the name of the keyval space that this process and all | |
-other processes in the process group have access to. The output parameter, | |
-kvsname, must be at least as long as the value returned by | |
-'PMI_KVS_Get_name_length_max()'. | |
- | |
-@*/ | |
-int PMI_KVS_Get_my_name( char kvsname[], int length ); | |
- | |
-/*@ | |
-PMI_KVS_Get_name_length_max - obtain the length necessary to store a kvsname | |
- | |
-Output Parameter: | |
-. length - maximum length required to hold a keyval space name | |
- | |
-Return values: | |
-+ PMI_SUCCESS - length successfully set | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to set the length | |
- | |
-Notes: | |
-This function returns the string length required to store a keyval space name. | |
- | |
-A routine is used rather than setting a maximum value in 'pmi.h' to allow | |
-different implementations of PMI to be used with the same executable. These | |
-different implementations may allow different maximum lengths; by using a | |
-routine here, we can interface with a variety of implementations of PMI. | |
- | |
-@*/ | |
-int PMI_KVS_Get_name_length_max( int *length ); | |
- | |
-/*@ | |
-PMI_KVS_Get_key_length_max - obtain the length necessary to store a key | |
- | |
-Output Parameter: | |
-. length - maximum length required to hold a key string. | |
- | |
-Return values: | |
-+ PMI_SUCCESS - length successfully set | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to set the length | |
- | |
-Notes: | |
-This function returns the string length required to store a key. | |
- | |
-@*/ | |
-int PMI_KVS_Get_key_length_max( int *length ); | |
- | |
-/*@ | |
-PMI_KVS_Get_value_length_max - obtain the length necessary to store a value | |
- | |
-Output Parameter: | |
-. length - maximum length required to hold a keyval space value | |
- | |
-Return values: | |
-+ PMI_SUCCESS - length successfully set | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - unable to set the length | |
- | |
-Notes: | |
-This function returns the string length required to store a value from a | |
-keyval space. | |
- | |
-@*/ | |
-int PMI_KVS_Get_value_length_max( int *length ); | |
- | |
-/*@ | |
-PMI_KVS_Put - put a key/value pair in a keyval space | |
- | |
-Input Parameters: | |
-+ kvsname - keyval space name | |
-. key - key | |
-- value - value | |
- | |
-Return values: | |
-+ PMI_SUCCESS - keyval pair successfully put in keyval space | |
-. PMI_ERR_INVALID_KVS - invalid kvsname argument | |
-. PMI_ERR_INVALID_KEY - invalid key argument | |
-. PMI_ERR_INVALID_VAL - invalid val argument | |
-- PMI_FAIL - put failed | |
- | |
-Notes: | |
-This function puts the key/value pair in the specified keyval space. The | |
-value is not visible to other processes until 'PMI_KVS_Commit()' is called. | |
-The function may complete locally. After 'PMI_KVS_Commit()' is called, the | |
-value may be retrieved by calling 'PMI_KVS_Get()'. All keys put to a keyval | |
-space must be unique to the keyval space. You may not put more than once | |
-with the same key. | |
- | |
-@*/ | |
-int PMI_KVS_Put( const char kvsname[], const char key[], const char value[]); | |
- | |
-/*@ | |
-PMI_KVS_Commit - commit all previous puts to the keyval space | |
- | |
-Input Parameters: | |
-. kvsname - keyval space name | |
- | |
-Return values: | |
-+ PMI_SUCCESS - commit succeeded | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - commit failed | |
- | |
-Notes: | |
-This function commits all previous puts since the last 'PMI_KVS_Commit()' into | |
-the specified keyval space. It is a process local operation. | |
- | |
-@*/ | |
-int PMI_KVS_Commit( const char kvsname[] ); | |
- | |
-/*@ | |
-PMI_KVS_Get - get a key/value pair from a keyval space | |
- | |
-Input Parameters: | |
-+ kvsname - keyval space name | |
-. key - key | |
-- length - length of value character array | |
- | |
-Output Parameters: | |
-. value - value | |
- | |
-Return values: | |
-+ PMI_SUCCESS - get succeeded | |
-. PMI_ERR_INVALID_KVS - invalid kvsname argument | |
-. PMI_ERR_INVALID_KEY - invalid key argument | |
-. PMI_ERR_INVALID_VAL - invalid val argument | |
-. PMI_ERR_INVALID_LENGTH - invalid length argument | |
-- PMI_FAIL - get failed | |
- | |
-Notes: | |
-This function gets the value of the specified key in the keyval space. | |
- | |
-@*/ | |
-int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int length); | |
- | |
-/* PMI Process Creation functions */ | |
- | |
-/*S | |
-PMI_keyval_t - keyval structure used by PMI_Spawn_mulitiple | |
- | |
-Fields: | |
-+ key - name of the key | |
-- val - value of the key | |
- | |
-S*/ | |
-typedef struct PMI_keyval_t | |
-{ | |
- const char * key; | |
- char * val; | |
-} PMI_keyval_t; | |
- | |
-/*@ | |
-PMI_Spawn_multiple - spawn a new set of processes | |
- | |
-Input Parameters: | |
-+ count - count of commands | |
-. cmds - array of command strings | |
-. argvs - array of argv arrays for each command string | |
-. maxprocs - array of maximum processes to spawn for each command string | |
-. info_keyval_sizes - array giving the number of elements in each of the | |
- 'info_keyval_vectors' | |
-. info_keyval_vectors - array of keyval vector arrays | |
-. preput_keyval_size - Number of elements in 'preput_keyval_vector' | |
-- preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space | |
- | |
-Output Parameter: | |
-. errors - array of errors for each command | |
- | |
-Return values: | |
-+ PMI_SUCCESS - spawn successful | |
-. PMI_ERR_INVALID_ARG - invalid argument | |
-- PMI_FAIL - spawn failed | |
- | |
-Notes: | |
-This function spawns a set of processes into a new process group. The 'count' | |
-field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs', | |
-'info_keyval_sizes' and 'info_keyval_vectors'. The 'preput_keyval_size' refers | |
-to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector' | |
-contains keyval pairs that will be put in the keyval space of the newly | |
-created process group before the processes are started. The 'maxprocs' array | |
-specifies the desired number of processes to create for each 'cmd' string. | |
-The actual number of processes may be less than the numbers specified in | |
-maxprocs. The acceptable number of processes spawned may be controlled by | |
-``soft'' keyvals in the info arrays. The ``soft'' option is specified by | |
-mpiexec in the MPI-2 standard. Environment variables may be passed to the | |
-spawned processes through PMI implementation specific 'info_keyval' parameters. | |
-@*/ | |
-int PMI_Spawn_multiple(int count, | |
- const char * cmds[], | |
- const char ** argvs[], | |
- const int maxprocs[], | |
- const int info_keyval_sizesp[], | |
- const PMI_keyval_t * info_keyval_vectors[], | |
- int preput_keyval_size, | |
- const PMI_keyval_t preput_keyval_vector[], | |
- int errors[]); | |
- | |
-#if defined(__cplusplus) | |
-} | |
-#endif | |
- | |
-#endif | |
diff --git a/src/include/pmi2.h b/src/include/pmi2.h | |
deleted file mode 100644 | |
index 9283ce0..0000000 | |
--- a/src/include/pmi2.h | |
+++ /dev/null | |
@@ -1,550 +0,0 @@ | |
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ | |
-/* | |
- * (C) 2007 by Argonne National Laboratory. | |
- * See COPYRIGHT in top-level directory. | |
- */ | |
- | |
-#ifndef PMI2_H_INCLUDED | |
-#define PMI2_H_INCLUDED | |
- | |
-#ifndef USE_PMI2_API | |
-#error This header file defines the PMI2 API, but PMI2 was not selected | |
-#endif | |
- | |
-#define PMI2_MAX_KEYLEN 64 | |
-#define PMI2_MAX_VALLEN 1024 | |
-#define PMI2_MAX_ATTRVALUE 1024 | |
-#define PMI2_ID_NULL -1 | |
- | |
-#if defined(__cplusplus) | |
-extern "C" { | |
-#endif | |
- | |
-/*D | |
-PMI2_CONSTANTS - PMI2 definitions | |
- | |
-Error Codes: | |
-+ PMI2_SUCCESS - operation completed successfully | |
-. PMI2_FAIL - operation failed | |
-. PMI2_ERR_NOMEM - input buffer not large enough | |
-. PMI2_ERR_INIT - PMI not initialized | |
-. PMI2_ERR_INVALID_ARG - invalid argument | |
-. PMI2_ERR_INVALID_KEY - invalid key argument | |
-. PMI2_ERR_INVALID_KEY_LENGTH - invalid key length argument | |
-. PMI2_ERR_INVALID_VAL - invalid val argument | |
-. PMI2_ERR_INVALID_VAL_LENGTH - invalid val length argument | |
-. PMI2_ERR_INVALID_LENGTH - invalid length argument | |
-. PMI2_ERR_INVALID_NUM_ARGS - invalid number of arguments | |
-. PMI2_ERR_INVALID_ARGS - invalid args argument | |
-. PMI2_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument | |
-. PMI2_ERR_INVALID_KEYVALP - invalid keyvalp argument | |
-. PMI2_ERR_INVALID_SIZE - invalid size argument | |
-- PMI2_ERR_OTHER - other unspecified error | |
- | |
-D*/ | |
-#define PMI2_SUCCESS 0 | |
-#define PMI2_FAIL -1 | |
-#define PMI2_ERR_INIT 1 | |
-#define PMI2_ERR_NOMEM 2 | |
-#define PMI2_ERR_INVALID_ARG 3 | |
-#define PMI2_ERR_INVALID_KEY 4 | |
-#define PMI2_ERR_INVALID_KEY_LENGTH 5 | |
-#define PMI2_ERR_INVALID_VAL 6 | |
-#define PMI2_ERR_INVALID_VAL_LENGTH 7 | |
-#define PMI2_ERR_INVALID_LENGTH 8 | |
-#define PMI2_ERR_INVALID_NUM_ARGS 9 | |
-#define PMI2_ERR_INVALID_ARGS 10 | |
-#define PMI2_ERR_INVALID_NUM_PARSED 11 | |
-#define PMI2_ERR_INVALID_KEYVALP 12 | |
-#define PMI2_ERR_INVALID_SIZE 13 | |
-#define PMI2_ERR_OTHER 14 | |
- | |
-/* This is here to allow spawn multiple functions to compile. This | |
- needs to be removed once those functions are fixed for pmi2 */ | |
-typedef struct PMI_keyval_t | |
-{ | |
- char * key; | |
- char * val; | |
-} PMI_keyval_t; | |
- | |
- | |
-/*@ | |
- PMI2_Connect_comm_t - connection structure used when connecting to other jobs | |
- | |
- Fields: | |
- + read - Read from a connection to the leader of the job to which | |
- this process will be connecting. Returns 0 on success or an MPI | |
- error code on failure. | |
- . write - Write to a connection to the leader of the job to which | |
- this process will be connecting. Returns 0 on success or an MPI | |
- error code on failure. | |
- . ctx - An anonymous pointer to data that may be used by the read | |
- and write members. | |
- - isMaster - Indicates which process is the "master"; may have the | |
- values 1 (is the master), 0 (is not the master), or -1 (neither is | |
- designated as the master). The two processes must agree on which | |
- process is the master, or both must select -1 (neither is the | |
- master). | |
- | |
- Notes: | |
- A typical implementation of these functions will use the read and | |
- write calls on a pre-established file descriptor (fd) between the | |
- two leading processes. This will be needed only if the PMI server | |
- cannot access the KVS spaces of another job (this may happen, for | |
- example, if each mpiexec creates the KVS spaces for the processes | |
- that it manages). | |
- | |
-@*/ | |
-typedef struct PMI2_Connect_comm { | |
- int (*read)( void *buf, int maxlen, void *ctx ); | |
- int (*write)( const void *buf, int len, void *ctx ); | |
- void *ctx; | |
- int isMaster; | |
-} PMI2_Connect_comm_t; | |
- | |
-struct MPIR_Info; | |
- | |
-/*@ | |
- PMI2_Init - initialize the Process Manager Interface | |
- | |
- Output Parameter: | |
- + spawned - spawned flag | |
- . size - number of processes in the job | |
- . rank - rank of this process in the job | |
- - appnum - which executable is this on the mpiexec commandline | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Notes: | |
- Initialize PMI for this process group. The value of spawned indicates whether | |
- this process was created by 'PMI2_Spawn_multiple'. 'spawned' will be non-zero | |
- iff this process group has a parent. | |
- | |
-@*/ | |
-int PMI2_Init(int *spawned, int *size, int *rank, int *appnum); | |
- | |
-/*@ | |
- PMI2_Finalize - finalize the Process Manager Interface | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Notes: | |
- Finalize PMI for this job. | |
- | |
-@*/ | |
-int PMI2_Finalize(void); | |
- | |
-/*@ | |
- PMI2_Initialized - check if PMI has been initialized | |
- | |
- Return values: | |
- Non-zero if PMI2_Initialize has been called successfully, zero otherwise. | |
- | |
-@*/ | |
-int PMI2_Initialized(void); | |
- | |
-/*@ | |
- PMI2_Abort - abort the process group associated with this process | |
- | |
- Input Parameters: | |
- + flag - non-zero if all processes in this job should abort, zero otherwise | |
- - error_msg - error message to be printed | |
- | |
- Return values: | |
- If the abort succeeds this function will not return. Returns an MPI | |
- error code otherwise. | |
- | |
-@*/ | |
-int PMI2_Abort(int flag, const char msg[]); | |
- | |
-/*@ | |
- PMI2_Spawn - spawn a new set of processes | |
- | |
- Input Parameters: | |
- + count - count of commands | |
- . cmds - array of command strings | |
- . argcs - size of argv arrays for each command string | |
- . argvs - array of argv arrays for each command string | |
- . maxprocs - array of maximum processes to spawn for each command string | |
- . info_keyval_sizes - array giving the number of elements in each of the | |
- 'info_keyval_vectors' | |
- . info_keyval_vectors - array of keyval vector arrays | |
- . preput_keyval_size - Number of elements in 'preput_keyval_vector' | |
- . preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space | |
- - jobIdSize - size of the buffer provided in jobId | |
- | |
- Output Parameter: | |
- + jobId - job id of the spawned processes | |
- - errors - array of errors for each command | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Notes: | |
- This function spawns a set of processes into a new job. The 'count' | |
- field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs', | |
- 'info_keyval_sizes' and 'info_keyval_vectors'. The 'preput_keyval_size' refers | |
- to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector' | |
- contains keyval pairs that will be put in the keyval space of the newly | |
- created job before the processes are started. The 'maxprocs' array | |
- specifies the desired number of processes to create for each 'cmd' string. | |
- The actual number of processes may be less than the numbers specified in | |
- maxprocs. The acceptable number of processes spawned may be controlled by | |
- ``soft'' keyvals in the info arrays. The ``soft'' option is specified by | |
- mpiexec in the MPI-2 standard. Environment variables may be passed to the | |
- spawned processes through PMI implementation specific 'info_keyval' parameters. | |
-@*/ | |
-int PMI2_Job_Spawn(int count, const char * cmds[], | |
- int argcs[], const char ** argvs[], | |
- const int maxprocs[], | |
- const int info_keyval_sizes[], | |
- const struct MPIR_Info *info_keyval_vectors[], | |
- int preput_keyval_size, | |
- const struct MPIR_Info *preput_keyval_vector[], | |
- char jobId[], int jobIdSize, | |
- int errors[]); | |
- | |
- | |
-/*@ | |
- PMI2_Job_GetId - get job id of this job | |
- | |
- Input parameters: | |
- . jobid_size - size of buffer provided in jobid | |
- | |
- Output parameters: | |
- . jobid - the job id of this job | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
-@*/ | |
-int PMI2_Job_GetId(char jobid[], int jobid_size); | |
- | |
-/*@ | |
- PMI2_Job_Connect - connect to the parallel job with ID jobid | |
- | |
- Input parameters: | |
- . jobid - job id of the job to connect to | |
- | |
- Output parameters: | |
- . conn - connection structure used to exteblish communication with | |
- the remote job | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Notes: | |
- This just "registers" the other parallel job as part of a parallel | |
- program, and is used in the PMI2_KVS_xxx routines (see below). This | |
- is not a collective call and establishes a connection between all | |
- processes that are connected to the calling processes (on the one | |
- side) and that are connected to the named jobId on the other | |
- side. Processes that are already connected may call this routine. | |
- | |
-@*/ | |
-int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn); | |
- | |
-/*@ | |
- PMI2_Job_Disconnect - disconnects from the job with ID jobid | |
- | |
- Input parameters: | |
- . jobid - job id of the job to connect to | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
-@*/ | |
-int PMI2_Job_Disconnect(const char jobid[]); | |
- | |
-/*@ | |
- PMI2_KVS_Put - put a key/value pair in the keyval space for this job | |
- | |
- Input Parameters: | |
- + key - key | |
- - value - value | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Notes: | |
- If multiple PMI2_KVS_Put calls are made with the same key between | |
- calls to PMI2_KVS_Fence, the behavior is undefined. That is, the | |
- value returned by PMI2_KVS_Get for that key after the PMI2_KVS_Fence | |
- is not defined. | |
- | |
-@*/ | |
-int PMI2_KVS_Put(const char key[], const char value[]); | |
-/*@ | |
- PMI2_KVS_Fence - commit all PMI2_KVS_Put calls made before this fence | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Notes: | |
- This is a collective call across the job. It has semantics that are | |
- similar to those for MPI_Win_fence and hence is most easily | |
- implemented as a barrier across all of the processes in the job. | |
- Specifically, all PMI2_KVS_Put operations performed by any process in | |
- the same job must be visible to all processes (by using PMI2_KVS_Get) | |
- after PMI2_KVS_Fence completes. However, a PMI implementation could | |
- make this a lazy operation by not waiting for all processes to enter | |
- their corresponding PMI2_KVS_Fence until some process issues a | |
- PMI2_KVS_Get. This might be appropriate for some wide-area | |
- implementations. | |
- | |
-@*/ | |
-int PMI2_KVS_Fence(void); | |
- | |
-/*@ | |
- PMI2_KVS_Get - returns the value associated with key in the key-value | |
- space associated with the job ID jobid | |
- | |
- Input Parameters: | |
- + jobid - the job id identifying the key-value space in which to look | |
- for key. If jobid is NULL, look in the key-value space of this job. | |
- . src_pmi_id - the pmi id of the process which put this keypair. This | |
- is just a hint to the server. PMI2_ID_NULL should be passed if no | |
- hint is provided. | |
- . key - key | |
- - maxvalue - size of the buffer provided in value | |
- | |
- Output Parameters: | |
- + value - value associated with key | |
- - vallen - length of the returned value, or, if the length is longer | |
- than maxvalue, the negative of the required length is returned | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
-@*/ | |
-int PMI2_KVS_Get(const char *jobid, int src_pmi_id, const char key[], char value [], int maxvalue, int *vallen); | |
- | |
-/*@ | |
- PMI2_Info_GetNodeAttr - returns the value of the attribute associated | |
- with this node | |
- | |
- Input Parameters: | |
- + name - name of the node attribute | |
- . valuelen - size of the buffer provided in value | |
- - waitfor - if non-zero, the function will not return until the | |
- attribute is available | |
- | |
- Output Parameters: | |
- + value - value of the attribute | |
- - found - non-zero indicates that the attribute was found | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Notes: | |
- This provides a way, when combined with PMI2_Info_PutNodeAttr, for | |
- processes on the same node to share information without requiring a | |
- more general barrier across the entire job. | |
- | |
- If waitfor is non-zero, the function will never return with found | |
- set to zero. | |
- | |
- Predefined attributes: | |
- + memPoolType - If the process manager allocated a shared memory | |
- pool for the MPI processes in this job and on this node, return | |
- the type of that pool. Types include sysv, anonmmap and ntshm. | |
- . memSYSVid - Return the SYSV memory segment id if the memory pool | |
- type is sysv. Returned as a string. | |
- . memAnonMMAPfd - Return the FD of the anonymous mmap segment. The | |
- FD is returned as a string. | |
- - memNTName - Return the name of the Windows NT shared memory | |
- segment, file mapping object backed by system paging | |
- file. Returned as a string. | |
- | |
-@*/ | |
-int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *found, int waitfor); | |
- | |
-/*@ | |
- PMI2_Info_GetNodeAttrIntArray - returns the value of the attribute associated | |
- with this node. The value must be an array of integers. | |
- | |
- Input Parameters: | |
- + name - name of the node attribute | |
- - arraylen - number of elements in array | |
- | |
- Output Parameters: | |
- + array - value of attribute | |
- . outlen - number of elements returned | |
- - found - non-zero if attribute was found | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Notes: | |
- Notice that, unlike PMI2_Info_GetNodeAttr, this function does not | |
- have a waitfor parameter, and will return immediately with found=0 | |
- if the attribute was not found. | |
- | |
- Predefined array attribute names: | |
- + localRanksCount - Return the number of local ranks that will be | |
- returned by the key localRanks. | |
- . localRanks - Return the ranks in MPI_COMM_WORLD of the processes | |
- that are running on this node. | |
- - cartCoords - Return the Cartesian coordinates of this process in | |
- the underlying network topology. The coordinates are indexed from | |
- zero. Value only if the Job attribute for physTopology includes | |
- cartesian. | |
- | |
-@*/ | |
-int PMI2_Info_GetNodeAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found); | |
- | |
-/*@ | |
- PMI2_Info_PutNodeAttr - stores the value of the named attribute | |
- associated with this node | |
- | |
- Input Parameters: | |
- + name - name of the node attribute | |
- - value - the value of the attribute | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Notes: | |
- For example, it might be used to share segment ids with other | |
- processes on the same SMP node. | |
- | |
-@*/ | |
-int PMI2_Info_PutNodeAttr(const char name[], const char value[]); | |
- | |
-/*@ | |
- PMI2_Info_GetJobAttr - returns the value of the attribute associated | |
- with this job | |
- | |
- Input Parameters: | |
- + name - name of the job attribute | |
- - valuelen - size of the buffer provided in value | |
- | |
- Output Parameters: | |
- + value - value of the attribute | |
- - found - non-zero indicates that the attribute was found | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
-@*/ | |
-int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *found); | |
- | |
-/*@ | |
- PMI2_Info_GetJobAttrIntArray - returns the value of the attribute associated | |
- with this job. The value must be an array of integers. | |
- | |
- Input Parameters: | |
- + name - name of the job attribute | |
- - arraylen - number of elements in array | |
- | |
- Output Parameters: | |
- + array - value of attribute | |
- . outlen - number of elements returned | |
- - found - non-zero if attribute was found | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
- Predefined array attribute names: | |
- | |
- + universeSize - The size of the "universe" (defined for the MPI | |
- attribute MPI_UNIVERSE_SIZE | |
- | |
- . hasNameServ - The value hasNameServ is true if the PMI2 environment | |
- supports the name service operations (publish, lookup, and | |
- unpublish). | |
- | |
- . physTopology - Return the topology of the underlying network. The | |
- valid topology types include cartesian, hierarchical, complete, | |
- kautz, hypercube; additional types may be added as necessary. If | |
- the type is hierarchical, then additional attributes may be | |
- queried to determine the details of the topology. For example, a | |
- typical cluster has a hierarchical physical topology, consisting | |
- of two levels of complete networks - the switched Ethernet or | |
- Infiniband and the SMP nodes. Other systems, such as IBM BlueGene, | |
- have one level that is cartesian (and in virtual node mode, have a | |
- single-level physical topology). | |
- | |
- . physTopologyLevels - Return a string describing the topology type | |
- for each level of the underlying network. Only valid if the | |
- physTopology is hierarchical. The value is a comma-separated list | |
- of physical topology types (except for hierarchical). The levels | |
- are ordered starting at the top, with the network closest to the | |
- processes last. The lower level networks may connect only a subset | |
- of processes. For example, for a cartesian mesh of SMPs, the value | |
- is cartesian,complete. All processes are connected by the | |
- cartesian part of this, but for each complete network, only the | |
- processes on the same node are connected. | |
- | |
- . cartDims - Return a string of comma-separated values describing | |
- the dimensions of the Cartesian topology. This must be consistent | |
- with the value of cartCoords that may be returned by | |
- PMI2_Info_GetNodeAttrIntArray. | |
- | |
- These job attributes are just a start, but they provide both an | |
- example of the sort of external data that is available through the | |
- PMI interface and how extensions can be added within the same API | |
- and wire protocol. For example, adding more complex network | |
- topologies requires only adding new keys, not new routines. | |
- | |
- . isHeterogeneous - The value isHeterogeneous is true if the | |
- processes belonging to the job are running on nodes with different | |
- underlying data models. | |
- | |
-@*/ | |
-int PMI2_Info_GetJobAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found); | |
- | |
-/*@ | |
- PMI2_Nameserv_publish - publish a name | |
- | |
- Input parameters: | |
- + service_name - string representing the service being published | |
- . info_ptr - | |
- - port - string representing the port on which to contact the service | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
-@*/ | |
-int PMI2_Nameserv_publish(const char service_name[], const struct MPIR_Info *info_ptr, const char port[]); | |
- | |
-/*@ | |
- PMI2_Nameserv_lookup - lookup a service by name | |
- | |
- Input parameters: | |
- + service_name - string representing the service being published | |
- . info_ptr - | |
- - portLen - size of buffer provided in port | |
- | |
- Output parameters: | |
- . port - string representing the port on which to contact the service | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
-@*/ | |
-int PMI2_Nameserv_lookup(const char service_name[], const struct MPIR_Info *info_ptr, | |
- char port[], int portLen); | |
-/*@ | |
- PMI2_Nameserv_unpublish - unpublish a name | |
- | |
- Input parameters: | |
- + service_name - string representing the service being unpublished | |
- - info_ptr - | |
- | |
- Return values: | |
- Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
- | |
-@*/ | |
-int PMI2_Nameserv_unpublish(const char service_name[], | |
- const struct MPIR_Info *info_ptr); | |
- | |
- | |
- | |
-#if defined(__cplusplus) | |
-} | |
-#endif | |
- | |
-#endif /* PMI2_H_INCLUDED */ | |
diff --git a/src/pmi/include/pmi.h b/src/pmi/include/pmi.h | |
new file mode 100644 | |
index 0000000..eeb1f8e | |
--- /dev/null | |
+++ b/src/pmi/include/pmi.h | |
@@ -0,0 +1,473 @@ | |
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ | |
+/* | |
+ * (C) 2001 by Argonne National Laboratory. | |
+ * See COPYRIGHT in top-level directory. | |
+ */ | |
+ | |
+#ifndef PMI_H_INCLUDED | |
+#define PMI_H_INCLUDED | |
+ | |
+#ifdef USE_PMI2_API | |
+#error This header file defines the PMI v1 API, but PMI2 was selected | |
+#endif | |
+ | |
+/* prototypes for the PMI interface in MPICH */ | |
+ | |
+#if defined(__cplusplus) | |
+extern "C" { | |
+#endif | |
+ | |
+/*D | |
+PMI_CONSTANTS - PMI definitions | |
+ | |
+Error Codes: | |
++ PMI_SUCCESS - operation completed successfully | |
+. PMI_FAIL - operation failed | |
+. PMI_ERR_NOMEM - input buffer not large enough | |
+. PMI_ERR_INIT - PMI not initialized | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+. PMI_ERR_INVALID_KEY - invalid key argument | |
+. PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument | |
+. PMI_ERR_INVALID_VAL - invalid val argument | |
+. PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument | |
+. PMI_ERR_INVALID_LENGTH - invalid length argument | |
+. PMI_ERR_INVALID_NUM_ARGS - invalid number of arguments | |
+. PMI_ERR_INVALID_ARGS - invalid args argument | |
+. PMI_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument | |
+. PMI_ERR_INVALID_KEYVALP - invalid keyvalp argument | |
+- PMI_ERR_INVALID_SIZE - invalid size argument | |
+ | |
+Booleans: | |
++ PMI_TRUE - true | |
+- PMI_FALSE - false | |
+ | |
+D*/ | |
+#define PMI_SUCCESS 0 | |
+#define PMI_FAIL -1 | |
+#define PMI_ERR_INIT 1 | |
+#define PMI_ERR_NOMEM 2 | |
+#define PMI_ERR_INVALID_ARG 3 | |
+#define PMI_ERR_INVALID_KEY 4 | |
+#define PMI_ERR_INVALID_KEY_LENGTH 5 | |
+#define PMI_ERR_INVALID_VAL 6 | |
+#define PMI_ERR_INVALID_VAL_LENGTH 7 | |
+#define PMI_ERR_INVALID_LENGTH 8 | |
+#define PMI_ERR_INVALID_NUM_ARGS 9 | |
+#define PMI_ERR_INVALID_ARGS 10 | |
+#define PMI_ERR_INVALID_NUM_PARSED 11 | |
+#define PMI_ERR_INVALID_KEYVALP 12 | |
+#define PMI_ERR_INVALID_SIZE 13 | |
+ | |
+/* PMI Group functions */ | |
+ | |
+/*@ | |
+PMI_Init - initialize the Process Manager Interface | |
+ | |
+Output Parameter: | |
+. spawned - spawned flag | |
+ | |
+Return values: | |
++ PMI_SUCCESS - initialization completed successfully | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - initialization failed | |
+ | |
+Notes: | |
+Initialize PMI for this process group. The value of spawned indicates whether | |
+this process was created by 'PMI_Spawn_multiple'. 'spawned' will be 'PMI_TRUE' if | |
+this process group has a parent and 'PMI_FALSE' if it does not. | |
+ | |
+@*/ | |
+int PMI_Init( int *spawned ); | |
+ | |
+/*@ | |
+PMI_Initialized - check if PMI has been initialized | |
+ | |
+Output Parameter: | |
+. initialized - boolean value | |
+ | |
+Return values: | |
++ PMI_SUCCESS - initialized successfully set | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to set the variable | |
+ | |
+Notes: | |
+On successful output, initialized will either be 'PMI_TRUE' or 'PMI_FALSE'. | |
+ | |
++ PMI_TRUE - initialize has been called. | |
+- PMI_FALSE - initialize has not been called or previously failed. | |
+ | |
+@*/ | |
+int PMI_Initialized( int *initialized ); | |
+ | |
+/*@ | |
+PMI_Finalize - finalize the Process Manager Interface | |
+ | |
+Return values: | |
++ PMI_SUCCESS - finalization completed successfully | |
+- PMI_FAIL - finalization failed | |
+ | |
+Notes: | |
+ Finalize PMI for this process group. | |
+ | |
+@*/ | |
+int PMI_Finalize( void ); | |
+ | |
+/*@ | |
+PMI_Get_size - obtain the size of the process group | |
+ | |
+Output Parameters: | |
+. size - pointer to an integer that receives the size of the process group | |
+ | |
+Return values: | |
++ PMI_SUCCESS - size successfully obtained | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to return the size | |
+ | |
+Notes: | |
+This function returns the size of the process group to which the local process | |
+belongs. | |
+ | |
+@*/ | |
+int PMI_Get_size( int *size ); | |
+ | |
+/*@ | |
+PMI_Get_rank - obtain the rank of the local process in the process group | |
+ | |
+Output Parameters: | |
+. rank - pointer to an integer that receives the rank in the process group | |
+ | |
+Return values: | |
++ PMI_SUCCESS - rank successfully obtained | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to return the rank | |
+ | |
+Notes: | |
+This function returns the rank of the local process in its process group. | |
+ | |
+@*/ | |
+int PMI_Get_rank( int *rank ); | |
+ | |
+/*@ | |
+PMI_Get_universe_size - obtain the universe size | |
+ | |
+Output Parameters: | |
+. size - pointer to an integer that receives the size | |
+ | |
+Return values: | |
++ PMI_SUCCESS - size successfully obtained | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to return the size | |
+ | |
+ | |
+@*/ | |
+int PMI_Get_universe_size( int *size ); | |
+ | |
+/*@ | |
+PMI_Get_appnum - obtain the application number | |
+ | |
+Output parameters: | |
+. appnum - pointer to an integer that receives the appnum | |
+ | |
+Return values: | |
++ PMI_SUCCESS - appnum successfully obtained | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to return the size | |
+ | |
+ | |
+@*/ | |
+int PMI_Get_appnum( int *appnum ); | |
+ | |
+/*@ | |
+PMI_Publish_name - publish a name | |
+ | |
+Input parameters: | |
+. service_name - string representing the service being published | |
+. port - string representing the port on which to contact the service | |
+ | |
+Return values: | |
++ PMI_SUCCESS - port for service successfully published | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to publish service | |
+ | |
+ | |
+@*/ | |
+int PMI_Publish_name( const char service_name[], const char port[] ); | |
+ | |
+/*@ | |
+PMI_Unpublish_name - unpublish a name | |
+ | |
+Input parameters: | |
+. service_name - string representing the service being unpublished | |
+ | |
+Return values: | |
++ PMI_SUCCESS - port for service successfully published | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to unpublish service | |
+ | |
+ | |
+@*/ | |
+int PMI_Unpublish_name( const char service_name[] ); | |
+ | |
+/*@ | |
+PMI_Lookup_name - lookup a service by name | |
+ | |
+Input parameters: | |
+. service_name - string representing the service being published | |
+ | |
+Output parameters: | |
+. port - string representing the port on which to contact the service | |
+ | |
+Return values: | |
++ PMI_SUCCESS - port for service successfully obtained | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to lookup service | |
+ | |
+ | |
+@*/ | |
+int PMI_Lookup_name( const char service_name[], char port[] ); | |
+ | |
+/*@ | |
+PMI_Barrier - barrier across the process group | |
+ | |
+Return values: | |
++ PMI_SUCCESS - barrier successfully finished | |
+- PMI_FAIL - barrier failed | |
+ | |
+Notes: | |
+This function is a collective call across all processes in the process group | |
+the local process belongs to. It will not return until all the processes | |
+have called 'PMI_Barrier()'. | |
+ | |
+@*/ | |
+int PMI_Barrier( void ); | |
+ | |
+/*@ | |
+PMI_Abort - abort the process group associated with this process | |
+ | |
+Input Parameters: | |
++ exit_code - exit code to be returned by this process | |
+- error_msg - error message to be printed | |
+ | |
+Return values: | |
+. none - this function should not return | |
+@*/ | |
+int PMI_Abort(int exit_code, const char error_msg[]); | |
+ | |
+/* PMI Keymap functions */ | |
+/*@ | |
+PMI_KVS_Get_my_name - obtain the name of the keyval space the local process group has access to | |
+ | |
+Input Parameters: | |
+. length - length of the kvsname character array | |
+ | |
+Output Parameters: | |
+. kvsname - a string that receives the keyval space name | |
+ | |
+Return values: | |
++ PMI_SUCCESS - kvsname successfully obtained | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+. PMI_ERR_INVALID_LENGTH - invalid length argument | |
+- PMI_FAIL - unable to return the kvsname | |
+ | |
+Notes: | |
+This function returns the name of the keyval space that this process and all | |
+other processes in the process group have access to. The output parameter, | |
+kvsname, must be at least as long as the value returned by | |
+'PMI_KVS_Get_name_length_max()'. | |
+ | |
+@*/ | |
+int PMI_KVS_Get_my_name( char kvsname[], int length ); | |
+ | |
+/*@ | |
+PMI_KVS_Get_name_length_max - obtain the length necessary to store a kvsname | |
+ | |
+Output Parameter: | |
+. length - maximum length required to hold a keyval space name | |
+ | |
+Return values: | |
++ PMI_SUCCESS - length successfully set | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to set the length | |
+ | |
+Notes: | |
+This function returns the string length required to store a keyval space name. | |
+ | |
+A routine is used rather than setting a maximum value in 'pmi.h' to allow | |
+different implementations of PMI to be used with the same executable. These | |
+different implementations may allow different maximum lengths; by using a | |
+routine here, we can interface with a variety of implementations of PMI. | |
+ | |
+@*/ | |
+int PMI_KVS_Get_name_length_max( int *length ); | |
+ | |
+/*@ | |
+PMI_KVS_Get_key_length_max - obtain the length necessary to store a key | |
+ | |
+Output Parameter: | |
+. length - maximum length required to hold a key string. | |
+ | |
+Return values: | |
++ PMI_SUCCESS - length successfully set | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to set the length | |
+ | |
+Notes: | |
+This function returns the string length required to store a key. | |
+ | |
+@*/ | |
+int PMI_KVS_Get_key_length_max( int *length ); | |
+ | |
+/*@ | |
+PMI_KVS_Get_value_length_max - obtain the length necessary to store a value | |
+ | |
+Output Parameter: | |
+. length - maximum length required to hold a keyval space value | |
+ | |
+Return values: | |
++ PMI_SUCCESS - length successfully set | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - unable to set the length | |
+ | |
+Notes: | |
+This function returns the string length required to store a value from a | |
+keyval space. | |
+ | |
+@*/ | |
+int PMI_KVS_Get_value_length_max( int *length ); | |
+ | |
+/*@ | |
+PMI_KVS_Put - put a key/value pair in a keyval space | |
+ | |
+Input Parameters: | |
++ kvsname - keyval space name | |
+. key - key | |
+- value - value | |
+ | |
+Return values: | |
++ PMI_SUCCESS - keyval pair successfully put in keyval space | |
+. PMI_ERR_INVALID_KVS - invalid kvsname argument | |
+. PMI_ERR_INVALID_KEY - invalid key argument | |
+. PMI_ERR_INVALID_VAL - invalid val argument | |
+- PMI_FAIL - put failed | |
+ | |
+Notes: | |
+This function puts the key/value pair in the specified keyval space. The | |
+value is not visible to other processes until 'PMI_KVS_Commit()' is called. | |
+The function may complete locally. After 'PMI_KVS_Commit()' is called, the | |
+value may be retrieved by calling 'PMI_KVS_Get()'. All keys put to a keyval | |
+space must be unique to the keyval space. You may not put more than once | |
+with the same key. | |
+ | |
+@*/ | |
+int PMI_KVS_Put( const char kvsname[], const char key[], const char value[]); | |
+ | |
+/*@ | |
+PMI_KVS_Commit - commit all previous puts to the keyval space | |
+ | |
+Input Parameters: | |
+. kvsname - keyval space name | |
+ | |
+Return values: | |
++ PMI_SUCCESS - commit succeeded | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - commit failed | |
+ | |
+Notes: | |
+This function commits all previous puts since the last 'PMI_KVS_Commit()' into | |
+the specified keyval space. It is a process local operation. | |
+ | |
+@*/ | |
+int PMI_KVS_Commit( const char kvsname[] ); | |
+ | |
+/*@ | |
+PMI_KVS_Get - get a key/value pair from a keyval space | |
+ | |
+Input Parameters: | |
++ kvsname - keyval space name | |
+. key - key | |
+- length - length of value character array | |
+ | |
+Output Parameters: | |
+. value - value | |
+ | |
+Return values: | |
++ PMI_SUCCESS - get succeeded | |
+. PMI_ERR_INVALID_KVS - invalid kvsname argument | |
+. PMI_ERR_INVALID_KEY - invalid key argument | |
+. PMI_ERR_INVALID_VAL - invalid val argument | |
+. PMI_ERR_INVALID_LENGTH - invalid length argument | |
+- PMI_FAIL - get failed | |
+ | |
+Notes: | |
+This function gets the value of the specified key in the keyval space. | |
+ | |
+@*/ | |
+int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int length); | |
+ | |
+/* PMI Process Creation functions */ | |
+ | |
+/*S | |
+PMI_keyval_t - keyval structure used by PMI_Spawn_mulitiple | |
+ | |
+Fields: | |
++ key - name of the key | |
+- val - value of the key | |
+ | |
+S*/ | |
+typedef struct PMI_keyval_t | |
+{ | |
+ const char * key; | |
+ char * val; | |
+} PMI_keyval_t; | |
+ | |
+/*@ | |
+PMI_Spawn_multiple - spawn a new set of processes | |
+ | |
+Input Parameters: | |
++ count - count of commands | |
+. cmds - array of command strings | |
+. argvs - array of argv arrays for each command string | |
+. maxprocs - array of maximum processes to spawn for each command string | |
+. info_keyval_sizes - array giving the number of elements in each of the | |
+ 'info_keyval_vectors' | |
+. info_keyval_vectors - array of keyval vector arrays | |
+. preput_keyval_size - Number of elements in 'preput_keyval_vector' | |
+- preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space | |
+ | |
+Output Parameter: | |
+. errors - array of errors for each command | |
+ | |
+Return values: | |
++ PMI_SUCCESS - spawn successful | |
+. PMI_ERR_INVALID_ARG - invalid argument | |
+- PMI_FAIL - spawn failed | |
+ | |
+Notes: | |
+This function spawns a set of processes into a new process group. The 'count' | |
+field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs', | |
+'info_keyval_sizes' and 'info_keyval_vectors'. The 'preput_keyval_size' refers | |
+to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector' | |
+contains keyval pairs that will be put in the keyval space of the newly | |
+created process group before the processes are started. The 'maxprocs' array | |
+specifies the desired number of processes to create for each 'cmd' string. | |
+The actual number of processes may be less than the numbers specified in | |
+maxprocs. The acceptable number of processes spawned may be controlled by | |
+``soft'' keyvals in the info arrays. The ``soft'' option is specified by | |
+mpiexec in the MPI-2 standard. Environment variables may be passed to the | |
+spawned processes through PMI implementation specific 'info_keyval' parameters. | |
+@*/ | |
+int PMI_Spawn_multiple(int count, | |
+ const char * cmds[], | |
+ const char ** argvs[], | |
+ const int maxprocs[], | |
+ const int info_keyval_sizesp[], | |
+ const PMI_keyval_t * info_keyval_vectors[], | |
+ int preput_keyval_size, | |
+ const PMI_keyval_t preput_keyval_vector[], | |
+ int errors[]); | |
+ | |
+#if defined(__cplusplus) | |
+} | |
+#endif | |
+ | |
+#endif | |
diff --git a/src/pmi/pmi2/include/pmi2.h b/src/pmi/pmi2/include/pmi2.h | |
new file mode 100644 | |
index 0000000..9283ce0 | |
--- /dev/null | |
+++ b/src/pmi/pmi2/include/pmi2.h | |
@@ -0,0 +1,550 @@ | |
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ | |
+/* | |
+ * (C) 2007 by Argonne National Laboratory. | |
+ * See COPYRIGHT in top-level directory. | |
+ */ | |
+ | |
+#ifndef PMI2_H_INCLUDED | |
+#define PMI2_H_INCLUDED | |
+ | |
+#ifndef USE_PMI2_API | |
+#error This header file defines the PMI2 API, but PMI2 was not selected | |
+#endif | |
+ | |
+#define PMI2_MAX_KEYLEN 64 | |
+#define PMI2_MAX_VALLEN 1024 | |
+#define PMI2_MAX_ATTRVALUE 1024 | |
+#define PMI2_ID_NULL -1 | |
+ | |
+#if defined(__cplusplus) | |
+extern "C" { | |
+#endif | |
+ | |
+/*D | |
+PMI2_CONSTANTS - PMI2 definitions | |
+ | |
+Error Codes: | |
++ PMI2_SUCCESS - operation completed successfully | |
+. PMI2_FAIL - operation failed | |
+. PMI2_ERR_NOMEM - input buffer not large enough | |
+. PMI2_ERR_INIT - PMI not initialized | |
+. PMI2_ERR_INVALID_ARG - invalid argument | |
+. PMI2_ERR_INVALID_KEY - invalid key argument | |
+. PMI2_ERR_INVALID_KEY_LENGTH - invalid key length argument | |
+. PMI2_ERR_INVALID_VAL - invalid val argument | |
+. PMI2_ERR_INVALID_VAL_LENGTH - invalid val length argument | |
+. PMI2_ERR_INVALID_LENGTH - invalid length argument | |
+. PMI2_ERR_INVALID_NUM_ARGS - invalid number of arguments | |
+. PMI2_ERR_INVALID_ARGS - invalid args argument | |
+. PMI2_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument | |
+. PMI2_ERR_INVALID_KEYVALP - invalid keyvalp argument | |
+. PMI2_ERR_INVALID_SIZE - invalid size argument | |
+- PMI2_ERR_OTHER - other unspecified error | |
+ | |
+D*/ | |
+#define PMI2_SUCCESS 0 | |
+#define PMI2_FAIL -1 | |
+#define PMI2_ERR_INIT 1 | |
+#define PMI2_ERR_NOMEM 2 | |
+#define PMI2_ERR_INVALID_ARG 3 | |
+#define PMI2_ERR_INVALID_KEY 4 | |
+#define PMI2_ERR_INVALID_KEY_LENGTH 5 | |
+#define PMI2_ERR_INVALID_VAL 6 | |
+#define PMI2_ERR_INVALID_VAL_LENGTH 7 | |
+#define PMI2_ERR_INVALID_LENGTH 8 | |
+#define PMI2_ERR_INVALID_NUM_ARGS 9 | |
+#define PMI2_ERR_INVALID_ARGS 10 | |
+#define PMI2_ERR_INVALID_NUM_PARSED 11 | |
+#define PMI2_ERR_INVALID_KEYVALP 12 | |
+#define PMI2_ERR_INVALID_SIZE 13 | |
+#define PMI2_ERR_OTHER 14 | |
+ | |
+/* This is here to allow spawn multiple functions to compile. This | |
+ needs to be removed once those functions are fixed for pmi2 */ | |
+typedef struct PMI_keyval_t | |
+{ | |
+ char * key; | |
+ char * val; | |
+} PMI_keyval_t; | |
+ | |
+ | |
+/*@ | |
+ PMI2_Connect_comm_t - connection structure used when connecting to other jobs | |
+ | |
+ Fields: | |
+ + read - Read from a connection to the leader of the job to which | |
+ this process will be connecting. Returns 0 on success or an MPI | |
+ error code on failure. | |
+ . write - Write to a connection to the leader of the job to which | |
+ this process will be connecting. Returns 0 on success or an MPI | |
+ error code on failure. | |
+ . ctx - An anonymous pointer to data that may be used by the read | |
+ and write members. | |
+ - isMaster - Indicates which process is the "master"; may have the | |
+ values 1 (is the master), 0 (is not the master), or -1 (neither is | |
+ designated as the master). The two processes must agree on which | |
+ process is the master, or both must select -1 (neither is the | |
+ master). | |
+ | |
+ Notes: | |
+ A typical implementation of these functions will use the read and | |
+ write calls on a pre-established file descriptor (fd) between the | |
+ two leading processes. This will be needed only if the PMI server | |
+ cannot access the KVS spaces of another job (this may happen, for | |
+ example, if each mpiexec creates the KVS spaces for the processes | |
+ that it manages). | |
+ | |
+@*/ | |
+typedef struct PMI2_Connect_comm { | |
+ int (*read)( void *buf, int maxlen, void *ctx ); | |
+ int (*write)( const void *buf, int len, void *ctx ); | |
+ void *ctx; | |
+ int isMaster; | |
+} PMI2_Connect_comm_t; | |
+ | |
+struct MPIR_Info; | |
+ | |
+/*@ | |
+ PMI2_Init - initialize the Process Manager Interface | |
+ | |
+ Output Parameter: | |
+ + spawned - spawned flag | |
+ . size - number of processes in the job | |
+ . rank - rank of this process in the job | |
+ - appnum - which executable is this on the mpiexec commandline | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Notes: | |
+ Initialize PMI for this process group. The value of spawned indicates whether | |
+ this process was created by 'PMI2_Spawn_multiple'. 'spawned' will be non-zero | |
+ iff this process group has a parent. | |
+ | |
+@*/ | |
+int PMI2_Init(int *spawned, int *size, int *rank, int *appnum); | |
+ | |
+/*@ | |
+ PMI2_Finalize - finalize the Process Manager Interface | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Notes: | |
+ Finalize PMI for this job. | |
+ | |
+@*/ | |
+int PMI2_Finalize(void); | |
+ | |
+/*@ | |
+ PMI2_Initialized - check if PMI has been initialized | |
+ | |
+ Return values: | |
+ Non-zero if PMI2_Initialize has been called successfully, zero otherwise. | |
+ | |
+@*/ | |
+int PMI2_Initialized(void); | |
+ | |
+/*@ | |
+ PMI2_Abort - abort the process group associated with this process | |
+ | |
+ Input Parameters: | |
+ + flag - non-zero if all processes in this job should abort, zero otherwise | |
+ - error_msg - error message to be printed | |
+ | |
+ Return values: | |
+ If the abort succeeds this function will not return. Returns an MPI | |
+ error code otherwise. | |
+ | |
+@*/ | |
+int PMI2_Abort(int flag, const char msg[]); | |
+ | |
+/*@ | |
+ PMI2_Spawn - spawn a new set of processes | |
+ | |
+ Input Parameters: | |
+ + count - count of commands | |
+ . cmds - array of command strings | |
+ . argcs - size of argv arrays for each command string | |
+ . argvs - array of argv arrays for each command string | |
+ . maxprocs - array of maximum processes to spawn for each command string | |
+ . info_keyval_sizes - array giving the number of elements in each of the | |
+ 'info_keyval_vectors' | |
+ . info_keyval_vectors - array of keyval vector arrays | |
+ . preput_keyval_size - Number of elements in 'preput_keyval_vector' | |
+ . preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space | |
+ - jobIdSize - size of the buffer provided in jobId | |
+ | |
+ Output Parameter: | |
+ + jobId - job id of the spawned processes | |
+ - errors - array of errors for each command | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Notes: | |
+ This function spawns a set of processes into a new job. The 'count' | |
+ field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs', | |
+ 'info_keyval_sizes' and 'info_keyval_vectors'. The 'preput_keyval_size' refers | |
+ to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector' | |
+ contains keyval pairs that will be put in the keyval space of the newly | |
+ created job before the processes are started. The 'maxprocs' array | |
+ specifies the desired number of processes to create for each 'cmd' string. | |
+ The actual number of processes may be less than the numbers specified in | |
+ maxprocs. The acceptable number of processes spawned may be controlled by | |
+ ``soft'' keyvals in the info arrays. The ``soft'' option is specified by | |
+ mpiexec in the MPI-2 standard. Environment variables may be passed to the | |
+ spawned processes through PMI implementation specific 'info_keyval' parameters. | |
+@*/ | |
+int PMI2_Job_Spawn(int count, const char * cmds[], | |
+ int argcs[], const char ** argvs[], | |
+ const int maxprocs[], | |
+ const int info_keyval_sizes[], | |
+ const struct MPIR_Info *info_keyval_vectors[], | |
+ int preput_keyval_size, | |
+ const struct MPIR_Info *preput_keyval_vector[], | |
+ char jobId[], int jobIdSize, | |
+ int errors[]); | |
+ | |
+ | |
+/*@ | |
+ PMI2_Job_GetId - get job id of this job | |
+ | |
+ Input parameters: | |
+ . jobid_size - size of buffer provided in jobid | |
+ | |
+ Output parameters: | |
+ . jobid - the job id of this job | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+@*/ | |
+int PMI2_Job_GetId(char jobid[], int jobid_size); | |
+ | |
+/*@ | |
+ PMI2_Job_Connect - connect to the parallel job with ID jobid | |
+ | |
+ Input parameters: | |
+ . jobid - job id of the job to connect to | |
+ | |
+ Output parameters: | |
+ . conn - connection structure used to exteblish communication with | |
+ the remote job | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Notes: | |
+ This just "registers" the other parallel job as part of a parallel | |
+ program, and is used in the PMI2_KVS_xxx routines (see below). This | |
+ is not a collective call and establishes a connection between all | |
+ processes that are connected to the calling processes (on the one | |
+ side) and that are connected to the named jobId on the other | |
+ side. Processes that are already connected may call this routine. | |
+ | |
+@*/ | |
+int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn); | |
+ | |
+/*@ | |
+ PMI2_Job_Disconnect - disconnects from the job with ID jobid | |
+ | |
+ Input parameters: | |
+ . jobid - job id of the job to connect to | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+@*/ | |
+int PMI2_Job_Disconnect(const char jobid[]); | |
+ | |
+/*@ | |
+ PMI2_KVS_Put - put a key/value pair in the keyval space for this job | |
+ | |
+ Input Parameters: | |
+ + key - key | |
+ - value - value | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Notes: | |
+ If multiple PMI2_KVS_Put calls are made with the same key between | |
+ calls to PMI2_KVS_Fence, the behavior is undefined. That is, the | |
+ value returned by PMI2_KVS_Get for that key after the PMI2_KVS_Fence | |
+ is not defined. | |
+ | |
+@*/ | |
+int PMI2_KVS_Put(const char key[], const char value[]); | |
+/*@ | |
+ PMI2_KVS_Fence - commit all PMI2_KVS_Put calls made before this fence | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Notes: | |
+ This is a collective call across the job. It has semantics that are | |
+ similar to those for MPI_Win_fence and hence is most easily | |
+ implemented as a barrier across all of the processes in the job. | |
+ Specifically, all PMI2_KVS_Put operations performed by any process in | |
+ the same job must be visible to all processes (by using PMI2_KVS_Get) | |
+ after PMI2_KVS_Fence completes. However, a PMI implementation could | |
+ make this a lazy operation by not waiting for all processes to enter | |
+ their corresponding PMI2_KVS_Fence until some process issues a | |
+ PMI2_KVS_Get. This might be appropriate for some wide-area | |
+ implementations. | |
+ | |
+@*/ | |
+int PMI2_KVS_Fence(void); | |
+ | |
+/*@ | |
+ PMI2_KVS_Get - returns the value associated with key in the key-value | |
+ space associated with the job ID jobid | |
+ | |
+ Input Parameters: | |
+ + jobid - the job id identifying the key-value space in which to look | |
+ for key. If jobid is NULL, look in the key-value space of this job. | |
+ . src_pmi_id - the pmi id of the process which put this keypair. This | |
+ is just a hint to the server. PMI2_ID_NULL should be passed if no | |
+ hint is provided. | |
+ . key - key | |
+ - maxvalue - size of the buffer provided in value | |
+ | |
+ Output Parameters: | |
+ + value - value associated with key | |
+ - vallen - length of the returned value, or, if the length is longer | |
+ than maxvalue, the negative of the required length is returned | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+@*/ | |
+int PMI2_KVS_Get(const char *jobid, int src_pmi_id, const char key[], char value [], int maxvalue, int *vallen); | |
+ | |
+/*@ | |
+ PMI2_Info_GetNodeAttr - returns the value of the attribute associated | |
+ with this node | |
+ | |
+ Input Parameters: | |
+ + name - name of the node attribute | |
+ . valuelen - size of the buffer provided in value | |
+ - waitfor - if non-zero, the function will not return until the | |
+ attribute is available | |
+ | |
+ Output Parameters: | |
+ + value - value of the attribute | |
+ - found - non-zero indicates that the attribute was found | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Notes: | |
+ This provides a way, when combined with PMI2_Info_PutNodeAttr, for | |
+ processes on the same node to share information without requiring a | |
+ more general barrier across the entire job. | |
+ | |
+ If waitfor is non-zero, the function will never return with found | |
+ set to zero. | |
+ | |
+ Predefined attributes: | |
+ + memPoolType - If the process manager allocated a shared memory | |
+ pool for the MPI processes in this job and on this node, return | |
+ the type of that pool. Types include sysv, anonmmap and ntshm. | |
+ . memSYSVid - Return the SYSV memory segment id if the memory pool | |
+ type is sysv. Returned as a string. | |
+ . memAnonMMAPfd - Return the FD of the anonymous mmap segment. The | |
+ FD is returned as a string. | |
+ - memNTName - Return the name of the Windows NT shared memory | |
+ segment, file mapping object backed by system paging | |
+ file. Returned as a string. | |
+ | |
+@*/ | |
+int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *found, int waitfor); | |
+ | |
+/*@ | |
+ PMI2_Info_GetNodeAttrIntArray - returns the value of the attribute associated | |
+ with this node. The value must be an array of integers. | |
+ | |
+ Input Parameters: | |
+ + name - name of the node attribute | |
+ - arraylen - number of elements in array | |
+ | |
+ Output Parameters: | |
+ + array - value of attribute | |
+ . outlen - number of elements returned | |
+ - found - non-zero if attribute was found | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Notes: | |
+ Notice that, unlike PMI2_Info_GetNodeAttr, this function does not | |
+ have a waitfor parameter, and will return immediately with found=0 | |
+ if the attribute was not found. | |
+ | |
+ Predefined array attribute names: | |
+ + localRanksCount - Return the number of local ranks that will be | |
+ returned by the key localRanks. | |
+ . localRanks - Return the ranks in MPI_COMM_WORLD of the processes | |
+ that are running on this node. | |
+ - cartCoords - Return the Cartesian coordinates of this process in | |
+ the underlying network topology. The coordinates are indexed from | |
+ zero. Value only if the Job attribute for physTopology includes | |
+ cartesian. | |
+ | |
+@*/ | |
+int PMI2_Info_GetNodeAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found); | |
+ | |
+/*@ | |
+ PMI2_Info_PutNodeAttr - stores the value of the named attribute | |
+ associated with this node | |
+ | |
+ Input Parameters: | |
+ + name - name of the node attribute | |
+ - value - the value of the attribute | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Notes: | |
+ For example, it might be used to share segment ids with other | |
+ processes on the same SMP node. | |
+ | |
+@*/ | |
+int PMI2_Info_PutNodeAttr(const char name[], const char value[]); | |
+ | |
+/*@ | |
+ PMI2_Info_GetJobAttr - returns the value of the attribute associated | |
+ with this job | |
+ | |
+ Input Parameters: | |
+ + name - name of the job attribute | |
+ - valuelen - size of the buffer provided in value | |
+ | |
+ Output Parameters: | |
+ + value - value of the attribute | |
+ - found - non-zero indicates that the attribute was found | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+@*/ | |
+int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *found); | |
+ | |
+/*@ | |
+ PMI2_Info_GetJobAttrIntArray - returns the value of the attribute associated | |
+ with this job. The value must be an array of integers. | |
+ | |
+ Input Parameters: | |
+ + name - name of the job attribute | |
+ - arraylen - number of elements in array | |
+ | |
+ Output Parameters: | |
+ + array - value of attribute | |
+ . outlen - number of elements returned | |
+ - found - non-zero if attribute was found | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+ Predefined array attribute names: | |
+ | |
+ + universeSize - The size of the "universe" (defined for the MPI | |
+ attribute MPI_UNIVERSE_SIZE | |
+ | |
+ . hasNameServ - The value hasNameServ is true if the PMI2 environment | |
+ supports the name service operations (publish, lookup, and | |
+ unpublish). | |
+ | |
+ . physTopology - Return the topology of the underlying network. The | |
+ valid topology types include cartesian, hierarchical, complete, | |
+ kautz, hypercube; additional types may be added as necessary. If | |
+ the type is hierarchical, then additional attributes may be | |
+ queried to determine the details of the topology. For example, a | |
+ typical cluster has a hierarchical physical topology, consisting | |
+ of two levels of complete networks - the switched Ethernet or | |
+ Infiniband and the SMP nodes. Other systems, such as IBM BlueGene, | |
+ have one level that is cartesian (and in virtual node mode, have a | |
+ single-level physical topology). | |
+ | |
+ . physTopologyLevels - Return a string describing the topology type | |
+ for each level of the underlying network. Only valid if the | |
+ physTopology is hierarchical. The value is a comma-separated list | |
+ of physical topology types (except for hierarchical). The levels | |
+ are ordered starting at the top, with the network closest to the | |
+ processes last. The lower level networks may connect only a subset | |
+ of processes. For example, for a cartesian mesh of SMPs, the value | |
+ is cartesian,complete. All processes are connected by the | |
+ cartesian part of this, but for each complete network, only the | |
+ processes on the same node are connected. | |
+ | |
+ . cartDims - Return a string of comma-separated values describing | |
+ the dimensions of the Cartesian topology. This must be consistent | |
+ with the value of cartCoords that may be returned by | |
+ PMI2_Info_GetNodeAttrIntArray. | |
+ | |
+ These job attributes are just a start, but they provide both an | |
+ example of the sort of external data that is available through the | |
+ PMI interface and how extensions can be added within the same API | |
+ and wire protocol. For example, adding more complex network | |
+ topologies requires only adding new keys, not new routines. | |
+ | |
+ . isHeterogeneous - The value isHeterogeneous is true if the | |
+ processes belonging to the job are running on nodes with different | |
+ underlying data models. | |
+ | |
+@*/ | |
+int PMI2_Info_GetJobAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found); | |
+ | |
+/*@ | |
+ PMI2_Nameserv_publish - publish a name | |
+ | |
+ Input parameters: | |
+ + service_name - string representing the service being published | |
+ . info_ptr - | |
+ - port - string representing the port on which to contact the service | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+@*/ | |
+int PMI2_Nameserv_publish(const char service_name[], const struct MPIR_Info *info_ptr, const char port[]); | |
+ | |
+/*@ | |
+ PMI2_Nameserv_lookup - lookup a service by name | |
+ | |
+ Input parameters: | |
+ + service_name - string representing the service being published | |
+ . info_ptr - | |
+ - portLen - size of buffer provided in port | |
+ | |
+ Output parameters: | |
+ . port - string representing the port on which to contact the service | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+@*/ | |
+int PMI2_Nameserv_lookup(const char service_name[], const struct MPIR_Info *info_ptr, | |
+ char port[], int portLen); | |
+/*@ | |
+ PMI2_Nameserv_unpublish - unpublish a name | |
+ | |
+ Input parameters: | |
+ + service_name - string representing the service being unpublished | |
+ - info_ptr - | |
+ | |
+ Return values: | |
+ Returns 'MPI_SUCCESS' on success and an MPI error code on failure. | |
+ | |
+@*/ | |
+int PMI2_Nameserv_unpublish(const char service_name[], | |
+ const struct MPIR_Info *info_ptr); | |
+ | |
+ | |
+ | |
+#if defined(__cplusplus) | |
+} | |
+#endif | |
+ | |
+#endif /* PMI2_H_INCLUDED */ | |
diff --git a/src/pmi/pmi2/simple/Makefile.mk b/src/pmi/pmi2/simple/Makefile.mk | |
index bd48a66..cd99aec 100644 | |
--- a/src/pmi/pmi2/simple/Makefile.mk | |
+++ b/src/pmi/pmi2/simple/Makefile.mk | |
@@ -14,8 +14,10 @@ mpi_core_sources += \ | |
noinst_HEADERS += \ | |
src/pmi/pmi2/simple/simple_pmiutil.h \ | |
src/pmi/pmi2/simple/simple2pmi.h \ | |
- src/pmi/pmi2/simple/pmi2compat.h | |
+ src/pmi/pmi2/simple/pmi2compat.h \ | |
+ src/pmi/pmi2/include/pmi2.h | |
AM_CPPFLAGS += -I$(top_srcdir)/src/pmi/pmi2/simple | |
+AM_CPPFLAGS += -I$(top_srcdir)/src/pmi/pmi2/include | |
endif BUILD_PMI_PMI2_SIMPLE | |
diff --git a/src/pmi/simple/Makefile.mk b/src/pmi/simple/Makefile.mk | |
index ef0eec8..b6234fb 100644 | |
--- a/src/pmi/simple/Makefile.mk | |
+++ b/src/pmi/simple/Makefile.mk | |
@@ -12,9 +12,11 @@ mpi_core_sources += \ | |
src/pmi/simple/simple_pmi.c | |
noinst_HEADERS += \ | |
- src/pmi/simple/simple_pmiutil.h | |
+ src/pmi/simple/simple_pmiutil.h \ | |
+ src/pmi/include/pmi.h | |
AM_CPPFLAGS += -I$(top_srcdir)/src/pmi/simple | |
+AM_CPPFLAGS += -I$(top_srcdir)/src/pmi/include | |
endif BUILD_PMI_SIMPLE | |
From 7e88d99e2b36c996917b6eeb5c764c74b3c54f15 Mon Sep 17 00:00:00 2001 | |
From: Ken Raffenetti <raffenet@mcs.anl.gov> | |
Date: Wed, 22 Feb 2017 15:23:38 -0600 | |
Subject: [PATCH 2/5] pmi: Simplify Cray PMI configuration | |
--- | |
src/pmi/craypmi/subconfigure.m4 | 15 ++++++--------- | |
1 file changed, 6 insertions(+), 9 deletions(-) | |
diff --git a/src/pmi/craypmi/subconfigure.m4 b/src/pmi/craypmi/subconfigure.m4 | |
index 4c99283..576c985 100644 | |
--- a/src/pmi/craypmi/subconfigure.m4 | |
+++ b/src/pmi/craypmi/subconfigure.m4 | |
@@ -8,18 +8,15 @@ AC_DEFUN([PAC_SUBCFG_BODY_]PAC_SUBCFG_AUTO_SUFFIX,[ | |
AM_CONDITIONAL([BUILD_PMI_CRAY],[test "x$pmi_name" = "xcraypmi"]) | |
AM_COND_IF([BUILD_PMI_CRAY],[ | |
-# sets CPPFLAGS and LDFLAGS | |
-PAC_SET_HEADER_LIB_PATH([pmi]) | |
+# set CPPFLAGS and LDFLAGS | |
+PAC_PREPEND_FLAG([$CRAY_PMI_INCLUDE_OPTS], [CPPFLAGS]) | |
+PAC_PREPEND_FLAG([$CRAY_PMI_POST_LINK_OPTS], [LDFLAGS]) | |
AC_CHECK_HEADER([pmi.h], [], [AC_MSG_ERROR([could not find pmi.h. Configure aborted])]) | |
+AC_CHECK_LIB([pmi], [PMI_Init], [], [AC_MSG_ERROR([could not find the cray libpmi. Configure aborted])]) | |
+ | |
AC_DEFINE(USE_CRAYPMI_API, 1, [Define if Cray PMI API must be used]) | |
-AC_CHECK_LIB([pmi], [PMI_Init], | |
- [ | |
- PAC_PREPEND_FLAG([$CRAY_PMI_POST_LINK_OPTS -lpmi], [WRAPPER_LIBS]) | |
- PAC_PREPEND_FLAG([$CRAY_PMI_POST_LINK_OPTS -lpmi],[LIBS]) | |
- PAC_PREPEND_FLAG([-Wl,-rpath=${with_pmi_lib},--enable-new-dtags], [WRAPPER_LIBS]) | |
- ], | |
- [AC_MSG_ERROR([could not find the cray libpmi. Configure aborted])]) | |
+PAC_APPEND_FLAG([-lpmi], [WRAPPER_LIBS]) | |
])dnl end COND_IF | |
From 8032a0c08b00b6e556d4e221df669a57faca75a0 Mon Sep 17 00:00:00 2001 | |
From: Ken Raffenetti <raffenet@mcs.anl.gov> | |
Date: Wed, 22 Feb 2017 15:26:00 -0600 | |
Subject: [PATCH 3/5] pmi: Rename craypmi to cray | |
--- | |
src/pmi/cray/subconfigure.m4 | 25 +++++++++++++++++++++++++ | |
src/pmi/craypmi/subconfigure.m4 | 25 ------------------------- | |
2 files changed, 25 insertions(+), 25 deletions(-) | |
create mode 100644 src/pmi/cray/subconfigure.m4 | |
delete mode 100644 src/pmi/craypmi/subconfigure.m4 | |
diff --git a/src/pmi/cray/subconfigure.m4 b/src/pmi/cray/subconfigure.m4 | |
new file mode 100644 | |
index 0000000..44ff8ed | |
--- /dev/null | |
+++ b/src/pmi/cray/subconfigure.m4 | |
@@ -0,0 +1,25 @@ | |
+[#] start of __file__ | |
+ | |
+AC_DEFUN([PAC_SUBCFG_PREREQ_]PAC_SUBCFG_AUTO_SUFFIX,[ | |
+]) | |
+ | |
+AC_DEFUN([PAC_SUBCFG_BODY_]PAC_SUBCFG_AUTO_SUFFIX,[ | |
+ | |
+AM_CONDITIONAL([BUILD_PMI_CRAY],[test "x$pmi_name" = "xcray"]) | |
+AM_COND_IF([BUILD_PMI_CRAY],[ | |
+ | |
+# set CPPFLAGS and LDFLAGS | |
+PAC_PREPEND_FLAG([$CRAY_PMI_INCLUDE_OPTS], [CPPFLAGS]) | |
+PAC_PREPEND_FLAG([$CRAY_PMI_POST_LINK_OPTS], [LDFLAGS]) | |
+ | |
+AC_CHECK_HEADER([pmi.h], [], [AC_MSG_ERROR([could not find pmi.h. Configure aborted])]) | |
+AC_CHECK_LIB([pmi], [PMI_Init], [], [AC_MSG_ERROR([could not find the cray libpmi. Configure aborted])]) | |
+ | |
+AC_DEFINE(USE_CRAYPMI_API, 1, [Define if Cray PMI API must be used]) | |
+PAC_APPEND_FLAG([-lpmi], [WRAPPER_LIBS]) | |
+ | |
+])dnl end COND_IF | |
+ | |
+])dnl end BODY macro | |
+ | |
+[#] end of __file__ | |
diff --git a/src/pmi/craypmi/subconfigure.m4 b/src/pmi/craypmi/subconfigure.m4 | |
deleted file mode 100644 | |
index 576c985..0000000 | |
--- a/src/pmi/craypmi/subconfigure.m4 | |
+++ /dev/null | |
@@ -1,25 +0,0 @@ | |
-[#] start of __file__ | |
- | |
-AC_DEFUN([PAC_SUBCFG_PREREQ_]PAC_SUBCFG_AUTO_SUFFIX,[ | |
-]) | |
- | |
-AC_DEFUN([PAC_SUBCFG_BODY_]PAC_SUBCFG_AUTO_SUFFIX,[ | |
- | |
-AM_CONDITIONAL([BUILD_PMI_CRAY],[test "x$pmi_name" = "xcraypmi"]) | |
-AM_COND_IF([BUILD_PMI_CRAY],[ | |
- | |
-# set CPPFLAGS and LDFLAGS | |
-PAC_PREPEND_FLAG([$CRAY_PMI_INCLUDE_OPTS], [CPPFLAGS]) | |
-PAC_PREPEND_FLAG([$CRAY_PMI_POST_LINK_OPTS], [LDFLAGS]) | |
- | |
-AC_CHECK_HEADER([pmi.h], [], [AC_MSG_ERROR([could not find pmi.h. Configure aborted])]) | |
-AC_CHECK_LIB([pmi], [PMI_Init], [], [AC_MSG_ERROR([could not find the cray libpmi. Configure aborted])]) | |
- | |
-AC_DEFINE(USE_CRAYPMI_API, 1, [Define if Cray PMI API must be used]) | |
-PAC_APPEND_FLAG([-lpmi], [WRAPPER_LIBS]) | |
- | |
-])dnl end COND_IF | |
- | |
-])dnl end BODY macro | |
- | |
-[#] end of __file__ | |
From 09c041a615313092901ccf4e4812c6fc6df806aa Mon Sep 17 00:00:00 2001 | |
From: Ken Raffenetti <raffenet@mcs.anl.gov> | |
Date: Wed, 22 Feb 2017 16:16:14 -0600 | |
Subject: [PATCH 4/5] CH4/OFI: Fix Cray PMI configuration | |
Fixes a compile error for undeclared variable. | |
--- | |
src/mpid/ch4/netmod/ofi/ofi_init.h | 5 +++-- | |
1 file changed, 3 insertions(+), 2 deletions(-) | |
diff --git a/src/mpid/ch4/netmod/ofi/ofi_init.h b/src/mpid/ch4/netmod/ofi/ofi_init.h | |
index 82240d7..c155f2c 100644 | |
--- a/src/mpid/ch4/netmod/ofi/ofi_init.h | |
+++ b/src/mpid/ch4/netmod/ofi/ofi_init.h | |
@@ -230,7 +230,7 @@ static inline int MPIDI_NM_mpi_init_hook(int rank, | |
int spawned, int num_contexts, void **netmod_contexts) | |
{ | |
int mpi_errno = MPI_SUCCESS, pmi_errno, i, fi_version; | |
- int thr_err = 0, str_errno, maxlen; | |
+ int thr_err = 0, str_errno, maxlen, vallen; | |
char *table = NULL, *provname = NULL; | |
struct fi_info *hints, *prov, *prov_use; | |
struct fi_cq_attr cq_attr; | |
@@ -775,7 +775,8 @@ static inline int MPIDI_NM_mpi_init_hook(int rank, | |
sprintf(keyS, "OFI-%d", i); | |
#ifdef USE_CRAYPMI_API | |
MPIDI_OFI_PMI_CALL_POP(PMI2_KVS_Get | |
- (NULL, -1, keyS, valS, MPIDI_KVSAPPSTRLEN, &len), pmi); | |
+ (NULL, -1, keyS, valS, MPIDI_KVSAPPSTRLEN, &vallen), pmi); | |
+ MPIR_Assert(vallen > 0); | |
#else | |
MPIDI_OFI_PMI_CALL_POP(PMI_KVS_Get | |
(MPIDI_Global.kvsname, keyS, valS, MPIDI_KVSAPPSTRLEN), pmi); | |
From 039c9a4d056b8dc6cc6bd2fb39543cbfb085da2c Mon Sep 17 00:00:00 2001 | |
From: Ken Raffenetti <raffenet@mcs.anl.gov> | |
Date: Tue, 28 Feb 2017 15:53:49 -0800 | |
Subject: [PATCH 5/5] pmi: Use PMI2 API with Cray PMI library | |
--- | |
src/mpid/ch4/netmod/ofi/ofi_init.h | 6 +++--- | |
src/mpid/ch4/src/ch4_init.h | 2 +- | |
src/pmi/cray/subconfigure.m4 | 2 +- | |
3 files changed, 5 insertions(+), 5 deletions(-) | |
diff --git a/src/mpid/ch4/netmod/ofi/ofi_init.h b/src/mpid/ch4/netmod/ofi/ofi_init.h | |
index c155f2c..d1d30b5 100644 | |
--- a/src/mpid/ch4/netmod/ofi/ofi_init.h | |
+++ b/src/mpid/ch4/netmod/ofi/ofi_init.h | |
@@ -740,7 +740,7 @@ static inline int MPIDI_NM_mpi_init_hook(int rank, | |
val = valS; | |
sprintf(keyS, "OFI-%d", rank); | |
-#ifdef USE_CRAYPMI_API | |
+#ifdef USE_PMI2_API | |
MPIDI_OFI_PMI_CALL_POP(PMI2_KVS_Put(keyS, val), pmi); | |
MPIDI_OFI_PMI_CALL_POP(PMI2_KVS_Fence(), pmi); | |
#else | |
@@ -773,7 +773,7 @@ static inline int MPIDI_NM_mpi_init_hook(int rank, | |
end += size % num_local; | |
for (i = start; i < end; i++) { | |
sprintf(keyS, "OFI-%d", i); | |
-#ifdef USE_CRAYPMI_API | |
+#ifdef USE_PMI2_API | |
MPIDI_OFI_PMI_CALL_POP(PMI2_KVS_Get | |
(NULL, -1, keyS, valS, MPIDI_KVSAPPSTRLEN, &vallen), pmi); | |
MPIR_Assert(vallen > 0); | |
@@ -976,7 +976,7 @@ static inline int MPIDI_NM_mpi_finalize_hook(void) | |
MPIR_Assert(slist_empty(&MPIDI_Global.cq_buff_list)); | |
} | |
-#ifdef USE_CRAYPMI_API | |
+#ifdef USE_PMI2_API | |
PMI2_Finalize(); | |
#else | |
PMI_Finalize(); | |
diff --git a/src/mpid/ch4/src/ch4_init.h b/src/mpid/ch4/src/ch4_init.h | |
index 60e1c29..cd811a4 100644 | |
--- a/src/mpid/ch4/src/ch4_init.h | |
+++ b/src/mpid/ch4/src/ch4_init.h | |
@@ -119,7 +119,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Init(int *argc, | |
MPIDI_CH4_DBG_MEMORY = MPL_dbg_class_alloc("CH4_MEMORY", "ch4_memory"); | |
#endif | |
MPIDI_choose_netmod(); | |
-#ifdef USE_CRAYPMI_API | |
+#ifdef USE_PMI2_API | |
pmi_errno = PMI2_Init(&has_parent, &size, &rank, &appnum); | |
if (pmi_errno != PMI_SUCCESS) { | |
diff --git a/src/pmi/cray/subconfigure.m4 b/src/pmi/cray/subconfigure.m4 | |
index 44ff8ed..7596ec0 100644 | |
--- a/src/pmi/cray/subconfigure.m4 | |
+++ b/src/pmi/cray/subconfigure.m4 | |
@@ -15,7 +15,7 @@ PAC_PREPEND_FLAG([$CRAY_PMI_POST_LINK_OPTS], [LDFLAGS]) | |
AC_CHECK_HEADER([pmi.h], [], [AC_MSG_ERROR([could not find pmi.h. Configure aborted])]) | |
AC_CHECK_LIB([pmi], [PMI_Init], [], [AC_MSG_ERROR([could not find the cray libpmi. Configure aborted])]) | |
-AC_DEFINE(USE_CRAYPMI_API, 1, [Define if Cray PMI API must be used]) | |
+AC_DEFINE(USE_PMI2_API, 1, [Define if Cray PMI API must be used]) | |
PAC_APPEND_FLAG([-lpmi], [WRAPPER_LIBS]) | |
])dnl end COND_IF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment