1
1

sync with pmix master (repo_rev git69c398e)

Этот коммит содержится в:
annu13 2015-10-09 15:17:43 -07:00
родитель 5787e9248f
Коммит cc5e1e26a5
33 изменённых файлов: 1025 добавлений и 279 удалений

Просмотреть файл

@ -30,7 +30,7 @@ greek=a1
# command, or with the date (if "git describe" fails) in the form of # command, or with the date (if "git describe" fails) in the form of
# "date<date>". # "date<date>".
repo_rev=git3c37421 repo_rev=git69c398e
# If tarball_version is not empty, it is used as the version string in # If tarball_version is not empty, it is used as the version string in
# the tarball filename, regardless of all other versions listed in # the tarball filename, regardless of all other versions listed in
@ -44,7 +44,7 @@ tarball_version=
# The date when this release was created # The date when this release was created
date="Oct 02, 2015" date="Oct 09, 2015"
# The shared library version of each of PMIx's public libraries. # The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library # These versions are maintained in accordance with the "Library

Просмотреть файл

@ -343,26 +343,26 @@ static void errhandler(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs, pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo) pmix_info_t info[], size_t ninfo)
{ {
pmix_output_verbose(2, "SERVER: ERRHANDLER CALLED WITH STATUS %d", status); pmix_output_verbose(0, pmix_globals.debug_output, "SERVER: ERRHANDLER CALLED WITH STATUS %d", status);
} }
static void op_callbk(pmix_status_t status, static void op_callbk(pmix_status_t status,
void *cbdata) void *cbdata)
{ {
pmix_output_verbose(2, "SERVER: OP CALLBACK CALLED WITH STATUS %d", status); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: OP CALLBACK CALLED WITH STATUS %d", status);
} }
static void errhandler_reg_callbk (pmix_status_t status, static void errhandler_reg_callbk (pmix_status_t status,
int errhandler_ref, int errhandler_ref,
void *cbdata) void *cbdata)
{ {
pmix_output_verbose(2, "SERVER: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%d", pmix_output_verbose(1, pmix_globals.debug_output, "SERVER: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%d",
status, errhandler_ref); status, errhandler_ref);
} }
static int connected(const pmix_proc_t *proc, void *server_object) static int connected(const pmix_proc_t *proc, void *server_object)
{ {
pmix_output_verbose(2, "SERVER: CONNECTED %s:%d", proc->nspace, proc->rank); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: CONNECTED %s:%d", proc->nspace, proc->rank);
return PMIX_SUCCESS; return PMIX_SUCCESS;
} }
@ -370,7 +370,7 @@ static int connected(const pmix_proc_t *proc, void *server_object)
static int finalized(const pmix_proc_t *proc, void *server_object, static int finalized(const pmix_proc_t *proc, void *server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata) pmix_op_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_output_verbose(2, "SERVER: FINALIZED %s:%d", proc->nspace, proc->rank); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: FINALIZED %s:%d", proc->nspace, proc->rank);
--wakeup; --wakeup;
/* ensure we call the cbfunc so the proc can exit! */ /* ensure we call the cbfunc so the proc can exit! */
if (NULL != cbfunc) { if (NULL != cbfunc) {
@ -399,7 +399,7 @@ static pmix_status_t abort_fn(const pmix_proc_t *proc,
pmix_status_t rc; pmix_status_t rc;
myxfer_t *x; myxfer_t *x;
pmix_output_verbose(2, "SERVER: ABORT on %s:%d", procs[0].nspace, procs[0].rank); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: ABORT on %s:%d", procs[0].nspace, procs[0].rank);
/* instead of aborting the specified procs, notify them /* instead of aborting the specified procs, notify them
* (if they have registered their errhandler) */ * (if they have registered their errhandler) */
@ -423,7 +423,7 @@ static pmix_status_t abort_fn(const pmix_proc_t *proc,
if (PMIX_SUCCESS != (rc = PMIx_Notify_error(status, procs, nprocs, if (PMIX_SUCCESS != (rc = PMIx_Notify_error(status, procs, nprocs,
&x->caller, 1, x->info, 2, &x->caller, 1, x->info, 2,
abcbfunc, x))) { abcbfunc, x))) {
pmix_output_verbose(1, "SERVER: FAILED NOTIFY ERROR %d", (int)rc); pmix_output_verbose(0, pmix_globals.debug_output, "SERVER: FAILED NOTIFY ERROR %d", (int)rc);
} }
return PMIX_SUCCESS; return PMIX_SUCCESS;
@ -435,7 +435,7 @@ static int fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
char *data, size_t ndata, char *data, size_t ndata,
pmix_modex_cbfunc_t cbfunc, void *cbdata) pmix_modex_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_output_verbose(2, "SERVER: FENCENB"); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: FENCENB");
/* pass the provided data back to each participating proc */ /* pass the provided data back to each participating proc */
if (NULL != cbfunc) { if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, data, ndata, cbdata, NULL, NULL); cbfunc(PMIX_SUCCESS, data, ndata, cbdata, NULL, NULL);
@ -448,7 +448,7 @@ static int dmodex_fn(const pmix_proc_t *proc,
const pmix_info_t info[], size_t ninfo, const pmix_info_t info[], size_t ninfo,
pmix_modex_cbfunc_t cbfunc, void *cbdata) pmix_modex_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_output_verbose(2, "SERVER: DMODEX"); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: DMODEX");
/* we don't have any data for remote procs as this /* we don't have any data for remote procs as this
* test only runs one server - so report accordingly */ * test only runs one server - so report accordingly */
@ -466,7 +466,7 @@ static int publish_fn(const pmix_proc_t *proc,
pmix_locdat_t *p; pmix_locdat_t *p;
size_t n; size_t n;
pmix_output_verbose(2, "SERVER: PUBLISH"); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: PUBLISH");
for (n=0; n < ninfo; n++) { for (n=0; n < ninfo; n++) {
p = PMIX_NEW(pmix_locdat_t); p = PMIX_NEW(pmix_locdat_t);
@ -493,7 +493,7 @@ static int lookup_fn(const pmix_proc_t *proc, char **keys,
pmix_pdata_t *pd; pmix_pdata_t *pd;
pmix_status_t ret = PMIX_ERR_NOT_FOUND; pmix_status_t ret = PMIX_ERR_NOT_FOUND;
pmix_output_verbose(2, "SERVER: LOOKUP"); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: LOOKUP");
PMIX_CONSTRUCT(&results, pmix_list_t); PMIX_CONSTRUCT(&results, pmix_list_t);
@ -539,7 +539,7 @@ static int unpublish_fn(const pmix_proc_t *proc, char **keys,
pmix_locdat_t *p, *p2; pmix_locdat_t *p, *p2;
size_t n; size_t n;
pmix_output_verbose(2, "SERVER: UNPUBLISH"); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: UNPUBLISH");
for (n=0; NULL != keys[n]; n++) { for (n=0; NULL != keys[n]; n++) {
PMIX_LIST_FOREACH_SAFE(p, p2, &pubdata, pmix_locdat_t) { PMIX_LIST_FOREACH_SAFE(p, p2, &pubdata, pmix_locdat_t) {
@ -572,7 +572,7 @@ static int spawn_fn(const pmix_proc_t *proc,
{ {
myxfer_t *x; myxfer_t *x;
pmix_output_verbose(2, "SERVER: SPAWN"); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: SPAWN");
/* in practice, we would pass this request to the local /* in practice, we would pass this request to the local
* resource manager for launch, and then have that server * resource manager for launch, and then have that server
@ -595,7 +595,7 @@ static int connect_fn(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo, const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata) pmix_op_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_output_verbose(2, "SERVER: CONNECT"); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: CONNECT");
/* in practice, we would pass this request to the local /* in practice, we would pass this request to the local
* resource manager for handling */ * resource manager for handling */
@ -612,7 +612,7 @@ static int disconnect_fn(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo, const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata) pmix_op_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_output_verbose(2, "SERVER: DISCONNECT"); pmix_output_verbose(2, pmix_globals.debug_output,"SERVER: DISCONNECT");
/* in practice, we would pass this request to the local /* in practice, we would pass this request to the local
* resource manager for handling */ * resource manager for handling */
@ -627,7 +627,7 @@ static int disconnect_fn(const pmix_proc_t procs[], size_t nprocs,
static int register_events_fn(const pmix_info_t info[], size_t ninfo, static int register_events_fn(const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata) pmix_op_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_output_verbose(2, "SERVER: REGISTER EVENTS"); pmix_output_verbose(2, pmix_globals.debug_output, "SERVER: REGISTER EVENTS");
/* in practice, we would pass this request to the local /* in practice, we would pass this request to the local
* resource manager for handling */ * resource manager for handling */

Просмотреть файл

@ -89,7 +89,7 @@ typedef struct PMI_keyval_t
cannot access the KVS spaces of another job (this may happen, for cannot access the KVS spaces of another job (this may happen, for
example, if each mpiexec creates the KVS spaces for the processes example, if each mpiexec creates the KVS spaces for the processes
that it manages). that it manages).
@*/ @*/
typedef struct PMI2_Connect_comm { typedef struct PMI2_Connect_comm {
int (*read)( void *buf, int maxlen, void *ctx ); int (*read)( void *buf, int maxlen, void *ctx );
@ -107,10 +107,10 @@ typedef struct PMI2_Connect_comm {
. size - number of processes in the job . size - number of processes in the job
. rank - rank of this process in the job . rank - rank of this process in the job
- appnum - which executable is this on the mpiexec commandline - appnum - which executable is this on the mpiexec commandline
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes: Notes:
Initialize PMI for this process group. The value of spawned indicates whether 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 this process was created by 'PMI2_Spawn_multiple'. 'spawned' will be non-zero
@ -121,13 +121,13 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum);
/*@ /*@
PMI2_Finalize - finalize the Process Manager Interface PMI2_Finalize - finalize the Process Manager Interface
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes: Notes:
Finalize PMI for this job. Finalize PMI for this job.
@*/ @*/
int PMI2_Finalize(void); int PMI2_Finalize(void);
@ -136,17 +136,17 @@ int PMI2_Finalize(void);
Return values: Return values:
Non-zero if PMI2_Initialize has been called successfully, zero otherwise. Non-zero if PMI2_Initialize has been called successfully, zero otherwise.
@*/ @*/
int PMI2_Initialized(void); int PMI2_Initialized(void);
/*@ /*@
PMI2_Abort - abort the process group associated with this process PMI2_Abort - abort the process group associated with this process
Input Parameters: Input Parameters:
+ flag - non-zero if all processes in this job should abort, zero otherwise + flag - non-zero if all processes in this job should abort, zero otherwise
- error_msg - error message to be printed - error_msg - error message to be printed
Return values: Return values:
If the abort succeeds this function will not return. Returns an MPI If the abort succeeds this function will not return. Returns an MPI
error code otherwise. error code otherwise.
@ -163,7 +163,7 @@ int PMI2_Abort(int flag, const char msg[]);
. argcs - size of argv arrays for each command string . argcs - size of argv arrays for each command string
. argvs - array 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 . 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_sizes - array giving the number of elements in each of the
'info_keyval_vectors' 'info_keyval_vectors'
. info_keyval_vectors - array of keyval vector arrays . info_keyval_vectors - array of keyval vector arrays
. preput_keyval_size - Number of elements in 'preput_keyval_vector' . preput_keyval_size - Number of elements in 'preput_keyval_vector'
@ -175,7 +175,7 @@ int PMI2_Abort(int flag, const char msg[]);
- errors - array of errors for each command - errors - array of errors for each command
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes: Notes:
This function spawns a set of processes into a new job. The 'count' This function spawns a set of processes into a new job. The 'count'
@ -184,7 +184,7 @@ int PMI2_Abort(int flag, const char msg[]);
to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector' 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 contains keyval pairs that will be put in the keyval space of the newly
created job before the processes are started. The 'maxprocs' array created job before the processes are started. The 'maxprocs' array
specifies the desired number of processes to create for each 'cmd' string. 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 The actual number of processes may be less than the numbers specified in
maxprocs. The acceptable number of processes spawned may be controlled by maxprocs. The acceptable number of processes spawned may be controlled by
``soft'' keyvals in the info arrays. The ``soft'' option is specified by ``soft'' keyvals in the info arrays. The ``soft'' option is specified by
@ -202,20 +202,38 @@ int PMI2_Job_Spawn(int count, const char * cmds[],
int errors[]); int errors[]);
/*@ /*@
PMI2_Job_GetId - get job id of this job PMI2_Job_GetId - get job id of this job
Input parameters: Input parameters:
. jobid_size - size of buffer provided in jobid . jobid_size - size of buffer provided in jobid
Output parameters: Output parameters:
. jobid - the job id of this job . jobid - the job id of this job
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/ @*/
int PMI2_Job_GetId(char jobid[], int jobid_size); int PMI2_Job_GetId(char jobid[], int jobid_size);
/*@
PMI2_Job_GetRank - get rank of this job
Output parameters:
. rank - the rank of this job
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Job_GetRank(int* rank);
/*@
PMI2_Info_GetSize - get the number of processes on the node
Output parameters:
. rank - the rank of this job
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Info_GetSize(int* size);
/*@ /*@
PMI2_Job_Connect - connect to the parallel job with ID jobid PMI2_Job_Connect - connect to the parallel job with ID jobid
@ -225,9 +243,9 @@ int PMI2_Job_GetId(char jobid[], int jobid_size);
Output parameters: Output parameters:
. conn - connection structure used to exteblish communication with . conn - connection structure used to exteblish communication with
the remote job the remote job
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes: Notes:
This just "registers" the other parallel job as part of a parallel This just "registers" the other parallel job as part of a parallel
@ -247,7 +265,7 @@ int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn);
. jobid - job id of the job to connect to . jobid - job id of the job to connect to
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/ @*/
int PMI2_Job_Disconnect(const char jobid[]); int PMI2_Job_Disconnect(const char jobid[]);
@ -258,9 +276,9 @@ int PMI2_Job_Disconnect(const char jobid[]);
Input Parameters: Input Parameters:
+ key - key + key - key
- value - value - value - value
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes: Notes:
If multiple PMI2_KVS_Put calls are made with the same key between If multiple PMI2_KVS_Put calls are made with the same key between
@ -274,7 +292,7 @@ int PMI2_KVS_Put(const char key[], const char value[]);
PMI2_KVS_Fence - commit all PMI2_KVS_Put calls made before this fence PMI2_KVS_Fence - commit all PMI2_KVS_Put calls made before this fence
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes: Notes:
This is a collective call across the job. It has semantics that are This is a collective call across the job. It has semantics that are
@ -287,7 +305,7 @@ int PMI2_KVS_Put(const char key[], const char value[]);
their corresponding PMI2_KVS_Fence until some process issues a their corresponding PMI2_KVS_Fence until some process issues a
PMI2_KVS_Get. This might be appropriate for some wide-area PMI2_KVS_Get. This might be appropriate for some wide-area
implementations. implementations.
@*/ @*/
int PMI2_KVS_Fence(void); int PMI2_KVS_Fence(void);
@ -308,9 +326,9 @@ int PMI2_KVS_Fence(void);
+ value - value associated with key + value - value associated with key
- vallen - length of the returned value, or, if the length is longer - vallen - length of the returned value, or, if the length is longer
than maxvalue, the negative of the required length is returned than maxvalue, the negative of the required length is returned
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/ @*/
int PMI2_KVS_Get(const char *jobid, int src_pmi_id, const char key[], char value [], int maxvalue, int *vallen); int PMI2_KVS_Get(const char *jobid, int src_pmi_id, const char key[], char value [], int maxvalue, int *vallen);
@ -328,9 +346,9 @@ int PMI2_KVS_Get(const char *jobid, int src_pmi_id, const char key[], char value
Output Parameters: Output Parameters:
+ value - value of the attribute + value - value of the attribute
- found - non-zero indicates that the attribute was found - found - non-zero indicates that the attribute was found
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes: Notes:
This provides a way, when combined with PMI2_Info_PutNodeAttr, for This provides a way, when combined with PMI2_Info_PutNodeAttr, for
@ -367,9 +385,9 @@ int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *fo
+ array - value of attribute + array - value of attribute
. outlen - number of elements returned . outlen - number of elements returned
- found - non-zero if attribute was found - found - non-zero if attribute was found
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes: Notes:
Notice that, unlike PMI2_Info_GetNodeAttr, this function does not Notice that, unlike PMI2_Info_GetNodeAttr, this function does not
@ -398,12 +416,12 @@ int PMI2_Info_GetNodeAttrIntArray(const char name[], int array[], int arraylen,
- value - the value of the attribute - value - the value of the attribute
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes: Notes:
For example, it might be used to share segment ids with other For example, it might be used to share segment ids with other
processes on the same SMP node. processes on the same SMP node.
@*/ @*/
int PMI2_Info_PutNodeAttr(const char name[], const char value[]); int PMI2_Info_PutNodeAttr(const char name[], const char value[]);
@ -418,9 +436,9 @@ int PMI2_Info_PutNodeAttr(const char name[], const char value[]);
Output Parameters: Output Parameters:
+ value - value of the attribute + value - value of the attribute
- found - non-zero indicates that the attribute was found - found - non-zero indicates that the attribute was found
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/ @*/
int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *found); int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *found);
@ -437,9 +455,9 @@ int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *fou
+ array - value of attribute + array - value of attribute
. outlen - number of elements returned . outlen - number of elements returned
- found - non-zero if attribute was found - found - non-zero if attribute was found
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Predefined array attribute names: Predefined array attribute names:
@ -449,7 +467,7 @@ int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *fou
. hasNameServ - The value hasNameServ is true if the PMI2 environment . hasNameServ - The value hasNameServ is true if the PMI2 environment
supports the name service operations (publish, lookup, and supports the name service operations (publish, lookup, and
unpublish). unpublish).
. physTopology - Return the topology of the underlying network. The . physTopology - Return the topology of the underlying network. The
valid topology types include cartesian, hierarchical, complete, valid topology types include cartesian, hierarchical, complete,
kautz, hypercube; additional types may be added as necessary. If kautz, hypercube; additional types may be added as necessary. If
@ -471,7 +489,7 @@ int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *fou
is cartesian,complete. All processes are connected by the is cartesian,complete. All processes are connected by the
cartesian part of this, but for each complete network, only the cartesian part of this, but for each complete network, only the
processes on the same node are connected. processes on the same node are connected.
. cartDims - Return a string of comma-separated values describing . cartDims - Return a string of comma-separated values describing
the dimensions of the Cartesian topology. This must be consistent the dimensions of the Cartesian topology. This must be consistent
with the value of cartCoords that may be returned by with the value of cartCoords that may be returned by
@ -482,7 +500,7 @@ int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *fou
PMI interface and how extensions can be added within the same API PMI interface and how extensions can be added within the same API
and wire protocol. For example, adding more complex network and wire protocol. For example, adding more complex network
topologies requires only adding new keys, not new routines. topologies requires only adding new keys, not new routines.
. isHeterogeneous - The value isHeterogeneous is true if the . isHeterogeneous - The value isHeterogeneous is true if the
processes belonging to the job are running on nodes with different processes belonging to the job are running on nodes with different
underlying data models. underlying data models.
@ -491,7 +509,7 @@ int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *fou
int PMI2_Info_GetJobAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found); int PMI2_Info_GetJobAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found);
/*@ /*@
PMI2_Nameserv_publish - publish a name PMI2_Nameserv_publish - publish a name
Input parameters: Input parameters:
+ service_name - string representing the service being published + service_name - string representing the service being published
@ -499,7 +517,7 @@ int PMI2_Info_GetJobAttrIntArray(const char name[], int array[], int arraylen, i
- port - string representing the port on which to contact the service - port - string representing the port on which to contact the service
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/ @*/
int PMI2_Nameserv_publish(const char service_name[], const PMI_keyval_t *info_ptr, const char port[]); int PMI2_Nameserv_publish(const char service_name[], const PMI_keyval_t *info_ptr, const char port[]);
@ -511,12 +529,12 @@ int PMI2_Nameserv_publish(const char service_name[], const PMI_keyval_t *info_pt
+ service_name - string representing the service being published + service_name - string representing the service being published
. info_ptr - . info_ptr -
- portLen - size of buffer provided in port - portLen - size of buffer provided in port
Output parameters: Output parameters:
. port - string representing the port on which to contact the service . port - string representing the port on which to contact the service
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/ @*/
int PMI2_Nameserv_lookup(const char service_name[], const PMI_keyval_t *info_ptr, int PMI2_Nameserv_lookup(const char service_name[], const PMI_keyval_t *info_ptr,
@ -529,10 +547,10 @@ int PMI2_Nameserv_lookup(const char service_name[], const PMI_keyval_t *info_ptr
- info_ptr - - info_ptr -
Return values: Return values:
Returns 'MPI_SUCCESS' on success and an MPI error code on failure. Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/ @*/
int PMI2_Nameserv_unpublish(const char service_name[], int PMI2_Nameserv_unpublish(const char service_name[],
const PMI_keyval_t *info_ptr); const PMI_keyval_t *info_ptr);

Просмотреть файл

@ -470,10 +470,10 @@ typedef struct {
} while(0); } while(0);
#define PMIX_INFO_LOAD(m, k, v, t) \ #define PMIX_INFO_LOAD(m, k, v, t) \
if (NULL != (m)) { \ do { \
(void)strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \ (void)strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \
pmix_value_load(&((m)->value), (v), (t)); \ pmix_value_load(&((m)->value), (v), (t)); \
} } while(0);
/**** PMIX LOOKUP RETURN STRUCT ****/ /**** PMIX LOOKUP RETURN STRUCT ****/

Просмотреть файл

@ -10,6 +10,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -13,6 +13,8 @@
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -13,6 +13,8 @@
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -3,6 +3,8 @@
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science * Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -37,53 +39,79 @@
#include "src/util/error.h" #include "src/util/error.h"
#include "src/util/output.h" #include "src/util/output.h"
#define PMI_MAX_ID_LEN PMIX_MAX_NSLEN /* Maximim size of PMI process group ID */
#define PMI_MAX_KEY_LEN PMIX_MAX_KEYLEN /* Maximum size of a PMI key */
#define PMI_MAX_KVSNAME_LEN PMIX_MAX_NSLEN /* Maximum size of KVS name */
#define PMI_MAX_VAL_LEN 4096 /* Maximum size of a PMI value */
#define PMI_CHECK() \
do { \
if (!pmi_init) { \
return PMI_FAIL; \
} \
} while (0)
/* local functions */ /* local functions */
static pmix_status_t convert_int(int *value, pmix_value_t *kv); static pmix_status_t convert_int(int *value, pmix_value_t *kv);
static int convert_err(pmix_status_t rc); static int convert_err(pmix_status_t rc);
static pmix_proc_t myproc; static pmix_proc_t myproc;
static bool data_commited = false; static bool data_commited = false;
static int pmi_init = 0;
int PMI_Init( int *spawned ) int PMI_Init(int *spawned)
{ {
pmix_value_t *kv; pmix_value_t *val;
pmix_status_t rc; pmix_status_t rc;
if (PMIX_SUCCESS != PMIx_Init(&myproc)) { if (PMIX_SUCCESS != PMIx_Init(&myproc)) {
return PMI_ERR_INIT; return PMI_ERR_INIT;
} }
if (NULL == spawned) { if (NULL != spawned) {
return PMI_SUCCESS; /* get the spawned flag */
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_SPAWNED, NULL, 0, &val)) {
rc = convert_int(spawned, val);
PMIX_VALUE_RELEASE(val);
if (PMIX_SUCCESS != rc) {
return convert_err(rc);
}
} else {
/* if not found, default to not spawned */
*spawned = 0;
}
} }
pmi_init = 1;
/* get the spawned flag - this will likely pull
* down all attributes assigned to the job, thus
* making all subsequent "get" operations purely
* local */
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_SPAWNED, NULL, 0, &kv)) {
rc = convert_int(spawned, kv);
PMIX_VALUE_RELEASE(kv);
return convert_err(rc);
}
/* if it wasn't found, then default to "not spawned" */
*spawned = 0;
return PMI_SUCCESS; return PMI_SUCCESS;
} }
int PMI_Initialized(PMI_BOOL *initialized) int PMI_Initialized(PMI_BOOL *initialized)
{ {
*initialized = (PMI_BOOL)PMIx_Initialized(); if (NULL == initialized) {
return PMI_ERR_INVALID_ARG;
}
*initialized = (PMIx_Initialized() ? PMI_TRUE : PMI_FALSE);
return PMI_SUCCESS; return PMI_SUCCESS;
} }
int PMI_Finalize(void) int PMI_Finalize(void)
{ {
return PMIx_Finalize(); pmix_status_t rc = PMIX_SUCCESS;
PMI_CHECK();
pmi_init = 0;
rc = PMIx_Finalize();
return convert_err(rc);
} }
int PMI_Abort(int flag, const char msg[]) int PMI_Abort(int flag, const char msg[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
PMI_CHECK();
rc = PMIx_Abort(flag, msg, NULL, 0); rc = PMIx_Abort(flag, msg, NULL, 0);
return convert_err(rc); return convert_err(rc);
@ -93,12 +121,23 @@ int PMI_Abort(int flag, const char msg[])
* provided kvsname as we only put into our own nspace */ * provided kvsname as we only put into our own nspace */
int PMI_KVS_Put(const char kvsname[], const char key[], const char value[]) int PMI_KVS_Put(const char kvsname[], const char key[], const char value[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_value_t val; pmix_value_t val;
PMI_CHECK();
if ((kvsname == NULL) || (strlen(kvsname) > PMI_MAX_KVSNAME_LEN)) {
return PMI_ERR_INVALID_KVS;
}
if ((key == NULL) || (strlen(key) >PMI_MAX_KEY_LEN)) {
return PMI_ERR_INVALID_KEY;
}
if ((value == NULL) || (strlen(value) > PMI_MAX_VAL_LEN)) {
return PMI_ERR_INVALID_VAL;
}
pmix_output_verbose(2, pmix_globals.debug_output, pmix_output_verbose(2, pmix_globals.debug_output,
"PMI_KVS_Put: KVS=%s, key=%s value=%s", "PMI_KVS_Put: KVS=%s, key=%s value=%s", kvsname, key, value);
kvsname, key, value);
val.type = PMIX_STRING; val.type = PMIX_STRING;
val.data.string = (char*)value; val.data.string = (char*)value;
@ -109,10 +148,16 @@ int PMI_KVS_Put(const char kvsname[], const char key[], const char value[])
/* KVS_Commit */ /* KVS_Commit */
int PMI_KVS_Commit(const char kvsname[]) int PMI_KVS_Commit(const char kvsname[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_output_verbose(2, pmix_globals.debug_output, PMI_CHECK();
"PMI_KVS_Commit: KVS=%s", kvsname);
if ((kvsname == NULL) || (strlen(kvsname) > PMI_MAX_KVSNAME_LEN)) {
return PMI_ERR_INVALID_KVS;
}
pmix_output_verbose(2, pmix_globals.debug_output, "PMI_KVS_Commit: KVS=%s",
kvsname);
rc = PMIx_Commit(); rc = PMIx_Commit();
/* PMIx permits only one data commit! */ /* PMIx permits only one data commit! */
@ -122,27 +167,38 @@ int PMI_KVS_Commit(const char kvsname[])
int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int length) int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int length)
{ {
pmix_status_t rc = PMIX_SUCCESS;
pmix_value_t *val; pmix_value_t *val;
uint32_t i; uint32_t i;
static pmix_proc_t proc; static pmix_proc_t proc;
uint32_t procnum; uint32_t procnum;
proc = myproc; proc = myproc;
int rc;
PMI_CHECK();
if ((kvsname == NULL) || (strlen(kvsname) > PMI_MAX_KVSNAME_LEN)) {
return PMI_ERR_INVALID_KVS;
}
if ((key == NULL) || (strlen(key) >PMI_MAX_KEY_LEN)) {
return PMI_ERR_INVALID_KEY;
}
if (value == NULL) {
return PMI_ERR_INVALID_VAL;
}
pmix_output_verbose(2, pmix_globals.debug_output, pmix_output_verbose(2, pmix_globals.debug_output,
"PMI_KVS_Get: KVS=%s, key=%s value=%s", "PMI_KVS_Get: KVS=%s, key=%s value=%s", kvsname, key, value);
kvsname, key, value);
/* PMI-1 expects resource manager to set /* PMI-1 expects resource manager to set
* process mapping in ANL notation. */ * process mapping in ANL notation. */
if( !strcmp(key, ANL_MAPPING) ) { if (!strcmp(key, ANL_MAPPING)) {
/* we are looking in the job-data. If there is nothing there /* we are looking in the job-data. If there is nothing there
* we don't want to look in rank's data, thus set rank to widcard */ * we don't want to look in rank's data, thus set rank to widcard */
proc.rank = PMIX_RANK_WILDCARD; proc.rank = PMIX_RANK_WILDCARD;
if( PMIX_SUCCESS == PMIx_Get(&proc, PMIX_ANL_MAP, NULL, 0, &val) && if (PMIX_SUCCESS == PMIx_Get(&proc, PMIX_ANL_MAP, NULL, 0, &val) &&
(NULL != val) && (PMIX_STRING == val->type) ){ (NULL != val) && (PMIX_STRING == val->type)) {
strncpy(value,val->data.string,length); strncpy(value, val->data.string, length);
PMIX_VALUE_FREE(val,1); PMIX_VALUE_FREE(val, 1);
return PMI_SUCCESS; return PMI_SUCCESS;
} else { } else {
/* artpol: /* artpol:
@ -167,47 +223,49 @@ int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int lengt
* an error and don't try to use direct modex. * an error and don't try to use direct modex.
*/ */
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc,PMIX_JOB_SIZE, NULL, 0,&val))) { if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_JOB_SIZE, NULL, 0, &val))) {
pmix_output_verbose(2, pmix_globals.debug_output, pmix_output_verbose(2, pmix_globals.debug_output,
"pmi1: executing put for KVS %s, key %s value %s", "pmi1: executing put for KVS %s, key %s value %s", kvsname, key,
kvsname, key, value); value);
return convert_err(rc); return convert_err(rc);
} }
procnum = val->data.uint32; procnum = val->data.uint32;
PMIX_VALUE_FREE(val,1); PMIX_VALUE_FREE(val, 1);
for( i=0; i < procnum; i++){ for (i = 0; i < procnum; i++) {
proc.rank = i; proc.rank = i;
if( PMIX_SUCCESS == PMIx_Get(&proc, key, NULL, 0, &val) && if (PMIX_SUCCESS == PMIx_Get(&proc, key, NULL, 0, &val) && (NULL != val)
(NULL != val) && (PMIX_STRING == val->type) ){ && (PMIX_STRING == val->type)) {
strncpy(value,val->data.string,length); strncpy(value, val->data.string, length);
PMIX_VALUE_FREE(val,1); PMIX_VALUE_FREE(val, 1);
return PMI_SUCCESS; return PMI_SUCCESS;
} }
PMIX_VALUE_FREE(val,1); PMIX_VALUE_FREE(val, 1);
} }
return PMI_FAIL; return PMI_FAIL;
} }
/* Barrier only applies to our own nspace, and we want all /* Barrier only applies to our own nspace, and we want all
* data to be collected upon completion */ * data to be collected upon completion */
int PMI_Barrier(void) int PMI_Barrier(void)
{ {
pmix_status_t rc = PMIX_SUCCESS;
pmix_info_t buf; pmix_info_t buf;
int rc, ninfo = 0; int ninfo = 0;
pmix_info_t *info = NULL; pmix_info_t *info = NULL;
if( data_commited ){ PMI_CHECK();
bool val = 1;
if (data_commited) {
bool val = 1;
info = &buf; info = &buf;
PMIX_INFO_CONSTRUCT(info); PMIX_INFO_CONSTRUCT(info);
PMIX_INFO_LOAD(info, PMIX_COLLECT_DATA, &val, PMIX_BOOL ); PMIX_INFO_LOAD(info, PMIX_COLLECT_DATA, &val, PMIX_BOOL);
ninfo = 1; ninfo = 1;
} }
rc = PMIx_Fence(NULL, 0, info, ninfo); rc = PMIx_Fence(NULL, 0, info, ninfo);
if( NULL != info ){ if (NULL != info) {
PMIX_INFO_DESTRUCT(info); PMIX_INFO_DESTRUCT(info);
} }
return rc; return rc;
@ -215,16 +273,18 @@ int PMI_Barrier(void)
int PMI_Get_size(int *size) int PMI_Get_size(int *size)
{ {
pmix_value_t *kv; pmix_status_t rc = PMIX_SUCCESS;
pmix_status_t rc; pmix_value_t *val;
PMI_CHECK();
if (NULL == size) { if (NULL == size) {
return PMI_FAIL; return PMI_ERR_INVALID_ARG;
} }
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_JOB_SIZE, NULL, 0, &kv)) { if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_JOB_SIZE, NULL, 0, &val)) {
rc = convert_int(size, kv); rc = convert_int(size, val);
PMIX_VALUE_RELEASE(kv); PMIX_VALUE_RELEASE(val);
return convert_err(rc); return convert_err(rc);
} }
@ -233,26 +293,30 @@ int PMI_Get_size(int *size)
int PMI_Get_rank(int *rk) int PMI_Get_rank(int *rk)
{ {
PMI_CHECK();
if (NULL == rk) { if (NULL == rk) {
return PMI_FAIL; return PMI_ERR_INVALID_ARG;
} }
*rk = pmix_globals.myid.rank; *rk = myproc.rank;
return PMI_SUCCESS; return PMI_SUCCESS;
} }
int PMI_Get_universe_size(int *size) int PMI_Get_universe_size(int *size)
{ {
pmix_value_t *kv; pmix_status_t rc = PMIX_SUCCESS;
pmix_status_t rc; pmix_value_t *val;
PMI_CHECK();
if (NULL == size) { if (NULL == size) {
return PMI_FAIL; return PMI_ERR_INVALID_ARG;
} }
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &kv)) { if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &val)) {
rc = convert_int(size, kv); rc = convert_int(size, val);
PMIX_VALUE_RELEASE(kv); PMIX_VALUE_RELEASE(val);
return convert_err(rc); return convert_err(rc);
} }
return PMI_FAIL; return PMI_FAIL;
@ -260,13 +324,15 @@ int PMI_Get_universe_size(int *size)
int PMI_Get_appnum(int *appnum) int PMI_Get_appnum(int *appnum)
{ {
pmix_value_t *kv; pmix_status_t rc = PMIX_SUCCESS;
pmix_status_t rc; pmix_value_t *val;
PMI_CHECK();
if (NULL != appnum && if (NULL != appnum &&
PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_APPNUM, NULL, 0, &kv)) { PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_APPNUM, NULL, 0, &val)) {
rc = convert_int(appnum, kv); rc = convert_int(appnum, val);
PMIX_VALUE_RELEASE(kv); PMIX_VALUE_RELEASE(val);
return convert_err(rc); return convert_err(rc);
} }
@ -275,16 +341,19 @@ int PMI_Get_appnum(int *appnum)
int PMI_Publish_name(const char service_name[], const char port[]) int PMI_Publish_name(const char service_name[], const char port[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_info_t info; pmix_info_t info;
PMI_CHECK();
if (NULL == service_name || NULL == port) { if (NULL == service_name || NULL == port) {
return convert_err(PMIX_ERR_BAD_PARAM); return PMI_ERR_INVALID_ARG;
} }
/* pass the service/port */ /* pass the service/port */
(void)strncpy(info.key, service_name, PMIX_MAX_KEYLEN); (void) strncpy(info.key, service_name, PMIX_MAX_KEYLEN);
info.value.type = PMIX_STRING; info.value.type = PMIX_STRING;
info.value.data.string = (char*)port; info.value.data.string = (char*) port;
/* publish the info - PMI-1 doesn't support /* publish the info - PMI-1 doesn't support
* any scope other than inside our own nspace */ * any scope other than inside our own nspace */
@ -295,11 +364,17 @@ int PMI_Publish_name(const char service_name[], const char port[])
int PMI_Unpublish_name(const char service_name[]) int PMI_Unpublish_name(const char service_name[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
char *keys[2]; char *keys[2];
PMI_CHECK();
if (NULL == service_name) {
return PMI_ERR_INVALID_ARG;
}
/* pass the service */ /* pass the service */
keys[0] = (char*)service_name; keys[0] = (char*) service_name;
keys[1] = NULL; keys[1] = NULL;
rc = PMIx_Unpublish(keys, NULL, 0); rc = PMIx_Unpublish(keys, NULL, 0);
@ -308,13 +383,19 @@ int PMI_Unpublish_name(const char service_name[])
int PMI_Lookup_name(const char service_name[], char port[]) int PMI_Lookup_name(const char service_name[], char port[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_pdata_t pdata; pmix_pdata_t pdata;
PMI_CHECK();
if (NULL == service_name || NULL == port) {
return PMI_ERR_INVALID_ARG;
}
PMIX_PDATA_CONSTRUCT(&pdata); PMIX_PDATA_CONSTRUCT(&pdata);
/* pass the service */ /* pass the service */
(void)strncpy(pdata.key, service_name, PMIX_MAX_KEYLEN); (void) strncpy(pdata.key, service_name, PMIX_MAX_KEYLEN);
/* PMI-1 doesn't want the nspace back */ /* PMI-1 doesn't want the nspace back */
if (PMIX_SUCCESS != (rc = PMIx_Lookup(&pdata, 1, NULL, 0))) { if (PMIX_SUCCESS != (rc = PMIx_Lookup(&pdata, 1, NULL, 0))) {
@ -322,8 +403,7 @@ int PMI_Lookup_name(const char service_name[], char port[])
} }
/* should have received a string back */ /* should have received a string back */
if (PMIX_STRING != pdata.value.type || if (PMIX_STRING != pdata.value.type || NULL == pdata.value.data.string) {
NULL == pdata.value.data.string) {
return convert_err(PMIX_ERR_NOT_FOUND); return convert_err(PMIX_ERR_NOT_FOUND);
} }
@ -332,7 +412,7 @@ int PMI_Lookup_name(const char service_name[], char port[])
* potential we could overrun it. As this feature * potential we could overrun it. As this feature
* isn't widely supported in PMI-1, try being * isn't widely supported in PMI-1, try being
* conservative */ * conservative */
(void)strncpy(port, pdata.value.data.string, PMIX_MAX_KEYLEN); (void) strncpy(port, pdata.value.data.string, PMIX_MAX_KEYLEN);
PMIX_PDATA_DESTRUCT(&pdata); PMIX_PDATA_DESTRUCT(&pdata);
return PMIX_SUCCESS; return PMIX_SUCCESS;
@ -343,37 +423,54 @@ int PMI_Get_id(char id_str[], int length)
/* we already obtained our nspace during PMI_Init, /* we already obtained our nspace during PMI_Init,
* so all we have to do here is return it */ * so all we have to do here is return it */
PMI_CHECK();
/* bozo check */ /* bozo check */
if (NULL == id_str) { if (NULL == id_str) {
return PMI_ERR_INVALID_ARGS; return PMI_ERR_INVALID_ARGS;
} }
(void)strncpy(id_str, pmix_globals.myid.nspace, length); if (length < PMI_MAX_ID_LEN) {
return PMI_ERR_INVALID_LENGTH;
}
(void) strncpy(id_str, myproc.nspace, length);
return PMI_SUCCESS; return PMI_SUCCESS;
} }
int PMI_Get_kvs_domain_id(char id_str[], int length) int PMI_Get_kvs_domain_id(char id_str[], int length)
{ {
PMI_CHECK();
/* same as PMI_Get_id */ /* same as PMI_Get_id */
return PMI_Get_id(id_str, length); return PMI_Get_id(id_str, length);
} }
int PMI_Get_id_length_max(int *length) int PMI_Get_id_length_max(int *length)
{ {
PMI_CHECK();
if (NULL == length) { if (NULL == length) {
return PMI_ERR_INVALID_VAL_LENGTH; return PMI_ERR_INVALID_VAL_LENGTH;
} }
*length = PMIX_MAX_KEYLEN;
*length = PMI_MAX_ID_LEN;
return PMI_SUCCESS; return PMI_SUCCESS;
} }
int PMI_Get_clique_size(int *size) int PMI_Get_clique_size(int *size)
{ {
pmix_value_t *kv; pmix_status_t rc = PMIX_SUCCESS;
pmix_status_t rc; pmix_value_t *val;
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_LOCAL_SIZE, NULL, 0, &kv)) { PMI_CHECK();
rc = convert_int(size, kv);
PMIX_VALUE_RELEASE(kv); if (NULL == size) {
return PMI_ERR_INVALID_ARGS;
}
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_LOCAL_SIZE, NULL, 0, &val)) {
rc = convert_int(size, val);
PMIX_VALUE_RELEASE(val);
return convert_err(rc); return convert_err(rc);
} }
@ -382,19 +479,25 @@ int PMI_Get_clique_size(int *size)
int PMI_Get_clique_ranks(int ranks[], int length) int PMI_Get_clique_ranks(int ranks[], int length)
{ {
pmix_value_t *kv; pmix_value_t *val;
char **rks; char **rks;
int i; int i;
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_LOCAL_PEERS, NULL, 0, &kv)) { PMI_CHECK();
if (NULL == ranks) {
return PMI_ERR_INVALID_ARGS;
}
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_LOCAL_PEERS, NULL, 0, &val)) {
/* kv will contain a string of comma-separated /* kv will contain a string of comma-separated
* ranks on my node */ * ranks on my node */
rks = pmix_argv_split(kv->data.string, ','); rks = pmix_argv_split(val->data.string, ',');
for (i=0; NULL != rks[i] && i < length; i++) { for (i = 0; NULL != rks[i] && i < length; i++) {
ranks[i] = strtol(rks[i], NULL, 10); ranks[i] = strtol(rks[i], NULL, 10);
} }
pmix_argv_free(rks); pmix_argv_free(rks);
PMIX_VALUE_RELEASE(kv); PMIX_VALUE_RELEASE(val);
return PMI_SUCCESS; return PMI_SUCCESS;
} }
return PMI_FAIL; return PMI_FAIL;
@ -402,36 +505,47 @@ int PMI_Get_clique_ranks(int ranks[], int length)
int PMI_KVS_Get_my_name(char kvsname[], int length) int PMI_KVS_Get_my_name(char kvsname[], int length)
{ {
PMI_CHECK();
/* same as PMI_Get_id */ /* same as PMI_Get_id */
return PMI_Get_id(kvsname, length); return PMI_Get_id(kvsname, length);
} }
int PMI_KVS_Get_name_length_max(int *length) int PMI_KVS_Get_name_length_max(int *length)
{ {
if (NULL == length) { PMI_CHECK();
return PMI_ERR_INVALID_VAL_LENGTH;
if (NULL == length) {
return PMI_ERR_INVALID_ARG;
} }
*length = PMIX_MAX_NSLEN;
*length = PMI_MAX_KVSNAME_LEN;
return PMI_SUCCESS; return PMI_SUCCESS;
} }
int PMI_KVS_Get_key_length_max(int *length) int PMI_KVS_Get_key_length_max(int *length)
{ {
PMI_CHECK();
if (NULL == length) { if (NULL == length) {
return PMI_ERR_INVALID_VAL_LENGTH; return PMI_ERR_INVALID_ARG;
} }
*length = PMIX_MAX_KEYLEN;
*length = PMI_MAX_KEY_LEN;
return PMI_SUCCESS; return PMI_SUCCESS;
} }
int PMI_KVS_Get_value_length_max(int *length) int PMI_KVS_Get_value_length_max(int *length)
{ {
PMI_CHECK();
if (NULL == length) { if (NULL == length) {
return PMI_ERR_INVALID_VAL_LENGTH; return PMI_ERR_INVALID_ARG;
} }
/* don't give them an enormous size of some implementations /* don't give them an enormous size of some implementations
* immediately malloc a data block for their use */ * immediately malloc a data block for their use */
*length = 4096; *length = PMI_MAX_VAL_LEN;
return PMI_SUCCESS; return PMI_SUCCESS;
} }
@ -473,31 +587,37 @@ int PMI_Spawn_multiple(int count,
const PMI_keyval_t preput_keyval_vector[], const PMI_keyval_t preput_keyval_vector[],
int errors[]) int errors[])
{ {
pmix_status_t rc = PMIX_SUCCESS;
pmix_app_t *apps; pmix_app_t *apps;
int i, k; int i, k;
pmix_status_t rc;
size_t j; size_t j;
char *evar; char *evar;
PMI_CHECK();
if (NULL == cmds) {
return PMI_ERR_INVALID_ARG;
}
/* setup the apps */ /* setup the apps */
PMIX_APP_CREATE(apps, count); PMIX_APP_CREATE(apps, count);
for (i=0; i < count; i++) { for (i = 0; i < count; i++) {
apps[i].cmd = strdup(cmds[i]); apps[i].cmd = strdup(cmds[i]);
apps[i].maxprocs = maxprocs[i]; apps[i].maxprocs = maxprocs[i];
apps[i].argv = pmix_argv_copy((char**)argvs[i]); apps[i].argv = pmix_argv_copy((char**) argvs[i]);
apps[i].argc = pmix_argv_count(apps[i].argv); apps[i].argc = pmix_argv_count(apps[i].argv);
apps[i].ninfo = info_keyval_sizesp[i]; apps[i].ninfo = info_keyval_sizesp[i];
if (0 < apps[i].ninfo) { if (0 < apps[i].ninfo) {
apps[i].info = (pmix_info_t*)malloc(apps[i].ninfo * sizeof(pmix_info_t)); apps[i].info = (pmix_info_t*)malloc(apps[i].ninfo * sizeof(pmix_info_t));
/* copy the info objects */ /* copy the info objects */
for (j=0; j < apps[i].ninfo; j++) { for (j = 0; j < apps[i].ninfo; j++) {
(void)strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN); (void)strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN);
apps[i].info[j].value.type = PMIX_STRING; apps[i].info[j].value.type = PMIX_STRING;
apps[i].info[j].value.data.string = strdup(info_keyval_vectors[i][j].val); apps[i].info[j].value.data.string = strdup(info_keyval_vectors[i][j].val);
} }
} }
/* push the preput values into the apps environ */ /* push the preput values into the apps environ */
for (k=0; k < preput_keyval_size; k++) { for (k = 0; k < preput_keyval_size; k++) {
(void)asprintf(&evar, "%s=%s", preput_keyval_vector[k].key, preput_keyval_vector[k].val); (void)asprintf(&evar, "%s=%s", preput_keyval_vector[k].key, preput_keyval_vector[k].val);
pmix_argv_append_nosize(&apps[i].env, evar); pmix_argv_append_nosize(&apps[i].env, evar);
free(evar); free(evar);
@ -506,12 +626,12 @@ int PMI_Spawn_multiple(int count,
rc = PMIx_Spawn(NULL, 0, apps, count, NULL); rc = PMIx_Spawn(NULL, 0, apps, count, NULL);
/* tear down the apps array */ /* tear down the apps array */
for (i=0; i < count; i++) { for (i = 0; i < count; i++) {
PMIX_APP_DESTRUCT(&apps[i]); PMIX_APP_DESTRUCT(&apps[i]);
} }
free(apps); free(apps);
if (NULL != errors) { if (NULL != errors) {
for (i=0; i < count; i++) { for (i = 0; i < count; i++) {
errors[i] = convert_err(rc); errors[i] = convert_err(rc);
} }
} }
@ -546,12 +666,11 @@ int PMI_Get_options(char *str, int *length)
return PMI_FAIL; return PMI_FAIL;
} }
/*** UTILITY FUNCTIONS ***/ /*** UTILITY FUNCTIONS ***/
/* internal function */ /* internal function */
static pmix_status_t convert_int(int *value, pmix_value_t *kv) static pmix_status_t convert_int(int *value, pmix_value_t *kv)
{ {
switch(kv->type) { switch (kv->type) {
case PMIX_INT: case PMIX_INT:
*value = kv->data.integer; *value = kv->data.integer;
break; break;
@ -600,7 +719,7 @@ static pmix_status_t convert_int(int *value, pmix_value_t *kv)
static int convert_err(pmix_status_t rc) static int convert_err(pmix_status_t rc)
{ {
switch(rc) { switch (rc) {
case PMIX_ERR_INVALID_SIZE: case PMIX_ERR_INVALID_SIZE:
return PMI_ERR_INVALID_SIZE; return PMI_ERR_INVALID_SIZE;

Просмотреть файл

@ -1,8 +1,10 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/* /*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -35,15 +37,24 @@
#include "src/util/error.h" #include "src/util/error.h"
#include "src/util/output.h" #include "src/util/output.h"
#define PMI2_CHECK() \
do { \
if (!pmi2_init) { \
return PMI2_FAIL; \
} \
} while (0)
/* local functions */ /* local functions */
static pmix_status_t convert_int(int *value, pmix_value_t *kv); static pmix_status_t convert_int(int *value, pmix_value_t *kv);
static int convert_err(pmix_status_t rc); static int convert_err(pmix_status_t rc);
static pmix_proc_t myproc; static pmix_proc_t myproc;
static int pmi2_init = 0;
int PMI2_Init(int *spawned, int *size, int *rank, int *appnum) int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
{ {
pmix_value_t *kv; pmix_status_t rc = PMIX_SUCCESS;
pmix_status_t rc; pmix_value_t *val;
pmix_proc_t proc;
if (PMIX_SUCCESS != PMIx_Init(&myproc)) { if (PMIX_SUCCESS != PMIx_Init(&myproc)) {
return PMI2_ERR_INIT; return PMI2_ERR_INIT;
@ -52,14 +63,18 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
/* get the rank */ /* get the rank */
*rank = myproc.rank; *rank = myproc.rank;
/* getting internal key requires special rank value */
memcpy(&proc, &myproc, sizeof(myproc));
proc.rank = PMIX_RANK_WILDCARD;
if (NULL != size) { if (NULL != size) {
/* get the universe size - this will likely pull /* get the universe size - this will likely pull
* down all attributes assigned to the job, thus * down all attributes assigned to the job, thus
* making all subsequent "get" operations purely * making all subsequent "get" operations purely
* local */ * local */
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &kv)) { if (PMIX_SUCCESS == PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val)) {
rc = convert_int(size, kv); rc = convert_int(size, val);
PMIX_VALUE_RELEASE(kv); PMIX_VALUE_RELEASE(val);
if (PMIX_SUCCESS != rc) { if (PMIX_SUCCESS != rc) {
goto error; goto error;
} }
@ -71,9 +86,9 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
if (NULL != spawned) { if (NULL != spawned) {
/* get the spawned flag */ /* get the spawned flag */
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_SPAWNED, NULL, 0, &kv)) { if (PMIX_SUCCESS == PMIx_Get(&proc, PMIX_SPAWNED, NULL, 0, &val)) {
rc = convert_int(spawned, kv); rc = convert_int(spawned, val);
PMIX_VALUE_RELEASE(kv); PMIX_VALUE_RELEASE(val);
if (PMIX_SUCCESS != rc) { if (PMIX_SUCCESS != rc) {
goto error; goto error;
} }
@ -85,9 +100,9 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
if (NULL != appnum) { if (NULL != appnum) {
/* get our appnum */ /* get our appnum */
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_APPNUM, NULL, 0, &kv)) { if (PMIX_SUCCESS == PMIx_Get(&proc, PMIX_APPNUM, NULL, 0, &val)) {
rc = convert_int(appnum, kv); rc = convert_int(appnum, val);
PMIX_VALUE_RELEASE(kv); PMIX_VALUE_RELEASE(val);
if (PMIX_SUCCESS != rc) { if (PMIX_SUCCESS != rc) {
goto error; goto error;
} }
@ -96,6 +111,7 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
*appnum = 0; *appnum = 0;
} }
} }
pmi2_init = 1;
return PMI2_SUCCESS; return PMI2_SUCCESS;
@ -112,15 +128,20 @@ int PMI2_Initialized(void)
int PMI2_Finalize(void) int PMI2_Finalize(void)
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
PMI2_CHECK();
pmi2_init = 0;
rc = PMIx_Finalize(); rc = PMIx_Finalize();
return convert_err(rc); return convert_err(rc);
} }
int PMI2_Abort(int flag, const char msg[]) int PMI2_Abort(int flag, const char msg[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
PMI2_CHECK();
rc = PMIx_Abort(flag, msg, NULL, 0); rc = PMIx_Abort(flag, msg, NULL, 0);
return convert_err(rc); return convert_err(rc);
@ -129,9 +150,18 @@ int PMI2_Abort(int flag, const char msg[])
/* KVS_Put - we default to PMIX_GLOBAL scope */ /* KVS_Put - we default to PMIX_GLOBAL scope */
int PMI2_KVS_Put(const char key[], const char value[]) int PMI2_KVS_Put(const char key[], const char value[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_value_t val; pmix_value_t val;
PMI2_CHECK();
if ((NULL == key) || (NULL == value)) {
return PMI2_ERR_INVALID_ARG;
}
pmix_output_verbose(3, pmix_globals.debug_output,
"PMI2_KVS_Put: key=%s value=%s", key, value);
val.type = PMIX_STRING; val.type = PMIX_STRING;
val.data.string = (char*)value; val.data.string = (char*)value;
rc = PMIx_Put(PMIX_GLOBAL, key, &val); rc = PMIx_Put(PMIX_GLOBAL, key, &val);
@ -141,14 +171,26 @@ int PMI2_KVS_Put(const char key[], const char value[])
/* KVS_Fence */ /* KVS_Fence */
int PMI2_KVS_Fence(void) int PMI2_KVS_Fence(void)
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
PMI2_CHECK();
if (PMIX_SUCCESS != (rc = PMIx_Commit())) { if (PMIX_SUCCESS != (rc = PMIx_Commit())) {
return convert_err(rc); return convert_err(rc);
} }
/* we want all data to be collected upon completion */ /* we want all data to be collected upon completion */
rc = PMIx_Fence(NULL, 0, NULL, 0); {
pmix_info_t info;
int ninfo = 1;
bool val = 1;
PMIX_INFO_CONSTRUCT(&info);
PMIX_INFO_LOAD(&info, PMIX_COLLECT_DATA, &val, PMIX_BOOL);
rc = PMIx_Fence(NULL, 0, &info, ninfo);
PMIX_INFO_DESTRUCT(&info);
}
return convert_err(rc); return convert_err(rc);
} }
@ -161,33 +203,68 @@ int PMI2_KVS_Get(const char *jobid, int src_pmi_id,
const char key[], char value [], const char key[], char value [],
int maxvalue, int *vallen) int maxvalue, int *vallen)
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_value_t *val; pmix_value_t *val;
pmix_proc_t proc; pmix_proc_t proc;
uint32_t procnum = 0;
(void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), sizeof(myproc.nspace)); PMI2_CHECK();
proc.rank = (src_pmi_id == PMI2_ID_NULL ? myproc.rank : src_pmi_id);
rc = PMIx_Get(&proc, key, NULL, 0, &val); if ((NULL == key) || (NULL == value)) {
if (PMIX_SUCCESS == rc && NULL != val) { return PMI2_ERR_INVALID_ARG;
if (PMIX_STRING != val->type) {
/* this is an error */
PMIX_VALUE_RELEASE(val);
return PMI2_FAIL;
}
if (NULL != val->data.string) {
(void)strncpy(value, val->data.string, maxvalue);
*vallen = strlen(val->data.string);
}
PMIX_VALUE_RELEASE(val);
} }
pmix_output_verbose(3, pmix_globals.debug_output,
"PMI2_KVS_Get: key=%s jobid=%s src_pmi_id=%d", key, (jobid ? jobid : "null"), src_pmi_id);
(void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), PMIX_MAX_NSLEN);
if (src_pmi_id == PMI2_ID_NULL) {
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_JOB_SIZE, NULL, 0, &val))) {
return convert_err(rc);
}
procnum = val->data.uint32;
PMIX_VALUE_RELEASE(val);
proc.rank = 0;
} else {
proc.rank = src_pmi_id;
}
do {
rc = PMIx_Get(&proc, key, NULL, 0, &val);
if (PMIX_SUCCESS == rc && NULL != val) {
if (PMIX_STRING != val->type) {
/* this is an error */
PMIX_VALUE_RELEASE(val);
return PMI2_FAIL;
}
if (NULL != val->data.string) {
(void)strncpy(value, val->data.string, maxvalue);
*vallen = strlen(val->data.string);
}
PMIX_VALUE_RELEASE(val);
break;
} else if (PMIX_ERR_NOT_FOUND == rc) {
proc.rank++;
} else {
break;
}
} while (proc.rank < (int)procnum);
return convert_err(rc); return convert_err(rc);
} }
int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *found, int waitfor) int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *found, int waitfor)
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_value_t *val; pmix_value_t *val;
PMI2_CHECK();
if ((NULL == name) || (NULL == value) || (NULL == found)) {
return PMI2_ERR_INVALID_ARG;
}
*found = 0; *found = 0;
rc = PMIx_Get(&myproc, name, NULL, 0, &val); rc = PMIx_Get(&myproc, name, NULL, 0, &val);
if (PMIX_SUCCESS == rc && NULL != val) { if (PMIX_SUCCESS == rc && NULL != val) {
@ -210,9 +287,15 @@ int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *fo
/* push info at the PMIX_LOCAL scope */ /* push info at the PMIX_LOCAL scope */
int PMI2_Info_PutNodeAttr(const char name[], const char value[]) int PMI2_Info_PutNodeAttr(const char name[], const char value[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_value_t val; pmix_value_t val;
PMI2_CHECK();
if ((NULL == name) || (NULL == value)) {
return PMI2_ERR_INVALID_ARG;
}
val.type = PMIX_STRING; val.type = PMIX_STRING;
val.data.string = (char*)value; val.data.string = (char*)value;
rc = PMIx_Put(PMIX_LOCAL, name, &val); rc = PMIx_Put(PMIX_LOCAL, name, &val);
@ -221,11 +304,22 @@ int PMI2_Info_PutNodeAttr(const char name[], const char value[])
int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *found) int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *found)
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_value_t *val; pmix_value_t *val;
pmix_proc_t proc;
PMI2_CHECK();
if ((NULL == name) || (NULL == value) || (NULL == found)) {
return PMI2_ERR_INVALID_ARG;
}
/* getting internal key requires special rank value */
memcpy(&proc, &myproc, sizeof(myproc));
proc.rank = PMIX_RANK_WILDCARD;
*found = 0; *found = 0;
rc = PMIx_Get(&myproc, name, NULL, 0, &val); rc = PMIx_Get(&proc, name, NULL, 0, &val);
if (PMIX_SUCCESS == rc && NULL != val) { if (PMIX_SUCCESS == rc && NULL != val) {
if (PMIX_STRING != val->type) { if (PMIX_STRING != val->type) {
/* this is an error */ /* this is an error */
@ -250,13 +344,16 @@ int PMI2_Info_GetJobAttrIntArray(const char name[], int array[], int arraylen, i
int PMI2_Nameserv_publish(const char service_name[], const PMI_keyval_t *info_ptr, const char port[]) int PMI2_Nameserv_publish(const char service_name[], const PMI_keyval_t *info_ptr, const char port[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
int nvals; int nvals;
pmix_info_t info[2]; pmix_info_t info[2];
PMI2_CHECK();
if (NULL == service_name || NULL == port) { if (NULL == service_name || NULL == port) {
return PMI2_ERR_INVALID_ARG; return PMI2_ERR_INVALID_ARG;
} }
/* pass the service/port */ /* pass the service/port */
(void)strncpy(info[0].key, service_name, PMIX_MAX_KEYLEN); (void)strncpy(info[0].key, service_name, PMIX_MAX_KEYLEN);
info[0].value.type = PMIX_STRING; info[0].value.type = PMIX_STRING;
@ -280,8 +377,14 @@ int PMI2_Nameserv_publish(const char service_name[], const PMI_keyval_t *info_pt
int PMI2_Nameserv_unpublish(const char service_name[], int PMI2_Nameserv_unpublish(const char service_name[],
const PMI_keyval_t *info_ptr) const PMI_keyval_t *info_ptr)
{ {
pmix_status_t rc = PMIX_SUCCESS;
char *keys[3]; char *keys[3];
pmix_status_t rc;
PMI2_CHECK();
if (NULL == service_name || NULL == info_ptr) {
return PMI2_ERR_INVALID_ARG;
}
/* pass the service */ /* pass the service */
keys[0] = (char*)service_name; keys[0] = (char*)service_name;
@ -300,10 +403,16 @@ int PMI2_Nameserv_unpublish(const char service_name[],
int PMI2_Nameserv_lookup(const char service_name[], const PMI_keyval_t *info_ptr, int PMI2_Nameserv_lookup(const char service_name[], const PMI_keyval_t *info_ptr,
char port[], int portLen) char port[], int portLen)
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
int nvals; int nvals;
pmix_pdata_t pdata[2]; pmix_pdata_t pdata[2];
PMI2_CHECK();
if (NULL == service_name || NULL == info_ptr || NULL == port) {
return PMI2_ERR_INVALID_ARG;
}
PMIX_PDATA_CONSTRUCT(&pdata[0]); PMIX_PDATA_CONSTRUCT(&pdata[0]);
PMIX_PDATA_CONSTRUCT(&pdata[1]); PMIX_PDATA_CONSTRUCT(&pdata[1]);
@ -347,9 +456,11 @@ int PMI2_Nameserv_lookup(const char service_name[], const PMI_keyval_t *info_ptr
int PMI2_Job_GetId(char jobid[], int jobid_size) int PMI2_Job_GetId(char jobid[], int jobid_size)
{ {
/* we already obtained our nspace during PMI_Init, /* we already obtained our nspace during pmi2_init,
* so all we have to do here is return it */ * so all we have to do here is return it */
PMI2_CHECK();
/* bozo check */ /* bozo check */
if (NULL == jobid) { if (NULL == jobid) {
return PMI2_ERR_INVALID_ARGS; return PMI2_ERR_INVALID_ARGS;
@ -358,11 +469,48 @@ int PMI2_Job_GetId(char jobid[], int jobid_size)
return PMI2_SUCCESS; return PMI2_SUCCESS;
} }
int PMI2_Job_GetRank(int *rank)
{
PMI2_CHECK();
if (NULL == rank) {
return PMI2_ERR_INVALID_ARGS;
}
*rank = myproc.rank;
return PMI2_SUCCESS;
}
int PMI2_Info_GetSize(int *size)
{
pmix_status_t rc = PMIX_SUCCESS;
pmix_value_t *val;
PMI2_CHECK();
if (NULL == size) {
return PMI2_ERR_INVALID_ARGS;
}
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_LOCAL_SIZE, NULL, 0, &val)) {
rc = convert_int(size, val);
PMIX_VALUE_RELEASE(val);
return convert_err(rc);
}
return PMI2_FAIL;
}
int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn) int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn)
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_proc_t proc; pmix_proc_t proc;
PMI2_CHECK();
if (NULL == jobid || NULL == conn) {
return PMI2_ERR_INVALID_ARGS;
}
(void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), sizeof(myproc.nspace)); (void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), sizeof(myproc.nspace));
proc.rank = PMIX_RANK_WILDCARD; proc.rank = PMIX_RANK_WILDCARD;
rc = PMIx_Connect(&proc, 1, NULL, 0); rc = PMIx_Connect(&proc, 1, NULL, 0);
@ -371,9 +519,15 @@ int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn)
int PMI2_Job_Disconnect(const char jobid[]) int PMI2_Job_Disconnect(const char jobid[])
{ {
pmix_status_t rc; pmix_status_t rc = PMIX_SUCCESS;
pmix_proc_t proc; pmix_proc_t proc;
PMI2_CHECK();
if (NULL == jobid) {
return PMI2_ERR_INVALID_ARGS;
}
(void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), sizeof(myproc.nspace)); (void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), sizeof(myproc.nspace));
proc.rank = PMIX_RANK_WILDCARD; proc.rank = PMIX_RANK_WILDCARD;
rc = PMIx_Disconnect(&proc, 1, NULL, 0); rc = PMIx_Disconnect(&proc, 1, NULL, 0);
@ -390,12 +544,18 @@ int PMI2_Job_Spawn(int count, const char * cmds[],
char jobId[], int jobIdSize, char jobId[], int jobIdSize,
int errors[]) int errors[])
{ {
pmix_status_t rc = PMIX_SUCCESS;
pmix_app_t *apps; pmix_app_t *apps;
int i, k; int i, k;
pmix_status_t rc;
size_t j; size_t j;
char *evar; char *evar;
PMI2_CHECK();
if (NULL == cmds) {
return PMI2_ERR_INVALID_ARGS;
}
/* setup the apps */ /* setup the apps */
PMIX_APP_CREATE(apps, count); PMIX_APP_CREATE(apps, count);
for (i=0; i < count; i++) { for (i=0; i < count; i++) {

Просмотреть файл

@ -5,6 +5,8 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>. * Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -5,6 +5,8 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>. * Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -5,6 +5,8 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>. * Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -5,6 +5,8 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Artem Y. Polyakov <artpol84@gmail.com>. * Copyright (c) 2014-2015 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -5,6 +5,8 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Artem Y. Polyakov <artpol84@gmail.com>. * Copyright (c) 2014-2015 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -3,6 +3,8 @@
* Copyright (c) 2015 Intel, Inc. All rights reserved * Copyright (c) 2015 Intel, Inc. All rights reserved
* Copyright (c) 2015 Artem Y. Polyakov <artpol84@gmail.com>. * Copyright (c) 2015 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
*/ */

Просмотреть файл

@ -4,6 +4,8 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,19 +1,7 @@
/* /*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved. * Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -74,6 +62,8 @@ static int test_item5(void);
static int test_item6(void); static int test_item6(void);
static int test_item7(void); static int test_item7(void);
static int test_item8(void); static int test_item8(void);
/* several sequence of fences is a buggy case for pmix v1.0 (see https://github.com/open-mpi/pmix/issues/37) */
static int test_item9(void);
static int spawned, size, rank, appnum; static int spawned, size, rank, appnum;
static char jobid[100]; static char jobid[100];
@ -149,6 +139,12 @@ int main(int argc, char **argv)
log_info("TI8 : %s\n", (rc ? "FAIL" : "PASS")); log_info("TI8 : %s\n", (rc ? "FAIL" : "PASS"));
} }
if (!ti || 9 == ti) {
rc = test_item9();
ret += (rc ? 1 : 0);
log_info("TI9 : %s\n", (rc ? "FAIL" : "PASS"));
}
if (PMI2_SUCCESS != (rc = PMI2_Finalize())) { if (PMI2_SUCCESS != (rc = PMI2_Finalize())) {
log_fatal("PMI2_Finalize failed: %d\n", rc); log_fatal("PMI2_Finalize failed: %d\n", rc);
return rc; return rc;
@ -160,6 +156,7 @@ int main(int argc, char **argv)
static int test_item1(void) static int test_item1(void)
{ {
int rc = 0; int rc = 0;
int val = 0;
log_info("spawned=%d size=%d rank=%d appnum=%d\n", spawned, size, rank, appnum); log_info("spawned=%d size=%d rank=%d appnum=%d\n", spawned, size, rank, appnum);
@ -175,9 +172,22 @@ static int test_item1(void)
} }
log_info("jobid=%s\n", jobid); log_info("jobid=%s\n", jobid);
log_assert(memcmp(jobid, __FUNCTION__, sizeof(__FUNCTION__)), ""); log_assert(memcmp(jobid, __FUNCTION__, sizeof(__FUNCTION__)), "");
val = random_value(10, 100);
if (PMI2_SUCCESS != (rc = PMI2_Job_GetRank(&val))) {
log_fatal("PMI2_Job_GetRank failed: %d\n", rc);
return rc;
}
log_assert(rank == val, "");
val = -1;
if (PMI2_SUCCESS != (rc = PMI2_Info_GetSize(&val))) {
log_fatal("PMI2_Info_GetSize failed: %d\n", rc);
return rc;
}
log_assert(0 < val, "");
return rc; return rc;
} }
@ -333,8 +343,8 @@ static int test_item7(void)
return rc; return rc;
} }
if (PMI2_SUCCESS != (rc = PMI2_KVS_Get(jobid, PMI2_ID_NULL, tkey, val, sizeof(val), &len))) { if (PMI2_SUCCESS != (rc = PMI2_KVS_Get(jobid, i, tkey, val, sizeof(val), &len))) {
log_fatal("PMI2_KVS_Get %d\n", rc); log_fatal("PMI2_KVS_Get [%s=?] %d\n", tkey, rc);
return rc; return rc;
} }
@ -348,18 +358,58 @@ static int test_item7(void)
} }
static int test_item8(void) static int test_item8(void)
{
int rc = 0;
int len;
char tkey[PMI2_MAX_VALLEN];
char tval[PMI2_MAX_VALLEN];
char val[PMI2_MAX_VALLEN];
int i = 0;
for (i = 0; i < size; i++) {
sprintf(tkey, "KEY-%d", i);
sprintf(tval, "VALUE-%d", i);
if (i == rank) {
if (PMI2_SUCCESS != (rc = PMI2_KVS_Put(tkey, tval))) {
log_fatal("PMI2_KVS_Put [%s=%s] %d\n", tkey, tval, rc);
return rc;
}
}
if (PMI2_SUCCESS != (rc = PMI2_KVS_Fence())) {
log_fatal("PMI2_KVS_Fence %d\n", rc);
return rc;
}
if (PMI2_SUCCESS != (rc = PMI2_KVS_Get(jobid, PMI2_ID_NULL, tkey, val, sizeof(val), &len))) {
log_fatal("PMI2_KVS_Get [%s=?] %d\n", tkey, rc);
return rc;
}
log_info("tkey=%s tval=%s val=%s len=%d\n", tkey, tval, val, len);
log_assert((int)strlen(tval) == len, "value does not meet expectation");
log_assert(!strcmp(tval, val), "value does not meet expectation");
}
return rc;
}
static int test_item9(void)
{ {
int rc = 0; int rc = 0;
int i, j, r; int i, j, r;
char symb, symb_start = 'a'; char symb, symb_start = 'a';
int fence_cnt; int fence_cnt;
int fence_num = random_value(2, 10); int fence_num = random_value(2, 10);
int keys_per_fence = random_value(10, 1000); int keys_per_fence = random_value(10, 100);
int val_size = random_value(10, PMI2_MAX_VALLEN); int val_size = random_value(10, PMI2_MAX_VALLEN / 10);
int keys_total = 0; int keys_total = 0;
fence_cnt = 0; fence_cnt = 0;
while (fence_cnt < fence_num) { while (fence_cnt < fence_num) {
log_info("fence_cnt=%d of fence_num=%d keys_per_fence=%d keys_total=%d val_size=%d\n",
fence_cnt, fence_num, keys_per_fence, keys_total, val_size);
symb = symb_start; symb = symb_start;
for (i = 0; i < keys_per_fence; i++) { for (i = 0; i < keys_per_fence; i++) {
char key[PMI2_MAX_KEYLEN]; char key[PMI2_MAX_KEYLEN];
@ -376,6 +426,7 @@ static int test_item8(void)
log_fatal("PMI2_KVS_Put [%s=%s] %d\n", key, val, rc); log_fatal("PMI2_KVS_Put [%s=%s] %d\n", key, val, rc);
return rc; return rc;
} }
log_info("PMI2_KVS_Put [rank=%d %s] %d\n", rank, key, rc);
} }
symb_start = symb; symb_start = symb;
keys_total += keys_per_fence; keys_total += keys_per_fence;
@ -393,11 +444,13 @@ static int test_item8(void)
char val[PMI2_MAX_VALLEN] = ""; char val[PMI2_MAX_VALLEN] = "";
sprintf(key, "RANK%d-key-%d", r, i); sprintf(key, "RANK%d-key-%d", r, i);
if (PMI2_SUCCESS != (rc = PMI2_KVS_Get(jobid, PMI2_ID_NULL, key, val, sizeof(val), &len))) { if (PMI2_SUCCESS != (rc = PMI2_KVS_Get(jobid, r, key, val, sizeof(val), &len))) {
log_fatal("PMI2_KVS_Get %d\n", rc); log_fatal("PMI2_KVS_Get [%s=?] %d\n", key, rc);
return rc; return rc;
} }
log_info("PMI2_KVS_Get [rank=%d %s] %d\n", rank, key, rc);
if (len != val_size) { if (len != val_size) {
log_fatal("%d: failure on rank %d, key #%d: len mismatch:" log_fatal("%d: failure on rank %d, key #%d: len mismatch:"
" %d instead of %d\n", rank, r, i, len, val_size); " %d instead of %d\n", rank, r, i, len, val_size);

Просмотреть файл

@ -1,19 +1,7 @@
/* /*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved. * Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -24,53 +12,411 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <time.h>
#include "pmi.h" #include "pmi.h"
/* Target is legacy SLURM pmi library implementation */
static int _legacy = 0;
/* Verbose level 0-silent, 1-fatal, 2-error, 3+ debug*/
static int _verbose = 1;
#define log_fatal(fmt, ...) \
do { \
if (_verbose > 0) \
fprintf(stderr, "FATAL " fmt, ##__VA_ARGS__); \
exit(rc); \
} while (0)
#define log_error(fmt) \
do { \
if (_verbose > 1) \
fprintf(stderr, "ERROR " fmt); \
} while (0)
#define log_info(fmt, ...) \
do { \
if (_verbose > 2) \
fprintf(stderr, "INFO " fmt, ##__VA_ARGS__); \
} while (0)
#define log_assert(e, msg) \
do { \
if (!(e)) { \
log_fatal("%s at %s:%d\n", msg, __FUNCTION__, __LINE__); \
rc = -1; \
} \
} while (0)
static inline long random_value(long min_value, long max_value)
{
return ((min_value >= max_value) ? min_value : min_value + (rand() % (max_value - min_value + 1)));
}
static int test_item1(void);
static int test_item2(void);
static int test_item3(void);
static int test_item4(void);
static int test_item5(void);
static int test_item6(void);
static int test_item7(void);
static int test_item8(void);
static int spawned, size, rank, appnum;
static char jobid[255];
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int spawned; int ret = 0;
int rc; int rc;
char *str = NULL;
int ti = (argc > 1 ? atoi(argv[1]) : 0);
/* init us */ srand(time(NULL));
str = getenv("VERBOSE");
_verbose = (str ? atoi(str) : _verbose);
str = getenv("LEGACY");
_legacy = (str ? atoi(str) : _legacy);
spawned = random_value(10, 20);
size = random_value(10, 20);
rank = random_value(10, 20);
appnum = random_value(10, 20);
if (PMI_SUCCESS != (rc = PMI_Init(&spawned))) { if (PMI_SUCCESS != (rc = PMI_Init(&spawned))) {
fprintf(stderr, "PMI_Init failed: %d\n", rc); log_fatal("PMI_Init failed: %d\n", rc);
return rc; return rc;
} }
#if 0
key = "local-key"; /* this test should be always run */
PMIX_VAL_SET(&value, int, 12345, rc, kvp_error ); if (1) {
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, key, &value))) { rc = test_item1();
fprintf(stderr, "PMIx_Put failed: %d\n", rc); ret += (rc ? 1 : 0);
log_info("TI1 : %s\n", (rc ? "FAIL" : "PASS"));
} }
key = "remote-key"; if (!ti || 2 == ti) {
char *ptr = "Test string"; rc = test_item2();
PMIX_VAL_SET(&value, string, ptr, rc, kvp_error ); ret += (rc ? 1 : 0);
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, key, &value))) { log_info("TI2 : %s\n", (rc ? "FAIL" : "PASS"));
fprintf(stderr, "PMIx_Put failed: %d\n", rc);
} }
key = "global-key"; if (!ti || 3 == ti) {
PMIX_VAL_SET(&value, float, 10.15, rc, kvp_error ); rc = test_item3();
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_GLOBAL, key, &value))) { ret += (rc ? 1 : 0);
fprintf(stderr, "PMIx_Put failed: %d\n", rc); log_info("TI3 : %s\n", (rc ? "FAIL" : "PASS"));
} }
/* Submit the data */ if (!ti || 4 == ti) {
pmix_range_t range; rc = test_item4();
range.ranks = NULL; ret += (rc ? 1 : 0);
range.nranks = 0; log_info("TI4 : %s\n", (rc ? "FAIL" : "PASS"));
if (PMIX_SUCCESS != (rc = PMIx_Fence(NULL, 0))) {
fprintf(stderr, "PMIx_Fence failed: %d\n", rc);
return rc;
} }
#endif
/* finalize us */ if (!ti || 5 == ti) {
rc = test_item5();
ret += (rc ? 1 : 0);
log_info("TI5 : %s\n", (rc ? "FAIL" : "PASS"));
}
if (!ti || 6 == ti) {
rc = test_item6();
ret += (rc ? 1 : 0);
log_info("TI6 : %s\n", (rc ? "FAIL" : "PASS"));
}
if (!ti || 7 == ti) {
rc = test_item7();
ret += (rc ? 1 : 0);
log_info("TI7 : %s\n", (rc ? "FAIL" : "PASS"));
}
if (!ti || 8 == ti) {
rc = test_item8();
ret += (rc ? 1 : 0);
log_info("TI8 : %s\n", (rc ? "FAIL" : "PASS"));
}
if (PMI_SUCCESS != (rc = PMI_Finalize())) { if (PMI_SUCCESS != (rc = PMI_Finalize())) {
fprintf(stderr, "PMI_Finalize failed: %d\n", rc); log_fatal("PMI_Finalize failed: %d\n", rc);
return rc;
} }
return ret;
}
static int test_item1(void)
{
int rc = 0;
int val = 0;
log_assert(spawned == PMI_FALSE || spawned == PMI_TRUE, "");
if (PMI_SUCCESS != (rc = PMI_Get_size(&size))) {
log_fatal("PMI_Get_Size failed: %d\n", rc);
return rc;
}
log_assert(size >= 0, "");
if (PMI_SUCCESS != (rc = PMI_Get_rank(&rank))) {
log_fatal("PMI_Get_Rank failed: %d\n", rc);
return rc;
}
log_assert(rank >= 0, "");
log_assert(rank < size, "");
if (PMI_SUCCESS != (rc = PMI_Get_appnum(&appnum))) {
log_fatal("PMI_Get_appnum failed: %d\n", rc);
return rc;
}
log_info("spawned=%d size=%d rank=%d appnum=%d\n", spawned, size, rank, appnum);
val = random_value(10, 100);
if (PMI_SUCCESS != (rc = PMI_Get_universe_size(&val))) {
log_fatal("PMI_Get_universe_size failed: %d\n", rc);
return rc;
}
log_assert(size == val, "");
val = random_value(10, 100);
if (PMI_SUCCESS != (rc = PMI_Get_id_length_max(&val))) {
log_fatal("PMI_Get_id_length_max failed: %d\n", rc);
return rc;
}
log_info("PMI_Get_id_length_max=%d\n", val);
if (!_legacy) {
log_assert(sizeof(jobid) == val, "Check PMIX_MAX_NSLEN value in pmix_common.h");
}
sprintf(jobid, "%s", __FUNCTION__);
if (PMI_SUCCESS != (rc = PMI_Get_id(jobid, sizeof(jobid)))) {
log_fatal("PMI_Get_id failed: %d\n", rc);
return rc;
}
log_info("jobid=%s\n", jobid);
log_assert(memcmp(jobid, __FUNCTION__, sizeof(__FUNCTION__)), "");
sprintf(jobid, "%s", __FUNCTION__);
if (PMI_SUCCESS != (rc = PMI_Get_kvs_domain_id(jobid, sizeof(jobid)))) {
log_fatal("PMI_Get_kvs_domain_id failed: %d\n", rc);
return rc;
}
log_info("PMI_Get_kvs_domain_id=%s\n", jobid);
log_assert(memcmp(jobid, __FUNCTION__, sizeof(__FUNCTION__)), "");
sprintf(jobid, "%s", __FUNCTION__);
if (PMI_SUCCESS != (rc = PMI_KVS_Get_my_name(jobid, sizeof(jobid)))) {
log_fatal("PMI_KVS_Get_my_name failed: %d\n", rc);
return rc;
}
log_info("PMI_KVS_Get_my_name=%s\n", jobid);
log_assert(memcmp(jobid, __FUNCTION__, sizeof(__FUNCTION__)), "");
return rc;
}
static int test_item2(void)
{
int rc = 0;
PMI_BOOL val;
if (PMI_SUCCESS != (rc = PMI_Initialized(&val))) {
log_fatal("PMI_Initialized failed: %d\n", rc);
return rc;
}
log_assert(PMI_TRUE == val, "");
return rc;
}
static int test_item3(void)
{
int rc = 0;
int val = 0;
val = random_value(10, 100);
if (PMI_SUCCESS != (rc = PMI_KVS_Get_key_length_max(&val))) {
log_fatal("PMI_KVS_Get_key_length_max failed: %d\n", rc);
return rc;
}
log_info("PMI_KVS_Get_key_length_max=%d\n", val);
if (!_legacy) {
log_assert(511 == val, "Check PMIX_MAX_KEYLEN value in pmix_common.h");
}
val = random_value(10, 100);
if (PMI_SUCCESS != (rc = PMI_KVS_Get_value_length_max(&val))) {
log_fatal("PMI_KVS_Get_value_length_max failed: %d\n", rc);
return rc;
}
log_info("PMI_KVS_Get_value_length_max=%d\n", val);
if (!_legacy) {
log_assert(4096 == val, "Check limitation for a value");
}
return rc;
}
static int test_item4(void)
{
int rc = 0;
int val = 0;
int *ranks = NULL;
int i = 0;
val = -1;
if (PMI_SUCCESS != (rc = PMI_Get_clique_size(&val))) {
log_fatal("PMI_Get_clique_size failed: %d\n", rc);
return rc;
}
log_info("PMI_Get_clique_size=%d\n", val);
log_assert((0 < val) && (val <= size), "");
ranks = alloca(val);
if (!ranks) {
return PMI_FAIL;
}
memset(ranks, (-1), val);
if (PMI_SUCCESS != (rc = PMI_Get_clique_ranks(ranks, val))) {
log_fatal("PMI_Get_clique_ranks failed: %d\n", rc);
return rc;
}
for (i = 0; i < val; i++) {
if (!((0 <= ranks[i]) && (ranks[i] < size))) {
log_fatal("found invalid value in ranks array: ranks[%d]=%d\n", i, ranks[i]);
return rc;
}
}
return rc;
}
static int test_item5(void)
{
int rc = 0;
char *val = NULL;
int val_size = 0;
/* Predefined Job attributes */
const char *tkeys[] = {
"PMI_process_mapping",
NULL
};
const char **ptr = tkeys;
if (PMI_SUCCESS != (rc = PMI_KVS_Get_value_length_max(&val_size))) {
log_fatal("PMI_KVS_Get_value_length_max failed: %d\n", rc);
return rc;
}
val = alloca(val_size);
if (!val) {
return PMI_FAIL;
}
while (*ptr) {
if (PMI_SUCCESS != (rc = PMI_KVS_Get(jobid, *ptr, val, val_size))) {
log_fatal("PMI_KVS_Get: [%s] %d\n", *ptr, rc);
return rc;
}
log_info("key=%s value=%.80s\n", *ptr, val);
ptr++;
}
return rc;
}
static int test_item6(void)
{
int rc = 0;
char nspace[100];
log_error("pmix does not support this functionality\n");
return rc;
if (0 == rank) {
if (PMI_SUCCESS != (rc = PMI_KVS_Create(nspace, sizeof(nspace)))) {
log_fatal("PMI_KVS_Create failed: %d\n", rc);
return rc;
}
log_info("nspace=%s\n", nspace);
if (PMI_SUCCESS != (rc = PMI_KVS_Destroy(nspace))) {
log_fatal("PMI_KVS_Destroy failed: %d\n", rc);
return rc;
}
}
return rc;
}
static int test_item7(void)
{
int rc = 0;
char val[100];
const char *tkey = __FUNCTION__;
const char *tval = __FILE__;
if (PMI_SUCCESS != (rc = PMI_KVS_Put(jobid, tkey, tval))) {
log_fatal("PMI_KVS_Put %d\n", rc);
return rc;
}
if (PMI_SUCCESS != (rc = PMI_KVS_Get(jobid, tkey, val, sizeof(val)))) {
log_fatal("PMI_KVS_Get %d\n", rc);
return rc;
}
log_info("tkey=%s tval=%s val=%s\n", tkey, tval, val);
log_assert(!strcmp(tval, val), "value does not meet expectation");
return rc;
}
static int test_item8(void)
{
int rc = 0;
char tkey[100];
char tval[100];
char val[100];
int i = 0;
for (i = 0; i < size; i++) {
sprintf(tkey, "KEY-%d", i);
sprintf(tval, "VALUE-%d", i);
if (i == rank) {
if (PMI_SUCCESS != (rc = PMI_KVS_Put(jobid, tkey, tval))) {
log_fatal("PMI_KVS_Put [%s=%s] %d\n", tkey, tval, rc);
return rc;
}
}
if (PMI_SUCCESS != (rc = PMI_KVS_Commit(jobid))) {
log_fatal("PMI_KVS_Commit %d\n", rc);
return rc;
}
if (PMI_SUCCESS != (rc = PMI_Barrier())) {
log_fatal("PMI_Barrier %d\n", rc);
return rc;
}
if (PMI_SUCCESS != (rc = PMI_KVS_Get(jobid, tkey, val, sizeof(val)))) {
log_fatal("PMI_KVS_Get [%s=?] %d\n", tkey, rc);
return rc;
}
log_info("tkey=%s tval=%s val=%s\n", tkey, tval, val);
log_assert(!strcmp(tval, val), "value does not meet expectation");
}
return rc; return rc;
} }

Просмотреть файл

@ -16,6 +16,8 @@
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved. * Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -2,6 +2,8 @@
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -2,6 +2,8 @@
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved. * Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Artem Y. Polyakov <artpol84@gmail.com>. * Copyright (c) 2015 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -4,6 +4,8 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow

Просмотреть файл

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow