sync with PMIX master
Этот коммит содержится в:
родитель
eb79edff33
Коммит
7434c47626
@ -50,6 +50,7 @@ include src/usock/Makefile.am
|
||||
include src/client/Makefile.am
|
||||
include src/server/Makefile.am
|
||||
include src/sec/Makefile.am
|
||||
include src/common/Makefile.am
|
||||
|
||||
lib_LTLIBRARIES = libpmix.la
|
||||
|
||||
|
@ -30,7 +30,7 @@ greek=a1
|
||||
# command, or with the date (if "git describe" fails) in the form of
|
||||
# "date<date>".
|
||||
|
||||
repo_rev=git0a8e0d9
|
||||
repo_rev=git3c37421
|
||||
|
||||
# If tarball_version is not empty, it is used as the version string in
|
||||
# the tarball filename, regardless of all other versions listed in
|
||||
@ -44,7 +44,7 @@ tarball_version=
|
||||
|
||||
# The date when this release was created
|
||||
|
||||
date="Sep 23, 2015"
|
||||
date="Oct 02, 2015"
|
||||
|
||||
# The shared library version of each of PMIx's public libraries.
|
||||
# These versions are maintained in accordance with the "Library
|
||||
|
@ -43,6 +43,20 @@ static void notification_fn(pmix_status_t status,
|
||||
completed = true;
|
||||
}
|
||||
|
||||
static void op_callbk(pmix_status_t status,
|
||||
void *cbdata)
|
||||
{
|
||||
fprintf(stderr, "client: OP CALLBACK CALLED WITH STATUS %d", status);
|
||||
}
|
||||
|
||||
static void errhandler_reg_callbk (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
fprintf(stderr, "cleint: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%d",
|
||||
status, errhandler_ref);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
@ -69,7 +83,7 @@ int main(int argc, char **argv)
|
||||
completed = false;
|
||||
|
||||
/* register our errhandler */
|
||||
PMIx_Register_errhandler(NULL, 0, notification_fn);
|
||||
PMIx_Register_errhandler(NULL, 0, notification_fn, errhandler_reg_callbk, NULL);
|
||||
|
||||
/* call fence to sync */
|
||||
PMIX_PROC_CONSTRUCT(&proc);
|
||||
@ -97,7 +111,7 @@ int main(int argc, char **argv)
|
||||
done:
|
||||
/* finalize us */
|
||||
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
|
||||
PMIx_Deregister_errhandler();
|
||||
PMIx_Deregister_errhandler(0, op_callbk, NULL);
|
||||
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
|
||||
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
|
@ -140,7 +140,10 @@ static void set_namespace(int nprocs, char *ranks, char *nspace,
|
||||
static void errhandler(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_info_t info[], size_t ninfo);
|
||||
|
||||
static void op_callbk(pmix_status_t status, void *cbdata);
|
||||
static void errhandler_reg_callbk (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata);
|
||||
static void opcbfunc(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
myxfer_t *x = (myxfer_t*)cbdata;
|
||||
@ -175,7 +178,7 @@ int main(int argc, char **argv)
|
||||
return rc;
|
||||
}
|
||||
/* register the errhandler */
|
||||
PMIx_Register_errhandler(NULL, 0, errhandler);
|
||||
PMIx_Register_errhandler(NULL, 0, errhandler, errhandler_reg_callbk, NULL);
|
||||
|
||||
/* setup the pub data, in case it is used */
|
||||
PMIX_CONSTRUCT(&pubdata, pmix_list_t);
|
||||
@ -282,7 +285,7 @@ int main(int argc, char **argv)
|
||||
pmix_argv_free(client_env);
|
||||
|
||||
/* deregister the errhandler */
|
||||
PMIx_Deregister_errhandler();
|
||||
PMIx_Deregister_errhandler(0, op_callbk, NULL);
|
||||
|
||||
/* release any pub data */
|
||||
PMIX_LIST_DESTRUCT(&pubdata);
|
||||
@ -343,6 +346,20 @@ static void errhandler(pmix_status_t status,
|
||||
pmix_output(0, "SERVER: ERRHANDLER CALLED WITH STATUS %d", status);
|
||||
}
|
||||
|
||||
static void op_callbk(pmix_status_t status,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_output(0, "SERVER: OP CALLBACK CALLED WITH STATUS %d", status);
|
||||
}
|
||||
|
||||
static void errhandler_reg_callbk (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_output(0, "SERVER: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%d",
|
||||
status, errhandler_ref);
|
||||
}
|
||||
|
||||
static int connected(const pmix_proc_t *proc, void *server_object)
|
||||
{
|
||||
pmix_output(0, "SERVER: CONNECTED %s:%d", proc->nspace, proc->rank);
|
||||
@ -403,7 +420,7 @@ static pmix_status_t abort_fn(const pmix_proc_t *proc,
|
||||
x->cbfunc = cbfunc;
|
||||
x->cbdata = cbdata;
|
||||
|
||||
if (PMIX_SUCCESS != (rc = PMIx_server_notify_error(status, procs, nprocs,
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Notify_error(status, procs, nprocs,
|
||||
&x->caller, 1, x->info, 2,
|
||||
abcbfunc, x))) {
|
||||
pmix_output(0, "SERVER: FAILED NOTIFY ERROR %d", (int)rc);
|
||||
|
@ -728,6 +728,15 @@ typedef void (*pmix_notification_fn_t)(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_info_t info[], size_t ninfo);
|
||||
|
||||
/* define a callback function for calls to PMIx_Register_errhandler. The
|
||||
* status indicates if the request was successful or not, errhandler_ref is
|
||||
* an integer reference assigned to the errhandler by PMIX, this reference
|
||||
* must be used to deregister the err handler. A ptr to the original
|
||||
* cbdata is returned. */
|
||||
typedef void (*pmix_errhandler_reg_cbfunc_t) (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata);
|
||||
|
||||
/* define a callback function for calls to PMIx_Get_nb. The status
|
||||
* indicates if the requested data was found or not - a pointer to the
|
||||
* pmix_value_t structure containing the found data is returned. The
|
||||
@ -756,16 +765,71 @@ typedef void (*pmix_value_cbfunc_t)(pmix_status_t status,
|
||||
* will be reported. Options to modify that behavior can be provided
|
||||
* in the info array
|
||||
*
|
||||
* Both the client application and the resource manager can register
|
||||
* err handlers for specific errors. PMIx client/server calls the registered
|
||||
* err handler upon receiving error notify notification (via PMIx_Notify_error)
|
||||
* from the other end (Resource Manager/Client application).
|
||||
*
|
||||
* Multiple err handlers can be registered for different errors. PMIX returns
|
||||
* an integer reference to each register handler in the callback fn. The caller
|
||||
* must retain the reference in order to deregister the errhandler.
|
||||
* Modification of the notification behavior can be accomplished by
|
||||
* deregistering the current errhandler, and then registering it
|
||||
* using a new set of info values.
|
||||
*
|
||||
* See pmix_common.h for a description of the notification function */
|
||||
void PMIx_Register_errhandler(pmix_info_t info[], size_t ninfo,
|
||||
pmix_notification_fn_t errhandler);
|
||||
pmix_notification_fn_t errhandler,
|
||||
pmix_errhandler_reg_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
|
||||
/* deregister the errhandler */
|
||||
void PMIx_Deregister_errhandler(void);
|
||||
/* deregister the errhandler
|
||||
* errhandler_ref is the reference returned by PMIx for the errhandler
|
||||
* to pmix_errhandler_reg_cbfunc_t */
|
||||
void PMIx_Deregister_errhandler(int errhandler_ref,
|
||||
pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
/* Report an error to a process for notification via any
|
||||
* registered errhandler. The errhandler registration can be
|
||||
* called by both the server and the client application. On the
|
||||
* server side, the errhandler is used to report errors detected
|
||||
* by PMIx to the host server for handling. On the client side,
|
||||
* the errhandler is used to notify the process of errors
|
||||
* reported by the server - e.g., the failure of another process.
|
||||
*
|
||||
* This function allows the host server to direct the server
|
||||
* convenience library to notify all indicated local procs of
|
||||
* an error. The error can be local, or anywhere in the cluster.
|
||||
* The status indicates the error being reported.
|
||||
*
|
||||
* The client application can also call this function to notify the
|
||||
* resource manager of an error it encountered. It can request the host
|
||||
* server to notify the indicated processes about the error.
|
||||
*
|
||||
* The first array of procs informs the server library as to which
|
||||
* processes should be alerted - e.g., the processes that are in
|
||||
* a directly-affected job or are connected to one that is affected.
|
||||
* Passing a NULL for this array will indicate that all local procs
|
||||
* are to be notified.
|
||||
*
|
||||
* The second array identifies the processes that will be impacted
|
||||
* by the error. This could consist of a single process, or a number
|
||||
* of processes.
|
||||
*
|
||||
* The info array contains any further info the RM can and/or chooses
|
||||
* to provide.
|
||||
*
|
||||
* The callback function will be called upon completion of the
|
||||
* notify_error function's actions. Note that any messages will
|
||||
* have been queued, but may not have been transmitted by this
|
||||
* time. Note that the caller is required to maintain the input
|
||||
* data until the callback function has been executed!
|
||||
*/
|
||||
pmix_status_t PMIx_Notify_error(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_proc_t error_procs[], size_t error_nprocs,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
/* Provide a string representation of a pmix_status_t value. Note
|
||||
* that the provided string is statically defined and must NOT be
|
||||
|
@ -254,13 +254,22 @@ typedef pmix_status_t (*pmix_server_disconnect_fn_t)(const pmix_proc_t procs[],
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
/* Register to receive notifications for the specified events. The resource
|
||||
* manager may have access to events beyond process failure. In cases where
|
||||
* the client application requests to be notified of such events, the request
|
||||
* will be passed to the PMIx server, which in turn shall pass the request to
|
||||
* the resource manager. */
|
||||
* manager may have access to events beyond process failure. The client
|
||||
* application requests to be notified of such events by registering a
|
||||
* err handler(s) for the events. The PMIx client shall pass the request
|
||||
* to the PMIx server, which in turn shall pass the request to
|
||||
* the resource manager by calling the register events function. */
|
||||
typedef pmix_status_t (*pmix_server_register_events_fn_t)(const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
/* Deregister to receive notifications for the specified events that
|
||||
* the client application has registered for previously. When the client
|
||||
* application deregisters the err handler forevents, PMIX client passes the
|
||||
* deregister request to PMIx server which in turn passes the request to the
|
||||
* resource manager by calling deregister events function.*/
|
||||
typedef pmix_status_t (*pmix_server_deregister_events_fn_t)(const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
/* Callback function for incoming connection requests from
|
||||
* local clients */
|
||||
typedef void (*pmix_connection_cbfunc_t)(int incoming_sd);
|
||||
@ -279,19 +288,20 @@ typedef pmix_status_t (*pmix_server_listener_fn_t)(int listening_sd,
|
||||
pmix_connection_cbfunc_t cbfunc);
|
||||
|
||||
typedef struct pmix_server_module_1_0_0_t {
|
||||
pmix_server_client_connected_fn_t client_connected;
|
||||
pmix_server_client_finalized_fn_t client_finalized;
|
||||
pmix_server_abort_fn_t abort;
|
||||
pmix_server_fencenb_fn_t fence_nb;
|
||||
pmix_server_dmodex_req_fn_t direct_modex;
|
||||
pmix_server_publish_fn_t publish;
|
||||
pmix_server_lookup_fn_t lookup;
|
||||
pmix_server_unpublish_fn_t unpublish;
|
||||
pmix_server_spawn_fn_t spawn;
|
||||
pmix_server_connect_fn_t connect;
|
||||
pmix_server_disconnect_fn_t disconnect;
|
||||
pmix_server_register_events_fn_t register_events;
|
||||
pmix_server_listener_fn_t listener;
|
||||
pmix_server_client_connected_fn_t client_connected;
|
||||
pmix_server_client_finalized_fn_t client_finalized;
|
||||
pmix_server_abort_fn_t abort;
|
||||
pmix_server_fencenb_fn_t fence_nb;
|
||||
pmix_server_dmodex_req_fn_t direct_modex;
|
||||
pmix_server_publish_fn_t publish;
|
||||
pmix_server_lookup_fn_t lookup;
|
||||
pmix_server_unpublish_fn_t unpublish;
|
||||
pmix_server_spawn_fn_t spawn;
|
||||
pmix_server_connect_fn_t connect;
|
||||
pmix_server_disconnect_fn_t disconnect;
|
||||
pmix_server_register_events_fn_t register_events;
|
||||
pmix_server_deregister_events_fn_t deregister_events;
|
||||
pmix_server_listener_fn_t listener;
|
||||
} pmix_server_module_t;
|
||||
|
||||
/**** SERVER SUPPORT INIT/FINALIZE FUNCTIONS ****/
|
||||
@ -411,44 +421,6 @@ pmix_status_t PMIx_server_dmodex_request(const pmix_proc_t *proc,
|
||||
pmix_dmodex_response_fn_t cbfunc,
|
||||
void *cbdata);
|
||||
|
||||
/* Report an error to a process for notification via any
|
||||
* registered errhandler. The errhandler registration can be
|
||||
* called by both the server and the client application. On the
|
||||
* server side, the errhandler is used to report errors detected
|
||||
* by PMIx to the host server for handling. On the client side,
|
||||
* the errhandler is used to notify the process of errors
|
||||
* reported by the server - e.g., the failure of another process.
|
||||
*
|
||||
* This function allows the host server to direct the server
|
||||
* convenience library to notify all indicated local procs of
|
||||
* an error. The error can be local, or anywhere in the cluster.
|
||||
* The status indicates the error being reported.
|
||||
*
|
||||
* The first array of procs informs the server library as to which
|
||||
* processes should be alerted - e.g., the processes that are in
|
||||
* a directly-affected job or are connected to one that is affected.
|
||||
* Passing a NULL for this array will indicate that all local procs
|
||||
* are to be notified.
|
||||
*
|
||||
* The second array identifies the processes that will be impacted
|
||||
* by the error. This could consist of a single process, or a number
|
||||
* of processes.
|
||||
*
|
||||
* The info array contains any further info the RM can and/or chooses
|
||||
* to provide.
|
||||
*
|
||||
* The callback function will be called upon completion of the
|
||||
* notify_error function's actions. Note that any messages will
|
||||
* have been queued, but may not have been transmitted by this
|
||||
* time. Note that the caller is required to maintain the input
|
||||
* data until the callback function has been executed! */
|
||||
pmix_status_t PMIx_server_notify_error(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_proc_t error_procs[], size_t error_nprocs,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -49,6 +49,9 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
|
||||
return PMI2_ERR_INIT;
|
||||
}
|
||||
|
||||
/* get the rank */
|
||||
*rank = myproc.rank;
|
||||
|
||||
if (NULL != size) {
|
||||
/* get the universe size - this will likely pull
|
||||
* down all attributes assigned to the job, thus
|
||||
@ -57,7 +60,9 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
|
||||
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &kv)) {
|
||||
rc = convert_int(size, kv);
|
||||
PMIX_VALUE_RELEASE(kv);
|
||||
return convert_err(rc);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
/* cannot continue without this info */
|
||||
return PMI2_ERR_INIT;
|
||||
@ -69,7 +74,9 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
|
||||
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 (PMIX_SUCCESS != rc) {
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
/* if not found, default to not spawned */
|
||||
*spawned = 0;
|
||||
@ -81,7 +88,9 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
|
||||
if (PMIX_SUCCESS == PMIx_Get(&myproc, PMIX_APPNUM, NULL, 0, &kv)) {
|
||||
rc = convert_int(appnum, kv);
|
||||
PMIX_VALUE_RELEASE(kv);
|
||||
return convert_err(rc);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
/* if not found, default to 0 */
|
||||
*appnum = 0;
|
||||
@ -89,6 +98,9 @@ int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
|
||||
}
|
||||
|
||||
return PMI2_SUCCESS;
|
||||
|
||||
error:
|
||||
return convert_err(rc);
|
||||
}
|
||||
|
||||
int PMI2_Initialized(void)
|
||||
@ -153,8 +165,8 @@ int PMI2_KVS_Get(const char *jobid, int src_pmi_id,
|
||||
pmix_value_t *val;
|
||||
pmix_proc_t proc;
|
||||
|
||||
(void)strncpy(proc.nspace, jobid, PMIX_MAX_NSLEN);
|
||||
proc.rank = src_pmi_id;
|
||||
(void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), sizeof(myproc.nspace));
|
||||
proc.rank = (src_pmi_id == PMI2_ID_NULL ? myproc.rank : src_pmi_id);
|
||||
rc = PMIx_Get(&proc, key, NULL, 0, &val);
|
||||
if (PMIX_SUCCESS == rc && NULL != val) {
|
||||
if (PMIX_STRING != val->type) {
|
||||
@ -173,9 +185,26 @@ int PMI2_KVS_Get(const char *jobid, int src_pmi_id,
|
||||
|
||||
int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *found, int waitfor)
|
||||
{
|
||||
/* translate the provided name to the equivalent PMIx
|
||||
* attribute name */
|
||||
return PMI2_FAIL;
|
||||
pmix_status_t rc;
|
||||
pmix_value_t *val;
|
||||
|
||||
*found = 0;
|
||||
rc = PMIx_Get(&myproc, name, 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, valuelen);
|
||||
*found = 1;
|
||||
}
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
} else if (PMIX_ERR_NOT_FOUND == rc) {
|
||||
rc = PMIX_SUCCESS;
|
||||
}
|
||||
return convert_err(rc);
|
||||
}
|
||||
|
||||
/* push info at the PMIX_LOCAL scope */
|
||||
@ -208,6 +237,8 @@ int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *fou
|
||||
*found = 1;
|
||||
}
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
} else if (PMIX_ERR_NOT_FOUND == rc) {
|
||||
rc = PMIX_SUCCESS;
|
||||
}
|
||||
return convert_err(rc);
|
||||
}
|
||||
@ -323,7 +354,7 @@ int PMI2_Job_GetId(char jobid[], int jobid_size)
|
||||
if (NULL == jobid) {
|
||||
return PMI2_ERR_INVALID_ARGS;
|
||||
}
|
||||
(void)strncpy(jobid, pmix_globals.myid.nspace, jobid_size);
|
||||
(void)strncpy(jobid, myproc.nspace, jobid_size);
|
||||
return PMI2_SUCCESS;
|
||||
}
|
||||
|
||||
@ -332,7 +363,7 @@ int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn)
|
||||
pmix_status_t rc;
|
||||
pmix_proc_t proc;
|
||||
|
||||
(void)strncpy(proc.nspace, jobid, PMIX_MAX_NSLEN);
|
||||
(void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), sizeof(myproc.nspace));
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
rc = PMIx_Connect(&proc, 1, NULL, 0);
|
||||
return convert_err(rc);
|
||||
@ -343,7 +374,7 @@ int PMI2_Job_Disconnect(const char jobid[])
|
||||
pmix_status_t rc;
|
||||
pmix_proc_t proc;
|
||||
|
||||
(void)strncpy(proc.nspace, jobid, PMIX_MAX_NSLEN);
|
||||
(void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), sizeof(myproc.nspace));
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
rc = PMIx_Disconnect(&proc, 1, NULL, 0);
|
||||
return convert_err(rc);
|
||||
@ -442,6 +473,9 @@ static pmix_status_t convert_int(int *value, pmix_value_t *kv)
|
||||
case PMIX_SIZE:
|
||||
*value = kv->data.size;
|
||||
break;
|
||||
case PMIX_BOOL:
|
||||
*value = kv->data.flag;
|
||||
break;
|
||||
default:
|
||||
/* not an integer type */
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <private/pmix_socket_errno.h>
|
||||
|
||||
#include <pmix_server.h>
|
||||
|
||||
#include <pmix_common.h>
|
||||
#include "src/include/pmix_globals.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
@ -860,11 +860,11 @@ static void _dmodex_req(int sd, short args, void *cbdata)
|
||||
* may not be a contribution */
|
||||
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->server->myremote, info->rank, "modex", &val)) &&
|
||||
NULL != val) {
|
||||
data = val->data.bo.bytes;
|
||||
sz = val->data.bo.size;
|
||||
/* protect the data */
|
||||
val->data.bo.bytes = NULL;
|
||||
val->data.bo.size = 0;
|
||||
data = val->data.bo.bytes;
|
||||
sz = val->data.bo.size;
|
||||
/* protect the data */
|
||||
val->data.bo.bytes = NULL;
|
||||
val->data.bo.size = 0;
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
}
|
||||
|
||||
@ -979,11 +979,11 @@ static void _notify_error(int sd, short args, void *cbdata)
|
||||
}
|
||||
|
||||
|
||||
pmix_status_t PMIx_server_notify_error(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_proc_t error_procs[], size_t error_nprocs,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata)
|
||||
pmix_status_t pmix_server_notify_error(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_proc_t error_procs[], size_t error_nprocs,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata)
|
||||
{
|
||||
pmix_notify_caddy_t *cd;
|
||||
size_t n;
|
||||
@ -1030,8 +1030,10 @@ static void reg_errhandler(int sd, short args, void *cbdata)
|
||||
cd->active = false;
|
||||
}
|
||||
|
||||
void PMIx_Register_errhandler(pmix_info_t info[], size_t ninfo,
|
||||
pmix_notification_fn_t err)
|
||||
void pmix_server_register_errhandler(pmix_info_t info[], size_t ninfo,
|
||||
pmix_notification_fn_t errhandler,
|
||||
pmix_errhandler_reg_cbfunc_t cbfunc,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_shift_caddy_t *cd;
|
||||
|
||||
@ -1039,7 +1041,7 @@ void PMIx_Register_errhandler(pmix_info_t info[], size_t ninfo,
|
||||
cd = PMIX_NEW(pmix_shift_caddy_t);
|
||||
cd->info = info;
|
||||
cd->ninfo = ninfo;
|
||||
cd->err = err;
|
||||
cd->err = errhandler;
|
||||
PMIX_THREADSHIFT(cd, reg_errhandler);
|
||||
PMIX_WAIT_FOR_COMPLETION(cd->active);
|
||||
PMIX_RELEASE(cd);
|
||||
@ -1052,10 +1054,11 @@ static void dereg_errhandler(int sd, short args, void *cbdata)
|
||||
cd->active = false;
|
||||
}
|
||||
|
||||
void PMIx_Deregister_errhandler(void)
|
||||
void pmix_server_deregister_errhandler(int errhandler_ref,
|
||||
pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_shift_caddy_t *cd;
|
||||
|
||||
/* need to thread shift this request */
|
||||
cd = PMIX_NEW(pmix_shift_caddy_t);
|
||||
PMIX_THREADSHIFT(cd, dereg_errhandler);
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include <private/autogen/config.h>
|
||||
#include <pmix/rename.h>
|
||||
|
||||
#include <pmix_common.h>
|
||||
#include <pmix_server.h>
|
||||
#include "src/usock/usock.h"
|
||||
#include "src/util/hash.h"
|
||||
@ -232,6 +232,20 @@ void pmix_pack_proc_map(pmix_buffer_t *buf,
|
||||
pmix_status_t pmix_regex_parse_nodes(const char *regexp, char ***names);
|
||||
pmix_status_t pmix_regex_parse_procs(const char *regexp, char ***procs);
|
||||
|
||||
void pmix_server_register_errhandler(pmix_info_t info[], size_t ninfo,
|
||||
pmix_notification_fn_t errhandler,
|
||||
pmix_errhandler_reg_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
|
||||
void pmix_server_deregister_errhandler(int errhandler_ref,
|
||||
pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
|
||||
pmix_status_t pmix_server_notify_error(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_proc_t error_procs[], size_t error_nprocs,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
extern pmix_server_module_t pmix_host_server;
|
||||
extern pmix_server_globals_t pmix_server_globals;
|
||||
|
@ -253,3 +253,17 @@ void errhandler(pmix_status_t status,
|
||||
test_abort = true;
|
||||
}
|
||||
|
||||
void op_callbk(pmix_status_t status,
|
||||
void *cbdata)
|
||||
{
|
||||
TEST_VERBOSE(( "OP CALLBACK CALLED WITH STATUS %d", status));
|
||||
}
|
||||
|
||||
void errhandler_reg_callbk (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
TEST_VERBOSE(("ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%d",
|
||||
status, errhandler_ref));
|
||||
}
|
||||
|
||||
|
@ -65,3 +65,11 @@ void errhandler(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_info_t info[], size_t ninfo);
|
||||
|
||||
void op_callbk(pmix_status_t status,
|
||||
void *cbdata);
|
||||
|
||||
void errhandler_reg_callbk (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata);
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* 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.
|
||||
* 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.
|
||||
@ -24,48 +24,400 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "pmi2.h"
|
||||
|
||||
/* Target is legacy SLURM pmi2 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, ##__VA_ARGS__); \
|
||||
} 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[100];
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int spawned, size, rank, appnum;
|
||||
int ret = 0;
|
||||
int rc;
|
||||
char *key;
|
||||
|
||||
/* init us */
|
||||
char *str = NULL;
|
||||
int ti = (argc > 1 ? atoi(argv[1]) : 0);
|
||||
|
||||
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 (PMI2_SUCCESS != (rc = PMI2_Init(&spawned, &size, &rank, &appnum))) {
|
||||
fprintf(stderr, "PMI2_Init failed: %d\n", rc);
|
||||
log_fatal("PMI2_Init failed: %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
key = "local-key";
|
||||
if (PMI2_SUCCESS != (rc = PMI2_KVS_Put(key, "my-local-value"))) {
|
||||
fprintf(stderr, "PMI2_Put failed: %d\n", rc);
|
||||
if (!ti || 1 == ti) {
|
||||
rc = test_item1();
|
||||
ret += (rc ? 1 : 0);
|
||||
log_info("TI1 : %s\n", (rc ? "FAIL" : "PASS"));
|
||||
}
|
||||
|
||||
key = "remote-key";
|
||||
if (PMI2_SUCCESS != (rc = PMI2_KVS_Put(key, "remote-value"))) {
|
||||
fprintf(stderr, "PMI2_Put failed: %d\n", rc);
|
||||
if (!ti || 2 == ti) {
|
||||
rc = test_item2();
|
||||
ret += (rc ? 1 : 0);
|
||||
log_info("TI2 : %s\n", (rc ? "FAIL" : "PASS"));
|
||||
}
|
||||
|
||||
key = "global-key";
|
||||
if (PMI2_SUCCESS != (rc = PMI2_KVS_Put(key, "global-value"))) {
|
||||
fprintf(stderr, "PMI2_Put failed: %d\n", rc);
|
||||
if (!ti || 3 == ti) {
|
||||
rc = test_item3();
|
||||
ret += (rc ? 1 : 0);
|
||||
log_info("TI3 : %s\n", (rc ? "FAIL" : "PASS"));
|
||||
}
|
||||
|
||||
/* Submit the data */
|
||||
if (PMI2_SUCCESS != (rc = PMI2_KVS_Fence())) {
|
||||
fprintf(stderr, "PMI2_Fence failed: %d\n", rc);
|
||||
return rc;
|
||||
if (!ti || 4 == ti) {
|
||||
rc = test_item4();
|
||||
ret += (rc ? 1 : 0);
|
||||
log_info("TI4 : %s\n", (rc ? "FAIL" : "PASS"));
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
|
||||
/* finalize us */
|
||||
if (PMI2_SUCCESS != (rc = PMI2_Finalize())) {
|
||||
fprintf(stderr, "PMI2_Finalize failed: %d\n", rc);
|
||||
log_fatal("PMI2_Finalize failed: %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int test_item1(void)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
log_info("spawned=%d size=%d rank=%d appnum=%d\n", spawned, size, rank, appnum);
|
||||
|
||||
log_assert(spawned == 0 || spawned == 1, "");
|
||||
log_assert(size >= 0, "");
|
||||
log_assert(rank >= 0, "");
|
||||
log_assert(rank < size, "");
|
||||
|
||||
sprintf(jobid, "%s", __FUNCTION__);
|
||||
if (PMI2_SUCCESS != (rc = PMI2_Job_GetId(jobid, sizeof(jobid)))) {
|
||||
log_fatal("PMI2_Job_GetId failed: %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
log_info("jobid=%s\n", jobid);
|
||||
|
||||
log_assert(memcmp(jobid, __FUNCTION__, sizeof(__FUNCTION__)), "");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int test_item2(void)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
log_assert(PMI2_Initialized(), "");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int test_item3(void)
|
||||
{
|
||||
int rc = 0;
|
||||
char val[PMI2_MAX_VALLEN];
|
||||
int found = 0;
|
||||
/* Predefined Job attributes */
|
||||
const char *tkeys[] = {
|
||||
"universeSize",
|
||||
"hasNameServ",
|
||||
"physTopology",
|
||||
"physTopologyLevels",
|
||||
"cartDims",
|
||||
"isHeterogeneous",
|
||||
NULL
|
||||
};
|
||||
const char **ptr = tkeys;
|
||||
|
||||
while (*ptr) {
|
||||
if (PMI2_SUCCESS != (rc = PMI2_Info_GetJobAttr(*ptr, val, sizeof(val), &found))) {
|
||||
log_fatal("PMI2_Info_GetJobAttr: [%s] %d\n", *ptr, rc);
|
||||
return rc;
|
||||
}
|
||||
log_info("key=%s value=%s found=%d\n", *ptr, (found ? val : "N/A"), found);
|
||||
if (!_legacy) {
|
||||
log_assert(!found, "Check test. Probably PMIx has a new functionality");
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int test_item4(void)
|
||||
{
|
||||
int rc = 0;
|
||||
char val[PMI2_MAX_VALLEN];
|
||||
int found = 0;
|
||||
/* Predefined Node attributes */
|
||||
const char *tkeys[] = {
|
||||
"memPoolType",
|
||||
"memSYSVid",
|
||||
"memAnonMMAPfd",
|
||||
"memNTName",
|
||||
NULL
|
||||
};
|
||||
const char **ptr = tkeys;
|
||||
|
||||
if (_legacy) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
while (*ptr) {
|
||||
if (PMI2_SUCCESS != (rc = PMI2_Info_GetNodeAttr(*ptr, val, sizeof(val), &found, 1))) {
|
||||
log_fatal("PMI2_Info_GetNodeAttr: [%s] %d\n", *ptr, rc);
|
||||
return rc;
|
||||
}
|
||||
log_info("key=%s value=%s found=%d\n", *ptr, (found ? val : "N/A"), found);
|
||||
if (!_legacy) {
|
||||
log_assert(!found, "Check test. Probably PMIx has a new functionality");
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int test_item5(void)
|
||||
{
|
||||
int rc = 0;
|
||||
char val[PMI2_MAX_VALLEN];
|
||||
int found = 0;
|
||||
const char *tkey = "sharedFilename";
|
||||
const char *tval = "pmix-pmi2-check";
|
||||
|
||||
if (PMI2_SUCCESS != (rc = PMI2_Info_PutNodeAttr(tkey, tval))) {
|
||||
log_fatal("PMI2_Info_PutNodeAttr %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (PMI2_SUCCESS != (rc = PMI2_Info_GetNodeAttr(tkey, val, sizeof(val), &found, 1))) {
|
||||
log_fatal("PMI2_Info_GetNodeAttr %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
log_info("tkey=%s tval=%s val=%s found=%d\n", tkey, tval, val, found);
|
||||
|
||||
log_assert(found, "PMI2_Info_GetNodeAttr does not find expected key");
|
||||
log_assert(strlen(tval) == strlen(val), "value does not meet expectation");
|
||||
log_assert(!strcmp(tval, val), "value does not meet expectation");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int test_item6(void)
|
||||
{
|
||||
int rc = 0;
|
||||
char val[PMI2_MAX_VALLEN];
|
||||
int len;
|
||||
const char *tkey = __FUNCTION__;
|
||||
const char *tval = __FILE__;
|
||||
|
||||
if (PMI2_SUCCESS != (rc = PMI2_KVS_Put(tkey, tval))) {
|
||||
log_fatal("PMI2_KVS_Put %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (PMI2_SUCCESS != (rc = PMI2_KVS_Get(NULL, PMI2_ID_NULL, tkey, val, sizeof(val), &len))) {
|
||||
log_fatal("PMI2_KVS_Get %d\n", 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_item7(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 %d\n", 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_item8(void)
|
||||
{
|
||||
int rc = 0;
|
||||
int i, j, r;
|
||||
char symb, symb_start = 'a';
|
||||
int fence_cnt;
|
||||
int fence_num = random_value(2, 10);
|
||||
int keys_per_fence = random_value(10, 1000);
|
||||
int val_size = random_value(10, PMI2_MAX_VALLEN);
|
||||
int keys_total = 0;
|
||||
|
||||
fence_cnt = 0;
|
||||
while (fence_cnt < fence_num) {
|
||||
symb = symb_start;
|
||||
for (i = 0; i < keys_per_fence; i++) {
|
||||
char key[PMI2_MAX_KEYLEN];
|
||||
char val[PMI2_MAX_VALLEN] = "";
|
||||
sprintf(key, "RANK%d-key-%d", rank, i + keys_total);
|
||||
for (j = 0; j < val_size; j++) {
|
||||
val[j] = symb;
|
||||
}
|
||||
symb++;
|
||||
if (symb > 'z') {
|
||||
symb = 'a';
|
||||
}
|
||||
if (PMI2_SUCCESS != (rc = PMI2_KVS_Put(key, val))) {
|
||||
log_fatal("PMI2_KVS_Put [%s=%s] %d\n", key, val, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
symb_start = symb;
|
||||
keys_total += keys_per_fence;
|
||||
|
||||
if (PMI2_SUCCESS != (rc = PMI2_KVS_Fence())) {
|
||||
log_fatal("PMI2_KVS_Fence %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
for (r = 0; r < size; r++) {
|
||||
int len;
|
||||
symb = 'a';
|
||||
for (i = 0; i < keys_total; i++) {
|
||||
char key[PMI2_MAX_KEYLEN];
|
||||
char val[PMI2_MAX_VALLEN] = "";
|
||||
sprintf(key, "RANK%d-key-%d", r, i);
|
||||
|
||||
if (PMI2_SUCCESS != (rc = PMI2_KVS_Get(jobid, PMI2_ID_NULL, key, val, sizeof(val), &len))) {
|
||||
log_fatal("PMI2_KVS_Get %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (len != val_size) {
|
||||
log_fatal("%d: failure on rank %d, key #%d: len mismatch:"
|
||||
" %d instead of %d\n", rank, r, i, len, val_size);
|
||||
}
|
||||
|
||||
for (j = 0; j < val_size; j++) {
|
||||
if (val[j] != symb) {
|
||||
log_fatal("%d: failure on rank %d, key #%d: value mismatch"
|
||||
" at symb %d: \'%c\' instead of \'%c\'\n", rank,
|
||||
r, i, j, val[j], symb);
|
||||
}
|
||||
}
|
||||
symb++;
|
||||
if (symb > 'z') {
|
||||
symb = 'a';
|
||||
}
|
||||
}
|
||||
}
|
||||
fence_cnt++;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ int main(int argc, char **argv)
|
||||
return rc;
|
||||
}
|
||||
/* register the errhandler */
|
||||
PMIx_Register_errhandler(NULL, 0, errhandler);
|
||||
PMIx_Register_errhandler(NULL, 0, errhandler, errhandler_reg_callbk, NULL);
|
||||
|
||||
order[CLI_UNINIT] = CLI_FORKED;
|
||||
order[CLI_FORKED] = CLI_FIN;
|
||||
@ -171,7 +171,7 @@ int main(int argc, char **argv)
|
||||
pmix_argv_free(client_env);
|
||||
|
||||
/* deregister the errhandler */
|
||||
PMIx_Deregister_errhandler();
|
||||
PMIx_Deregister_errhandler(0, op_callbk, NULL);
|
||||
|
||||
cli_wait_all(1.0);
|
||||
|
||||
|
@ -48,6 +48,20 @@ static void notification_fn(pmix_status_t status,
|
||||
completed = true;
|
||||
}
|
||||
|
||||
static void op_callbk(pmix_status_t status,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_output(0, "CLIENT: OP CALLBACK CALLED WITH STATUS %d", status);
|
||||
}
|
||||
|
||||
static void errhandler_reg_callbk (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_output(0, "Client: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%d",
|
||||
status, errhandler_ref);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
@ -55,7 +69,7 @@ int main(int argc, char **argv)
|
||||
pmix_value_t *val = &value;
|
||||
pmix_proc_t proc;
|
||||
uint32_t nprocs;
|
||||
|
||||
|
||||
/* init us */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
|
||||
pmix_output(0, "Client ns %s rank %d: PMIx_Init failed: %d", myproc.nspace, myproc.rank, rc);
|
||||
@ -72,10 +86,10 @@ int main(int argc, char **argv)
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs);
|
||||
completed = false;
|
||||
|
||||
|
||||
/* register our errhandler */
|
||||
PMIx_Register_errhandler(NULL, 0, notification_fn);
|
||||
|
||||
PMIx_Register_errhandler(NULL, 0, notification_fn, errhandler_reg_callbk, NULL);
|
||||
|
||||
/* call fence to sync */
|
||||
PMIX_PROC_CONSTRUCT(&proc);
|
||||
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
|
||||
@ -84,7 +98,7 @@ int main(int argc, char **argv)
|
||||
pmix_output(0, "Client ns %s rank %d: PMIx_Fence failed: %d", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
/* rank=0 calls abort */
|
||||
if (0 == myproc.rank) {
|
||||
PMIx_Abort(PMIX_ERR_OUT_OF_RESOURCE, "Eat rocks",
|
||||
@ -102,8 +116,8 @@ int main(int argc, char **argv)
|
||||
done:
|
||||
/* finalize us */
|
||||
pmix_output(0, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank);
|
||||
PMIx_Deregister_errhandler();
|
||||
|
||||
PMIx_Deregister_errhandler(0, op_callbk, NULL);
|
||||
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
|
||||
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
} else {
|
||||
|
@ -153,6 +153,10 @@ static void errhandler(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_info_t info[], size_t ninfo);
|
||||
static void wait_signal_callback(int fd, short event, void *arg);
|
||||
static void op_callbk(pmix_status_t status, void *cbdata);
|
||||
static void errhandler_reg_callbk (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata);
|
||||
|
||||
static void opcbfunc(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
@ -192,7 +196,7 @@ int main(int argc, char **argv)
|
||||
return rc;
|
||||
}
|
||||
/* register the errhandler */
|
||||
PMIx_Register_errhandler(NULL, 0, errhandler);
|
||||
PMIx_Register_errhandler(NULL, 0, errhandler, errhandler_reg_callbk, NULL);
|
||||
|
||||
/* setup the pub data, in case it is used */
|
||||
PMIX_CONSTRUCT(&pubdata, pmix_list_t);
|
||||
@ -293,7 +297,7 @@ int main(int argc, char **argv)
|
||||
pmix_argv_free(client_env);
|
||||
|
||||
/* deregister the errhandler */
|
||||
PMIx_Deregister_errhandler();
|
||||
PMIx_Deregister_errhandler(0, op_callbk, NULL);
|
||||
|
||||
/* release any pub data */
|
||||
PMIX_LIST_DESTRUCT(&pubdata);
|
||||
@ -355,6 +359,20 @@ static void errhandler(pmix_status_t status,
|
||||
pmix_output(0, "SERVER: ERRHANDLER CALLED WITH STATUS %d", status);
|
||||
}
|
||||
|
||||
static void op_callbk(pmix_status_t status,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_output(0, "SERVER: OP CALLBACK CALLED WITH STATUS %d", status);
|
||||
}
|
||||
|
||||
static void errhandler_reg_callbk (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_output(0, "SERVER: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%d",
|
||||
status, errhandler_ref);
|
||||
}
|
||||
|
||||
static pmix_status_t connected(const pmix_proc_t *proc, void *server_object)
|
||||
{
|
||||
return PMIX_SUCCESS;
|
||||
@ -413,7 +431,7 @@ static int abort_fn(const pmix_proc_t *proc,
|
||||
x->cbfunc = cbfunc;
|
||||
x->cbdata = cbdata;
|
||||
|
||||
if (PMIX_SUCCESS != (rc = PMIx_server_notify_error(status, procs, nprocs,
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Notify_error(status, procs, nprocs,
|
||||
&x->caller, 1, x->info, 2,
|
||||
abcbfunc, x))) {
|
||||
pmix_output(0, "SERVER: FAILED NOTIFY ERROR %d", (int)rc);
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
static pmix_proc_t my_proc;
|
||||
static char *dbgvalue=NULL;
|
||||
static int errhdler_ref = 0;
|
||||
|
||||
static void myerr(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
@ -71,6 +72,16 @@ static void myerr(pmix_status_t status,
|
||||
OPAL_LIST_DESTRUCT(&ilist);
|
||||
}
|
||||
|
||||
static void errreg_cbfunc (pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
errhdler_ref = errhandler_ref;
|
||||
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
|
||||
"PMIX client errreg_cbfunc - error handler registered status=%d, reference=%d",
|
||||
status, errhandler_ref);
|
||||
}
|
||||
|
||||
int pmix1_client_init(void)
|
||||
{
|
||||
opal_process_name_t pname;
|
||||
@ -112,7 +123,7 @@ int pmix1_client_init(void)
|
||||
opal_proc_set_name(&pname);
|
||||
|
||||
/* register the errhandler */
|
||||
PMIx_Register_errhandler(NULL, 0, myerr);
|
||||
PMIx_Register_errhandler(NULL, 0, myerr, errreg_cbfunc, NULL );
|
||||
return OPAL_SUCCESS;
|
||||
|
||||
}
|
||||
@ -125,7 +136,7 @@ int pmix1_client_finalize(void)
|
||||
"PMIx_client finalize");
|
||||
|
||||
/* deregister the errhandler */
|
||||
PMIx_Deregister_errhandler();
|
||||
PMIx_Deregister_errhandler(errhdler_ref, NULL, NULL);
|
||||
|
||||
rc = PMIx_Finalize();
|
||||
|
||||
@ -711,7 +722,7 @@ static void lk_cbfunc(pmix_status_t status,
|
||||
{
|
||||
pmix1_opcaddy_t *op = (pmix1_opcaddy_t*)cbdata;
|
||||
opal_pmix_pdata_t *d;
|
||||
opal_list_t results, *r;
|
||||
opal_list_t results, *r = NULL;
|
||||
int rc;
|
||||
size_t n;
|
||||
opal_pmix1_jobid_trkr_t *job, *jptr;
|
||||
@ -764,10 +775,7 @@ static void lk_cbfunc(pmix_status_t status,
|
||||
}
|
||||
}
|
||||
r = &results;
|
||||
} else {
|
||||
r = NULL;
|
||||
}
|
||||
|
||||
release:
|
||||
/* execute the callback */
|
||||
op->lkcbfunc(rc, r, op->cbdata);
|
||||
|
@ -79,6 +79,8 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_register_events(const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_deregister_events(const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_listener_fn(int listening_sd,
|
||||
pmix_connection_cbfunc_t cbfunc);
|
||||
|
||||
@ -95,6 +97,7 @@ pmix_server_module_t mymodule = {
|
||||
server_connect_fn,
|
||||
server_disconnect_fn,
|
||||
server_register_events,
|
||||
server_deregister_events,
|
||||
server_listener_fn
|
||||
};
|
||||
|
||||
@ -758,6 +761,11 @@ static pmix_status_t server_register_events(const pmix_info_t info[], size_t nin
|
||||
return pmix1_convert_opalrc(rc);
|
||||
}
|
||||
|
||||
static pmix_status_t server_deregister_events(const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata)
|
||||
{
|
||||
return PMIX_ERR_NOT_IMPLEMENTED;
|
||||
}
|
||||
static pmix_status_t server_listener_fn(int listening_sd,
|
||||
pmix_connection_cbfunc_t cbfunc)
|
||||
{
|
||||
|
@ -47,6 +47,7 @@
|
||||
extern pmix_server_module_t mymodule;
|
||||
extern opal_pmix_server_module_t *host_module;
|
||||
static char *dbgvalue=NULL;
|
||||
static int errhdler_ref = 0;
|
||||
|
||||
static void myerr(pmix_status_t status,
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
@ -85,6 +86,16 @@ static void myerr(pmix_status_t status,
|
||||
OPAL_LIST_DESTRUCT(&ilist);
|
||||
}
|
||||
|
||||
static void errreg_cbfunc(pmix_status_t status,
|
||||
int errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
errhdler_ref = errhandler_ref;
|
||||
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
|
||||
"PMIX server errreg_cbfunc - error handler registered status=%d, reference=%d",
|
||||
status, errhandler_ref);
|
||||
}
|
||||
|
||||
int pmix1_server_init(opal_pmix_server_module_t *module)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
@ -102,7 +113,7 @@ int pmix1_server_init(opal_pmix_server_module_t *module)
|
||||
host_module = module;
|
||||
|
||||
/* register the errhandler */
|
||||
PMIx_Register_errhandler(NULL, 0, myerr);
|
||||
PMIx_Register_errhandler(NULL, 0, myerr, errreg_cbfunc, NULL);
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
@ -111,7 +122,7 @@ int pmix1_server_finalize(void)
|
||||
pmix_status_t rc;
|
||||
|
||||
/* deregister the errhandler */
|
||||
PMIx_Deregister_errhandler();
|
||||
PMIx_Deregister_errhandler(errhdler_ref, NULL, NULL);
|
||||
|
||||
rc = PMIx_server_finalize();
|
||||
return pmix1_convert_rc(rc);
|
||||
@ -354,7 +365,7 @@ int pmix1_server_notify_error(int status,
|
||||
op->cbdata = cbdata;
|
||||
|
||||
rc = pmix1_convert_opalrc(status);
|
||||
rc = PMIx_server_notify_error(rc, ps, psz, eps, esz,
|
||||
rc = PMIx_Notify_error(rc, ps, psz, eps, esz,
|
||||
pinfo, sz, opcbfunc, op);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
OBJ_RELEASE(op);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user