1
1

Merge pull request #1767 from rhc54/topic/pmix2

Enable the PMIx event notification capability
Этот коммит содержится в:
rhc54 2016-06-16 15:27:43 -07:00 коммит произвёл GitHub
родитель e135543cb0 5d330d5220
Коммит 702a982271
264 изменённых файлов: 11859 добавлений и 5939 удалений

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

@ -14,7 +14,7 @@
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -42,7 +42,7 @@ opal_pointer_array_t ompi_errhandler_f_to_c_table = {{0}};
/*
* default errhandler id
*/
static int default_errhandler_id = -1;
static size_t default_errhandler_id = SIZE_MAX;
/*
* Class information
@ -163,7 +163,7 @@ int ompi_errhandler_finalize(void)
/* JMS Add stuff here checking for unreleased errorhandlers,
similar to communicators, info handles, etc. */
opal_pmix.deregister_errhandler(default_errhandler_id, NULL, NULL);
opal_pmix.deregister_evhandler(default_errhandler_id, NULL, NULL);
/* Remove errhandler F2C table */
@ -222,7 +222,7 @@ ompi_errhandler_t *ompi_errhandler_create(ompi_errhandler_type_t object_type,
/* registration callback */
void ompi_errhandler_registration_callback(int status,
int errhandler_ref,
size_t errhandler_ref,
void *cbdata)
{
ompi_errhandler_errtrk_t *errtrk = (ompi_errhandler_errtrk_t*)cbdata;
@ -236,14 +236,15 @@ void ompi_errhandler_registration_callback(int status,
* Default errhandler callback
*/
void ompi_errhandler_callback(int status,
opal_list_t *procs,
opal_list_t *info,
opal_pmix_release_cbfunc_t cbfunc,
const opal_process_name_t *source,
opal_list_t *info, opal_list_t *results,
opal_pmix_notification_complete_fn_t cbfunc,
void *cbdata)
{
/* allow the caller to release its data */
/* tell the event chain engine to go no further - we
* will handle this */
if (NULL != cbfunc) {
cbfunc(cbdata);
cbfunc(OMPI_ERR_HANDLERS_COMPLETE, NULL, NULL, NULL, cbdata);
}
/* our default action is to abort */
ompi_mpi_abort(MPI_COMM_WORLD, status);

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

@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -380,13 +380,13 @@ typedef struct {
} ompi_errhandler_errtrk_t;
OMPI_DECLSPEC void ompi_errhandler_callback(int status,
opal_list_t *procs,
opal_list_t *info,
opal_pmix_release_cbfunc_t cbfunc,
const opal_process_name_t *source,
opal_list_t *info, opal_list_t *results,
opal_pmix_notification_complete_fn_t cbfunc,
void *cbdata);
OMPI_DECLSPEC void ompi_errhandler_registration_callback(int status,
int errhandler_ref,
size_t errhandler_ref,
void *cbdata);
/**
* Check to see if an errhandler is intrinsic.

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

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -63,6 +64,7 @@ enum {
OMPI_ERR_BUFFER = OPAL_ERR_BUFFER,
OMPI_ERR_SILENT = OPAL_ERR_SILENT,
OMPI_ERR_HANDLERS_COMPLETE = OPAL_ERR_HANDLERS_COMPLETE,
OMPI_ERR_REQUEST = OMPI_ERR_BASE - 1,
OMPI_ERR_RMA_SYNC = OMPI_ERR_BASE - 2,

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

@ -95,6 +95,34 @@ void ompi_rte_abort(int error_code, char *fmt, ...)
exit(-1);
}
static size_t handler = SIZE_MAX;
static bool debugger_register_active = true;
static bool debugger_event_active = true;
static void _release_fn(int status,
const opal_process_name_t *source,
opal_list_t *info, opal_list_t *results,
opal_pmix_notification_complete_fn_t cbfunc,
void *cbdata)
{
/* must let the notifier know we are done */
if (NULL != cbfunc) {
cbfunc(ORTE_SUCCESS, NULL, NULL, NULL, cbdata);
}
debugger_event_active = false;
}
static void _register_fn(int status,
size_t evhandler_ref,
void *cbdata)
{
opal_list_t *codes = (opal_list_t*)cbdata;
handler = evhandler_ref;
OPAL_LIST_RELEASE(codes);
debugger_register_active = false;
}
/*
* Wait for a debugger if asked. We support two ways of waiting for
* attaching debuggers -- see big comment in
@ -103,7 +131,8 @@ void ompi_rte_abort(int error_code, char *fmt, ...)
void ompi_rte_wait_for_debugger(void)
{
int debugger;
orte_rml_recv_cb_t xfer;
opal_list_t *codes;
opal_value_t *kv;
/* See lengthy comment in orte/tools/orterun/debuggers.c about
orte_in_parallel_debugger */
@ -133,23 +162,23 @@ void ompi_rte_wait_for_debugger(void)
#endif
}
} else {
/* only the rank=0 proc waits for either a message from the
* HNP or for the debugger to attach - everyone else will just
* spin in * the grpcomm barrier in ompi_mpi_init until rank=0
* joins them.
*/
if (0 != ORTE_PROC_MY_NAME->vpid) {
return;
}
/* VPID 0 waits for a message from the HNP */
OBJ_CONSTRUCT(&xfer, orte_rml_recv_cb_t);
xfer.active = true;
orte_rml.recv_buffer_nb(OMPI_NAME_WILDCARD,
ORTE_RML_TAG_DEBUGGER_RELEASE,
ORTE_RML_NON_PERSISTENT,
orte_rml_recv_callback, &xfer);
/* let the MPI progress engine run while we wait */
OMPI_WAIT_FOR_COMPLETION(xfer.active);
/* register an event handler for the ORTE_ERR_DEBUGGER_RELEASE event */
codes = OBJ_NEW(opal_list_t);
kv = OBJ_NEW(opal_value_t);
kv->key = strdup("errorcode");
kv->type = OPAL_INT;
kv->data.integer = ORTE_ERR_DEBUGGER_RELEASE;
opal_list_append(codes, &kv->super);
opal_pmix.register_evhandler(codes, NULL, _release_fn, _register_fn, codes);
/* let the MPI progress engine run while we wait for registration to complete */
OMPI_WAIT_FOR_COMPLETION(debugger_register_active);
/* let the MPI progress engine run while we wait for debugger release */
OMPI_WAIT_FOR_COMPLETION(debugger_event_active);
/* deregister the event handler */
opal_pmix.deregister_evhandler(handler, NULL, NULL);
}
}

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

@ -12,10 +12,10 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -94,13 +94,13 @@ int MPI_Lookup_name(const char *service_name, MPI_Info info, char *port_name)
rng = OBJ_NEW(opal_value_t);
rng->key = strdup(OPAL_PMIX_RANGE);
rng->type = OPAL_INT;
rng->data.integer = OPAL_PMIX_NAMESPACE; // share only with procs in same nspace
rng->data.integer = OPAL_PMIX_RANGE_NAMESPACE; // share only with procs in same nspace
opal_list_append(&pinfo, &rng->super);
} else if (0 == strcmp(range, "session")) {
rng = OBJ_NEW(opal_value_t);
rng->key = strdup(OPAL_PMIX_RANGE);
rng->type = OPAL_INT;
rng->data.integer = OPAL_PMIX_SESSION; // share only with procs in same session
rng->data.integer = OPAL_PMIX_RANGE_SESSION; // share only with procs in same session
opal_list_append(&pinfo, &rng->super);
} else {
/* unrecognized scope */

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

@ -12,10 +12,10 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -94,13 +94,13 @@ int MPI_Publish_name(const char *service_name, MPI_Info info,
rng = OBJ_NEW(opal_value_t);
rng->key = strdup(OPAL_PMIX_RANGE);
rng->type = OPAL_INT;
rng->data.integer = OPAL_PMIX_NAMESPACE; // share only with procs in same nspace
rng->data.integer = OPAL_PMIX_RANGE_NAMESPACE; // share only with procs in same nspace
opal_list_append(&values, &rng->super);
} else if (0 == strcmp(range, "session")) {
rng = OBJ_NEW(opal_value_t);
rng->key = strdup(OPAL_PMIX_RANGE);
rng->type = OPAL_INT;
rng->data.integer = OPAL_PMIX_SESSION; // share only with procs in same session
rng->data.integer = OPAL_PMIX_RANGE_SESSION; // share only with procs in same session
opal_list_append(&values, &rng->super);
} else {
/* unrecognized scope */

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

@ -12,10 +12,10 @@
* All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -96,13 +96,13 @@ int MPI_Unpublish_name(const char *service_name, MPI_Info info,
rng = OBJ_NEW(opal_value_t);
rng->key = strdup(OPAL_PMIX_RANGE);
rng->type = OPAL_INT;
rng->data.integer = OPAL_PMIX_NAMESPACE; // share only with procs in same nspace
rng->data.integer = OPAL_PMIX_RANGE_NAMESPACE; // share only with procs in same nspace
opal_list_append(&pinfo, &rng->super);
} else if (0 == strcmp(range, "session")) {
rng = OBJ_NEW(opal_value_t);
rng->key = strdup(OPAL_PMIX_RANGE);
rng->type = OPAL_INT;
rng->data.integer = OPAL_PMIX_SESSION; // share only with procs in same session
rng->data.integer = OPAL_PMIX_RANGE_SESSION; // share only with procs in same session
opal_list_append(&pinfo, &rng->super);
} else {
/* unrecognized scope */

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

@ -380,6 +380,8 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
char *cmd=NULL, *av=NULL;
ompi_errhandler_errtrk_t errtrk;
volatile bool active;
opal_list_t info;
opal_value_t *kv;
OPAL_TIMING_DECLARE(tm);
OPAL_TIMING_INIT_EXT(&tm, OPAL_TIMING_GET_TIME_OF_DAY);
@ -522,10 +524,16 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
/* Register the default errhandler callback */
errtrk.status = OPAL_ERROR;
errtrk.active = true;
opal_pmix.register_errhandler(NULL, ompi_errhandler_callback,
ompi_errhandler_registration_callback,
(void*)&errtrk);
/* we want to go first */
OBJ_CONSTRUCT(&info, opal_list_t);
kv = OBJ_NEW(opal_value_t);
kv->key = strdup(OPAL_PMIX_EVENT_ORDER_PREPEND);
opal_list_append(&info, &kv->super);
opal_pmix.register_evhandler(NULL, &info, ompi_errhandler_callback,
ompi_errhandler_registration_callback,
(void*)&errtrk);
OMPI_WAIT_FOR_COMPLETION(errtrk.active);
OPAL_LIST_DESTRUCT(&info);
if (OPAL_SUCCESS != errtrk.status) {
error = "Error handler registration";
ret = errtrk.status;

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

@ -10,7 +10,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -76,7 +76,6 @@ nobase_opal_HEADERS = $(headers)
endif
include class/Makefile.am
include errhandler/Makefile.am
include memoryhooks/Makefile.am
include runtime/Makefile.am
include threads/Makefile.am

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

@ -1,17 +0,0 @@
# -*- makefile -*-
#
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This makefile.am does not stand on its own - it is included from opal/Makefile.am
headers += \
errhandler/opal_errhandler.h
lib@OPAL_LIB_PREFIX@open_pal_la_SOURCES += \
errhandler/opal_errhandler.c

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

@ -1,34 +0,0 @@
/*
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/errhandler/opal_errhandler.h"
opal_errhandler_fn_t errhandler = NULL;
void *cbdata = NULL;
void opal_register_errhandler(opal_errhandler_fn_t newerr, void *cbd)
{
errhandler = newerr;
cbdata = cbd;
}
void opal_deregister_errhandler(void)
{
errhandler = NULL;
cbdata = NULL;
}
void opal_invoke_errhandler(int status, opal_proc_t *proc)
{
if (NULL != errhandler) {
errhandler(status, proc, cbdata);
}
}

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

@ -1,25 +0,0 @@
/*
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OPAL_ERRHANDLER_H
#define OPAL_ERRHANDLER_H
#include "opal_config.h"
#include "opal/util/proc.h"
typedef void (*opal_errhandler_fn_t)(int status, opal_proc_t *proc, void *cbdata);
OPAL_DECLSPEC void opal_register_errhandler(opal_errhandler_fn_t errhandler, void *cbdata);
OPAL_DECLSPEC void opal_deregister_errhandler(void);
OPAL_DECLSPEC void opal_invoke_errhandler(int status, opal_proc_t *proc);
#endif

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

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -81,7 +81,8 @@ enum {
OPAL_ERR_COMM_FAILURE = (OPAL_ERR_BASE - 51),
OPAL_ERR_SERVER_NOT_AVAIL = (OPAL_ERR_BASE - 52),
OPAL_ERR_IN_PROCESS = (OPAL_ERR_BASE - 53),
OPAL_ERR_DEBUGGER_RELEASE = (OPAL_ERR_BASE - 54)
OPAL_ERR_DEBUGGER_RELEASE = (OPAL_ERR_BASE - 54),
OPAL_ERR_HANDLERS_COMPLETE = (OPAL_ERR_BASE - 55)
};
#define OPAL_ERR_MAX (OPAL_ERR_BASE - 100)

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

@ -32,17 +32,23 @@ OPAL_DECLSPEC int opal_pmix_base_select(void);
OPAL_DECLSPEC extern bool opal_pmix_base_allow_delayed_server;
OPAL_DECLSPEC void opal_pmix_base_register_handler(opal_list_t *info,
opal_pmix_notification_fn_t errhandler,
opal_pmix_errhandler_reg_cbfunc_t cbfunc,
OPAL_DECLSPEC void opal_pmix_base_register_handler(opal_list_t *event_codes,
opal_list_t *info,
opal_pmix_notification_fn_t evhandler,
opal_pmix_evhandler_reg_cbfunc_t cbfunc,
void *cbdata);
OPAL_DECLSPEC void opal_pmix_base_deregister_handler(int errhandler,
OPAL_DECLSPEC void opal_pmix_base_deregister_handler(size_t errhandler,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_DECLSPEC void opal_pmix_base_errhandler(int status,
opal_list_t *procs,
opal_list_t *info,
opal_pmix_release_cbfunc_t cbfunc, void *cbdata);
OPAL_DECLSPEC int opal_pmix_base_notify_event(int status,
const opal_process_name_t *source,
opal_pmix_data_range_t range,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_DECLSPEC void opal_pmix_base_evhandler(int status,
const opal_process_name_t *source,
opal_list_t *info, opal_list_t *results,
opal_pmix_notification_complete_fn_t cbfunc, void *cbdata);
OPAL_DECLSPEC int opal_pmix_base_exchange(opal_value_t *info,
opal_pmix_pdata_t *pdat,
int timeout);

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

@ -46,39 +46,49 @@ void opal_pmix_base_set_evbase(opal_event_base_t *evbase)
/******** ERRHANDLER SUPPORT FOR COMPONENTS THAT
******** DO NOT NATIVELY SUPPORT IT
********/
static opal_pmix_notification_fn_t errhandler = NULL;
static opal_pmix_notification_fn_t evhandler = NULL;
void opal_pmix_base_register_handler(opal_list_t *info,
void opal_pmix_base_register_handler(opal_list_t *event_codes,
opal_list_t *info,
opal_pmix_notification_fn_t err,
opal_pmix_errhandler_reg_cbfunc_t cbfunc,
opal_pmix_evhandler_reg_cbfunc_t cbfunc,
void *cbdata)
{
errhandler = err;
evhandler = err;
if (NULL != cbfunc) {
cbfunc(OPAL_SUCCESS, 0, cbdata);
}
}
void opal_pmix_base_errhandler(int status,
opal_list_t *procs,
opal_list_t *info,
opal_pmix_release_cbfunc_t cbfunc, void *cbdata)
void opal_pmix_base_evhandler(int status,
const opal_process_name_t *source,
opal_list_t *info, opal_list_t *results,
opal_pmix_notification_complete_fn_t cbfunc, void *cbdata)
{
if (NULL != errhandler) {
errhandler(status, procs, info, cbfunc, cbdata);
if (NULL != evhandler) {
evhandler(status, source, info, results, cbfunc, cbdata);
}
}
void opal_pmix_base_deregister_handler(int errid,
void opal_pmix_base_deregister_handler(size_t errid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
errhandler = NULL;
evhandler = NULL;
if (NULL != cbfunc) {
cbfunc(OPAL_SUCCESS, cbdata);
}
}
int opal_pmix_base_notify_event(int status,
const opal_process_name_t *source,
opal_pmix_data_range_t range,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{
return OPAL_SUCCESS;
}
struct lookup_caddy_t {
volatile bool active;
int status;

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

@ -110,8 +110,8 @@ const opal_pmix_base_module_t opal_pmix_cray_module = {
.resolve_peers = cray_resolve_peers,
.resolve_nodes = cray_resolve_nodes,
.get_version = cray_get_version,
.register_errhandler = opal_pmix_base_register_handler,
.deregister_errhandler = opal_pmix_base_deregister_handler,
.register_evhandler = opal_pmix_base_register_handler,
.deregister_evhandler = opal_pmix_base_deregister_handler,
.store_local = cray_store_local,
.get_nspace = cray_get_nspace,
.register_jobid = cray_register_jobid

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

@ -85,11 +85,11 @@ const opal_pmix_base_module_t opal_pmix_ext114_module = {
.server_deregister_client = pmix1_server_deregister_client,
.server_setup_fork = pmix1_server_setup_fork,
.server_dmodex_request = pmix1_server_dmodex,
.server_notify_error = pmix1_server_notify_error,
.server_notify_event = pmix1_server_notify_error,
/* utility APIs */
.get_version = PMIx_Get_version,
.register_errhandler = opal_pmix_base_register_handler,
.deregister_errhandler = opal_pmix_base_deregister_handler,
.register_evhandler = opal_pmix_base_register_handler,
.deregister_evhandler = opal_pmix_base_deregister_handler,
.store_local = pmix1_store_local,
.get_nspace = pmix1_get_nspace,
.register_jobid = pmix1_register_jobid

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

@ -145,19 +145,22 @@ OPAL_MODULE_DECLSPEC int pmix1_server_register_nspace(opal_jobid_t jobid,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC void pmix1_server_deregister_nspace(opal_jobid_t jobid);
OPAL_MODULE_DECLSPEC void pmix1_server_deregister_nspace(opal_jobid_t jobid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_server_register_client(const opal_process_name_t *proc,
uid_t uid, gid_t gid,
void *server_object,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC void pmix1_server_deregister_client(const opal_process_name_t *proc);
OPAL_MODULE_DECLSPEC void pmix1_server_deregister_client(const opal_process_name_t *proc,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env);
OPAL_MODULE_DECLSPEC int pmix1_server_dmodex(const opal_process_name_t *proc,
opal_pmix_modex_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_server_notify_error(int status,
opal_list_t *procs,
opal_list_t *error_procs,
const opal_process_name_t *source,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);

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

@ -43,8 +43,10 @@ static int errhdler_ref = 0;
} while (0)
static void completion_handler (void * cbdata) {
int * cond = (int *)cbdata;
static void completion_handler(int status, opal_list_t *results,
opal_pmix_op_cbfunc_t cbfunc, void *thiscbdata,
void *notification_cbdata) {
int * cond = (int *)notification_cbdata;
*cond = 0;
}
@ -81,7 +83,7 @@ static void myerr(pmix_status_t status,
}
/* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
opal_pmix_base_evhandler(rc, &OPAL_PROC_MY_NAME, &plist, &ilist, completion_handler, (void *)&cond);
PMIX_WAIT_FOR_COMPLETION(cond);
OPAL_LIST_DESTRUCT(&plist);

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

@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
@ -44,7 +44,7 @@
/* These are the interfaces used by the embedded PMIx server
* to call up into ORTE for service requests */
static pmix_status_t server_client_connected_fn(const pmix_proc_t *proc, void* server_object);
static pmix_status_t server_client_connected_fn(const pmix_proc_t *proc, void* server_object);
static pmix_status_t server_client_finalized_fn(const pmix_proc_t *proc, void* server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t server_abort_fn(const pmix_proc_t *proc, void *server_object,
@ -85,20 +85,20 @@ static pmix_status_t server_listener_fn(int listening_sd,
pmix_connection_cbfunc_t cbfunc);
pmix_server_module_t mymodule = {
server_client_connected_fn,
server_client_finalized_fn,
server_abort_fn,
server_fencenb_fn,
server_dmodex_req_fn,
server_publish_fn,
server_lookup_fn,
server_unpublish_fn,
server_spawn_fn,
server_connect_fn,
server_disconnect_fn,
server_register_events,
server_deregister_events,
server_listener_fn
.client_connected = server_client_connected_fn,
.client_finalized = server_client_finalized_fn,
.abort = server_abort_fn,
.fence_nb = server_fencenb_fn,
.direct_modex = server_dmodex_req_fn,
.publish = server_publish_fn,
.lookup = server_lookup_fn,
.unpublish = server_unpublish_fn,
.spawn = server_spawn_fn,
.connect = server_connect_fn,
.disconnect = server_disconnect_fn,
.register_events = server_register_events,
.deregister_events = server_deregister_events,
.listener = server_listener_fn
};
opal_pmix_server_module_t *host_module = NULL;
@ -130,7 +130,8 @@ static pmix_status_t server_client_connected_fn(const pmix_proc_t *p, void *serv
proc.vpid = p->rank;
/* pass it up */
rc = host_module->client_connected(&proc, server_object);
rc = host_module->client_connected(&proc, server_object,
NULL, NULL);
return pmix1_convert_opalrc(rc);
}

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

@ -50,8 +50,10 @@ extern opal_pmix_server_module_t *host_module;
static char *dbgvalue=NULL;
static int errhdler_ref = 0;
static void completion_handler (void * cbdata) {
int * cond = (int *)cbdata;
static void completion_handler(int status, opal_list_t *results,
opal_pmix_op_cbfunc_t cbfunc, void *thiscbdata,
void *notification_cbdata) {
int * cond = (int *)notification_cbdata;
*cond = 0;
}
@ -95,7 +97,7 @@ static void myerr(pmix_status_t status,
}
/* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
opal_pmix_base_evhandler(rc, &OPAL_PROC_MY_NAME, &plist, &ilist, completion_handler, (void *)&cond);
PMIX_WAIT_FOR_COMPLETION(cond);
OPAL_LIST_DESTRUCT(&plist);
@ -263,7 +265,9 @@ int pmix1_server_register_nspace(opal_jobid_t jobid,
return pmix1_convert_rc(rc);
}
void pmix1_server_deregister_nspace(opal_jobid_t jobid)
void pmix1_server_deregister_nspace(opal_jobid_t jobid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
opal_pmix1_jobid_trkr_t *jptr;
@ -306,7 +310,9 @@ int pmix1_server_register_client(const opal_process_name_t *proc,
return pmix1_convert_rc(rc);
}
void pmix1_server_deregister_client(const opal_process_name_t *proc)
void pmix1_server_deregister_client(const opal_process_name_t *proc,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
opal_pmix1_jobid_trkr_t *jptr;
pmix_proc_t p;
@ -376,46 +382,20 @@ int pmix1_server_dmodex(const opal_process_name_t *proc,
}
int pmix1_server_notify_error(int status,
opal_list_t *procs,
opal_list_t *error_procs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
const opal_process_name_t *source,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{
opal_value_t *kv;
pmix_info_t *pinfo;
size_t sz, psz, esz, n;
pmix_proc_t *ps, *eps;
size_t sz, n;
pmix_status_t rc;
pmix1_opcaddy_t *op;
opal_namelist_t *nm;
/* convert the list of procs */
if (NULL != procs) {
psz = opal_list_get_size(procs);
PMIX_PROC_CREATE(ps, psz);
n = 0;
OPAL_LIST_FOREACH(nm, procs, opal_namelist_t) {
(void)opal_snprintf_jobid(ps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
ps[n].rank = (int)nm->name.vpid;
++n;
}
} else {
psz = 0;
ps = NULL;
}
if (NULL != error_procs) {
esz = opal_list_get_size(error_procs);
PMIX_PROC_CREATE(eps, esz);
n = 0;
OPAL_LIST_FOREACH(nm, error_procs, opal_namelist_t) {
(void)opal_snprintf_jobid(eps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
eps[n].rank = (int)nm->name.vpid;
++n;
}
} else {
esz = 0;
eps = NULL;
}
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
/* convert the list to an array of pmix_info_t */
if (NULL != info) {
@ -430,21 +410,12 @@ int pmix1_server_notify_error(int status,
sz = 0;
pinfo = NULL;
}
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op->procs = ps;
op->nprocs = psz;
op->error_procs = eps;
op->nerror_procs = esz;
op->info = pinfo;
op->sz = sz;
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
rc = pmix1_convert_opalrc(status);
rc = PMIx_Notify_error(rc, ps, psz, eps, esz,
pinfo, sz, opcbfunc, op);
rc = PMIx_Notify_error(rc, NULL, 0, NULL, 0,
pinfo, sz, opcbfunc, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}

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

@ -45,61 +45,75 @@
/* These are functions used by both client and server to
* access common functions in the embedded PMIx library */
static const char *pmix1_get_nspace(opal_jobid_t jobid);
static void pmix1_register_jobid(opal_jobid_t jobid, const char *nspace);
static const char *pmix20_get_nspace(opal_jobid_t jobid);
static void pmix20_register_jobid(opal_jobid_t jobid, const char *nspace);
static void register_handler(opal_list_t *event_codes,
opal_list_t *info,
opal_pmix_notification_fn_t evhandler,
opal_pmix_evhandler_reg_cbfunc_t cbfunc,
void *cbdata);
static void deregister_handler(size_t evhandler,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
static int notify_event(int status,
const opal_process_name_t *source,
opal_pmix_data_range_t range,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
const opal_pmix_base_module_t opal_pmix_ext20_module = {
/* client APIs */
.init = pmix1_client_init,
.finalize = pmix1_client_finalize,
.initialized = pmix1_initialized,
.abort = pmix1_abort,
.commit = pmix1_commit,
.fence = pmix1_fence,
.fence_nb = pmix1_fencenb,
.put = pmix1_put,
.get = pmix1_get,
.get_nb = pmix1_getnb,
.publish = pmix1_publish,
.publish_nb = pmix1_publishnb,
.lookup = pmix1_lookup,
.lookup_nb = pmix1_lookupnb,
.unpublish = pmix1_unpublish,
.unpublish_nb = pmix1_unpublishnb,
.spawn = pmix1_spawn,
.spawn_nb = pmix1_spawnnb,
.connect = pmix1_connect,
.connect_nb = pmix1_connectnb,
.disconnect = pmix1_disconnect,
.disconnect_nb = pmix1_disconnectnb,
.resolve_peers = pmix1_resolve_peers,
.resolve_nodes = pmix1_resolve_nodes,
.init = pmix20_client_init,
.finalize = pmix20_client_finalize,
.initialized = pmix20_initialized,
.abort = pmix20_abort,
.commit = pmix20_commit,
.fence = pmix20_fence,
.fence_nb = pmix20_fencenb,
.put = pmix20_put,
.get = pmix20_get,
.get_nb = pmix20_getnb,
.publish = pmix20_publish,
.publish_nb = pmix20_publishnb,
.lookup = pmix20_lookup,
.lookup_nb = pmix20_lookupnb,
.unpublish = pmix20_unpublish,
.unpublish_nb = pmix20_unpublishnb,
.spawn = pmix20_spawn,
.spawn_nb = pmix20_spawnnb,
.connect = pmix20_connect,
.connect_nb = pmix20_connectnb,
.disconnect = pmix20_disconnect,
.disconnect_nb = pmix20_disconnectnb,
.resolve_peers = pmix20_resolve_peers,
.resolve_nodes = pmix20_resolve_nodes,
/* server APIs */
.server_init = pmix1_server_init,
.server_finalize = pmix1_server_finalize,
.generate_regex = pmix1_server_gen_regex,
.generate_ppn = pmix1_server_gen_ppn,
.server_register_nspace = pmix1_server_register_nspace,
.server_deregister_nspace = pmix1_server_deregister_nspace,
.server_register_client = pmix1_server_register_client,
.server_deregister_client = pmix1_server_deregister_client,
.server_setup_fork = pmix1_server_setup_fork,
.server_dmodex_request = pmix1_server_dmodex,
.server_notify_error = pmix1_server_notify_error,
.server_init = pmix20_server_init,
.server_finalize = pmix20_server_finalize,
.generate_regex = pmix20_server_gen_regex,
.generate_ppn = pmix20_server_gen_ppn,
.server_register_nspace = pmix20_server_register_nspace,
.server_deregister_nspace = pmix20_server_deregister_nspace,
.server_register_client = pmix20_server_register_client,
.server_deregister_client = pmix20_server_deregister_client,
.server_setup_fork = pmix20_server_setup_fork,
.server_dmodex_request = pmix20_server_dmodex,
.server_notify_event = pmix20_server_notify_event,
/* utility APIs */
.get_version = PMIx_Get_version,
.register_errhandler = opal_pmix_base_register_handler,
.deregister_errhandler = opal_pmix_base_deregister_handler,
.store_local = pmix1_store_local,
.get_nspace = pmix1_get_nspace,
.register_jobid = pmix1_register_jobid
.register_evhandler = register_handler,
.deregister_evhandler = deregister_handler,
.notify_event = notify_event,
.store_local = pmix20_store_local,
.get_nspace = pmix20_get_nspace,
.register_jobid = pmix20_register_jobid
};
static const char *pmix1_get_nspace(opal_jobid_t jobid)
static const char *pmix20_get_nspace(opal_jobid_t jobid)
{
opal_pmix1_jobid_trkr_t *jptr;
opal_pmix20_jobid_trkr_t *jptr;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == jobid) {
return jptr->nspace;
}
@ -107,25 +121,302 @@ static const char *pmix1_get_nspace(opal_jobid_t jobid)
return NULL;
}
static void pmix1_register_jobid(opal_jobid_t jobid, const char *nspace)
static void pmix20_register_jobid(opal_jobid_t jobid, const char *nspace)
{
opal_pmix1_jobid_trkr_t *jptr;
opal_pmix20_jobid_trkr_t *jptr;
/* if we don't already have it, add this to our jobid tracker */
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == jobid) {
return;
}
}
jptr = OBJ_NEW(opal_pmix1_jobid_trkr_t);
jptr = OBJ_NEW(opal_pmix20_jobid_trkr_t);
(void)strncpy(jptr->nspace, nspace, PMIX_MAX_NSLEN);
jptr->jobid = jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &jptr->super);
}
pmix_status_t pmix1_convert_opalrc(int rc)
static void completion_handler(int status, void *cbdata)
{
opal_pmix20_event_chain_t *chain = (opal_pmix20_event_chain_t*)cbdata;
if (NULL != chain->info) {
OPAL_LIST_RELEASE(chain->info);
}
}
static void progress_local_event_hdlr(int status,
opal_list_t *results,
opal_pmix_op_cbfunc_t cbfunc, void *thiscbdata,
void *notification_cbdata)
{
opal_pmix20_event_chain_t *chain = (opal_pmix20_event_chain_t*)notification_cbdata;
size_t n;
opal_list_item_t *nxt;
opal_pmix20_single_event_t *sing;
opal_pmix20_multi_event_t *multi;
opal_pmix20_default_event_t *def;
/* if any results were provided, then add them here */
if (NULL != results) {
while (NULL != (nxt = opal_list_remove_first(results))) {
opal_list_append(results, nxt);
}
}
/* if the caller indicates that the chain is completed, then stop here */
if (OPAL_ERR_HANDLERS_COMPLETE == status) {
goto complete;
}
/* see if we need to continue, starting with the single code events */
if (NULL != chain->sing) {
/* the last handler was for a single code - see if there are
* any others that match this event */
while (opal_list_get_end(&mca_pmix_ext20_component.single_events) != (nxt = opal_list_get_next(&chain->sing->super))) {
sing = (opal_pmix20_single_event_t*)nxt;
if (sing->code == chain->status) {
OBJ_RETAIN(chain);
chain->sing = sing;
sing->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
goto complete;
}
}
/* if we get here, then there are no more single code
* events that match */
chain->sing = NULL;
/* pickup the beginning of the multi-code event list */
if (0 < opal_list_get_size(&mca_pmix_ext20_component.multi_events)) {
chain->multi = (opal_pmix20_multi_event_t*)opal_list_get_begin(&mca_pmix_ext20_component.multi_events);
}
}
/* see if we need to continue with the multi code events */
if (NULL != chain->multi) {
while (opal_list_get_end(&mca_pmix_ext20_component.multi_events) != (nxt = opal_list_get_next(&chain->multi->super))) {
multi = (opal_pmix20_multi_event_t*)nxt;
for (n=0; n < multi->ncodes; n++) {
if (multi->codes[n] == chain->status) {
/* found it - invoke the handler, pointing its
* callback function to our progression function */
OBJ_RETAIN(chain);
chain->multi = multi;
multi->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
goto complete;
}
}
}
/* if we get here, then there are no more multi-mode
* events that match */
chain->multi = NULL;
/* pickup the beginning of the default event list */
if (0 < opal_list_get_size(&mca_pmix_ext20_component.default_events)) {
chain->def = (opal_pmix20_default_event_t*)opal_list_get_begin(&mca_pmix_ext20_component.default_events);
}
}
/* if they didn't want it to go to a default handler, then we are done */
if (chain->nondefault) {
goto complete;
}
if (NULL != chain->def) {
if (opal_list_get_end(&mca_pmix_ext20_component.default_events) != (nxt = opal_list_get_next(&chain->def->super))) {
def = (opal_pmix20_default_event_t*)nxt;
OBJ_RETAIN(chain);
chain->def = def;
def->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
}
}
complete:
/* we still have to call their final callback */
if (NULL != chain->final_cbfunc) {
chain->final_cbfunc(OPAL_SUCCESS, chain->final_cbdata);
}
/* maintain acctng */
OBJ_RELEASE(chain);
/* let the caller know that we are done with their callback */
if (NULL != cbfunc) {
cbfunc(OPAL_SUCCESS, thiscbdata);
}
}
static void _event_hdlr(int sd, short args, void *cbdata)
{
pmix20_threadshift_t *cd = (pmix20_threadshift_t*)cbdata;
size_t n;
opal_pmix20_event_chain_t *chain;
opal_pmix20_single_event_t *sing;
opal_pmix20_multi_event_t *multi;
opal_pmix20_default_event_t *def;
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s RECEIVED NOTIFICATION OF STATUS %d",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), cd->status);
chain = OBJ_NEW(opal_pmix20_event_chain_t);
/* point it at our final callback */
chain->final_cbfunc = completion_handler;
chain->final_cbdata = chain;
/* carry across provided info */
chain->status = cd->status;
chain->source = cd->pname;
chain->info = cd->info;
chain->nondefault = cd->nondefault;
/* cycle thru the single-event registrations first */
OPAL_LIST_FOREACH(sing, &mca_pmix_ext20_component.single_events, opal_pmix20_single_event_t) {
if (sing->code == chain->status) {
/* found it - invoke the handler, pointing its
* callback function to our progression function */
OBJ_RETAIN(chain);
chain->sing = sing;
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s CALLING SINGLE EVHDLR",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME));
sing->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
return;
}
}
/* if we didn't find any match in the single-event registrations,
* then cycle thru the multi-event registrations next */
OPAL_LIST_FOREACH(multi, &mca_pmix_ext20_component.multi_events, opal_pmix20_multi_event_t) {
for (n=0; n < multi->ncodes; n++) {
if (multi->codes[n] == chain->status) {
/* found it - invoke the handler, pointing its
* callback function to our progression function */
OBJ_RETAIN(chain);
chain->multi = multi;
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s CALLING MULTI EVHDLR",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME));
multi->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
return;
}
}
}
/* if they didn't want it to go to a default handler, then we are done */
if (chain->nondefault) {
/* if we get here, then we need to cache this event in case they
* register for it later - we cannot lose individual events */
opal_list_append(&mca_pmix_ext20_component.cache, &chain->super);
return;
}
/* we are done with the threadshift caddy */
OBJ_RELEASE(cd);
/* finally, pass it to any default handlers */
if (0 < opal_list_get_size(&mca_pmix_ext20_component.default_events)) {
def = (opal_pmix20_default_event_t*)opal_list_get_first(&mca_pmix_ext20_component.default_events);
OBJ_RETAIN(chain);
chain->def = def;
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s CALLING DEFAULT EVHDLR",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME));
def->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
return;
}
/* we still have to call their final callback */
if (NULL != chain->final_cbfunc) {
chain->final_cbfunc(PMIX_SUCCESS, chain->final_cbdata);
}
return;
}
/* this function will be called by the PMIx client library
* whenever it receives notification of an event. The
* notification can come from an ORTE daemon (when launched
* by mpirun), directly from a RM (when direct launched), or
* from another process (via the local daemon).
* The call will occur in the PMIx event base */
void pmix20_event_hdlr(size_t evhdlr_registration_id,
pmix_status_t status, const pmix_proc_t *source,
pmix_info_t info[], size_t ninfo,
pmix_event_notification_cbfunc_fn_t cbfunc,
void *cbdata)
{
pmix20_threadshift_t *cd;
int rc;
opal_value_t *iptr;
size_t n;
/* this is in the PMIx local thread - need to threadshift to
* our own thread as we will be accessing framework-global
* lists and objects */
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s RECEIVED NOTIFICATION OF STATUS %d",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), status);
cd = OBJ_NEW(pmix20_threadshift_t);
/* convert the incoming status */
cd->status = pmix20_convert_rc(status);
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s CONVERTED STATUS %d TO STATUS %d",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), status, cd->status);
/* convert the nspace/rank to an opal_process_name_t */
if (NULL == source) {
cd->pname.jobid = OPAL_NAME_INVALID->jobid;
cd->pname.vpid = OPAL_NAME_INVALID->vpid;
} else {
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&cd->pname.jobid, source->nspace))) {
OPAL_ERROR_LOG(rc);
OBJ_RELEASE(cd);
return;
}
cd->pname.vpid = source->rank;
}
/* convert the array of info */
if (NULL != info) {
cd->info = OBJ_NEW(opal_list_t);
for (n=0; n < ninfo; n++) {
if (0 == strncmp(info[n].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) {
cd->nondefault = true;
}
iptr = OBJ_NEW(opal_value_t);
iptr->key = strdup(info[n].key);
pmix20_value_unload(iptr, &info[n].value);
opal_list_append(cd->info, &iptr->super);
}
}
/* now push it into the local thread */
event_assign(&cd->ev, opal_pmix_base.evbase,
-1, EV_WRITE, _event_hdlr, cd);
event_active(&cd->ev, EV_WRITE, 1);
/* we don't need any of the data they provided,
* so let them go */
if (NULL != cbfunc) {
cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata);
}
}
pmix_status_t pmix20_convert_opalrc(int rc)
{
switch (rc) {
case OPAL_ERR_DEBUGGER_RELEASE:
return PMIX_ERR_DEBUGGER_RELEASE;
case OPAL_ERR_NOT_IMPLEMENTED:
case OPAL_ERR_NOT_SUPPORTED:
return PMIX_ERR_NOT_SUPPORTED;
@ -165,9 +456,12 @@ pmix_status_t pmix1_convert_opalrc(int rc)
}
}
int pmix1_convert_rc(pmix_status_t rc)
int pmix20_convert_rc(pmix_status_t rc)
{
switch (rc) {
case PMIX_ERR_DEBUGGER_RELEASE:
return OPAL_ERR_DEBUGGER_RELEASE;
case PMIX_ERR_NOT_SUPPORTED:
return OPAL_ERR_NOT_SUPPORTED;
@ -210,7 +504,7 @@ int pmix1_convert_rc(pmix_status_t rc)
}
}
pmix_scope_t pmix1_convert_opalscope(opal_pmix_scope_t scope) {
pmix_scope_t pmix20_convert_opalscope(opal_pmix_scope_t scope) {
switch(scope) {
case OPAL_PMIX_LOCAL:
return PMIX_LOCAL;
@ -223,13 +517,51 @@ pmix_scope_t pmix1_convert_opalscope(opal_pmix_scope_t scope) {
}
}
void pmix1_value_load(pmix_value_t *v,
opal_value_t *kv)
pmix_data_range_t pmix20_convert_opalrange(opal_pmix_data_range_t range) {
switch(range) {
case OPAL_PMIX_RANGE_UNDEF:
return PMIX_RANGE_UNDEF;
case OPAL_PMIX_RANGE_LOCAL:
return PMIX_RANGE_LOCAL;
case OPAL_PMIX_RANGE_NAMESPACE:
return PMIX_RANGE_NAMESPACE;
case OPAL_PMIX_RANGE_SESSION:
return PMIX_RANGE_SESSION;
case OPAL_PMIX_RANGE_GLOBAL:
return PMIX_RANGE_GLOBAL;
case OPAL_PMIX_RANGE_CUSTOM:
return PMIX_RANGE_CUSTOM;
default:
return PMIX_SCOPE_UNDEF;
}
}
opal_pmix_data_range_t pmix20_convert_range(pmix_data_range_t range) {
switch(range) {
case PMIX_RANGE_UNDEF:
return OPAL_PMIX_RANGE_UNDEF;
case PMIX_RANGE_LOCAL:
return OPAL_PMIX_RANGE_LOCAL;
case PMIX_RANGE_NAMESPACE:
return OPAL_PMIX_RANGE_NAMESPACE;
case PMIX_RANGE_SESSION:
return OPAL_PMIX_RANGE_SESSION;
case PMIX_RANGE_GLOBAL:
return OPAL_PMIX_RANGE_GLOBAL;
case PMIX_RANGE_CUSTOM:
return OPAL_PMIX_RANGE_CUSTOM;
default:
return OPAL_PMIX_SCOPE_UNDEF;
}
}
void pmix20_value_load(pmix_value_t *v,
opal_value_t *kv)
{
switch(kv->type) {
case OPAL_UNDEF:
v->type = PMIX_UNDEF;
opal_output(0, "TYPE WAS UNDEF");
break;
case OPAL_BOOL:
v->type = PMIX_BOOL;
@ -324,7 +656,7 @@ void pmix1_value_load(pmix_value_t *v,
}
}
int pmix1_value_unload(opal_value_t *kv,
int pmix20_value_unload(opal_value_t *kv,
const pmix_value_t *v)
{
int rc=OPAL_SUCCESS;
@ -427,13 +759,341 @@ int pmix1_value_unload(opal_value_t *kv,
return rc;
}
static void _reg_hdlr(int sd, short args, void *cbdata)
{
pmix20_threadshift_t *cd = (pmix20_threadshift_t*)cbdata;
opal_pmix20_event_chain_t *chain;
opal_pmix20_single_event_t *sing = NULL;
opal_pmix20_multi_event_t *multi = NULL;
opal_pmix20_default_event_t *def = NULL;
opal_value_t *kv;
int i;
bool prepend = false;
size_t n;
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s REGISTER HANDLER CODES %s",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME),
(NULL == cd->event_codes) ? "NULL" : "NON-NULL");
if (NULL != cd->info) {
OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) {
if (0 == strcmp(kv->key, OPAL_PMIX_EVENT_ORDER_PREPEND)) {
prepend = true;
break;
}
}
}
if (NULL == cd->event_codes) {
/* this is a default handler */
def = OBJ_NEW(opal_pmix20_default_event_t);
def->handler = cd->evhandler;
def->index = mca_pmix_ext20_component.evindex;
if (prepend) {
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s PREPENDING TO DEFAULT EVENTS",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME));
opal_list_prepend(&mca_pmix_ext20_component.default_events, &def->super);
} else {
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s APPENDING TO DEFAULT EVENTS",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME));
opal_list_append(&mca_pmix_ext20_component.default_events, &def->super);
}
} else if (1 == opal_list_get_size(cd->event_codes)) {
/* single handler */
sing = OBJ_NEW(opal_pmix20_single_event_t);
kv = (opal_value_t*)opal_list_get_first(cd->event_codes);
sing->code = kv->data.integer;
sing->index = mca_pmix_ext20_component.evindex;
sing->handler = cd->evhandler;
if (prepend) {
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s PREPENDING TO SINGLE EVENTS WITH CODE %d",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), sing->code);
opal_list_prepend(&mca_pmix_ext20_component.single_events, &sing->super);
} else {
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s APPENDING TO SINGLE EVENTS WITH CODE %d",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), sing->code);
opal_list_append(&mca_pmix_ext20_component.single_events, &sing->super);
}
} else {
multi = OBJ_NEW(opal_pmix20_multi_event_t);
multi->ncodes = opal_list_get_size(cd->event_codes);
multi->codes = (int*)malloc(multi->ncodes * sizeof(int));
i=0;
OPAL_LIST_FOREACH(kv, cd->event_codes, opal_value_t) {
multi->codes[i] = kv->data.integer;
++i;
}
multi->index = mca_pmix_ext20_component.evindex;
multi->handler = cd->evhandler;
if (prepend) {
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s PREPENDING TO MULTI EVENTS",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME));
opal_list_prepend(&mca_pmix_ext20_component.multi_events, &multi->super);
} else {
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"%s APPENDING TO MULTI EVENTS",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME));
opal_list_append(&mca_pmix_ext20_component.multi_events, &multi->super);
}
}
/* release the caller */
if (NULL != cd->cbfunc) {
cd->cbfunc(OPAL_SUCCESS, mca_pmix_ext20_component.evindex, cd->cbdata);
}
mca_pmix_ext20_component.evindex++;
/* check if any matching notifications have been cached - only nondefault
* events will have been cached*/
if (NULL == def) {
/* check single code registrations */
if (NULL != sing) {
OPAL_LIST_FOREACH(chain, &mca_pmix_ext20_component.cache, opal_pmix20_event_chain_t) {
if (sing->code == chain->status) {
opal_list_remove_item(&mca_pmix_ext20_component.cache, &chain->super);
chain->sing = sing;
sing->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
OBJ_RELEASE(cd);
return;
}
}
} else if (NULL != multi) {
/* check for multi code registrations */
OPAL_LIST_FOREACH(chain, &mca_pmix_ext20_component.cache, opal_pmix20_event_chain_t) {
for (n=0; n < multi->ncodes; n++) {
if (multi->codes[n] == chain->status) {
opal_list_remove_item(&mca_pmix_ext20_component.cache, &chain->super);
chain->multi = multi;
multi->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
OBJ_RELEASE(cd);
return;
}
}
}
}
}
OBJ_RELEASE(cd);
return;
}
static void register_handler(opal_list_t *event_codes,
opal_list_t *info,
opal_pmix_notification_fn_t evhandler,
opal_pmix_evhandler_reg_cbfunc_t cbfunc,
void *cbdata)
{
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
OPAL_PMIX_THREADSHIFT(event_codes, info, evhandler, _reg_hdlr, cbfunc, cbdata);
return;
}
static void _dereg_hdlr(int sd, short args, void *cbdata)
{
pmix20_threadshift_t *cd = (pmix20_threadshift_t*)cbdata;
opal_pmix20_single_event_t *sing;
opal_pmix20_multi_event_t *multi;
opal_pmix20_default_event_t *def;
/* check the single events first */
OPAL_LIST_FOREACH(sing, &mca_pmix_ext20_component.single_events, opal_pmix20_single_event_t) {
if (cd->handler == sing->index) {
opal_list_remove_item(&mca_pmix_ext20_component.single_events, &sing->super);
OBJ_RELEASE(sing);
goto release;
}
}
/* check multi events */
OPAL_LIST_FOREACH(multi, &mca_pmix_ext20_component.multi_events, opal_pmix20_multi_event_t) {
if (cd->handler == multi->index) {
opal_list_remove_item(&mca_pmix_ext20_component.multi_events, &multi->super);
OBJ_RELEASE(multi);
goto release;
}
}
/* check default events */
OPAL_LIST_FOREACH(def, &mca_pmix_ext20_component.default_events, opal_pmix20_default_event_t) {
if (cd->handler == def->index) {
opal_list_remove_item(&mca_pmix_ext20_component.default_events, &def->super);
OBJ_RELEASE(def);
break;
}
}
release:
if (NULL != cd->opcbfunc) {
cd->opcbfunc(OPAL_SUCCESS, cd->cbdata);
}
OBJ_RELEASE(cd);
}
static void deregister_handler(size_t evhandler,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
OPAL_PMIX_OP_THREADSHIFT(evhandler, _dereg_hdlr, cbfunc, cbdata);
return;
}
static void _notify_event(int sd, short args, void *cbdata)
{
pmix20_threadshift_t *cd = (pmix20_threadshift_t*)cbdata;
size_t i;
opal_pmix20_single_event_t *sing;
opal_pmix20_multi_event_t *multi;
opal_pmix20_default_event_t *def;
opal_pmix20_event_chain_t *chain;
/* check the single events first */
OPAL_LIST_FOREACH(sing, &mca_pmix_ext20_component.single_events, opal_pmix20_single_event_t) {
if (cd->status == sing->code) {
/* found it - invoke the handler, pointing its
* callback function to our progression function */
chain = OBJ_NEW(opal_pmix20_event_chain_t);
chain->status = cd->status;
chain->range = pmix20_convert_opalrange(cd->range);
chain->source = *(cd->source);
chain->info = cd->info;
chain->final_cbfunc = cd->opcbfunc;
chain->final_cbdata = cd->cbdata;
chain->sing = sing;
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"[%s] CALLING SINGLE EVHDLR FOR STATUS %d",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), chain->status);
sing->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
OBJ_RELEASE(cd);
return;
}
}
/* check multi events */
OPAL_LIST_FOREACH(multi, &mca_pmix_ext20_component.multi_events, opal_pmix20_multi_event_t) {
for (i=0; i < multi->ncodes; i++) {
if (cd->status == multi->codes[i]) {
/* found it - invoke the handler, pointing its
* callback function to our progression function */
chain = OBJ_NEW(opal_pmix20_event_chain_t);
chain->status = cd->status;
chain->range = pmix20_convert_opalrange(cd->range);
chain->source = *(cd->source);
chain->info = cd->info;
chain->final_cbfunc = cd->opcbfunc;
chain->final_cbdata = cd->cbdata;
chain->multi = multi;
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"[%s] CALLING MULTI EVHDLR FOR STATUS %d",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), chain->status);
multi->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
OBJ_RELEASE(cd);
return;
}
}
}
/* check default events */
if (0 < opal_list_get_size(&mca_pmix_ext20_component.default_events)) {
def = (opal_pmix20_default_event_t*)opal_list_get_first(&mca_pmix_ext20_component.default_events);
chain = OBJ_NEW(opal_pmix20_event_chain_t);
chain->status = cd->status;
chain->range = pmix20_convert_opalrange(cd->range);
chain->source = *(cd->source);
chain->info = cd->info;
chain->final_cbfunc = cd->opcbfunc;
chain->final_cbdata = cd->cbdata;
chain->def = def;
opal_output_verbose(2, opal_pmix_base_framework.framework_output,
"[%s] CALLING DEFAULT EVHDLR FOR STATUS %d",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), chain->status);
def->handler(chain->status, &chain->source,
chain->info, &chain->results,
progress_local_event_hdlr, (void*)chain);
OBJ_RELEASE(cd);
return;
}
/* if we get here, then there are no registered event handlers */
if (NULL != cd->opcbfunc) {
cd->opcbfunc(OPAL_ERR_NOT_FOUND, cd->cbdata);
}
OBJ_RELEASE(cd);
return;
}
static int notify_event(int status,
const opal_process_name_t *source,
opal_pmix_data_range_t range,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
OPAL_PMIX_NOTIFY_THREADSHIFT(status, source, range, info, _notify_event, cbfunc, cbdata);
return OPAL_SUCCESS;
}
/**** INSTANTIATE INTERNAL CLASSES ****/
OBJ_CLASS_INSTANCE(opal_pmix1_jobid_trkr_t,
OBJ_CLASS_INSTANCE(opal_pmix20_jobid_trkr_t,
opal_list_item_t,
NULL, NULL);
static void opcon(pmix1_opcaddy_t *p)
OBJ_CLASS_INSTANCE(opal_pmix20_single_event_t,
opal_list_item_t,
NULL, NULL);
static void mtevcon(opal_pmix20_multi_event_t *p)
{
p->codes = NULL;
p->ncodes = 0;
}
static void mtevdes(opal_pmix20_multi_event_t *p)
{
if (NULL != p->codes) {
free(p->codes);
}
}
OBJ_CLASS_INSTANCE(opal_pmix20_multi_event_t,
opal_list_item_t,
mtevcon, mtevdes);
OBJ_CLASS_INSTANCE(opal_pmix20_default_event_t,
opal_list_item_t,
NULL, NULL);
static void chcon(opal_pmix20_event_chain_t *p)
{
p->nondefault = false;
p->info = NULL;
OBJ_CONSTRUCT(&p->results, opal_list_t);
p->sing = NULL;
p->multi = NULL;
p->def = NULL;
p->final_cbfunc = NULL;
p->final_cbdata = NULL;
}
static void chdes(opal_pmix20_event_chain_t *p)
{
OPAL_LIST_DESTRUCT(&p->results);
}
OBJ_CLASS_INSTANCE(opal_pmix20_event_chain_t,
opal_list_item_t,
chcon, chdes);
static void opcon(pmix20_opcaddy_t *p)
{
memset(&p->p, 0, sizeof(pmix_proc_t));
p->procs = NULL;
@ -444,6 +1104,7 @@ static void opcon(pmix1_opcaddy_t *p)
p->ninfo = 0;
p->apps = NULL;
p->sz = 0;
p->active = false;
p->opcbfunc = NULL;
p->mdxcbfunc = NULL;
p->valcbfunc = NULL;
@ -451,7 +1112,7 @@ static void opcon(pmix1_opcaddy_t *p)
p->spcbfunc = NULL;
p->cbdata = NULL;
}
static void opdes(pmix1_opcaddy_t *p)
static void opdes(pmix20_opcaddy_t *p)
{
if (NULL != p->procs) {
PMIX_PROC_FREE(p->procs, p->nprocs);
@ -466,11 +1127,11 @@ static void opdes(pmix1_opcaddy_t *p)
PMIX_APP_FREE(p->apps, p->sz);
}
}
OBJ_CLASS_INSTANCE(pmix1_opcaddy_t,
OBJ_CLASS_INSTANCE(pmix20_opcaddy_t,
opal_object_t,
opcon, opdes);
static void ocadcon(pmix1_opalcaddy_t *p)
static void ocadcon(pmix20_opalcaddy_t *p)
{
OBJ_CONSTRUCT(&p->procs, opal_list_t);
OBJ_CONSTRUCT(&p->info, opal_list_t);
@ -484,12 +1145,27 @@ static void ocadcon(pmix1_opalcaddy_t *p)
p->odmdxfunc = NULL;
p->ocbdata = NULL;
}
static void ocaddes(pmix1_opalcaddy_t *p)
static void ocaddes(pmix20_opalcaddy_t *p)
{
OPAL_LIST_DESTRUCT(&p->procs);
OPAL_LIST_DESTRUCT(&p->info);
OPAL_LIST_DESTRUCT(&p->apps);
}
OBJ_CLASS_INSTANCE(pmix1_opalcaddy_t,
OBJ_CLASS_INSTANCE(pmix20_opalcaddy_t,
opal_object_t,
ocadcon, ocaddes);
static void tscon(pmix20_threadshift_t *p)
{
p->active = false;
p->source = NULL;
p->event_codes = NULL;
p->info = NULL;
p->evhandler = NULL;
p->cbfunc = NULL;
p->opcbfunc = NULL;
p->cbdata = NULL;
}
OBJ_CLASS_INSTANCE(pmix20_threadshift_t,
opal_object_t,
tscon, NULL);

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

@ -23,13 +23,13 @@
#include <sys/un.h>
#endif
#include "opal/class/opal_list.h"
#include "opal/mca/mca.h"
#include "opal/mca/event/event.h"
#include "opal/util/proc.h"
#include "opal/mca/pmix/pmix.h"
#include "pmix_server.h"
#include "pmix_server.h"
#include "pmix/pmix_common.h"
BEGIN_C_DECLS
@ -38,6 +38,12 @@ typedef struct {
opal_pmix_base_component_t super;
opal_list_t jobids;
bool native_launch;
size_t evindex;
opal_list_t single_events;
opal_list_t multi_events;
opal_list_t default_events;
int cache_size;
opal_list_t cache;
} mca_pmix_ext20_component_t;
OPAL_DECLSPEC extern mca_pmix_ext20_component_t mca_pmix_ext20_component;
@ -49,11 +55,52 @@ typedef struct {
opal_list_item_t super;
opal_jobid_t jobid;
char nspace[PMIX_MAX_NSLEN + 1];
} opal_pmix1_jobid_trkr_t;
OBJ_CLASS_DECLARATION(opal_pmix1_jobid_trkr_t);
} opal_pmix20_jobid_trkr_t;
OBJ_CLASS_DECLARATION(opal_pmix20_jobid_trkr_t);
typedef struct {
opal_list_item_t super;
size_t index;
int code;
opal_pmix_notification_fn_t handler;
} opal_pmix20_single_event_t;
OBJ_CLASS_DECLARATION(opal_pmix20_single_event_t);
typedef struct {
opal_list_item_t super;
size_t index;
int *codes;
size_t ncodes;
opal_pmix_notification_fn_t handler;
} opal_pmix20_multi_event_t;
OBJ_CLASS_DECLARATION(opal_pmix20_multi_event_t);
typedef struct {
opal_list_item_t super;
size_t index;
opal_pmix_notification_fn_t handler;
} opal_pmix20_default_event_t;
OBJ_CLASS_DECLARATION(opal_pmix20_default_event_t);
typedef struct {
opal_list_item_t super;
int status;
bool nondefault;
opal_process_name_t source;
pmix_data_range_t range;
opal_list_t *info;
opal_list_t results;
opal_pmix20_single_event_t *sing;
opal_pmix20_multi_event_t *multi;
opal_pmix20_default_event_t *def;
opal_pmix_op_cbfunc_t final_cbfunc;
void *final_cbdata;
} opal_pmix20_event_chain_t;
OBJ_CLASS_DECLARATION(opal_pmix20_event_chain_t);
typedef struct {
opal_object_t super;
pmix_status_t status;
pmix_proc_t p;
pmix_proc_t *procs;
size_t nprocs;
@ -63,14 +110,15 @@ typedef struct {
size_t ninfo;
pmix_app_t *apps;
size_t sz;
volatile bool active;
opal_pmix_op_cbfunc_t opcbfunc;
opal_pmix_modex_cbfunc_t mdxcbfunc;
opal_pmix_value_cbfunc_t valcbfunc;
opal_pmix_lookup_cbfunc_t lkcbfunc;
opal_pmix_spawn_cbfunc_t spcbfunc;
void *cbdata;
} pmix1_opcaddy_t;
OBJ_CLASS_DECLARATION(pmix1_opcaddy_t);
} pmix20_opcaddy_t;
OBJ_CLASS_DECLARATION(pmix20_opcaddy_t);
typedef struct {
opal_object_t super;
@ -85,90 +133,176 @@ typedef struct {
void *cbdata;
opal_pmix_release_cbfunc_t odmdxfunc;
void *ocbdata;
} pmix1_opalcaddy_t;
OBJ_CLASS_DECLARATION(pmix1_opalcaddy_t);
} pmix20_opalcaddy_t;
OBJ_CLASS_DECLARATION(pmix20_opalcaddy_t);
typedef struct {
opal_object_t super;
opal_event_t ev;
volatile bool active;
size_t id;
int status;
opal_process_name_t pname;
opal_jobid_t jobid;
const opal_process_name_t *source;
opal_pmix_data_range_t range;
bool nondefault;
size_t handler;
opal_list_t *event_codes;
opal_list_t *info;
opal_pmix_notification_fn_t evhandler;
opal_pmix_evhandler_reg_cbfunc_t cbfunc;
opal_pmix_op_cbfunc_t opcbfunc;
void *cbdata;
} pmix20_threadshift_t;
OBJ_CLASS_DECLARATION(pmix20_threadshift_t);
#define OPAL_PMIX_OPCD_THREADSHIFT(i, s, sr, if, nif, fn, cb, cd) \
do { \
pmix20_opalcaddy_t *_cd; \
_cd = OBJ_NEW(pmix20_opalcaddy_t); \
_cd->id = (i); \
_cd->status = (s); \
_cd->source = (sr); \
_cd->info = (i); \
_cd->evcbfunc = (cb); \
_cd->cbdata = (cd); \
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
-1, EV_WRITE, (fn), (_cd)); \
event_active(&((_cd)->ev), EV_WRITE, 1); \
} while(0)
#define OPAL_PMIX_OP_THREADSHIFT(e, fn, cb, cd) \
do { \
pmix20_threadshift_t *_cd; \
_cd = OBJ_NEW(pmix20_threadshift_t); \
_cd->handler = (e); \
_cd->opcbfunc = (cb); \
_cd->cbdata = (cd); \
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
-1, EV_WRITE, (fn), (_cd)); \
event_active(&((_cd)->ev), EV_WRITE, 1); \
} while(0)
#define OPAL_PMIX_THREADSHIFT(e, i, eh, fn, cb, cd) \
do { \
pmix20_threadshift_t *_cd; \
_cd = OBJ_NEW(pmix20_threadshift_t); \
_cd->event_codes = (e); \
_cd->info = (i); \
_cd->evhandler = (eh); \
_cd->cbfunc = (cb); \
_cd->cbdata = (cd); \
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
-1, EV_WRITE, (fn), (_cd)); \
event_active(&((_cd)->ev), EV_WRITE, 1); \
} while(0)
#define OPAL_PMIX_NOTIFY_THREADSHIFT(s, sr, r, i, fn, cb, cd) \
do { \
pmix20_threadshift_t *_cd; \
_cd = OBJ_NEW(pmix20_threadshift_t); \
_cd->status = (s); \
_cd->source = (sr); \
_cd->range = (r); \
_cd->info = (i); \
_cd->opcbfunc = (cb); \
_cd->cbdata = (cd); \
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
-1, EV_WRITE, (fn), (_cd)); \
event_active(&((_cd)->ev), EV_WRITE, 1); \
} while(0)
/**** CLIENT FUNCTIONS ****/
OPAL_MODULE_DECLSPEC int pmix1_client_init(void);
OPAL_MODULE_DECLSPEC int pmix1_client_finalize(void);
OPAL_MODULE_DECLSPEC int pmix1_initialized(void);
OPAL_MODULE_DECLSPEC int pmix1_abort(int flag, const char *msg,
OPAL_MODULE_DECLSPEC int pmix20_client_init(void);
OPAL_MODULE_DECLSPEC int pmix20_client_finalize(void);
OPAL_MODULE_DECLSPEC int pmix20_initialized(void);
OPAL_MODULE_DECLSPEC int pmix20_abort(int flag, const char *msg,
opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix1_commit(void);
OPAL_MODULE_DECLSPEC int pmix1_fence(opal_list_t *procs, int collect_data);
OPAL_MODULE_DECLSPEC int pmix1_fencenb(opal_list_t *procs, int collect_data,
OPAL_MODULE_DECLSPEC int pmix20_commit(void);
OPAL_MODULE_DECLSPEC int pmix20_fence(opal_list_t *procs, int collect_data);
OPAL_MODULE_DECLSPEC int pmix20_fencenb(opal_list_t *procs, int collect_data,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_put(opal_pmix_scope_t scope,
OPAL_MODULE_DECLSPEC int pmix20_put(opal_pmix_scope_t scope,
opal_value_t *val);
OPAL_MODULE_DECLSPEC int pmix1_get(const opal_process_name_t *proc, const char *key,
OPAL_MODULE_DECLSPEC int pmix20_get(const opal_process_name_t *proc, const char *key,
opal_list_t *info, opal_value_t **val);
OPAL_MODULE_DECLSPEC int pmix1_getnb(const opal_process_name_t *proc, const char *key,
OPAL_MODULE_DECLSPEC int pmix20_getnb(const opal_process_name_t *proc, const char *key,
opal_list_t *info,
opal_pmix_value_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_publish(opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix1_publishnb(opal_list_t *info,
OPAL_MODULE_DECLSPEC int pmix20_publish(opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix20_publishnb(opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_lookup(opal_list_t *data, opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix1_lookupnb(char **keys, opal_list_t *info,
OPAL_MODULE_DECLSPEC int pmix20_lookup(opal_list_t *data, opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix20_lookupnb(char **keys, opal_list_t *info,
opal_pmix_lookup_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_unpublish(char **keys, opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix1_unpublishnb(char **keys, opal_list_t *info,
OPAL_MODULE_DECLSPEC int pmix20_unpublish(char **keys, opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix20_unpublishnb(char **keys, opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid);
OPAL_MODULE_DECLSPEC int pmix1_spawnnb(opal_list_t *job_info, opal_list_t *apps,
OPAL_MODULE_DECLSPEC int pmix20_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid);
OPAL_MODULE_DECLSPEC int pmix20_spawnnb(opal_list_t *job_info, opal_list_t *apps,
opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_connect(opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix1_connectnb(opal_list_t *procs,
OPAL_MODULE_DECLSPEC int pmix20_connect(opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix20_connectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_disconnect(opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix1_disconnectnb(opal_list_t *procs,
OPAL_MODULE_DECLSPEC int pmix20_disconnect(opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix20_disconnectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_resolve_peers(const char *nodename, opal_jobid_t jobid,
OPAL_MODULE_DECLSPEC int pmix20_resolve_peers(const char *nodename, opal_jobid_t jobid,
opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix1_resolve_nodes(opal_jobid_t jobid, char **nodelist);
OPAL_MODULE_DECLSPEC int pmix20_resolve_nodes(opal_jobid_t jobid, char **nodelist);
/**** COMMON FUNCTIONS ****/
OPAL_MODULE_DECLSPEC int pmix1_store_local(const opal_process_name_t *proc,
OPAL_MODULE_DECLSPEC int pmix20_store_local(const opal_process_name_t *proc,
opal_value_t *val);
/**** SERVER SOUTHBOUND FUNCTIONS ****/
OPAL_MODULE_DECLSPEC int pmix1_server_init(opal_pmix_server_module_t *module,
OPAL_MODULE_DECLSPEC int pmix20_server_init(opal_pmix_server_module_t *module,
opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix1_server_finalize(void);
OPAL_MODULE_DECLSPEC int pmix1_server_gen_regex(const char *input, char **regex);
OPAL_MODULE_DECLSPEC int pmix1_server_gen_ppn(const char *input, char **ppn);
OPAL_MODULE_DECLSPEC int pmix1_server_register_nspace(opal_jobid_t jobid,
OPAL_MODULE_DECLSPEC int pmix20_server_finalize(void);
OPAL_MODULE_DECLSPEC int pmix20_server_gen_regex(const char *input, char **regex);
OPAL_MODULE_DECLSPEC int pmix20_server_gen_ppn(const char *input, char **ppn);
OPAL_MODULE_DECLSPEC int pmix20_server_register_nspace(opal_jobid_t jobid,
int nlocalprocs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC void pmix1_server_deregister_nspace(opal_jobid_t jobid);
OPAL_MODULE_DECLSPEC int pmix1_server_register_client(const opal_process_name_t *proc,
OPAL_MODULE_DECLSPEC void pmix20_server_deregister_nspace(opal_jobid_t jobid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int pmix20_server_register_client(const opal_process_name_t *proc,
uid_t uid, gid_t gid,
void *server_object,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC void pmix1_server_deregister_client(const opal_process_name_t *proc);
OPAL_MODULE_DECLSPEC int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env);
OPAL_MODULE_DECLSPEC int pmix1_server_dmodex(const opal_process_name_t *proc,
OPAL_MODULE_DECLSPEC void pmix20_server_deregister_client(const opal_process_name_t *proc,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int pmix20_server_setup_fork(const opal_process_name_t *proc, char ***env);
OPAL_MODULE_DECLSPEC int pmix20_server_dmodex(const opal_process_name_t *proc,
opal_pmix_modex_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_server_notify_error(int status,
opal_list_t *procs,
opal_list_t *error_procs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix20_server_notify_event(int status,
const opal_process_name_t *source,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
/**** COMPONENT UTILITY FUNCTIONS ****/
OPAL_MODULE_DECLSPEC pmix_status_t pmix1_convert_opalrc(int rc);
OPAL_MODULE_DECLSPEC int pmix1_convert_rc(pmix_status_t rc);
OPAL_MODULE_DECLSPEC pmix_scope_t pmix1_convert_opalscope(opal_pmix_scope_t scope);
OPAL_MODULE_DECLSPEC void pmix1_value_load(pmix_value_t *v,
OPAL_MODULE_DECLSPEC void pmix20_event_hdlr(size_t evhdlr_registration_id,
pmix_status_t status, const pmix_proc_t *source,
pmix_info_t info[], size_t ninfo,
pmix_event_notification_cbfunc_fn_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC pmix_status_t pmix20_convert_opalrc(int rc);
OPAL_MODULE_DECLSPEC int pmix20_convert_rc(pmix_status_t rc);
OPAL_MODULE_DECLSPEC pmix_scope_t pmix20_convert_opalscope(opal_pmix_scope_t scope);
OPAL_MODULE_DECLSPEC pmix_data_range_t pmix20_convert_opalrange(opal_pmix_data_range_t range);
OPAL_MODULE_DECLSPEC opal_pmix_data_range_t pmix20_convert_range(pmix_data_range_t range);
OPAL_MODULE_DECLSPEC void pmix20_value_load(pmix_value_t *v,
opal_value_t *kv);
OPAL_MODULE_DECLSPEC int pmix1_value_unload(opal_value_t *kv,
OPAL_MODULE_DECLSPEC int pmix20_value_unload(opal_value_t *kv,
const pmix_value_t *v);
END_C_DECLS

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

@ -43,55 +43,6 @@ static size_t errhdler_ref = 0;
} while (0)
static void completion_handler (void *cbdata) {
bool *active = (bool *)cbdata;
*active = false;
}
static void myerr(size_t evhdlr_registration_id,
pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo,
pmix_event_notification_cbfunc_fn_t cbfunc,
void *cbdata)
{
int rc;
opal_list_t plist, ilist;
opal_namelist_t *nm;
opal_value_t *iptr;
size_t n;
volatile bool active;
/* convert the incoming status */
rc = pmix1_convert_rc(status);
/* convert the array of procs */
OBJ_CONSTRUCT(&plist, opal_list_t);
for (n=0; n < nprocs; n++) {
nm = OBJ_NEW(opal_namelist_t);
nm->name.jobid = strtoul(procs[n].nspace, NULL, 10);
nm->name.vpid = procs[n].rank;
opal_list_append(&plist, &nm->super);
}
/* convert the array of info */
OBJ_CONSTRUCT(&ilist, opal_list_t);
for (n=0; n < ninfo; n++) {
iptr = OBJ_NEW(opal_value_t);
iptr->key = strdup(info[n].key);
pmix1_value_unload(iptr, &info[n].value);
opal_list_append(&plist, &iptr->super);
}
/* call the base errhandler */
active = true;
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&active);
PMIX_WAIT_FOR_COMPLETION(active);
OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist);
}
static void errreg_cbfunc (pmix_status_t status,
size_t errhandler_ref,
void *cbdata)
@ -102,12 +53,12 @@ static void errreg_cbfunc (pmix_status_t status,
status, (unsigned long)errhandler_ref);
}
int pmix1_client_init(void)
int pmix20_client_init(void)
{
opal_process_name_t pname;
pmix_status_t rc;
int dbg;
opal_pmix1_jobid_trkr_t *job;
opal_pmix20_jobid_trkr_t *job;
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client init");
@ -119,7 +70,7 @@ int pmix1_client_init(void)
rc = PMIx_Init(&my_proc, NULL, 0);
if (PMIX_SUCCESS != rc) {
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
/* store our jobid and rank */
@ -135,7 +86,7 @@ int pmix1_client_init(void)
}
/* insert this into our list of jobids - it will be the
* first, and so we'll check it first */
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
job = OBJ_NEW(opal_pmix20_jobid_trkr_t);
(void)strncpy(job->nspace, my_proc.nspace, PMIX_MAX_NSLEN);
job->jobid = pname.jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
@ -144,12 +95,12 @@ int pmix1_client_init(void)
opal_proc_set_name(&pname);
/* register the default event handler */
PMIx_Register_event_handler(NULL, 0, NULL, 0, myerr, errreg_cbfunc, NULL);
PMIx_Register_event_handler(NULL, 0, NULL, 0, pmix20_event_hdlr, errreg_cbfunc, NULL);
return OPAL_SUCCESS;
}
int pmix1_client_finalize(void)
int pmix20_client_finalize(void)
{
pmix_status_t rc;
@ -160,10 +111,10 @@ int pmix1_client_finalize(void)
PMIx_Deregister_event_handler(errhdler_ref, NULL, NULL);
rc = PMIx_Finalize(NULL, 0);
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
int pmix1_initialized(void)
int pmix20_initialized(void)
{
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client initialized");
@ -171,14 +122,14 @@ int pmix1_initialized(void)
return PMIx_Initialized();
}
int pmix1_abort(int flag, const char *msg,
int pmix20_abort(int flag, const char *msg,
opal_list_t *procs)
{
pmix_status_t rc;
pmix_proc_t *parray=NULL;
size_t n, cnt=0;
opal_namelist_t *ptr;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client abort");
@ -192,7 +143,7 @@ int pmix1_abort(int flag, const char *msg,
/* look thru our list of jobids and find the
* corresponding nspace */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) {
job = jptr;
break;
@ -213,21 +164,24 @@ int pmix1_abort(int flag, const char *msg,
/* release the array */
PMIX_PROC_FREE(parray, cnt);
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
int pmix1_store_local(const opal_process_name_t *proc, opal_value_t *val)
int pmix20_store_local(const opal_process_name_t *proc, opal_value_t *val)
{
pmix_value_t kv;
pmix_status_t rc;
pmix_proc_t p;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
if (NULL != proc) {
/* look thru our list of jobids and find the
* corresponding nspace */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == proc->jobid) {
job = jptr;
break;
@ -246,40 +200,40 @@ int pmix1_store_local(const opal_process_name_t *proc, opal_value_t *val)
}
PMIX_VALUE_CONSTRUCT(&kv);
pmix1_value_load(&kv, val);
pmix20_value_load(&kv, val);
rc = PMIx_Store_internal(&p, val->key, &kv);
PMIX_VALUE_DESTRUCT(&kv);
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
int pmix1_commit(void)
int pmix20_commit(void)
{
pmix_status_t rc;
rc = PMIx_Commit();
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
static void opcbfunc(pmix_status_t status, void *cbdata)
{
pmix1_opcaddy_t *op = (pmix1_opcaddy_t*)cbdata;
pmix20_opcaddy_t *op = (pmix20_opcaddy_t*)cbdata;
if (NULL != op->opcbfunc) {
op->opcbfunc(pmix1_convert_rc(status), op->cbdata);
op->opcbfunc(pmix20_convert_rc(status), op->cbdata);
}
OBJ_RELEASE(op);
}
int pmix1_fence(opal_list_t *procs, int collect_data)
int pmix20_fence(opal_list_t *procs, int collect_data)
{
pmix_status_t rc;
pmix_proc_t *parray=NULL;
size_t n, cnt=0;
opal_namelist_t *ptr;
pmix_info_t info, *iptr;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client fence");
@ -293,7 +247,7 @@ int pmix1_fence(opal_list_t *procs, int collect_data)
/* look thru our list of jobids and find the
* corresponding nspace */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) {
job = jptr;
break;
@ -328,20 +282,23 @@ int pmix1_fence(opal_list_t *procs, int collect_data)
PMIX_INFO_DESTRUCT(&info);
}
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
int pmix1_fencenb(opal_list_t *procs, int collect_data,
int pmix20_fencenb(opal_list_t *procs, int collect_data,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_status_t rc;
pmix_proc_t *parray=NULL;
size_t n, cnt=0;
opal_namelist_t *ptr;
pmix1_opcaddy_t *op;
pmix20_opcaddy_t *op;
pmix_info_t info, *iptr;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client fence_nb");
@ -355,7 +312,7 @@ int pmix1_fencenb(opal_list_t *procs, int collect_data,
/* look thru our list of jobids and find the
* corresponding nspace */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) {
job = jptr;
break;
@ -383,7 +340,7 @@ int pmix1_fencenb(opal_list_t *procs, int collect_data,
}
/* create the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op = OBJ_NEW(pmix20_opcaddy_t);
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
op->procs = parray;
@ -395,29 +352,29 @@ int pmix1_fencenb(opal_list_t *procs, int collect_data,
OBJ_RELEASE(op);
}
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
int pmix1_put(opal_pmix_scope_t opal_scope,
int pmix20_put(opal_pmix_scope_t opal_scope,
opal_value_t *val)
{
pmix_value_t kv;
pmix_scope_t pmix_scope = pmix1_convert_opalscope(opal_scope);
pmix_scope_t pmix_scope = pmix20_convert_opalscope(opal_scope);
pmix_status_t rc;
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client put");
PMIX_VALUE_CONSTRUCT(&kv);
pmix1_value_load(&kv, val);
pmix20_value_load(&kv, val);
rc = PMIx_Put(pmix_scope, val->key, &kv);
PMIX_VALUE_DESTRUCT(&kv);
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
int pmix1_get(const opal_process_name_t *proc, const char *key,
int pmix20_get(const opal_process_name_t *proc, const char *key,
opal_list_t *info, opal_value_t **val)
{
int ret;
@ -427,7 +384,7 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
size_t ninfo, n;
pmix_info_t *pinfo;
opal_value_t *ival;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"%s PMIx_client get on proc %s key %s",
@ -440,7 +397,7 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
/* look thru our list of jobids and find the
* corresponding nspace */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == proc->jobid) {
job = jptr;
break;
@ -475,7 +432,7 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
n=0;
OPAL_LIST_FOREACH(ival, info, opal_value_t) {
(void)strncpy(pinfo[n].key, ival->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pinfo[n].value, ival);
pmix20_value_load(&pinfo[n].value, ival);
}
} else {
pinfo = NULL;
@ -492,11 +449,11 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
ret = OPAL_SUCCESS;
} else {
*val = OBJ_NEW(opal_value_t);
ret = pmix1_value_unload(*val, kv);
ret = pmix20_value_unload(*val, kv);
PMIX_VALUE_FREE(kv, 1);
}
} else {
ret = pmix1_convert_rc(rc);
ret = pmix20_convert_rc(rc);
}
PMIX_INFO_FREE(pinfo, ninfo);
return ret;
@ -505,13 +462,13 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
static void val_cbfunc(pmix_status_t status,
pmix_value_t *kv, void *cbdata)
{
pmix1_opcaddy_t *op = (pmix1_opcaddy_t*)cbdata;
pmix20_opcaddy_t *op = (pmix20_opcaddy_t*)cbdata;
int rc;
opal_value_t val, *v=NULL;
rc = pmix1_convert_opalrc(status);
rc = pmix20_convert_opalrc(status);
if (PMIX_SUCCESS == status && NULL != kv) {
rc = pmix1_value_unload(&val, kv);
rc = pmix20_value_unload(&val, kv);
v = &val;
}
@ -521,15 +478,18 @@ static void val_cbfunc(pmix_status_t status,
OBJ_RELEASE(op);
}
int pmix1_getnb(const opal_process_name_t *proc, const char *key,
int pmix20_getnb(const opal_process_name_t *proc, const char *key,
opal_list_t *info,
opal_pmix_value_cbfunc_t cbfunc, void *cbdata)
{
pmix1_opcaddy_t *op;
pmix20_opcaddy_t *op;
pmix_status_t rc;
size_t n;
opal_value_t *ival;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
/* we must threadshift this request as we might not be in an event
* and we are going to access shared lists/objects */
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"%s PMIx_client get_nb on proc %s key %s",
@ -537,7 +497,7 @@ int pmix1_getnb(const opal_process_name_t *proc, const char *key,
(NULL == proc) ? "NULL" : OPAL_NAME_PRINT(*proc), key);
/* create the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op = OBJ_NEW(pmix20_opcaddy_t);
op->valcbfunc = cbfunc;
op->cbdata = cbdata;
@ -545,7 +505,7 @@ int pmix1_getnb(const opal_process_name_t *proc, const char *key,
/* look thru our list of jobids and find the
* corresponding nspace */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == proc->jobid) {
job = jptr;
break;
@ -568,7 +528,7 @@ int pmix1_getnb(const opal_process_name_t *proc, const char *key,
n=0;
OPAL_LIST_FOREACH(ival, info, opal_value_t) {
(void)strncpy(op->info[n].key, ival->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&op->info[n].value, ival);
pmix20_value_load(&op->info[n].value, ival);
}
}
}
@ -579,10 +539,10 @@ int pmix1_getnb(const opal_process_name_t *proc, const char *key,
OBJ_RELEASE(op);
}
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
int pmix1_publish(opal_list_t *info)
int pmix20_publish(opal_list_t *info)
{
pmix_info_t *pinfo;
pmix_status_t ret;
@ -602,7 +562,7 @@ int pmix1_publish(opal_list_t *info)
n=0;
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
(void)strncpy(pinfo[n].key, iptr->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pinfo[n].value, iptr);
pmix20_value_load(&pinfo[n].value, iptr);
++n;
}
} else {
@ -611,16 +571,16 @@ int pmix1_publish(opal_list_t *info)
ret = PMIx_Publish(pinfo, sz);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_publishnb(opal_list_t *info,
int pmix20_publishnb(opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_status_t ret;
opal_value_t *iptr;
size_t n;
pmix1_opcaddy_t *op;
pmix20_opcaddy_t *op;
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client publish_nb");
@ -630,7 +590,7 @@ int pmix1_publishnb(opal_list_t *info,
}
/* create the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op = OBJ_NEW(pmix20_opcaddy_t);
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
@ -640,17 +600,17 @@ int pmix1_publishnb(opal_list_t *info,
n=0;
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
(void)strncpy(op->info[n].key, iptr->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&op->info[n].value, iptr);
pmix20_value_load(&op->info[n].value, iptr);
++n;
}
}
ret = PMIx_Publish_nb(op->info, op->sz, opcbfunc, op);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_lookup(opal_list_t *data, opal_list_t *info)
int pmix20_lookup(opal_list_t *data, opal_list_t *info)
{
pmix_pdata_t *pdata;
pmix_info_t *pinfo;
@ -659,8 +619,10 @@ int pmix1_lookup(opal_list_t *data, opal_list_t *info)
pmix_status_t ret;
opal_pmix_pdata_t *d;
opal_value_t *iptr;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
/* we must threadshift this request as we might not be in an event
* and we are going to access shared lists/objects */
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client lookup");
@ -681,7 +643,7 @@ int pmix1_lookup(opal_list_t *data, opal_list_t *info)
n=0;
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
(void)strncpy(pinfo[n++].key, iptr->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pinfo[n].value, iptr);
pmix20_value_load(&pinfo[n].value, iptr);
++n;
}
} else {
@ -707,14 +669,14 @@ int pmix1_lookup(opal_list_t *data, opal_list_t *info)
}
/* if we don't already have it, add this to our jobid tracker */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == d->proc.jobid) {
job = jptr;
break;
}
}
if (NULL == job) {
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
job = OBJ_NEW(opal_pmix20_jobid_trkr_t);
(void)strncpy(job->nspace, pdata[n].proc.nspace, PMIX_MAX_NSLEN);
job->jobid = d->proc.jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
@ -724,7 +686,7 @@ int pmix1_lookup(opal_list_t *data, opal_list_t *info)
} else {
d->proc.vpid = pdata[n].proc.rank;
}
rc = pmix1_value_unload(&d->value, &pdata[n].value);
rc = pmix20_value_unload(&d->value, &pdata[n].value);
if (OPAL_SUCCESS != rc) {
OPAL_ERROR_LOG(rc);
PMIX_PDATA_FREE(pdata, sz);
@ -734,26 +696,30 @@ int pmix1_lookup(opal_list_t *data, opal_list_t *info)
}
}
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
static void lk_cbfunc(pmix_status_t status,
pmix_pdata_t data[], size_t ndata,
void *cbdata)
{
pmix1_opcaddy_t *op = (pmix1_opcaddy_t*)cbdata;
pmix20_opcaddy_t *op = (pmix20_opcaddy_t*)cbdata;
opal_pmix_pdata_t *d;
opal_list_t results, *r = NULL;
int rc;
size_t n;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
if (NULL == op->lkcbfunc) {
/* this is in the PMIx local thread - need to threadshift to
* our own thread as we will be accessing framework-global
* lists and objects */
if (NULL == op->lkcbfunc) {
OBJ_RELEASE(op);
return;
}
rc = pmix1_convert_rc(status);
rc = pmix20_convert_rc(status);
if (OPAL_SUCCESS == rc) {
OBJ_CONSTRUCT(&results, opal_list_t);
for (n=0; n < ndata; n++) {
@ -770,14 +736,14 @@ static void lk_cbfunc(pmix_status_t status,
}
/* if we don't already have it, add this to our jobid tracker */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == d->proc.jobid) {
job = jptr;
break;
}
}
if (NULL == job) {
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
job = OBJ_NEW(opal_pmix20_jobid_trkr_t);
(void)strncpy(job->nspace, data[n].proc.nspace, PMIX_MAX_NSLEN);
job->jobid = d->proc.jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
@ -788,7 +754,7 @@ static void lk_cbfunc(pmix_status_t status,
d->proc.vpid = data[n].proc.rank;
}
d->value.key = strdup(data[n].key);
rc = pmix1_value_unload(&d->value, &data[n].value);
rc = pmix20_value_unload(&d->value, &data[n].value);
if (OPAL_SUCCESS != rc) {
rc = OPAL_ERR_BAD_PARAM;
OPAL_ERROR_LOG(rc);
@ -807,11 +773,11 @@ static void lk_cbfunc(pmix_status_t status,
OBJ_RELEASE(op);
}
int pmix1_lookupnb(char **keys, opal_list_t *info,
int pmix20_lookupnb(char **keys, opal_list_t *info,
opal_pmix_lookup_cbfunc_t cbfunc, void *cbdata)
{
pmix_status_t ret;
pmix1_opcaddy_t *op;
pmix20_opcaddy_t *op;
opal_value_t *iptr;
size_t n;
@ -820,7 +786,7 @@ int pmix1_lookupnb(char **keys, opal_list_t *info,
"PMIx_client lookup_nb");
/* create the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op = OBJ_NEW(pmix20_opcaddy_t);
op->lkcbfunc = cbfunc;
op->cbdata = cbdata;
@ -831,7 +797,7 @@ int pmix1_lookupnb(char **keys, opal_list_t *info,
n=0;
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
(void)strncpy(op->info[n].key, iptr->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&op->info[n].value, iptr);
pmix20_value_load(&op->info[n].value, iptr);
++n;
}
}
@ -839,10 +805,10 @@ int pmix1_lookupnb(char **keys, opal_list_t *info,
ret = PMIx_Lookup_nb(keys, op->info, op->sz, lk_cbfunc, op);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_unpublish(char **keys, opal_list_t *info)
int pmix20_unpublish(char **keys, opal_list_t *info)
{
pmix_status_t ret;
size_t ninfo, n;
@ -855,7 +821,7 @@ int pmix1_unpublish(char **keys, opal_list_t *info)
n=0;
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
(void)strncpy(pinfo[n++].key, iptr->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pinfo[n].value, iptr);
pmix20_value_load(&pinfo[n].value, iptr);
++n;
}
} else {
@ -866,19 +832,19 @@ int pmix1_unpublish(char **keys, opal_list_t *info)
ret = PMIx_Unpublish(keys, pinfo, ninfo);
PMIX_INFO_FREE(pinfo, ninfo);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_unpublishnb(char **keys, opal_list_t *info,
int pmix20_unpublishnb(char **keys, opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_status_t ret;
pmix1_opcaddy_t *op;
pmix20_opcaddy_t *op;
opal_value_t *iptr;
size_t n;
/* create the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op = OBJ_NEW(pmix20_opcaddy_t);
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
@ -889,7 +855,7 @@ int pmix1_unpublishnb(char **keys, opal_list_t *info,
n=0;
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
(void)strncpy(op->info[n].key, iptr->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&op->info[n].value, iptr);
pmix20_value_load(&op->info[n].value, iptr);
++n;
}
}
@ -897,10 +863,10 @@ int pmix1_unpublishnb(char **keys, opal_list_t *info,
ret = PMIx_Unpublish_nb(keys, op->info, op->sz, opcbfunc, op);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
int pmix20_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
{
pmix_status_t ret;
pmix_info_t *pinfo = NULL;
@ -909,14 +875,14 @@ int pmix1_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
char nspace[PMIX_MAX_NSLEN+1];
opal_value_t *info;
opal_pmix_app_t *app;
opal_pmix1_jobid_trkr_t *job;
opal_pmix20_jobid_trkr_t *job;
if (NULL != job_info && 0 < (ninfo = opal_list_get_size(job_info))) {
PMIX_INFO_CREATE(pinfo, ninfo);
n=0;
OPAL_LIST_FOREACH(info, job_info, opal_value_t) {
(void)strncpy(pinfo[n].key, info->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pinfo[n].value, info);
pmix20_value_load(&pinfo[n].value, info);
++n;
}
}
@ -935,7 +901,7 @@ int pmix1_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
m=0;
OPAL_LIST_FOREACH(info, &app->info, opal_value_t) {
(void)strncpy(papps[n].info[m].key, info->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&papps[n].info[m].value, info);
pmix20_value_load(&papps[n].info[m].value, info);
++m;
}
}
@ -954,25 +920,29 @@ int pmix1_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
OPAL_HASH_STR(nspace, *jobid);
}
/* add this to our jobid tracker */
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
job = OBJ_NEW(opal_pmix20_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = *jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
}
PMIX_APP_FREE(papps, napps);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
static void spcbfunc(pmix_status_t status,
char *nspace, void *cbdata)
{
pmix1_opcaddy_t *op = (pmix1_opcaddy_t*)cbdata;
pmix20_opcaddy_t *op = (pmix20_opcaddy_t*)cbdata;
int rc;
opal_jobid_t jobid=OPAL_JOBID_INVALID;
opal_pmix1_jobid_trkr_t *job;
opal_pmix20_jobid_trkr_t *job;
rc = pmix1_convert_rc(status);
/* this is in the PMIx local thread - need to threadshift to
* our own thread as we will be accessing framework-global
* lists and objects */
rc = pmix20_convert_rc(status);
if (PMIX_SUCCESS == status) {
if (mca_pmix_ext20_component.native_launch) {
/* if we were launched by the OMPI RTE, then
@ -984,7 +954,7 @@ static void spcbfunc(pmix_status_t status,
OPAL_HASH_STR(nspace, jobid);
}
/* add this to our jobid tracker */
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
job = OBJ_NEW(opal_pmix20_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
@ -994,17 +964,17 @@ static void spcbfunc(pmix_status_t status,
OBJ_RELEASE(op);
}
int pmix1_spawnnb(opal_list_t *job_info, opal_list_t *apps,
int pmix20_spawnnb(opal_list_t *job_info, opal_list_t *apps,
opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata)
{
pmix_status_t ret;
pmix1_opcaddy_t *op;
pmix20_opcaddy_t *op;
size_t n, m;
opal_value_t *info;
opal_pmix_app_t *app;
/* create the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op = OBJ_NEW(pmix20_opcaddy_t);
op->spcbfunc = cbfunc;
op->cbdata = cbdata;
@ -1013,7 +983,7 @@ int pmix1_spawnnb(opal_list_t *job_info, opal_list_t *apps,
n=0;
OPAL_LIST_FOREACH(info, job_info, opal_value_t) {
(void)strncpy(op->info[n].key, info->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&op->info[n].value, info);
pmix20_value_load(&op->info[n].value, info);
++n;
}
}
@ -1032,7 +1002,7 @@ int pmix1_spawnnb(opal_list_t *job_info, opal_list_t *apps,
m=0;
OPAL_LIST_FOREACH(info, &app->info, opal_value_t) {
(void)strncpy(op->apps[n].info[m].key, info->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&op->apps[n].info[m].value, info);
pmix20_value_load(&op->apps[n].info[m].value, info);
++m;
}
}
@ -1041,16 +1011,16 @@ int pmix1_spawnnb(opal_list_t *job_info, opal_list_t *apps,
ret = PMIx_Spawn_nb(op->info, op->ninfo, op->apps, op->sz, spcbfunc, op);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_connect(opal_list_t *procs)
int pmix20_connect(opal_list_t *procs)
{
pmix_status_t ret;
pmix_proc_t *parray=NULL;
size_t n, cnt=0;
opal_namelist_t *ptr;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
/* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
@ -1065,7 +1035,7 @@ int pmix1_connect(opal_list_t *procs)
/* look thru our list of jobids and find the
* corresponding nspace */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) {
job = jptr;
break;
@ -1087,18 +1057,21 @@ int pmix1_connect(opal_list_t *procs)
ret = PMIx_Connect(parray, cnt, NULL, 0);
PMIX_PROC_FREE(parray, cnt);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_connectnb(opal_list_t *procs,
int pmix20_connectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
pmix_status_t ret;
size_t n, cnt=0;
opal_namelist_t *ptr;
pmix1_opcaddy_t *op;
opal_pmix1_jobid_trkr_t *job;
pmix20_opcaddy_t *op;
opal_pmix20_jobid_trkr_t *job;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
/* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
@ -1106,7 +1079,7 @@ int pmix1_connectnb(opal_list_t *procs,
}
/* create the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op = OBJ_NEW(pmix20_opcaddy_t);
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
op->nprocs = cnt;
@ -1118,7 +1091,7 @@ int pmix1_connectnb(opal_list_t *procs,
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the
* corresponding nspace */
OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (job->jobid == ptr->name.jobid) {
(void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN);
break;
@ -1134,16 +1107,16 @@ int pmix1_connectnb(opal_list_t *procs,
ret = PMIx_Connect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_disconnect(opal_list_t *procs)
int pmix20_disconnect(opal_list_t *procs)
{
pmix_status_t ret;
pmix_proc_t *parray=NULL;
size_t n, cnt=0;
opal_namelist_t *ptr;
opal_pmix1_jobid_trkr_t *job;
opal_pmix20_jobid_trkr_t *job;
/* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
@ -1157,7 +1130,7 @@ int pmix1_disconnect(opal_list_t *procs)
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the
* corresponding nspace */
OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (job->jobid == ptr->name.jobid) {
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
break;
@ -1174,18 +1147,21 @@ int pmix1_disconnect(opal_list_t *procs)
ret = PMIx_Disconnect(parray, cnt, NULL, 0);
PMIX_PROC_FREE(parray, cnt);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_disconnectnb(opal_list_t *procs,
int pmix20_disconnectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
pmix_status_t ret;
size_t n, cnt=0;
opal_namelist_t *ptr;
pmix1_opcaddy_t *op;
opal_pmix1_jobid_trkr_t *job;
pmix20_opcaddy_t *op;
opal_pmix20_jobid_trkr_t *job;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
/* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
@ -1193,7 +1169,7 @@ int pmix1_disconnectnb(opal_list_t *procs,
}
/* create the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op = OBJ_NEW(pmix20_opcaddy_t);
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
op->nprocs = cnt;
@ -1205,7 +1181,7 @@ int pmix1_disconnectnb(opal_list_t *procs,
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the
* corresponding nspace */
OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (job->jobid == ptr->name.jobid) {
(void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN);
break;
@ -1221,11 +1197,11 @@ int pmix1_disconnectnb(opal_list_t *procs,
ret = PMIx_Disconnect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op);
return pmix1_convert_rc(ret);
return pmix20_convert_rc(ret);
}
int pmix1_resolve_peers(const char *nodename, opal_jobid_t jobid,
int pmix20_resolve_peers(const char *nodename, opal_jobid_t jobid,
opal_list_t *procs)
{
char *nspace;
@ -1234,13 +1210,16 @@ int pmix1_resolve_peers(const char *nodename, opal_jobid_t jobid,
opal_namelist_t *nm;
int rc;
pmix_status_t ret;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
if (OPAL_JOBID_WILDCARD == jobid) {
nspace = NULL;
} else {
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == jobid) {
job = jptr;
break;
@ -1253,7 +1232,7 @@ int pmix1_resolve_peers(const char *nodename, opal_jobid_t jobid,
}
ret = PMIx_Resolve_peers(nodename, nspace, &array, &nprocs);
rc = pmix1_convert_rc(ret);
rc = pmix20_convert_rc(ret);
if (NULL != array && 0 < nprocs) {
for (n=0; n < nprocs; n++) {
@ -1270,14 +1249,14 @@ int pmix1_resolve_peers(const char *nodename, opal_jobid_t jobid,
}
/* if we don't already have it, add this to our jobid tracker */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == nm->name.jobid) {
job = jptr;
break;
}
}
if (NULL == job) {
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
job = OBJ_NEW(opal_pmix20_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
@ -1290,17 +1269,20 @@ int pmix1_resolve_peers(const char *nodename, opal_jobid_t jobid,
return rc;
}
int pmix1_resolve_nodes(opal_jobid_t jobid, char **nodelist)
int pmix20_resolve_nodes(opal_jobid_t jobid, char **nodelist)
{
pmix_status_t ret;
char *nspace=NULL;
opal_pmix1_jobid_trkr_t *job, *jptr;
opal_pmix20_jobid_trkr_t *job, *jptr;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
if (OPAL_JOBID_WILDCARD != jobid) {
/* look thru our list of jobids and find the
* corresponding nspace */
job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == jobid) {
job = jptr;
break;
@ -1314,5 +1296,5 @@ int pmix1_resolve_nodes(opal_jobid_t jobid, char **nodelist)
ret = PMIx_Resolve_nodes(nspace, nodelist);
return pmix1_convert_rc(ret);;
return pmix20_convert_rc(ret);;
}

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -35,6 +35,7 @@ const char *opal_pmix_ext20_component_version_string =
static int external_open(void);
static int external_close(void);
static int external_component_query(mca_base_module_t **module, int *priority);
static int external_register(void);
/*
@ -64,6 +65,7 @@ mca_pmix_ext20_component_t mca_pmix_ext20_component = {
.mca_open_component = external_open,
.mca_close_component = external_close,
.mca_query_component = external_component_query,
.mca_register_component_params = external_register,
},
/* Next the MCA v1.0.0 component meta data */
.base_data = {
@ -74,15 +76,38 @@ mca_pmix_ext20_component_t mca_pmix_ext20_component = {
.native_launch = false
};
static int external_register(void)
{
mca_pmix_ext20_component.cache_size = 256;
mca_base_component_var_register(&mca_pmix_ext20_component.super.base_version,
"cache_size", "Size of the ring buffer cache for events",
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_5,
MCA_BASE_VAR_SCOPE_CONSTANT,
&mca_pmix_ext20_component.cache_size);
return OPAL_SUCCESS;
}
static int external_open(void)
{
mca_pmix_ext20_component.evindex = 0;
OBJ_CONSTRUCT(&mca_pmix_ext20_component.jobids, opal_list_t);
OBJ_CONSTRUCT(&mca_pmix_ext20_component.single_events, opal_list_t);
OBJ_CONSTRUCT(&mca_pmix_ext20_component.multi_events, opal_list_t);
OBJ_CONSTRUCT(&mca_pmix_ext20_component.default_events, opal_list_t);
OBJ_CONSTRUCT(&mca_pmix_ext20_component.cache, opal_list_t);
return OPAL_SUCCESS;
}
static int external_close(void)
{
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.jobids);
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.single_events);
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.multi_events);
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.default_events);
OPAL_LIST_DESTRUCT(&mca_pmix_ext20_component.cache);
return OPAL_SUCCESS;
}

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

@ -44,7 +44,8 @@
/* These are the interfaces used by the embedded PMIx server
* to call up into ORTE for service requests */
static pmix_status_t server_client_connected_fn(const pmix_proc_t *proc, void* server_object);
static pmix_status_t server_client_connected_fn(const pmix_proc_t *proc, void* server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t server_client_finalized_fn(const pmix_proc_t *proc, void* server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t server_abort_fn(const pmix_proc_t *proc, void *server_object,
@ -83,13 +84,11 @@
static pmix_status_t server_deregister_events(pmix_status_t *codes, size_t ncodes,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t server_notify_event(pmix_status_t code,
pmix_proc_t procs[], size_t nprocs,
const pmix_proc_t *source,
pmix_data_range_t range,
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);
pmix_server_module_t mymodule = {
pmix_server_module_t mymodule = {
.client_connected = server_client_connected_fn,
.client_finalized = server_client_finalized_fn,
.abort = server_abort_fn,
@ -103,8 +102,7 @@
.disconnect = server_disconnect_fn,
.register_events = server_register_events,
.deregister_events = server_deregister_events,
.notify_event = server_notify_event,
.listener = server_listener_fn
.notify_event = server_notify_event
};
opal_pmix_server_module_t *host_module = NULL;
@ -112,39 +110,46 @@ opal_pmix_server_module_t *host_module = NULL;
static void opal_opcbfunc(int status, void *cbdata)
{
pmix1_opalcaddy_t *opalcaddy = (pmix1_opalcaddy_t*)cbdata;
pmix20_opalcaddy_t *opalcaddy = (pmix20_opalcaddy_t*)cbdata;
if (NULL != opalcaddy->opcbfunc) {
opalcaddy->opcbfunc(pmix1_convert_opalrc(status), opalcaddy->cbdata);
opalcaddy->opcbfunc(pmix20_convert_opalrc(status), opalcaddy->cbdata);
}
OBJ_RELEASE(opalcaddy);
}
static pmix_status_t server_client_connected_fn(const pmix_proc_t *p, void *server_object)
static pmix_status_t server_client_connected_fn(const pmix_proc_t *p, void *server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
int rc;
opal_process_name_t proc;
pmix20_opalcaddy_t *opalcaddy;
if (NULL == host_module || NULL == host_module->client_connected) {
return PMIX_SUCCESS;
}
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->opcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
/* convert the nspace/rank to an opal_process_name_t */
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) {
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
proc.vpid = p->rank;
/* pass it up */
rc = host_module->client_connected(&proc, server_object);
return pmix1_convert_opalrc(rc);
rc = host_module->client_connected(&proc, server_object,
opal_opcbfunc, opalcaddy);
return pmix20_convert_opalrc(rc);
}
static pmix_status_t server_client_finalized_fn(const pmix_proc_t *p, void* server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
int rc;
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
opal_process_name_t proc;
if (NULL == host_module || NULL == host_module->client_finalized) {
@ -153,12 +158,12 @@ static pmix_status_t server_client_finalized_fn(const pmix_proc_t *p, void* serv
/* convert the nspace/rank to an opal_process_name_t */
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) {
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
proc.vpid = p->rank;
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->opcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -167,7 +172,7 @@ static pmix_status_t server_client_finalized_fn(const pmix_proc_t *p, void* serv
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object,
@ -179,7 +184,7 @@ static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object,
opal_namelist_t *nm;
opal_process_name_t proc;
int rc;
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
if (NULL == host_module || NULL == host_module->abort) {
return PMIX_ERR_NOT_SUPPORTED;
@ -187,12 +192,12 @@ static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object,
/* convert the nspace/rank to an opal_process_name_t */
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) {
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
proc.vpid = p->rank;
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->opcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -202,7 +207,7 @@ static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object,
opal_list_append(&opalcaddy->procs, &nm->super);
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
if (PMIX_RANK_WILDCARD == procs[n].rank) {
nm->name.vpid = OPAL_VPID_WILDCARD;
@ -217,12 +222,12 @@ static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object,
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
static void _data_release(void *cbdata)
{
pmix1_opalcaddy_t *opalcaddy = (pmix1_opalcaddy_t*)cbdata;
pmix20_opalcaddy_t *opalcaddy = (pmix20_opalcaddy_t*)cbdata;
if (NULL != opalcaddy->odmdxfunc) {
opalcaddy->odmdxfunc(opalcaddy->ocbdata);
@ -234,9 +239,9 @@ static void opmdx_response(int status, const char *data, size_t sz, void *cbdata
opal_pmix_release_cbfunc_t relcbfunc, void *relcbdata)
{
pmix_status_t rc;
pmix1_opalcaddy_t *opalcaddy = (pmix1_opalcaddy_t*)cbdata;
pmix20_opalcaddy_t *opalcaddy = (pmix20_opalcaddy_t*)cbdata;
rc = pmix1_convert_rc(status);
rc = pmix20_convert_rc(status);
if (NULL != opalcaddy->mdxcbfunc) {
opalcaddy->odmdxfunc = relcbfunc;
opalcaddy->ocbdata = relcbdata;
@ -252,7 +257,7 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
char *data, size_t ndata,
pmix_modex_cbfunc_t cbfunc, void *cbdata)
{
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
size_t n;
opal_namelist_t *nm;
opal_value_t *iptr;
@ -263,7 +268,7 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
}
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->mdxcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -273,7 +278,7 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
opal_list_append(&opalcaddy->procs, &nm->super);
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
if (PMIX_RANK_WILDCARD == procs[n].rank) {
nm->name.vpid = OPAL_VPID_WILDCARD;
@ -287,9 +292,9 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
iptr = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &iptr->super);
iptr->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(iptr, &info[n].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(iptr, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
@ -299,7 +304,7 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
@ -307,7 +312,7 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
pmix_modex_cbfunc_t cbfunc, void *cbdata)
{
int rc;
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
opal_process_name_t proc;
opal_value_t *iptr;
size_t n;
@ -318,7 +323,7 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
/* convert the nspace/rank to an opal_process_name_t */
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) {
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
if (PMIX_RANK_WILDCARD == p->rank) {
proc.vpid = OPAL_VPID_WILDCARD;
@ -327,7 +332,7 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
}
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->mdxcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -336,9 +341,9 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
iptr = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &iptr->super);
iptr->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(iptr, &info[n].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(iptr, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
@ -350,7 +355,7 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
if (OPAL_ERR_IN_PROCESS == rc) {
rc = OPAL_SUCCESS;
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
static pmix_status_t server_publish_fn(const pmix_proc_t *p,
@ -359,7 +364,7 @@ static pmix_status_t server_publish_fn(const pmix_proc_t *p,
{
int rc;
size_t n;
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
opal_process_name_t proc;
opal_value_t *oinfo;
@ -369,7 +374,7 @@ static pmix_status_t server_publish_fn(const pmix_proc_t *p,
/* convert the nspace/rank to an opal_process_name_t */
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) {
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
if (PMIX_RANK_WILDCARD == p->rank) {
proc.vpid = OPAL_VPID_WILDCARD;
@ -378,7 +383,7 @@ static pmix_status_t server_publish_fn(const pmix_proc_t *p,
}
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->opcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -387,9 +392,9 @@ static pmix_status_t server_publish_fn(const pmix_proc_t *p,
oinfo = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &oinfo->super);
oinfo->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(oinfo, &info[n].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
@ -399,21 +404,21 @@ static pmix_status_t server_publish_fn(const pmix_proc_t *p,
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
static void opal_lkupcbfunc(int status,
opal_list_t *data,
void *cbdata)
{
pmix1_opalcaddy_t *opalcaddy = (pmix1_opalcaddy_t*)cbdata;
pmix20_opalcaddy_t *opalcaddy = (pmix20_opalcaddy_t*)cbdata;
pmix_status_t rc;
pmix_pdata_t *d=NULL;
size_t nd=0, n;
opal_pmix_pdata_t *p;
if (NULL != opalcaddy->lkupcbfunc) {
rc = pmix1_convert_opalrc(status);
rc = pmix20_convert_opalrc(status);
/* convert any returned data */
if (NULL != data) {
nd = opal_list_get_size(data);
@ -424,7 +429,7 @@ static void opal_lkupcbfunc(int status,
(void)opal_snprintf_jobid(d[n].proc.nspace, PMIX_MAX_NSLEN, p->proc.jobid);
d[n].proc.rank = p->proc.vpid;
(void)strncpy(d[n].key, p->value.key, PMIX_MAX_KEYLEN);
pmix1_value_load(&d[n].value, &p->value);
pmix20_value_load(&d[n].value, &p->value);
}
}
opalcaddy->lkupcbfunc(rc, d, nd, opalcaddy->cbdata);
@ -437,7 +442,7 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys,
pmix_lookup_cbfunc_t cbfunc, void *cbdata)
{
int rc;
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
opal_process_name_t proc;
opal_value_t *iptr;
size_t n;
@ -448,7 +453,7 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys,
/* convert the nspace/rank to an opal_process_name_t */
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) {
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
if (PMIX_RANK_WILDCARD == p->rank) {
proc.vpid = OPAL_VPID_WILDCARD;
@ -457,7 +462,7 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys,
}
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->lkupcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -466,9 +471,9 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys,
iptr = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &iptr->super);
iptr->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(iptr, &info[n].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(iptr, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
@ -478,7 +483,7 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys,
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
@ -487,7 +492,7 @@ static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
int rc;
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
opal_process_name_t proc;
opal_value_t *iptr;
size_t n;
@ -498,7 +503,7 @@ static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys,
/* convert the nspace/rank to an opal_process_name_t */
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) {
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
if (PMIX_RANK_WILDCARD == p->rank) {
proc.vpid = OPAL_VPID_WILDCARD;
@ -507,7 +512,7 @@ static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys,
}
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->opcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -516,9 +521,9 @@ static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys,
iptr = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &iptr->super);
iptr->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(iptr, &info[n].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(iptr, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
@ -528,17 +533,17 @@ static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys,
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
static void opal_spncbfunc(int status, opal_jobid_t jobid, void *cbdata)
{
pmix1_opalcaddy_t *opalcaddy = (pmix1_opalcaddy_t*)cbdata;
pmix20_opalcaddy_t *opalcaddy = (pmix20_opalcaddy_t*)cbdata;
pmix_status_t rc;
char nspace[PMIX_MAX_NSLEN];
if (NULL != opalcaddy->spwncbfunc) {
rc = pmix1_convert_opalrc(status);
rc = pmix20_convert_opalrc(status);
/* convert the jobid */
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
opalcaddy->spwncbfunc(rc, nspace, opalcaddy->cbdata);
@ -551,7 +556,7 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p,
const pmix_app_t apps[], size_t napps,
pmix_spawn_cbfunc_t cbfunc, void *cbdata)
{
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
opal_process_name_t proc;
opal_pmix_app_t *app;
opal_value_t *oinfo;
@ -564,7 +569,7 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p,
/* convert the nspace/rank to an opal_process_name_t */
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) {
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
if (PMIX_RANK_WILDCARD == p->rank) {
proc.vpid = OPAL_VPID_WILDCARD;
@ -573,7 +578,7 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p,
}
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->spwncbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -582,9 +587,9 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p,
oinfo = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &oinfo->super);
oinfo->key = strdup(job_info[k].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(oinfo, &job_info[k].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &job_info[k].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
@ -607,9 +612,9 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p,
oinfo = OBJ_NEW(opal_value_t);
opal_list_append(&app->info, &oinfo->super);
oinfo->key = strdup(apps[n].info[k].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(oinfo, &apps[n].info[k].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &apps[n].info[k].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
}
@ -621,7 +626,7 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p,
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
@ -630,7 +635,7 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
int rc;
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
opal_namelist_t *nm;
size_t n;
opal_value_t *oinfo;
@ -640,7 +645,7 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs,
}
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->opcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -650,7 +655,7 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs,
opal_list_append(&opalcaddy->procs, &nm->super);
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
if (PMIX_RANK_WILDCARD == procs[n].rank) {
nm->name.vpid = OPAL_VPID_WILDCARD;
@ -664,9 +669,9 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs,
oinfo = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &oinfo->super);
oinfo->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(oinfo, &info[n].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
@ -676,7 +681,7 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs,
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
@ -685,7 +690,7 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
int rc;
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
opal_namelist_t *nm;
size_t n;
opal_value_t *oinfo;
@ -695,7 +700,7 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro
}
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->opcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -705,7 +710,7 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro
opal_list_append(&opalcaddy->procs, &nm->super);
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
if (PMIX_RANK_WILDCARD == procs[n].rank) {
nm->name.vpid = OPAL_VPID_WILDCARD;
@ -719,9 +724,9 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro
oinfo = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &oinfo->super);
oinfo->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(oinfo, &info[n].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
@ -731,20 +736,20 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
static pmix_status_t server_register_events(pmix_status_t *codes, size_t ncodes,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix1_opalcaddy_t *opalcaddy;
pmix20_opalcaddy_t *opalcaddy;
size_t n;
opal_value_t *oinfo;
int rc;
/* setup the caddy */
opalcaddy = OBJ_NEW(pmix1_opalcaddy_t);
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->opcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;
@ -753,9 +758,9 @@ static pmix_status_t server_register_events(pmix_status_t *codes, size_t ncodes,
oinfo = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &oinfo->super);
oinfo->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix1_value_unload(oinfo, &info[n].value))) {
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
}
@ -765,7 +770,7 @@ static pmix_status_t server_register_events(pmix_status_t *codes, size_t ncodes,
OBJ_RELEASE(opalcaddy);
}
return pmix1_convert_opalrc(rc);
return pmix20_convert_opalrc(rc);
}
static pmix_status_t server_deregister_events(pmix_status_t *codes, size_t ncodes,
@ -775,22 +780,10 @@ static pmix_status_t server_deregister_events(pmix_status_t *codes, size_t ncode
}
static pmix_status_t server_notify_event(pmix_status_t code,
pmix_proc_t procs[], size_t nprocs,
const pmix_proc_t *source,
pmix_data_range_t range,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
return PMIX_ERR_NOT_SUPPORTED;
}
static pmix_status_t server_listener_fn(int listening_sd,
pmix_connection_cbfunc_t cbfunc)
{
int rc;
if (NULL == host_module || NULL == host_module->listener) {
return PMIX_ERR_NOT_SUPPORTED;
}
rc = host_module->listener(listening_sd, cbfunc);
return pmix1_convert_opalrc(rc);
}

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

@ -3,7 +3,7 @@
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
@ -57,66 +57,20 @@ static size_t errhdler_ref = 0;
} \
} while (0)
static void completion_handler (void *cbdata) {
bool *active = (bool *)cbdata;
*active = false;
}
static void myerr(size_t evhdlr_registration_id,
pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo,
pmix_event_notification_cbfunc_fn_t cbfunc,
void *cbdata)
{
int rc;
opal_list_t plist, ilist;
opal_namelist_t *nm;
opal_value_t *iptr;
size_t n;
volatile bool active;
/* convert the incoming status */
rc = pmix1_convert_rc(status);
/* convert the array of procs */
OBJ_CONSTRUCT(&plist, opal_list_t);
for (n=0; n < nprocs; n++) {
nm = OBJ_NEW(opal_namelist_t);
nm->name.jobid = strtoul(procs[n].nspace, NULL, 10);
nm->name.vpid = procs[n].rank;
opal_list_append(&plist, &nm->super);
}
/* convert the array of info */
OBJ_CONSTRUCT(&ilist, opal_list_t);
for (n=0; n < ninfo; n++) {
iptr = OBJ_NEW(opal_value_t);
iptr->key = strdup(info[n].key);
pmix1_value_unload(iptr, &info[n].value);
opal_list_append(&plist, &iptr->super);
}
/* call the base errhandler */
active = true;
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&active);
PMIX_WAIT_FOR_COMPLETION(active);
OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist);
}
static void errreg_cbfunc (pmix_status_t status,
size_t errhandler_ref,
void *cbdata)
{
volatile bool *active = (volatile bool*)cbdata;
errhdler_ref = errhandler_ref;
opal_output_verbose(5, opal_pmix_base_framework.framework_output,
"PMIX server errreg_cbfunc - error handler registered status=%d, reference=%lu",
status, (unsigned long)errhandler_ref);
*active = false;
}
int pmix1_server_init(opal_pmix_server_module_t *module,
int pmix20_server_init(opal_pmix_server_module_t *module,
opal_list_t *info)
{
pmix_status_t rc;
@ -124,6 +78,7 @@ int pmix1_server_init(opal_pmix_server_module_t *module,
opal_value_t *kv;
pmix_info_t *pinfo;
size_t sz, n;
volatile bool active;
if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) {
asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg);
@ -137,7 +92,7 @@ int pmix1_server_init(opal_pmix_server_module_t *module,
n = 0;
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pinfo[n].value, kv);
pmix20_value_load(&pinfo[n].value, kv);
++n;
}
} else {
@ -147,7 +102,7 @@ int pmix1_server_init(opal_pmix_server_module_t *module,
if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, pinfo, sz))) {
PMIX_INFO_FREE(pinfo, sz);
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
PMIX_INFO_FREE(pinfo, sz);
@ -155,79 +110,95 @@ int pmix1_server_init(opal_pmix_server_module_t *module,
host_module = module;
/* register the default event handler */
PMIx_Register_event_handler(NULL, 0, NULL, 0, myerr, errreg_cbfunc, NULL);
active = true;
PMIx_Register_event_handler(NULL, 0, NULL, 0, pmix20_event_hdlr, errreg_cbfunc, (void*)&active);
PMIX_WAIT_FOR_COMPLETION(active);
return OPAL_SUCCESS;
}
int pmix1_server_finalize(void)
static void fincb(pmix_status_t status, void *cbdata)
{
pmix_status_t rc;
/* deregister the default event handler */
PMIx_Deregister_event_handler(errhdler_ref, NULL, NULL);
rc = PMIx_server_finalize();
return pmix1_convert_rc(rc);
volatile bool *active = (volatile bool*)cbdata;
*active = false;
}
int pmix1_server_gen_regex(const char *input, char **regex)
int pmix20_server_finalize(void)
{
pmix_status_t rc;
volatile bool active;
/* deregister the default event handler */
active = true;
PMIx_Deregister_event_handler(errhdler_ref, fincb, (void*)&active);
PMIX_WAIT_FOR_COMPLETION(active);
rc = PMIx_server_finalize();
return pmix20_convert_rc(rc);
}
int pmix20_server_gen_regex(const char *input, char **regex)
{
pmix_status_t rc;
rc = PMIx_generate_regex(input, regex);
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
int pmix1_server_gen_ppn(const char *input, char **ppn)
int pmix20_server_gen_ppn(const char *input, char **ppn)
{
pmix_status_t rc;
rc = PMIx_generate_ppn(input, ppn);
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
static void opcbfunc(pmix_status_t status, void *cbdata)
{
pmix1_opcaddy_t *op = (pmix1_opcaddy_t*)cbdata;
pmix20_opcaddy_t *op = (pmix20_opcaddy_t*)cbdata;
if (NULL != op->opcbfunc) {
op->opcbfunc(pmix1_convert_rc(status), op->cbdata);
op->opcbfunc(pmix20_convert_rc(status), op->cbdata);
}
if (op->active) {
op->status = status;
op->active = false;
} else {
OBJ_RELEASE(op);
}
OBJ_RELEASE(op);
}
int pmix1_server_register_nspace(opal_jobid_t jobid,
int nlocalprocs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
static void _reg_nspace(int sd, short args, void *cbdata)
{
pmix20_threadshift_t *cd = (pmix20_threadshift_t*)cbdata;
opal_value_t *kv, *k2;
pmix_info_t *pinfo, *pmap;
pmix_info_t *pinfo = NULL, *pmap;
size_t sz, szmap, m, n;
char nspace[PMIX_MAX_NSLEN];
pmix_status_t rc;
pmix1_opcaddy_t *op;
opal_list_t *pmapinfo;
opal_pmix1_jobid_trkr_t *job;
opal_pmix20_jobid_trkr_t *job;
pmix20_opcaddy_t op;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
/* convert the jobid */
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, cd->jobid);
/* store this job in our list of known nspaces */
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
job = OBJ_NEW(opal_pmix20_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = jobid;
job->jobid = cd->jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
/* convert the list to an array of pmix_info_t */
if (NULL != info) {
sz = opal_list_get_size(info);
if (NULL != cd->info) {
sz = opal_list_get_size(cd->info);
PMIX_INFO_CREATE(pinfo, sz);
n = 0;
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
if (0 == strcmp(kv->key, OPAL_PMIX_PROC_DATA)) {
pinfo[n].value.type = PMIX_INFO_ARRAY;
@ -241,11 +212,11 @@ int pmix1_server_register_nspace(opal_jobid_t jobid,
m = 0;
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pmap[m].value, k2);
pmix20_value_load(&pmap[m].value, k2);
++m;
}
} else {
pmix1_value_load(&pinfo[n].value, kv);
pmix20_value_load(&pinfo[n].value, kv);
}
++n;
}
@ -254,82 +225,185 @@ int pmix1_server_register_nspace(opal_jobid_t jobid,
pinfo = NULL;
}
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op->info = pinfo;
op->sz = sz;
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
rc = PMIx_server_register_nspace(nspace, nlocalprocs, pinfo, sz,
opcbfunc, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
OBJ_CONSTRUCT(&op, pmix20_opcaddy_t);
op.active = true;
rc = PMIx_server_register_nspace(nspace, cd->status, pinfo, sz,
opcbfunc, (void*)&op);
if (PMIX_SUCCESS == rc) {
PMIX_WAIT_FOR_COMPLETION(op.active);
} else {
op.status = rc;
}
return pmix1_convert_rc(rc);
/* ensure we execute the cbfunc so the caller doesn't hang */
if (NULL != cd->opcbfunc) {
cd->opcbfunc(pmix20_convert_rc(op.status), cd->cbdata);
}
if (NULL != pinfo) {
PMIX_INFO_FREE(pinfo, sz);
}
OBJ_DESTRUCT(&op);
OBJ_RELEASE(cd);
}
void pmix1_server_deregister_nspace(opal_jobid_t jobid)
int pmix20_server_register_nspace(opal_jobid_t jobid,
int nlocalprocs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
opal_pmix1_jobid_trkr_t *jptr;
pmix20_threadshift_t *cd;
/* we must threadshift this request as it touches
* shared lists of objects */
cd = OBJ_NEW(pmix20_threadshift_t);
cd->jobid = jobid;
cd->status = nlocalprocs;
cd->info = info;
cd->opcbfunc = cbfunc;
cd->cbdata = cbdata;
/* if the cbfunc is NULL, then the caller is in an event
* and we can directly call the processing function */
if (NULL == cbfunc) {
_reg_nspace(0, 0, cd);
} else {
event_assign(&cd->ev, opal_pmix_base.evbase,
-1, EV_WRITE, _reg_nspace, cd);
event_active(&cd->ev, EV_WRITE, 1);
}
return OPAL_SUCCESS;
}
static void tdcbfunc(pmix_status_t status, void *cbdata)
{
pmix20_threadshift_t *cd = (pmix20_threadshift_t*)cbdata;
if (NULL != cd->opcbfunc) {
cd->opcbfunc(pmix20_convert_rc(status), cd->cbdata);
}
if (cd->active) {
cd->active = false;
} else {
OBJ_RELEASE(cd);
}
}
static void _dereg_nspace(int sd, short args, void *cbdata)
{
pmix20_threadshift_t *cd = (pmix20_threadshift_t*)cbdata;
opal_pmix20_jobid_trkr_t *jptr;
/* if we don't already have it, we can ignore this */
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
if (jptr->jobid == jobid) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == cd->jobid) {
/* found it - tell the server to deregister */
PMIx_server_deregister_nspace(jptr->nspace);
cd->active = true;
PMIx_server_deregister_nspace(jptr->nspace, tdcbfunc, cd);
PMIX_WAIT_FOR_COMPLETION(cd->active);
OBJ_RELEASE(cd);
/* now get rid of it from our list */
opal_list_remove_item(&mca_pmix_ext20_component.jobids, &jptr->super);
OBJ_RELEASE(jptr);
return;
}
}
/* must release the caller */
tdcbfunc(PMIX_ERR_NOT_FOUND, cd);
}
int pmix1_server_register_client(const opal_process_name_t *proc,
void pmix20_server_deregister_nspace(opal_jobid_t jobid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
pmix20_threadshift_t *cd;
/* we must threadshift this request as it touches
* shared lists of objects */
cd = OBJ_NEW(pmix20_threadshift_t);
cd->jobid = jobid;
cd->opcbfunc = cbfunc;
cd->cbdata = cbdata;
if (NULL == cbfunc) {
_dereg_nspace(0, 0, cd);
} else {
event_assign(&cd->ev, opal_pmix_base.evbase,
-1, EV_WRITE, _dereg_nspace, cd);
event_active(&cd->ev, EV_WRITE, 1);
}
}
int pmix20_server_register_client(const opal_process_name_t *proc,
uid_t uid, gid_t gid,
void *server_object,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
pmix_status_t rc;
pmix1_opcaddy_t *op;
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
pmix_proc_t p;
pmix20_opcaddy_t op;
/* convert the jobid */
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = proc->vpid;
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
p.rank = proc->vpid;
rc = PMIx_server_register_client(&op->p, uid, gid, server_object,
opcbfunc, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
OBJ_CONSTRUCT(&op, pmix20_opcaddy_t);
op.active = true;
rc = PMIx_server_register_client(&p, uid, gid, server_object,
opcbfunc, (void*)&op);
if (PMIX_SUCCESS == rc) {
PMIX_WAIT_FOR_COMPLETION(op.active);
rc = op.status;
}
return pmix1_convert_rc(rc);
OBJ_DESTRUCT(&op);
return pmix20_convert_rc(rc);
}
void pmix1_server_deregister_client(const opal_process_name_t *proc)
static void _dereg_client(int sd, short args, void *cbdata)
{
opal_pmix1_jobid_trkr_t *jptr;
pmix20_threadshift_t *cd = (pmix20_threadshift_t*)cbdata;
opal_pmix20_jobid_trkr_t *jptr;
pmix_proc_t p;
/* if we don't already have it, we can ignore this */
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix1_jobid_trkr_t) {
if (jptr->jobid == proc->jobid) {
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_pmix20_jobid_trkr_t) {
if (jptr->jobid == cd->source->jobid) {
/* found it - tell the server to deregister */
(void)strncpy(p.nspace, jptr->nspace, PMIX_MAX_NSLEN);
p.rank = proc->vpid;
PMIx_server_deregister_client(&p);
return;
p.rank = cd->source->vpid;
cd->active = true;
PMIx_server_deregister_client(&p, tdcbfunc, (void*)cd);
PMIX_WAIT_FOR_COMPLETION(cd->active);
break;
}
}
OBJ_RELEASE(cd);
}
/* tell the local PMIx server to cleanup this client as it is
* done executing */
void pmix20_server_deregister_client(const opal_process_name_t *proc,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
pmix20_threadshift_t *cd;
/* we must threadshift this request as we might not be in an event
* and we are going to access framework-global lists/objects */
cd = OBJ_NEW(pmix20_threadshift_t);
cd->source = proc;
cd->opcbfunc = cbfunc;
cd->cbdata = cbdata;
if (NULL == cbfunc) {
_dereg_client(0, 0, cd);
} else {
event_assign(&cd->ev, opal_pmix_base.evbase,
-1, EV_WRITE, _dereg_client, cd);
event_active(&cd->ev, EV_WRITE, 1);
}
}
int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env)
/* have the local PMIx server setup the environment for this client */
int pmix20_server_setup_fork(const opal_process_name_t *proc, char ***env)
{
pmix_status_t rc;
pmix_proc_t p;
@ -339,7 +413,7 @@ int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env)
p.rank = proc->vpid;
rc = PMIx_server_setup_fork(&p, env);
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
/* this is the call back up from the embedded PMIx server that
@ -348,23 +422,24 @@ int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env)
static void dmdx_response(pmix_status_t status, char *data, size_t sz, void *cbdata)
{
int rc;
pmix1_opcaddy_t *op = (pmix1_opcaddy_t*)cbdata;
pmix20_opcaddy_t *op = (pmix20_opcaddy_t*)cbdata;
rc = pmix1_convert_rc(status);
rc = pmix20_convert_rc(status);
if (NULL != op->mdxcbfunc) {
op->mdxcbfunc(rc, data, sz, op->cbdata, NULL, NULL);
}
OBJ_RELEASE(op);
}
int pmix1_server_dmodex(const opal_process_name_t *proc,
/* request modex data for a local proc from the PMIx server */
int pmix20_server_dmodex(const opal_process_name_t *proc,
opal_pmix_modex_cbfunc_t cbfunc, void *cbdata)
{
pmix1_opcaddy_t *op;
pmix20_opcaddy_t *op;
pmix_status_t rc;
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op = OBJ_NEW(pmix20_opcaddy_t);
op->mdxcbfunc = cbfunc;
op->cbdata = cbdata;
@ -377,50 +452,20 @@ int pmix1_server_dmodex(const opal_process_name_t *proc,
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}
int pmix1_server_notify_error(int status,
opal_list_t *procs,
opal_list_t *error_procs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
/* tell the PMIx server to notify its local clients of an event */
int pmix20_server_notify_event(int status,
const opal_process_name_t *source,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{
opal_value_t *kv;
pmix_info_t *pinfo;
size_t sz, psz, esz, n;
pmix_proc_t *ps, *eps;
size_t sz, n;
pmix_status_t rc;
pmix1_opcaddy_t *op;
opal_namelist_t *nm;
/* convert the list of procs */
if (NULL != procs) {
psz = opal_list_get_size(procs);
PMIX_PROC_CREATE(ps, psz);
n = 0;
OPAL_LIST_FOREACH(nm, procs, opal_namelist_t) {
(void)opal_snprintf_jobid(ps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
ps[n].rank = (int)nm->name.vpid;
++n;
}
} else {
psz = 0;
ps = NULL;
}
if (NULL != error_procs) {
esz = opal_list_get_size(error_procs);
PMIX_PROC_CREATE(eps, esz);
n = 0;
OPAL_LIST_FOREACH(nm, error_procs, opal_namelist_t) {
(void)opal_snprintf_jobid(eps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
eps[n].rank = (int)nm->name.vpid;
++n;
}
} else {
esz = 0;
eps = NULL;
}
pmix20_opcaddy_t *op;
/* convert the list to an array of pmix_info_t */
if (NULL != info) {
@ -429,29 +474,35 @@ int pmix1_server_notify_error(int status,
n = 0;
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pinfo[n].value, kv);
pmix20_value_load(&pinfo[n].value, kv);
}
} else {
sz = 0;
pinfo = NULL;
}
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op->procs = ps;
op->nprocs = psz;
op->error_procs = eps;
op->nerror_procs = esz;
op = OBJ_NEW(pmix20_opcaddy_t);
op->info = pinfo;
op->sz = sz;
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
/* convert the jobid */
if (NULL == source) {
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, OPAL_JOBID_INVALID);
op->p.rank = OPAL_VPID_INVALID;
} else {
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, source->jobid);
op->p.rank = source->vpid;
}
rc = pmix1_convert_opalrc(status);
rc = PMIx_Notify_event(rc, ps, psz, eps, esz,
rc = pmix20_convert_opalrc(status);
/* the range is irrelevant here as the server is passing
* the event down to its local clients */
rc = PMIx_Notify_event(rc, &op->p, PMIX_RANGE_LOCAL,
pinfo, sz, opcbfunc, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}
return pmix1_convert_rc(rc);
return pmix20_convert_rc(rc);
}

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

@ -106,8 +106,9 @@ const opal_pmix_base_module_t opal_pmix_isolated_module = {
.resolve_peers = isolated_resolve_peers,
.resolve_nodes = isolated_resolve_nodes,
.get_version = isolated_get_version,
.register_errhandler = opal_pmix_base_register_handler,
.deregister_errhandler = opal_pmix_base_deregister_handler,
.register_evhandler = opal_pmix_base_register_handler,
.deregister_evhandler = opal_pmix_base_deregister_handler,
.notify_event = opal_pmix_base_notify_event,
.store_local = isolated_store_local,
.get_nspace = isolated_get_nspace,
.register_jobid = isolated_register_jobid

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

@ -517,6 +517,9 @@ typedef int (*opal_pmix_base_module_resolve_nodes_fn_t)(opal_jobid_t jobid, char
/************************************************************
* SERVER APIs *
* *
* These are calls that go down (or "south") from the ORTE *
* daemon into the PMIx server library *
************************************************************/
/* Initialize the server support library - must pass the callback
@ -595,7 +598,9 @@ typedef int (*opal_pmix_base_module_server_register_nspace_fn_t)(opal_jobid_t jo
* can be freed. Note that the server will automatically
* purge all info relating to any clients it has from
* this nspace */
typedef void (*opal_pmix_base_module_server_deregister_nspace_fn_t)(opal_jobid_t jobid);
typedef void (*opal_pmix_base_module_server_deregister_nspace_fn_t)(opal_jobid_t jobid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
/* Register a client process with the PMIx server library. The
* expected user ID and group ID of the child process helps the
@ -623,7 +628,9 @@ typedef int (*opal_pmix_base_module_server_register_client_fn_t)(const opal_proc
* so there is no need to call this function during normal
* finalize operations. Instead, this is provided for use
* during exception operations */
typedef void (*opal_pmix_base_module_server_deregister_client_fn_t)(const opal_process_name_t *proc);
typedef void (*opal_pmix_base_module_server_deregister_client_fn_t)(const opal_process_name_t *proc,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
/* Setup the environment of a child process to be forked
* by the host so it can correctly interact with the PMIx
@ -645,40 +652,34 @@ typedef int (*opal_pmix_base_module_server_dmodex_request_fn_t)(const opal_proce
opal_pmix_modex_cbfunc_t cbfunc,
void *cbdata);
/* Report an error to a process for notification via any
* registered errhandler. The errhandler registration can be
/* Report an event to a process for notification via any
* registered event handler. The handler registration can be
* called by both the server and the client application. On the
* server side, the errhandler is used to report errors detected
* server side, the handler is used to report events detected
* by PMIx to the host server for handling. On the client side,
* the errhandler is used to notify the process of errors
* the handler is used to notify the process of events
* 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.
* convenience library to notify all registered local procs of
* an event. The event can be local, or anywhere in the cluster.
* The status indicates the event 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 source parameter informs the handler of the source that
* generated the event. This will be NULL if the event came
* from the external resource manager.
*
* 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
* notify_event 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! */
typedef int (*opal_pmix_base_module_server_notify_error_fn_t)(int status,
opal_list_t *procs,
opal_list_t *error_procs,
* data until the callback function has been executed if this
* function returns OPAL_SUCCESS! */
typedef int (*opal_pmix_base_module_server_notify_event_fn_t)(int status,
const opal_process_name_t *source,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
@ -690,90 +691,76 @@ typedef int (*opal_pmix_base_module_server_notify_error_fn_t)(int status,
/* get the version of the embedded library */
typedef const char* (*opal_pmix_base_module_get_version_fn_t)(void);
/* Register an errhandler to report errors. Three types of errors
/* Register an event handler to report event. Three types of events
* can be reported:
*
* (a) those that occur within the client library, but are not
* reportable via the API itself (e.g., loss of connection to
* the server). These errors typically occur during behind-the-scenes
* the server). These events typically occur during behind-the-scenes
* non-blocking operations.
*
* (b) job-related errors such as the failure of another process in
* (b) job-related events such as the failure of another process in
* the job or in any connected job, impending failure of hardware
* within the job's usage footprint, etc.
*
* (c) system notifications that are made available by the local
* administrators
*
* By default, only errors that directly affect the process and/or
* By default, only events that directly affect the process and/or
* any process to which it is connected (via the PMIx_Connect call)
* 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)
* event handlers for specific events. PMIx client/server calls the registered
* event handler upon receiving event notify notification (via PMIx_Notify_event)
* 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.
* Multiple event handlers can be registered for different events. PMIX returns
* a size_t reference to each register handler in the callback fn. The caller
* must retain the reference in order to deregister the evhandler.
* Modification of the notification behavior can be accomplished by
* deregistering the current errhandler, and then registering it
* deregistering the current evhandler, and then registering it
* using a new set of info values.
*
* A NULL for event_codes indicates registration as a default event handler
*
* See pmix_types.h for a description of the notification function */
typedef void (*opal_pmix_base_module_register_fn_t)(opal_list_t *info,
opal_pmix_notification_fn_t errhandler,
opal_pmix_errhandler_reg_cbfunc_t cbfunc,
typedef void (*opal_pmix_base_module_register_fn_t)(opal_list_t *event_codes,
opal_list_t *info,
opal_pmix_notification_fn_t evhandler,
opal_pmix_evhandler_reg_cbfunc_t cbfunc,
void *cbdata);
/* deregister the errhandler
* errhandler_ref is the reference returned by PMIx for the errhandler
* to pmix_errhandler_reg_cbfunc_t */
typedef void (*opal_pmix_base_module_deregister_fn_t)(int errhandler,
/* deregister the evhandler
* evhandler_ref is the reference returned by PMIx for the evhandler
* to pmix_evhandler_reg_cbfunc_t */
typedef void (*opal_pmix_base_module_deregister_fn_t)(size_t evhandler,
opal_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.
/* Report an event for notification via any
* registered evhandler. On the PMIx
* server side, this is used to report events detected
* by PMIx to the host server for handling and/or distribution.
*
* 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.
* resource manager of an event it detected. It can specify the
* range over which that notification should occur.
*
* 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
* The info array contains any further info the caller 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
* notify_event 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!
* data until the callback function has been executed if it
* returns OPAL_SUCCESS!
*/
typedef int (*opal_pmix_base_module_notify_error_fn_t)(int status,
opal_list_t *procs,
opal_list_t *error_procs,
typedef int (*opal_pmix_base_module_notify_event_fn_t)(int status,
const opal_process_name_t *source,
opal_pmix_data_range_t range,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
@ -830,12 +817,12 @@ typedef struct {
opal_pmix_base_module_server_deregister_client_fn_t server_deregister_client;
opal_pmix_base_module_server_setup_fork_fn_t server_setup_fork;
opal_pmix_base_module_server_dmodex_request_fn_t server_dmodex_request;
opal_pmix_base_module_server_notify_error_fn_t server_notify_error;
opal_pmix_base_module_server_notify_event_fn_t server_notify_event;
/* Utility APIs */
opal_pmix_base_module_get_version_fn_t get_version;
opal_pmix_base_module_register_fn_t register_errhandler;
opal_pmix_base_module_deregister_fn_t deregister_errhandler;
opal_pmix_base_module_notify_error_fn_t notify_error;
opal_pmix_base_module_register_fn_t register_evhandler;
opal_pmix_base_module_deregister_fn_t deregister_evhandler;
opal_pmix_base_module_notify_event_fn_t notify_event;
opal_pmix_base_module_store_fn_t store_local;
opal_pmix_base_module_get_nspace_fn_t get_nspace;
opal_pmix_base_module_register_jobid_fn_t register_jobid;

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

@ -1,53 +0,0 @@
#
# Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
EXTRA_DIST = autogen.subdirs
SUBDIRS = pmix
sources = \
pmix1.h \
pmix_pmix1_component.c \
pmix_pmix1.c \
pmix1_client.c \
pmix1_server_south.c \
pmix1_server_north.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_opal_pmix_pmix114_DSO
component_noinst =
component_install = mca_pmix_pmix114.la
else
component_noinst = libmca_pmix_pmix114.la
component_install =
endif
mcacomponentdir = $(opallibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_pmix_pmix114_la_SOURCES = $(sources)
mca_pmix_pmix114_la_CFLAGS = $(opal_pmix_pmix114_CFLAGS)
mca_pmix_pmix114_la_CPPFLAGS = \
-I$(srcdir)/pmix/include $(opal_pmix_pmix114_CPPFLAGS)
mca_pmix_pmix114_la_LDFLAGS = -module -avoid-version $(opal_pmix_pmix114_LDFLAGS)
mca_pmix_pmix114_la_LIBADD = $(opal_pmix_pmix114_LIBS)
mca_pmix_pmix114_la_DEPENDENCIES = $(mca_pmix_pmix114_la_LIBADD)
noinst_LTLIBRARIES = $(component_noinst)
libmca_pmix_pmix114_la_SOURCES =$(sources)
libmca_pmix_pmix114_la_CFLAGS = $(opal_pmix_pmix114_CFLAGS)
libmca_pmix_pmix114_la_CPPFLAGS = -I$(srcdir)/pmix/include $(opal_pmix_pmix114_CPPFLAGS)
libmca_pmix_pmix114_la_LDFLAGS = -module -avoid-version $(opal_pmix_pmix114_LDFLAGS)
libmca_pmix_pmix114_la_LIBADD = $(opal_pmix_pmix114_LIBS)
libmca_pmix_pmix114_la_DEPENDENCIES = $(mca_pmix_pmix114_la_LIBADD)

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

@ -1,75 +0,0 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 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) 2011-2013 Los Alamos National Security, LLC.
# All rights reserved.
# Copyright (c) 2010-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_pmix_pmix114_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_opal_pmix_pmix114_CONFIG],[
AC_CONFIG_FILES([opal/mca/pmix/pmix114/Makefile])
OPAL_VAR_SCOPE_PUSH([PMIX_VERSION opal_pmix_pmix114_save_CPPFLAGS opal_pmix_pmix114_save_LDFLAGS opal_pmix_pmix114_save_LIBS opal_pmix_pmix114_basedir opal_pmix_pmix114_save_cflags])
AS_IF([test "$opal_external_pmix_happy" = "yes"],
[AC_MSG_WARN([using an external pmix; disqualifiying this component])
opal_pmix_pmix114_happy=0],
[PMIX_VERSION=
opal_pmix_pmix114_basedir=opal/mca/pmix/pmix114
opal_pmix_pmix114_save_CFLAGS=$CFLAGS
opal_pmix_pmix114_save_CPPFLAGS=$CPPFLAGS
opal_pmix_pmix114_save_LDFLAGS=$LDFLAGS
opal_pmix_pmix114_save_LIBS=$LIBS
opal_pmix_pmix114_args="--enable-embedded-mode --with-pmix-symbol-prefix=opal_pmix_pmix114_ --disable-visibility --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --with-hwloc-header=\\\"$opal_hwloc_base_include\\\""
AS_IF([test "$enable_debug" = "yes"],
[opal_pmix_pmix114_args="--enable-debug $opal_pmix_pmix114_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"],
[opal_pmix_pmix114_args="--disable-debug $opal_pmix_pmix114_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"])
CPPFLAGS="-I$OPAL_TOP_SRCDIR -I$OPAL_TOP_BUILDDIR -I$OPAL_TOP_SRCDIR/opal/include -I$OPAL_TOP_BUILDDIR/opal/include $CPPFLAGS"
OPAL_CONFIG_SUBDIR([$opal_pmix_pmix114_basedir/pmix],
[$opal_pmix_pmix114_args $opal_subdir_args 'CFLAGS=$CFLAGS' 'CPPFLAGS=$CPPFLAGS'],
[opal_pmix_pmix114_happy=1], [opal_pmix_pmix114_happy=0])
AS_IF([test $opal_pmix_pmix114_happy -eq 1],
[PMIX_VERSION="internal v`$srcdir/$opal_pmix_pmix114_basedir/pmix/config/pmix_get_version.sh $srcdir/$opal_pmix_pmix114_basedir/pmix/VERSION`"
# Build flags for our Makefile.am
opal_pmix_pmix114_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_pmix_pmix114_basedir"'/pmix/libpmix.la'
opal_pmix_pmix114_CPPFLAGS='-I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix114/pmix/include/pmix -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix114/pmix/include -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix114/pmix -I$(OPAL_TOP_SRCDIR)/opal/mca/pmix/pmix114/pmix'
AC_SUBST([opal_pmix_pmix114_LIBS])
AC_SUBST([opal_pmix_pmix114_CPPFLAGS])])
CFLAGS=$opal_pmix_pmix114_save_CFLAGS
CPPFLAGS=$opal_pmix_pmix114_save_CPPFLAGS
LDFLAGS=$opal_pmix_pmix114_save_LDFLAGS
LIBS=$opal_pmix_pmix114_save_LIBS
])
AS_IF([test $opal_pmix_pmix114_happy -eq 1],
[$1],
[$2])
OPAL_VAR_SCOPE_POP
])dnl

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

@ -1,474 +0,0 @@
/* -*- C -*-
*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 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) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef PMIX_BFROP_INTERNAL_H_
#define PMIX_BFROP_INTERNAL_H_
#include <src/include/pmix_config.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* for struct timeval */
#endif
#include "src/class/pmix_pointer_array.h"
#include "buffer_ops.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#if PMIX_HAVE_HWLOC
#include PMIX_HWLOC_HEADER
#endif
BEGIN_C_DECLS
/*
* The default starting chunk size
*/
#define PMIX_BFROP_DEFAULT_INITIAL_SIZE 128
/*
* The default threshold size when we switch from doubling the
* buffer size to addatively increasing it
*/
#define PMIX_BFROP_DEFAULT_THRESHOLD_SIZE 1024
/*
* Internal type corresponding to size_t. Do not use this in
* interface calls - use PMIX_SIZE instead.
*/
#if SIZEOF_SIZE_T == 1
#define BFROP_TYPE_SIZE_T PMIX_UINT8
#elif SIZEOF_SIZE_T == 2
#define BFROP_TYPE_SIZE_T PMIX_UINT16
#elif SIZEOF_SIZE_T == 4
#define BFROP_TYPE_SIZE_T PMIX_UINT32
#elif SIZEOF_SIZE_T == 8
#define BFROP_TYPE_SIZE_T PMIX_UINT64
#else
#error Unsupported size_t size!
#endif
/*
* Internal type corresponding to bool. Do not use this in interface
* calls - use PMIX_BOOL instead.
*/
#if SIZEOF__BOOL == 1
#define BFROP_TYPE_BOOL PMIX_UINT8
#elif SIZEOF__BOOL == 2
#define BFROP_TYPE_BOOL PMIX_UINT16
#elif SIZEOF__BOOL == 4
#define BFROP_TYPE_BOOL PMIX_UINT32
#elif SIZEOF__BOOL == 8
#define BFROP_TYPE_BOOL PMIX_UINT64
#else
#error Unsupported bool size!
#endif
/*
* Internal type corresponding to int and unsigned int. Do not use
* this in interface calls - use PMIX_INT / PMIX_UINT instead.
*/
#if SIZEOF_INT == 1
#define BFROP_TYPE_INT PMIX_INT8
#define BFROP_TYPE_UINT PMIX_UINT8
#elif SIZEOF_INT == 2
#define BFROP_TYPE_INT PMIX_INT16
#define BFROP_TYPE_UINT PMIX_UINT16
#elif SIZEOF_INT == 4
#define BFROP_TYPE_INT PMIX_INT32
#define BFROP_TYPE_UINT PMIX_UINT32
#elif SIZEOF_INT == 8
#define BFROP_TYPE_INT PMIX_INT64
#define BFROP_TYPE_UINT PMIX_UINT64
#else
#error Unsupported int size!
#endif
/*
* Internal type corresponding to pid_t. Do not use this in interface
* calls - use PMIX_PID instead.
*/
#if SIZEOF_PID_T == 1
#define BFROP_TYPE_PID_T PMIX_UINT8
#elif SIZEOF_PID_T == 2
#define BFROP_TYPE_PID_T PMIX_UINT16
#elif SIZEOF_PID_T == 4
#define BFROP_TYPE_PID_T PMIX_UINT32
#elif SIZEOF_PID_T == 8
#define BFROP_TYPE_PID_T PMIX_UINT64
#else
#error Unsupported pid_t size!
#endif
/* Unpack generic size macros */
#define UNPACK_SIZE_MISMATCH(unpack_type, remote_type, ret) \
do { \
switch(remote_type) { \
case PMIX_UINT8: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint8_t, remote_type); \
break; \
case PMIX_INT8: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int8_t, remote_type); \
break; \
case PMIX_UINT16: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint16_t, remote_type); \
break; \
case PMIX_INT16: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int16_t, remote_type); \
break; \
case PMIX_UINT32: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint32_t, remote_type); \
break; \
case PMIX_INT32: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int32_t, remote_type); \
break; \
case PMIX_UINT64: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint64_t, remote_type); \
break; \
case PMIX_INT64: \
UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int64_t, remote_type); \
break; \
default: \
ret = PMIX_ERR_NOT_FOUND; \
} \
} while (0)
/* NOTE: do not need to deal with endianness here, as the unpacking of
the underling sender-side type will do that for us. Repeat: the
data in tmpbuf[] is already in host byte order. */
#define UNPACK_SIZE_MISMATCH_FOUND(unpack_type, tmptype, tmpbfroptype) \
do { \
int32_t i; \
tmptype *tmpbuf = (tmptype*)malloc(sizeof(tmptype) * (*num_vals)); \
ret = pmix_bfrop_unpack_buffer(buffer, tmpbuf, num_vals, tmpbfroptype); \
for (i = 0 ; i < *num_vals ; ++i) { \
((unpack_type*) dest)[i] = (unpack_type)(tmpbuf[i]); \
} \
free(tmpbuf); \
} while (0)
/**
* Internal struct used for holding registered bfrop functions
*/
typedef struct {
pmix_object_t super;
/* type identifier */
pmix_data_type_t odti_type;
/** Debugging string name */
char *odti_name;
/** Pack function */
pmix_bfrop_pack_fn_t odti_pack_fn;
/** Unpack function */
pmix_bfrop_unpack_fn_t odti_unpack_fn;
/** copy function */
pmix_bfrop_copy_fn_t odti_copy_fn;
/** print function */
pmix_bfrop_print_fn_t odti_print_fn;
} pmix_bfrop_type_info_t;
PMIX_DECLSPEC PMIX_CLASS_DECLARATION(pmix_bfrop_type_info_t);
/*
* globals needed within bfrop
*/
extern bool pmix_bfrop_initialized;
extern size_t pmix_bfrop_initial_size;
extern size_t pmix_bfrop_threshold_size;
extern pmix_pointer_array_t pmix_bfrop_types;
extern pmix_data_type_t pmix_bfrop_num_reg_types;
/* macro for registering data types */
#define PMIX_REGISTER_TYPE(n, t, p, u, c, pr) \
do { \
pmix_bfrop_type_info_t *_info; \
_info = PMIX_NEW(pmix_bfrop_type_info_t); \
_info->odti_name = strdup((n)); \
_info->odti_type = (t); \
_info->odti_pack_fn = (pmix_bfrop_pack_fn_t)(p); \
_info->odti_unpack_fn = (pmix_bfrop_unpack_fn_t)(u); \
_info->odti_copy_fn = (pmix_bfrop_copy_fn_t)(c) ; \
_info->odti_print_fn = (pmix_bfrop_print_fn_t)(pr) ; \
pmix_pointer_array_set_item(&pmix_bfrop_types, (t), _info); \
++pmix_bfrop_num_reg_types; \
} while (0)
/*
* Implementations of API functions
*/
pmix_status_t pmix_bfrop_pack(pmix_buffer_t *buffer, const void *src,
int32_t num_vals,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack(pmix_buffer_t *buffer, void *dest,
int32_t *max_num_vals,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy(void **dest, void *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print(char **output, char *prefix, void *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src);
/*
* Specialized functions
*/
PMIX_DECLSPEC pmix_status_t pmix_bfrop_pack_buffer(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
PMIX_DECLSPEC pmix_status_t pmix_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst,
int32_t *num_vals, pmix_data_type_t type);
/*
* Internal pack functions
*/
pmix_status_t pmix_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_string(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_int(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_float(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_double(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_pack_topo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
#endif
pmix_status_t pmix_bfrop_pack_value(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_info(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
/*
* Internal unpack functions
*/
pmix_status_t pmix_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_unpack_topo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
#endif
pmix_status_t pmix_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_status_t pmix_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
/*
* Internal copy functions
*/
pmix_status_t pmix_bfrop_std_copy(void **dest, void *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_string(char **dest, char *src, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_copy_topo(hwloc_topology_t *dest,
hwloc_topology_t src,
pmix_data_type_t type);
#endif
pmix_status_t pmix_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_array(pmix_info_array_t **dest, pmix_info_array_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src,
pmix_data_type_t type);
pmix_status_t pmix_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src,
pmix_data_type_t type);
/*
* Internal print functions
*/
pmix_status_t pmix_bfrop_print_bool(char **output, char *prefix, bool *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_byte(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_string(char **output, char *prefix, char *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_size(char **output, char *prefix, size_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_pid(char **output, char *prefix, pid_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int(char **output, char *prefix, int *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int8(char **output, char *prefix, int8_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int16(char **output, char *prefix, int16_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int32(char **output, char *prefix, int32_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_int64(char **output, char *prefix, int64_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint(char **output, char *prefix, uint *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint8(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint16(char **output, char *prefix, uint16_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint32(char **output, char *prefix, uint32_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_uint64(char **output, char *prefix, uint64_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_float(char **output, char *prefix, float *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_double(char **output, char *prefix, double *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_timeval(char **output, char *prefix, struct timeval *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_time(char **output, char *prefix, time_t *src, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
pmix_status_t pmix_bfrop_print_topo(char **output, char *prefix,
hwloc_topology_t src, pmix_data_type_t type);
#endif
pmix_status_t pmix_bfrop_print_value(char **output, char *prefix, pmix_value_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_array(char **output, char *prefix,
pmix_info_array_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_proc(char **output, char *prefix,
pmix_proc_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_app(char **output, char *prefix,
pmix_app_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_info(char **output, char *prefix,
pmix_info_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_buf(char **output, char *prefix,
pmix_buffer_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_kval(char **output, char *prefix,
pmix_kval_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_modex(char **output, char *prefix,
pmix_modex_data_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_persist(char **output, char *prefix,
pmix_persistence_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_bo(char **output, char *prefix,
pmix_byte_object_t *src, pmix_data_type_t type);
pmix_status_t pmix_bfrop_print_pdata(char **output, char *prefix,
pmix_pdata_t *src, pmix_data_type_t type);
/*
* Internal helper functions
*/
char* pmix_bfrop_buffer_extend(pmix_buffer_t *bptr, size_t bytes_to_add);
bool pmix_bfrop_too_small(pmix_buffer_t *buffer, size_t bytes_reqd);
pmix_bfrop_type_info_t* pmix_bfrop_find_type(pmix_data_type_t type);
pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type);
pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type);
END_C_DECLS
#endif

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

@ -1,48 +0,0 @@
/*
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_CLIENT_OPS_H
#define PMIX_CLIENT_OPS_H
#include <src/include/pmix_config.h>
#include "src/buffer_ops/buffer_ops.h"
#include "src/class/pmix_hash_table.h"
#include "src/usock/usock.h"
BEGIN_C_DECLS
typedef struct {
pmix_peer_t myserver; // messaging support to/from my server
pmix_list_t pending_requests; // list of pmix_cb_t pending data requests
} pmix_client_globals_t;
extern pmix_client_globals_t pmix_client_globals;
void pmix_client_process_nspace_blob(const char *nspace, pmix_buffer_t *bptr);
void pmix_client_register_errhandler(pmix_info_t info[], size_t ninfo,
pmix_notification_fn_t errhandler,
pmix_errhandler_reg_cbfunc_t cbfunc,
void *cbdata);
void pmix_client_deregister_errhandler(int errhandler_ref,
pmix_op_cbfunc_t cbfunc,
void *cbdata);
pmix_status_t pmix_client_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 /* PMIX_CLIENT_OPS_H */

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

@ -1,11 +0,0 @@
#
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
sources += \
src/common/pmix_common.c

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

@ -1,116 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 IBM Corporation, All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <src/include/types.h>
#include <pmix/autogen/pmix_stdint.h>
#include <src/include/pmix_socket_errno.h>
#include <pmix.h>
#include <pmix/pmix_common.h>
#include <pmix_server.h>
#include "src/util/output.h"
#include "src/client/pmix_client_ops.h"
#include "src/server/pmix_server_ops.h"
#include "src/include/pmix_globals.h"
PMIX_EXPORT void PMIx_Register_errhandler(pmix_info_t info[], size_t ninfo,
pmix_notification_fn_t errhandler,
pmix_errhandler_reg_cbfunc_t cbfunc,
void *cbdata)
{
if (pmix_globals.init_cntr <= 0) {
return;
}
/* common err handler registration */
if (pmix_globals.server) {
/* PMIX server: store the error handler, process info keys and call
* cbfunc with reference to the errhandler */
pmix_output_verbose(2, pmix_globals.debug_output,
"registering server err handler");
pmix_server_register_errhandler(info, ninfo,
errhandler,
cbfunc,cbdata);
} else {
/* PMIX client: store the error handler, process info keys &
* call pmix_server_register_for_events, and call cbfunc with
* reference to the errhandler */
pmix_output_verbose(2, pmix_globals.debug_output,
"registering client err handler");
pmix_client_register_errhandler(info, ninfo,
errhandler,
cbfunc, cbdata);
}
}
PMIX_EXPORT void PMIx_Deregister_errhandler(int errhandler_ref,
pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
if (pmix_globals.init_cntr <= 0) {
return;
}
if (errhandler_ref < 0) {
return;
}
/* common err handler registration */
if (pmix_globals.server) {
/* PMIX server: store the error handler, process info keys and call
* cbfunc with reference to the errhandler */
pmix_server_deregister_errhandler(errhandler_ref,cbfunc,cbdata);
pmix_output_verbose(2, pmix_globals.debug_output,
"deregistering server err handler");
} else {
/* PMIX client: store the error handler, process info keys &
* call pmix_server_register_for_events, and call cbfunc with
* reference to the errhandler */
pmix_client_deregister_errhandler(errhandler_ref, cbfunc, cbdata);
pmix_output_verbose(2, pmix_globals.debug_output,
"deregistering client err handler");
}
}
PMIX_EXPORT 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)
{
int rc;
if (pmix_globals.init_cntr <= 0) {
return PMIX_ERR_INIT;
}
if (pmix_globals.server) {
rc = pmix_server_notify_error(status, procs, nprocs, error_procs,
error_nprocs, info, ninfo,
cbfunc, cbdata);
pmix_output_verbose(0, pmix_globals.debug_output,
"pmix_server_notify_error error =%d, rc=%d", status, rc);
} else {
rc = pmix_client_notify_error(status, procs, nprocs, error_procs,
error_nprocs, info, ninfo,
cbfunc, cbdata);
pmix_output_verbose(0, pmix_globals.debug_output,
"pmix_client_notify_error error =%d, rc=%d", status, rc);
}
return rc;
}

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

@ -1,297 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 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) 2007-2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <errno.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <pmix/pmix_common.h>
#include "src/util/error.h"
#include "src/include/pmix_globals.h"
#include "src/buffer_ops/buffer_ops.h"
const char* PMIx_Error_string(pmix_status_t errnum)
{
switch(errnum) {
case PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER:
return "UNPACK-PAST-END";
case PMIX_ERR_COMM_FAILURE:
return "COMM-FAILURE";
case PMIX_ERR_NOT_IMPLEMENTED:
return "NOT-IMPLEMENTED";
case PMIX_ERR_NOT_SUPPORTED:
return "NOT-SUPPORTED";
case PMIX_ERR_NOT_FOUND:
return "NOT-FOUND";
case PMIX_ERR_SERVER_NOT_AVAIL:
return "SERVER-NOT-AVAIL";
case PMIX_ERR_INVALID_NAMESPACE:
return "INVALID-NAMESPACE";
case PMIX_ERR_INVALID_SIZE:
return "INVALID-SIZE";
case PMIX_ERR_INVALID_KEYVALP:
return "INVALID-KEYVAL";
case PMIX_ERR_INVALID_NUM_PARSED:
return "INVALID-NUM-PARSED";
case PMIX_ERR_INVALID_ARGS:
return "INVALID-ARGS";
case PMIX_ERR_INVALID_NUM_ARGS:
return "INVALID-NUM-ARGS";
case PMIX_ERR_INVALID_LENGTH:
return "INVALID-LENGTH";
case PMIX_ERR_INVALID_VAL_LENGTH:
return "INVALID-VAL-LENGTH";
case PMIX_ERR_INVALID_VAL:
return "INVALID-VAL";
case PMIX_ERR_INVALID_KEY_LENGTH:
return "INVALID-KEY-LENGTH";
case PMIX_ERR_INVALID_KEY:
return "INVALID-KEY";
case PMIX_ERR_INVALID_ARG:
return "INVALID-ARG";
case PMIX_ERR_NOMEM:
return "NO-MEM";
case PMIX_ERR_INIT:
return "INIT";
case PMIX_ERR_DATA_VALUE_NOT_FOUND:
return "DATA-VALUE-NOT-FOUND";
case PMIX_ERR_OUT_OF_RESOURCE:
return "OUT-OF-RESOURCE";
case PMIX_ERR_RESOURCE_BUSY:
return "RESOURCE-BUSY";
case PMIX_ERR_BAD_PARAM:
return "BAD-PARAM";
case PMIX_ERR_IN_ERRNO:
return "ERR-IN-ERRNO";
case PMIX_ERR_UNREACH:
return "UNREACHABLE";
case PMIX_ERR_TIMEOUT:
return "TIMEOUT";
case PMIX_ERR_NO_PERMISSIONS:
return "NO-PERMISSIONS";
case PMIX_ERR_PACK_MISMATCH:
return "PACK-MISMATCH";
case PMIX_ERR_PACK_FAILURE:
return "PACK-FAILURE";
case PMIX_ERR_UNPACK_FAILURE:
return "UNPACK-FAILURE";
case PMIX_ERR_UNPACK_INADEQUATE_SPACE:
return "UNPACK-INADEQUATE-SPACE";
case PMIX_ERR_TYPE_MISMATCH:
return "TYPE-MISMATCH";
case PMIX_ERR_PROC_ENTRY_NOT_FOUND:
return "PROC-ENTRY-NOT-FOUND";
case PMIX_ERR_UNKNOWN_DATA_TYPE:
return "UNKNOWN-DATA-TYPE";
case PMIX_ERR_WOULD_BLOCK:
return "WOULD-BLOCK";
case PMIX_ERR_READY_FOR_HANDSHAKE:
return "READY-FOR-HANDSHAKE";
case PMIX_ERR_HANDSHAKE_FAILED:
return "HANDSHAKE-FAILED";
case PMIX_ERR_INVALID_CRED:
return "INVALID-CREDENTIAL";
case PMIX_EXISTS:
return "EXISTS";
case PMIX_ERR_SERVER_FAILED_REQUEST:
return "SERVER FAILED REQUEST";
case PMIX_ERR_PROC_MIGRATE:
return "PROC-MIGRATE";
case PMIX_ERR_PROC_CHECKPOINT:
return "PROC-CHECKPOINT-ERROR";
case PMIX_ERR_PROC_RESTART:
return "PROC_RESTART";
case PMIX_ERR_PROC_ABORTING:
return "PROC-ABORTING";
case PMIX_ERR_PROC_REQUESTED_ABORT:
return "PROC-ABORT-REQUESTED";
case PMIX_ERR_PROC_ABORTED:
return "PROC-ABORTED";
case PMIX_ERR_DEBUGGER_RELEASE:
return "DEBUGGER-RELEASE";
case PMIX_ERR_SILENT:
return "SILENT_ERROR";
case PMIX_ERROR:
return "ERROR";
case PMIX_SUCCESS:
return "SUCCESS";
}
return "ERROR STRING NOT FOUND";
}
void pmix_errhandler_invoke(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo)
{
/* We need to parse thru each registered handler and determine
* which one to call for the specific error */
int i, idflt;
size_t j;
bool fired = false;
pmix_error_reg_info_t *errreg, *errdflt=NULL;
pmix_info_t *iptr;
PMIX_INFO_CREATE(iptr, ninfo+1);
(void)strncpy(iptr[0].key, PMIX_ERROR_HANDLER_ID, PMIX_MAX_KEYLEN);
iptr[0].value.type = PMIX_INT;
if (NULL != info) {
for (j=0; j < ninfo; j++) {
PMIX_INFO_LOAD(&iptr[j+1], info[j].key, &info[j].value.data, info[j].value.type);
}
}
for (i = 0; i < pmix_globals.errregs.size; i++) {
if (NULL == (errreg = (pmix_error_reg_info_t*) pmix_pointer_array_get_item(&pmix_globals.errregs, i))) {
continue;
}
if (NULL == errreg->info || 0 == errreg->ninfo) {
// this is a general err handler - we will call it if there is no better match
errdflt = errreg;
idflt = i;
continue;
}
iptr[0].value.data.integer = i;
/* match error name key first */
for (j = 0; j < errreg->ninfo; j++) {
if ((0 == strcmp(errreg->info[j].key, PMIX_ERROR_NAME)) &&
(status == errreg->info[j].value.data.int32)) {
iptr[0].value.data.integer = i;
errreg->errhandler(status, procs, nprocs, iptr, ninfo+1);
fired = true;
break;
}
}
}
/* if nothing fired and we found a general err handler, then fire it */
if (!fired && NULL != errdflt) {
iptr[0].value.data.integer = idflt;
errdflt->errhandler(status, procs, nprocs, iptr, ninfo+1);
}
/* cleanup */
PMIX_INFO_FREE(iptr, ninfo+1);
}
pmix_status_t pmix_lookup_errhandler(pmix_notification_fn_t err,
int *index)
{
int i;
pmix_error_reg_info_t *errreg;
pmix_status_t rc = PMIX_ERR_NOT_FOUND;
for (i = 0; i < pmix_pointer_array_get_size(&pmix_globals.errregs) ; i++) {
errreg = (pmix_error_reg_info_t*)pmix_pointer_array_get_item(&pmix_globals.errregs, i);
if ((NULL != errreg) && (err == errreg->errhandler)) {
*index = i;
rc = PMIX_SUCCESS;
break;
}
}
return rc;
}
pmix_status_t pmix_add_errhandler(pmix_notification_fn_t err,
pmix_info_t *info, int ninfo,
int *index)
{
int i;
pmix_status_t rc = PMIX_SUCCESS;
pmix_error_reg_info_t *errreg;
errreg = PMIX_NEW(pmix_error_reg_info_t);
errreg->errhandler = err;
errreg->ninfo = ninfo;
if (NULL != info && 0 < ninfo) {
PMIX_INFO_CREATE(errreg->info, ninfo);
for (i=0; i < ninfo; i++) {
(void)strncpy(errreg->info[i].key, info[i].key, PMIX_MAX_KEYLEN);
pmix_value_xfer(&errreg->info[i].value, &info[i].value);
}
}
*index = pmix_pointer_array_add(&pmix_globals.errregs, errreg);
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_add_errhandler index =%d", *index);
if (*index < 0) {
PMIX_RELEASE(errreg);
rc = PMIX_ERROR;
}
return rc;
}
pmix_status_t pmix_remove_errhandler(int errhandler_ref)
{
int rc = PMIX_SUCCESS;
pmix_error_reg_info_t *errreg;
errreg = (pmix_error_reg_info_t*)pmix_pointer_array_get_item(&pmix_globals.errregs,
errhandler_ref);
if (NULL != errreg) {
PMIX_RELEASE(errreg);
pmix_pointer_array_set_item(&pmix_globals.errregs, errhandler_ref, NULL);
} else {
rc = PMIX_ERR_NOT_FOUND;
}
return rc;
}
void pmix_get_errorgroup(pmix_status_t status, char *pmix_error_group)
{
switch(status) {
case PMIX_ERR_UNREACH:
case PMIX_ERR_COMM_FAILURE:
case PMIX_ERR_SERVER_NOT_AVAIL:
case PMIX_ERR_TIMEOUT:
case PMIX_ERR_PACK_FAILURE:
case PMIX_ERR_UNPACK_FAILURE:
(void)strncpy(pmix_error_group, PMIX_ERROR_GROUP_COMM, PMIX_MAX_KEYLEN);
break;
case PMIX_ERR_OUT_OF_RESOURCE:
case PMIX_ERR_RESOURCE_BUSY:
case PMIX_ERR_NOMEM:
(void)strncpy(pmix_error_group, PMIX_ERROR_GROUP_RESOURCE, PMIX_MAX_KEYLEN);
break;
case PMIX_ERR_PROC_MIGRATE:
case PMIX_ERR_PROC_CHECKPOINT:
case PMIX_ERR_PROC_RESTART:
(void)strncpy(pmix_error_group, PMIX_ERROR_GROUP_MIGRATE, PMIX_MAX_KEYLEN);
break;
case PMIX_ERR_PROC_ABORTING:
case PMIX_ERR_PROC_REQUESTED_ABORT:
case PMIX_ERR_PROC_ABORTED:
(void)strncpy(pmix_error_group, PMIX_ERROR_GROUP_ABORT, PMIX_MAX_KEYLEN);
break;
default:
(void)strncpy(pmix_error_group, PMIX_ERROR_GROUP_GENERAL, PMIX_MAX_KEYLEN);
}
}

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

@ -1,70 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 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) 2015-2016 Intel, Inc. All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_UTIL_ERROR_H
#define PMIX_UTIL_ERROR_H
#include <src/include/pmix_config.h>
#include <pmix/pmix_common.h>
#include "src/util/output.h"
BEGIN_C_DECLS
#define PMIX_ERROR_LOG(r) \
do { \
if (PMIX_ERR_SILENT != (r)) { \
pmix_output(0, "PMIX ERROR: %s in file %s at line %d", \
PMIx_Error_string((r)), __FILE__, __LINE__); \
} \
} while (0)
#define PMIX_REPORT_ERROR(e) \
pmix_errhandler_invoke(e, NULL, 0, NULL, 0)
void pmix_errhandler_invoke(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo);
pmix_status_t pmix_lookup_errhandler(pmix_notification_fn_t err,
int *index);
pmix_status_t pmix_add_errhandler(pmix_notification_fn_t err,
pmix_info_t *info, int ninfo,
int *index);
pmix_status_t pmix_remove_errhandler(int errhandler_ref);
void pmix_get_errorgroup(pmix_status_t status, char *pmix_error_group);
PMIX_DECLSPEC pmix_status_t pmix_lookup_errhandler(pmix_notification_fn_t err,
int *index);
PMIX_DECLSPEC pmix_status_t pmix_add_errhandler(pmix_notification_fn_t err,
pmix_info_t *info, int ninfo,
int *index);
PMIX_DECLSPEC pmix_status_t pmix_remove_errhandler(int errhandler_ref);
PMIX_DECLSPEC void pmix_get_errorgroup ( pmix_status_t status, char *pmix_error_group);
END_C_DECLS
#endif /* PMIX_UTIL_ERROR_H */

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

@ -1,102 +0,0 @@
/*
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include <time.h>
#include "test_error.h"
#include "test_common.h"
#define MAX_ERR_HANDLERS 5
#define TEST_NOTIFY PMIX_ERR_TIMEOUT
static bool done;
static void comfail_errhandler(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo)
{
TEST_ERROR(("comfail errhandler called for error status = %d nprocs =%d ninfo = %d",
status, nprocs, ninfo));
}
static void timeout_errhandler(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo)
{
TEST_ERROR(("timeout errhandler called for error status = %d nprocs = %d ninfo = %d",
status, nprocs, ninfo));
}
static void op1_callbk(pmix_status_t status,
void *cbdata)
{
TEST_VERBOSE(( "op1_callbk CALLED WITH STATUS %d", status));
done = true;
}
static void errhandler_reg_callbk1 (pmix_status_t status,
int errhandler_ref,
void *cbdata)
{
int *ref = (int*) cbdata;
*ref = errhandler_ref;
TEST_VERBOSE(("PMIX client ERRHANDLER REGISTRATION CALLED WITH STATUS %d, ref=%d",
status, *ref, errhandler_ref));
}
int test_error(char *my_nspace, int my_rank, test_params params)
{
pmix_info_t *info;
size_t ninfo;
int errhandler_refs[MAX_ERR_HANDLERS];
int value;
struct timespec ts;
TEST_VERBOSE(("test-error: running error handling test cases"));
/* register specific client error handlers and test their invocation
* by trigerring events from server side*/
ninfo = 1;
value = PMIX_ERR_TIMEOUT;
PMIX_INFO_CREATE(info, ninfo);
(void)strncpy(info[0].key, PMIX_ERROR_NAME, PMIX_MAX_KEYLEN);
pmix_value_load(&info[0].value, &value, PMIX_INT);
PMIx_Register_errhandler(info, 1, timeout_errhandler, errhandler_reg_callbk1, &errhandler_refs[0]);
/* reg a handler for comm errors */
(void)strncpy(info[0].key, PMIX_ERROR_GROUP_COMM, PMIX_MAX_KEYLEN);
value = 1;
pmix_value_load(&info[0].value, &value, PMIX_BOOL);
PMIx_Register_errhandler(info, 1, comfail_errhandler, errhandler_reg_callbk1, &errhandler_refs[1]);
/* inject error from client */
done = false;
/* change error value to test other error notifications */
PMIx_Notify_error(TEST_NOTIFY,
NULL, 0,
NULL, 0, NULL, 0,
op1_callbk, NULL);
while(!done) {
ts.tv_sec = 0;
ts.tv_nsec = 100000;
nanosleep(&ts, NULL);
}
done = false;
/* dereg all handlers*/
PMIx_Deregister_errhandler( errhandler_refs[0], op1_callbk, NULL);
/* loop until we get callback */
while(!done) {
ts.tv_sec = 0;
ts.tv_nsec = 100000;
nanosleep(&ts, NULL);
}
done = false;
PMIx_Deregister_errhandler( errhandler_refs[1], op1_callbk, NULL);
/* loop until we get callback */
while(!done) {
ts.tv_sec = 0;
ts.tv_nsec = 100000;
nanosleep(&ts, NULL);
}
return PMIX_SUCCESS;
}

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

@ -1,174 +0,0 @@
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MCA_PMIX_PMIX1_H
#define MCA_PMIX_PMIX1_H
#include "opal_config.h"
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#include "opal/mca/mca.h"
#include "opal/mca/event/event.h"
#include "opal/util/proc.h"
#include "opal/mca/pmix/pmix.h"
#include "opal/mca/pmix/pmix_server.h"
#include "opal/mca/pmix/pmix114/pmix/include/pmix_server.h"
#include "opal/mca/pmix/pmix114/pmix/include/pmix/pmix_common.h"
BEGIN_C_DECLS
typedef struct {
opal_pmix_base_component_t super;
opal_list_t jobids;
bool native_launch;
} mca_pmix_pmix1_component_t;
OPAL_DECLSPEC extern mca_pmix_pmix1_component_t mca_pmix_pmix114_component;
OPAL_DECLSPEC extern const opal_pmix_base_module_t opal_pmix_pmix114_module;
/**** INTERNAL OBJECTS ****/
typedef struct {
opal_list_item_t super;
opal_jobid_t jobid;
char nspace[PMIX_MAX_NSLEN + 1];
} opal_pmix1_jobid_trkr_t;
OBJ_CLASS_DECLARATION(opal_pmix1_jobid_trkr_t);
typedef struct {
opal_object_t super;
pmix_proc_t p;
pmix_proc_t *procs;
size_t nprocs;
pmix_proc_t *error_procs;
size_t nerror_procs;
pmix_info_t *info;
size_t ninfo;
pmix_app_t *apps;
size_t sz;
opal_pmix_op_cbfunc_t opcbfunc;
opal_pmix_modex_cbfunc_t mdxcbfunc;
opal_pmix_value_cbfunc_t valcbfunc;
opal_pmix_lookup_cbfunc_t lkcbfunc;
opal_pmix_spawn_cbfunc_t spcbfunc;
void *cbdata;
} pmix1_opcaddy_t;
OBJ_CLASS_DECLARATION(pmix1_opcaddy_t);
typedef struct {
opal_object_t super;
opal_list_t procs;
opal_list_t info;
opal_list_t apps;
pmix_op_cbfunc_t opcbfunc;
pmix_dmodex_response_fn_t dmdxfunc;
pmix_modex_cbfunc_t mdxcbfunc;
pmix_lookup_cbfunc_t lkupcbfunc;
pmix_spawn_cbfunc_t spwncbfunc;
void *cbdata;
opal_pmix_release_cbfunc_t odmdxfunc;
void *ocbdata;
} pmix1_opalcaddy_t;
OBJ_CLASS_DECLARATION(pmix1_opalcaddy_t);
/**** CLIENT FUNCTIONS ****/
OPAL_MODULE_DECLSPEC int pmix1_client_init(void);
OPAL_MODULE_DECLSPEC int pmix1_client_finalize(void);
OPAL_MODULE_DECLSPEC int pmix1_initialized(void);
OPAL_MODULE_DECLSPEC int pmix1_abort(int flag, const char *msg,
opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix1_commit(void);
OPAL_MODULE_DECLSPEC int pmix1_fence(opal_list_t *procs, int collect_data);
OPAL_MODULE_DECLSPEC int pmix1_fencenb(opal_list_t *procs, int collect_data,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_put(opal_pmix_scope_t scope,
opal_value_t *val);
OPAL_MODULE_DECLSPEC int pmix1_get(const opal_process_name_t *proc, const char *key,
opal_list_t *info, opal_value_t **val);
OPAL_MODULE_DECLSPEC int pmix1_getnb(const opal_process_name_t *proc, const char *key,
opal_list_t *info,
opal_pmix_value_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_publish(opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix1_publishnb(opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_lookup(opal_list_t *data, opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix1_lookupnb(char **keys, opal_list_t *info,
opal_pmix_lookup_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_unpublish(char **keys, opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix1_unpublishnb(char **keys, opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid);
OPAL_MODULE_DECLSPEC int pmix1_spawnnb(opal_list_t *job_info, opal_list_t *apps,
opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_connect(opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix1_connectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_disconnect(opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix1_disconnectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_resolve_peers(const char *nodename, opal_jobid_t jobid,
opal_list_t *procs);
OPAL_MODULE_DECLSPEC int pmix1_resolve_nodes(opal_jobid_t jobid, char **nodelist);
/**** COMMON FUNCTIONS ****/
OPAL_MODULE_DECLSPEC int pmix1_store_local(const opal_process_name_t *proc,
opal_value_t *val);
/**** SERVER SOUTHBOUND FUNCTIONS ****/
OPAL_MODULE_DECLSPEC int pmix1_server_init(opal_pmix_server_module_t *module,
opal_list_t *info);
OPAL_MODULE_DECLSPEC int pmix1_server_finalize(void);
OPAL_MODULE_DECLSPEC int pmix1_server_gen_regex(const char *input, char **regex);
OPAL_MODULE_DECLSPEC int pmix1_server_gen_ppn(const char *input, char **ppn);
OPAL_MODULE_DECLSPEC int pmix1_server_register_nspace(opal_jobid_t jobid,
int nlocalprocs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC void pmix1_server_deregister_nspace(opal_jobid_t jobid);
OPAL_MODULE_DECLSPEC int pmix1_server_register_client(const opal_process_name_t *proc,
uid_t uid, gid_t gid,
void *server_object,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_MODULE_DECLSPEC void pmix1_server_deregister_client(const opal_process_name_t *proc);
OPAL_MODULE_DECLSPEC int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env);
OPAL_MODULE_DECLSPEC int pmix1_server_dmodex(const opal_process_name_t *proc,
opal_pmix_modex_cbfunc_t cbfunc, void *cbdata);
OPAL_MODULE_DECLSPEC int pmix1_server_notify_error(int status,
opal_list_t *procs,
opal_list_t *error_procs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
/**** COMPONENT UTILITY FUNCTIONS ****/
OPAL_MODULE_DECLSPEC pmix_status_t pmix1_convert_opalrc(int rc);
OPAL_MODULE_DECLSPEC int pmix1_convert_rc(pmix_status_t rc);
OPAL_MODULE_DECLSPEC pmix_scope_t pmix1_convert_opalscope(opal_pmix_scope_t scope);
OPAL_MODULE_DECLSPEC void pmix1_value_load(pmix_value_t *v,
opal_value_t *kv);
OPAL_MODULE_DECLSPEC int pmix1_value_unload(opal_value_t *kv,
const pmix_value_t *v);
END_C_DECLS
#endif /* MCA_PMIX_PMIX1_H */

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

@ -1,440 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/types.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "opal/dss/dss.h"
#include "opal/mca/event/event.h"
#include "opal/mca/hwloc/base/base.h"
#include "opal/runtime/opal.h"
#include "opal/runtime/opal_progress_threads.h"
#include "opal/util/argv.h"
#include "opal/util/error.h"
#include "opal/util/output.h"
#include "opal/util/proc.h"
#include "opal/util/show_help.h"
#include "opal/mca/pmix/base/base.h"
#include "pmix1.h"
#include "pmix.h"
#include "pmix_server.h"
/**** S.O.U.T.H.B.O.U.N.D I.N.T.E.R.F.A.C.E.S ****/
/* These are the interfaces used by the OMPI/ORTE/OPAL layer to call
* down into the embedded PMIx server. */
extern pmix_server_module_t pmix114_module;
extern opal_pmix_server_module_t *pmix114_host_module;
static char *dbgvalue=NULL;
static int errhdler_ref = 0;
static void release_cbfunc(void *cbdata)
{
pmix1_opalcaddy_t *cd = (pmix1_opalcaddy_t*)cbdata;
OBJ_RELEASE(cd);
}
static void myerr(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo)
{
int rc;
opal_namelist_t *nm;
opal_value_t *iptr;
size_t n;
pmix1_opalcaddy_t *cd;
/* convert the incoming status */
rc = pmix1_convert_rc(status);
/* setup the caddy */
cd = OBJ_NEW(pmix1_opalcaddy_t);
/* convert the array of procs */
for (n=0; n < nprocs; n++) {
nm = OBJ_NEW(opal_namelist_t);
nm->name.jobid = strtoul(procs[n].nspace, NULL, 10);
nm->name.vpid = procs[n].rank;
opal_list_append(&cd->procs, &nm->super);
}
/* convert the array of info */
for (n=0; n < ninfo; n++) {
iptr = OBJ_NEW(opal_value_t);
iptr->key = strdup(info[n].key);
pmix1_value_unload(iptr, &info[n].value);
opal_list_append(&cd->info, &iptr->super);
}
/* call the base errhandler */
opal_pmix_base_errhandler(rc, &cd->procs, &cd->info, release_cbfunc, cd);
}
static void errreg_cbfunc(pmix_status_t status,
int errhandler_ref,
void *cbdata)
{
errhdler_ref = errhandler_ref;
opal_output_verbose(5, 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,
opal_list_t *info)
{
pmix_status_t rc;
int dbg;
opal_value_t *kv;
pmix_info_t *pinfo;
size_t sz, n;
if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) {
asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg);
putenv(dbgvalue);
}
/* convert the list to an array of pmix_info_t */
if (NULL != info) {
sz = opal_list_get_size(info);
PMIX_INFO_CREATE(pinfo, sz);
n = 0;
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pinfo[n].value, kv);
++n;
}
} else {
sz = 0;
pinfo = NULL;
}
if (PMIX_SUCCESS != (rc = PMIx_server_init(&pmix114_module, pinfo, sz))) {
PMIX_INFO_FREE(pinfo, sz);
return pmix1_convert_rc(rc);
}
PMIX_INFO_FREE(pinfo, sz);
/* record the host module */
pmix114_host_module = module;
/* register the errhandler */
PMIx_Register_errhandler(NULL, 0, myerr, errreg_cbfunc, NULL);
return OPAL_SUCCESS;
}
int pmix1_server_finalize(void)
{
pmix_status_t rc;
/* deregister the errhandler */
PMIx_Deregister_errhandler(errhdler_ref, NULL, NULL);
rc = PMIx_server_finalize();
return pmix1_convert_rc(rc);
}
int pmix1_server_gen_regex(const char *input, char **regex)
{
pmix_status_t rc;
rc = PMIx_generate_regex(input, regex);
return pmix1_convert_rc(rc);
}
int pmix1_server_gen_ppn(const char *input, char **ppn)
{
pmix_status_t rc;
rc = PMIx_generate_ppn(input, ppn);
return pmix1_convert_rc(rc);
}
static void opcbfunc(pmix_status_t status, void *cbdata)
{
pmix1_opcaddy_t *op = (pmix1_opcaddy_t*)cbdata;
if (NULL != op->opcbfunc) {
op->opcbfunc(pmix1_convert_rc(status), op->cbdata);
}
OBJ_RELEASE(op);
}
int pmix1_server_register_nspace(opal_jobid_t jobid,
int nlocalprocs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
opal_value_t *kv, *k2;
pmix_info_t *pinfo, *pmap;
size_t sz, szmap, m, n;
char nspace[PMIX_MAX_NSLEN];
pmix_status_t rc;
pmix1_opcaddy_t *op;
opal_list_t *pmapinfo;
opal_pmix1_jobid_trkr_t *job;
/* convert the jobid */
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
/* store this job in our list of known nspaces */
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = jobid;
opal_list_append(&mca_pmix_pmix114_component.jobids, &job->super);
/* convert the list to an array of pmix_info_t */
if (NULL != info) {
sz = opal_list_get_size(info);
PMIX_INFO_CREATE(pinfo, sz);
n = 0;
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
if (0 == strcmp(kv->key, OPAL_PMIX_PROC_DATA)) {
pinfo[n].value.type = PMIX_INFO_ARRAY;
/* the value contains a list of values - convert
* that list to another array */
pmapinfo = (opal_list_t*)kv->data.ptr;
szmap = opal_list_get_size(pmapinfo);
PMIX_INFO_CREATE(pmap, szmap);
pinfo[n].value.data.array.array = (struct pmix_info_t *)pmap;
pinfo[n].value.data.array.size = szmap;
m = 0;
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pmap[m].value, k2);
++m;
}
} else {
pmix1_value_load(&pinfo[n].value, kv);
}
++n;
}
} else {
sz = 0;
pinfo = NULL;
}
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op->info = pinfo;
op->sz = sz;
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
rc = PMIx_server_register_nspace(nspace, nlocalprocs, pinfo, sz,
opcbfunc, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}
return pmix1_convert_rc(rc);
}
void pmix1_server_deregister_nspace(opal_jobid_t jobid)
{
opal_pmix1_jobid_trkr_t *jptr;
/* if we don't already have it, we can ignore this */
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix114_component.jobids, opal_pmix1_jobid_trkr_t) {
if (jptr->jobid == jobid) {
/* found it - tell the server to deregister */
PMIx_server_deregister_nspace(jptr->nspace);
/* now get rid of it from our list */
opal_list_remove_item(&mca_pmix_pmix114_component.jobids, &jptr->super);
OBJ_RELEASE(jptr);
return;
}
}
}
int pmix1_server_register_client(const opal_process_name_t *proc,
uid_t uid, gid_t gid,
void *server_object,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
pmix_status_t rc;
pmix1_opcaddy_t *op;
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
/* convert the jobid */
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = proc->vpid;
rc = PMIx_server_register_client(&op->p, uid, gid, server_object,
opcbfunc, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}
return pmix1_convert_rc(rc);
}
void pmix1_server_deregister_client(const opal_process_name_t *proc)
{
opal_pmix1_jobid_trkr_t *jptr;
pmix_proc_t p;
/* if we don't already have it, we can ignore this */
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix114_component.jobids, opal_pmix1_jobid_trkr_t) {
if (jptr->jobid == proc->jobid) {
/* found it - tell the server to deregister */
(void)strncpy(p.nspace, jptr->nspace, PMIX_MAX_NSLEN);
p.rank = proc->vpid;
PMIx_server_deregister_client(&p);
return;
}
}
}
int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env)
{
pmix_status_t rc;
pmix_proc_t p;
/* convert the jobid */
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
p.rank = proc->vpid;
rc = PMIx_server_setup_fork(&p, env);
return pmix1_convert_rc(rc);
}
/* this is the call back up from the embedded PMIx server that
* will contain the returned data. Note that the embedded server
* "owns" the data and will free it upon return from this function */
static void dmdx_response(pmix_status_t status, char *data, size_t sz, void *cbdata)
{
int rc;
pmix1_opcaddy_t *op = (pmix1_opcaddy_t*)cbdata;
rc = pmix1_convert_rc(status);
if (NULL != op->mdxcbfunc) {
op->mdxcbfunc(rc, data, sz, op->cbdata, NULL, NULL);
}
OBJ_RELEASE(op);
}
int pmix1_server_dmodex(const opal_process_name_t *proc,
opal_pmix_modex_cbfunc_t cbfunc, void *cbdata)
{
pmix1_opcaddy_t *op;
pmix_status_t rc;
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op->mdxcbfunc = cbfunc;
op->cbdata = cbdata;
/* convert the jobid */
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
op->p.rank = proc->vpid;
/* find the internally-cached data for this proc */
rc = PMIx_server_dmodex_request(&op->p, dmdx_response, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}
return pmix1_convert_rc(rc);
}
int pmix1_server_notify_error(int status,
opal_list_t *procs,
opal_list_t *error_procs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{
opal_value_t *kv;
pmix_info_t *pinfo;
size_t sz, psz, esz, n;
pmix_proc_t *ps, *eps;
pmix_status_t rc;
pmix1_opcaddy_t *op;
opal_namelist_t *nm;
/* convert the list of procs */
if (NULL != procs) {
psz = opal_list_get_size(procs);
PMIX_PROC_CREATE(ps, psz);
n = 0;
OPAL_LIST_FOREACH(nm, procs, opal_namelist_t) {
(void)opal_snprintf_jobid(ps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
ps[n].rank = (int)nm->name.vpid;
++n;
}
} else {
psz = 0;
ps = NULL;
}
if (NULL != error_procs) {
esz = opal_list_get_size(error_procs);
PMIX_PROC_CREATE(eps, esz);
n = 0;
OPAL_LIST_FOREACH(nm, error_procs, opal_namelist_t) {
(void)opal_snprintf_jobid(eps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
eps[n].rank = (int)nm->name.vpid;
++n;
}
} else {
esz = 0;
eps = NULL;
}
/* convert the list to an array of pmix_info_t */
if (NULL != info) {
sz = opal_list_get_size(info);
PMIX_INFO_CREATE(pinfo, sz);
n = 0;
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
pmix1_value_load(&pinfo[n].value, kv);
}
} else {
sz = 0;
pinfo = NULL;
}
/* setup the caddy */
op = OBJ_NEW(pmix1_opcaddy_t);
op->procs = ps;
op->nprocs = psz;
op->error_procs = eps;
op->nerror_procs = esz;
op->info = pinfo;
op->sz = sz;
op->opcbfunc = cbfunc;
op->cbdata = cbdata;
rc = pmix1_convert_opalrc(status);
rc = PMIx_Notify_error(rc, ps, psz, eps, esz,
pinfo, sz, opcbfunc, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}
return pmix1_convert_rc(rc);
}

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

@ -1,555 +0,0 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/types.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "opal/dss/dss.h"
#include "opal/mca/event/event.h"
#include "opal/mca/hwloc/base/base.h"
#include "opal/runtime/opal.h"
#include "opal/runtime/opal_progress_threads.h"
#include "opal/util/argv.h"
#include "opal/util/error.h"
#include "opal/util/output.h"
#include "opal/util/proc.h"
#include "opal/util/show_help.h"
#include "pmix1.h"
#include "opal/mca/pmix/base/base.h"
#include "opal/mca/pmix/pmix_types.h"
#include "opal/mca/pmix/pmix114/pmix/include/pmix/pmix_common.h"
/**** C.O.M.M.O.N I.N.T.E.R.F.A.C.E.S ****/
/* These are functions used by both client and server to
* access common functions in the embedded PMIx library */
static const char *pmix1_get_nspace(opal_jobid_t jobid);
static void pmix1_register_jobid(opal_jobid_t jobid, const char *nspace);
const opal_pmix_base_module_t opal_pmix_pmix114_module = {
/* client APIs */
.init = pmix1_client_init,
.finalize = pmix1_client_finalize,
.initialized = pmix1_initialized,
.abort = pmix1_abort,
.commit = pmix1_commit,
.fence = pmix1_fence,
.fence_nb = pmix1_fencenb,
.put = pmix1_put,
.get = pmix1_get,
.get_nb = pmix1_getnb,
.publish = pmix1_publish,
.publish_nb = pmix1_publishnb,
.lookup = pmix1_lookup,
.lookup_nb = pmix1_lookupnb,
.unpublish = pmix1_unpublish,
.unpublish_nb = pmix1_unpublishnb,
.spawn = pmix1_spawn,
.spawn_nb = pmix1_spawnnb,
.connect = pmix1_connect,
.connect_nb = pmix1_connectnb,
.disconnect = pmix1_disconnect,
.disconnect_nb = pmix1_disconnectnb,
.resolve_peers = pmix1_resolve_peers,
.resolve_nodes = pmix1_resolve_nodes,
/* server APIs */
.server_init = pmix1_server_init,
.server_finalize = pmix1_server_finalize,
.generate_regex = pmix1_server_gen_regex,
.generate_ppn = pmix1_server_gen_ppn,
.server_register_nspace = pmix1_server_register_nspace,
.server_deregister_nspace = pmix1_server_deregister_nspace,
.server_register_client = pmix1_server_register_client,
.server_deregister_client = pmix1_server_deregister_client,
.server_setup_fork = pmix1_server_setup_fork,
.server_dmodex_request = pmix1_server_dmodex,
.server_notify_error = pmix1_server_notify_error,
/* utility APIs */
.get_version = PMIx_Get_version,
.register_errhandler = opal_pmix_base_register_handler,
.deregister_errhandler = opal_pmix_base_deregister_handler,
.store_local = pmix1_store_local,
.get_nspace = pmix1_get_nspace,
.register_jobid = pmix1_register_jobid
};
static const char *pmix1_get_nspace(opal_jobid_t jobid)
{
opal_pmix1_jobid_trkr_t *jptr;
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix114_component.jobids, opal_pmix1_jobid_trkr_t) {
if (jptr->jobid == jobid) {
return jptr->nspace;
}
}
return NULL;
}
static void pmix1_register_jobid(opal_jobid_t jobid, const char *nspace)
{
opal_pmix1_jobid_trkr_t *jptr;
/* if we don't already have it, add this to our jobid tracker */
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix114_component.jobids, opal_pmix1_jobid_trkr_t) {
if (jptr->jobid == jobid) {
return;
}
}
jptr = OBJ_NEW(opal_pmix1_jobid_trkr_t);
(void)strncpy(jptr->nspace, nspace, PMIX_MAX_NSLEN);
jptr->jobid = jobid;
opal_list_append(&mca_pmix_pmix114_component.jobids, &jptr->super);
}
pmix_status_t pmix1_convert_opalrc(int rc)
{
switch (rc) {
case OPAL_ERR_UNPACK_READ_PAST_END_OF_BUFFER:
return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
case OPAL_ERR_COMM_FAILURE:
return PMIX_ERR_COMM_FAILURE;
case OPAL_ERR_NOT_IMPLEMENTED:
return PMIX_ERR_NOT_IMPLEMENTED;
case OPAL_ERR_NOT_SUPPORTED:
return PMIX_ERR_NOT_SUPPORTED;
case OPAL_ERR_NOT_FOUND:
return PMIX_ERR_NOT_FOUND;
case OPAL_ERR_SERVER_NOT_AVAIL:
return PMIX_ERR_SERVER_NOT_AVAIL;
case OPAL_ERR_BAD_PARAM:
return PMIX_ERR_BAD_PARAM;
case OPAL_ERR_OUT_OF_RESOURCE:
return PMIX_ERR_NOMEM;
case OPAL_ERR_DATA_VALUE_NOT_FOUND:
return PMIX_ERR_DATA_VALUE_NOT_FOUND;
case OPAL_ERR_IN_ERRNO:
return PMIX_ERR_IN_ERRNO;
case OPAL_ERR_UNREACH:
return PMIX_ERR_UNREACH;
case OPAL_ERR_TIMEOUT:
return PMIX_ERR_TIMEOUT;
case OPAL_ERR_PERM:
return PMIX_ERR_NO_PERMISSIONS;
case OPAL_ERR_PACK_MISMATCH:
return PMIX_ERR_PACK_MISMATCH;
case OPAL_ERR_PACK_FAILURE:
return PMIX_ERR_PACK_FAILURE;
case OPAL_ERR_UNPACK_FAILURE:
return PMIX_ERR_UNPACK_FAILURE;
case OPAL_ERR_UNPACK_INADEQUATE_SPACE:
return PMIX_ERR_UNPACK_INADEQUATE_SPACE;
case OPAL_ERR_TYPE_MISMATCH:
return PMIX_ERR_TYPE_MISMATCH;
case OPAL_ERR_PROC_ENTRY_NOT_FOUND:
return PMIX_ERR_PROC_ENTRY_NOT_FOUND;
case OPAL_ERR_UNKNOWN_DATA_TYPE:
return PMIX_ERR_UNKNOWN_DATA_TYPE;
case OPAL_ERR_WOULD_BLOCK:
return PMIX_ERR_WOULD_BLOCK;
case OPAL_EXISTS:
return PMIX_EXISTS;
case OPAL_ERR_SILENT:
return PMIX_ERR_SILENT;
case OPAL_ERROR:
return PMIX_ERROR;
case OPAL_SUCCESS:
return PMIX_SUCCESS;
default:
return PMIX_ERROR;
}
}
int pmix1_convert_rc(pmix_status_t rc)
{
switch (rc) {
case PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER:
return OPAL_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
case PMIX_ERR_COMM_FAILURE:
return OPAL_ERR_COMM_FAILURE;
case PMIX_ERR_NOT_IMPLEMENTED:
return OPAL_ERR_NOT_IMPLEMENTED;
case PMIX_ERR_NOT_SUPPORTED:
return OPAL_ERR_NOT_SUPPORTED;
case PMIX_ERR_NOT_FOUND:
return OPAL_ERR_NOT_FOUND;
case PMIX_ERR_SERVER_NOT_AVAIL:
return OPAL_ERR_SERVER_NOT_AVAIL;
case PMIX_ERR_INVALID_NAMESPACE:
case PMIX_ERR_INVALID_SIZE:
case PMIX_ERR_INVALID_KEYVALP:
case PMIX_ERR_INVALID_NUM_PARSED:
case PMIX_ERR_INVALID_ARGS:
case PMIX_ERR_INVALID_NUM_ARGS:
case PMIX_ERR_INVALID_LENGTH:
case PMIX_ERR_INVALID_VAL_LENGTH:
case PMIX_ERR_INVALID_VAL:
case PMIX_ERR_INVALID_KEY_LENGTH:
case PMIX_ERR_INVALID_KEY:
case PMIX_ERR_INVALID_ARG:
return OPAL_ERR_BAD_PARAM;
case PMIX_ERR_NOMEM:
return OPAL_ERR_OUT_OF_RESOURCE;
case PMIX_ERR_INIT:
return OPAL_ERROR;
case PMIX_ERR_DATA_VALUE_NOT_FOUND:
return OPAL_ERR_DATA_VALUE_NOT_FOUND;
case PMIX_ERR_OUT_OF_RESOURCE:
return OPAL_ERR_OUT_OF_RESOURCE;
case PMIX_ERR_RESOURCE_BUSY:
return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
case PMIX_ERR_BAD_PARAM:
return OPAL_ERR_BAD_PARAM;
case PMIX_ERR_IN_ERRNO:
return OPAL_ERR_IN_ERRNO;
case PMIX_ERR_UNREACH:
return OPAL_ERR_UNREACH;
case PMIX_ERR_TIMEOUT:
return OPAL_ERR_TIMEOUT;
case PMIX_ERR_NO_PERMISSIONS:
return OPAL_ERR_PERM;
case PMIX_ERR_PACK_MISMATCH:
return OPAL_ERR_PACK_MISMATCH;
case PMIX_ERR_PACK_FAILURE:
return OPAL_ERR_PACK_FAILURE;
case PMIX_ERR_UNPACK_FAILURE:
return OPAL_ERR_UNPACK_FAILURE;
case PMIX_ERR_UNPACK_INADEQUATE_SPACE:
return OPAL_ERR_UNPACK_INADEQUATE_SPACE;
case PMIX_ERR_TYPE_MISMATCH:
return OPAL_ERR_TYPE_MISMATCH;
case PMIX_ERR_PROC_ENTRY_NOT_FOUND:
return OPAL_ERR_PROC_ENTRY_NOT_FOUND;
case PMIX_ERR_UNKNOWN_DATA_TYPE:
return OPAL_ERR_UNKNOWN_DATA_TYPE;
case PMIX_ERR_WOULD_BLOCK:
return OPAL_ERR_WOULD_BLOCK;
case PMIX_ERR_READY_FOR_HANDSHAKE:
case PMIX_ERR_HANDSHAKE_FAILED:
case PMIX_ERR_INVALID_CRED:
return OPAL_ERR_COMM_FAILURE;
case PMIX_EXISTS:
return OPAL_EXISTS;
case PMIX_ERR_SILENT:
return OPAL_ERR_SILENT;
case PMIX_ERROR:
return OPAL_ERROR;
case PMIX_SUCCESS:
return OPAL_SUCCESS;
default:
return OPAL_ERROR;
}
}
pmix_scope_t pmix1_convert_opalscope(opal_pmix_scope_t scope) {
switch(scope) {
case OPAL_PMIX_LOCAL:
return PMIX_LOCAL;
case OPAL_PMIX_REMOTE:
return PMIX_REMOTE;
case OPAL_PMIX_GLOBAL:
return PMIX_GLOBAL;
default:
return PMIX_SCOPE_UNDEF;
}
}
void pmix1_value_load(pmix_value_t *v,
opal_value_t *kv)
{
switch(kv->type) {
case OPAL_UNDEF:
v->type = PMIX_UNDEF;
opal_output(0, "TYPE WAS UNDEF");
break;
case OPAL_BOOL:
v->type = PMIX_BOOL;
memcpy(&(v->data.flag), &kv->data.flag, 1);
break;
case OPAL_BYTE:
v->type = PMIX_BYTE;
memcpy(&(v->data.byte), &kv->data.byte, 1);
break;
case OPAL_STRING:
v->type = PMIX_STRING;
if (NULL != kv->data.string) {
v->data.string = strdup(kv->data.string);
} else {
v->data.string = NULL;
}
break;
case OPAL_SIZE:
v->type = PMIX_SIZE;
v->data.size = (size_t)kv->data.size;
break;
case OPAL_PID:
v->type = PMIX_PID;
memcpy(&(v->data.pid), &kv->data.pid, sizeof(pid_t));
break;
case OPAL_INT:
v->type = PMIX_INT;
memcpy(&(v->data.integer), &kv->data.integer, sizeof(int));
break;
case OPAL_INT8:
v->type = PMIX_INT8;
memcpy(&(v->data.int8), &kv->data.int8, 1);
break;
case OPAL_INT16:
v->type = PMIX_INT16;
memcpy(&(v->data.int16), &kv->data.int16, 2);
break;
case OPAL_INT32:
v->type = PMIX_INT32;
memcpy(&(v->data.int32), &kv->data.int32, 4);
break;
case OPAL_INT64:
v->type = PMIX_INT64;
memcpy(&(v->data.int64), &kv->data.int64, 8);
break;
case OPAL_UINT:
v->type = PMIX_UINT;
memcpy(&(v->data.uint), &kv->data.uint, sizeof(int));
break;
case OPAL_UINT8:
v->type = PMIX_UINT8;
memcpy(&(v->data.uint8), &kv->data.uint8, 1);
break;
case OPAL_UINT16:
v->type = PMIX_UINT16;
memcpy(&(v->data.uint16), &kv->data.uint16, 2);
break;
case OPAL_UINT32:
v->type = PMIX_UINT32;
memcpy(&(v->data.uint32), &kv->data.uint32, 4);
break;
case OPAL_UINT64:
v->type = PMIX_UINT64;
memcpy(&(v->data.uint64), &kv->data.uint64, 8);
break;
case OPAL_FLOAT:
v->type = PMIX_FLOAT;
memcpy(&(v->data.fval), &kv->data.fval, sizeof(float));
break;
case OPAL_DOUBLE:
v->type = PMIX_DOUBLE;
memcpy(&(v->data.dval), &kv->data.dval, sizeof(double));
break;
case OPAL_TIMEVAL:
v->type = PMIX_TIMEVAL;
memcpy(&(v->data.tv), &kv->data.tv, sizeof(struct timeval));
break;
case OPAL_BYTE_OBJECT:
v->type = PMIX_BYTE_OBJECT;
if (NULL != kv->data.bo.bytes) {
v->data.bo.bytes = (char*)malloc(kv->data.bo.size);
memcpy(v->data.bo.bytes, kv->data.bo.bytes, kv->data.bo.size);
v->data.bo.size = (size_t)kv->data.bo.size;
} else {
v->data.bo.bytes = NULL;
v->data.bo.size = 0;
}
break;
default:
/* silence warnings */
break;
}
}
int pmix1_value_unload(opal_value_t *kv,
const pmix_value_t *v)
{
int rc=OPAL_SUCCESS;
switch(v->type) {
case PMIX_UNDEF:
rc = OPAL_ERR_UNKNOWN_DATA_TYPE;
break;
case PMIX_BOOL:
kv->type = OPAL_BOOL;
memcpy(&kv->data.flag, &(v->data.flag), 1);
break;
case PMIX_BYTE:
kv->type = OPAL_BYTE;
memcpy(&kv->data.byte, &(v->data.byte), 1);
break;
case PMIX_STRING:
kv->type = OPAL_STRING;
if (NULL != v->data.string) {
kv->data.string = strdup(v->data.string);
}
break;
case PMIX_SIZE:
kv->type = OPAL_SIZE;
kv->data.size = (int)v->data.size;
break;
case PMIX_PID:
kv->type = OPAL_PID;
memcpy(&kv->data.pid, &(v->data.pid), sizeof(pid_t));
break;
case PMIX_INT:
kv->type = OPAL_INT;
memcpy(&kv->data.integer, &(v->data.integer), sizeof(int));
break;
case PMIX_INT8:
kv->type = OPAL_INT8;
memcpy(&kv->data.int8, &(v->data.int8), 1);
break;
case PMIX_INT16:
kv->type = OPAL_INT16;
memcpy(&kv->data.int16, &(v->data.int16), 2);
break;
case PMIX_INT32:
kv->type = OPAL_INT32;
memcpy(&kv->data.int32, &(v->data.int32), 4);
break;
case PMIX_INT64:
kv->type = OPAL_INT64;
memcpy(&kv->data, &(v->data.int64), 8);
break;
case PMIX_UINT:
kv->type = OPAL_UINT;
memcpy(&kv->data, &(v->data.uint), sizeof(int));
break;
case PMIX_UINT8:
kv->type = OPAL_UINT8;
memcpy(&kv->data, &(v->data.uint8), 1);
break;
case PMIX_UINT16:
kv->type = OPAL_UINT16;
memcpy(&kv->data, &(v->data.uint16), 2);
break;
case PMIX_UINT32:
kv->type = OPAL_UINT32;
memcpy(&kv->data, &(v->data.uint32), 4);
break;
case PMIX_UINT64:
kv->type = OPAL_UINT64;
memcpy(&kv->data, &(v->data.uint64), 8);
break;
case PMIX_FLOAT:
kv->type = OPAL_FLOAT;
memcpy(&kv->data, &(v->data.fval), sizeof(float));
break;
case PMIX_DOUBLE:
kv->type = OPAL_DOUBLE;
memcpy(&kv->data, &(v->data.dval), sizeof(double));
break;
case PMIX_TIMEVAL:
kv->type = OPAL_TIMEVAL;
memcpy(&kv->data, &(v->data.tv), sizeof(struct timeval));
break;
case PMIX_BYTE_OBJECT:
kv->type = OPAL_BYTE_OBJECT;
if (NULL != v->data.bo.bytes && 0 < v->data.bo.size) {
kv->data.bo.bytes = (uint8_t*)malloc(v->data.bo.size);
memcpy(kv->data.bo.bytes, v->data.bo.bytes, v->data.bo.size);
kv->data.bo.size = (int)v->data.bo.size;
} else {
kv->data.bo.bytes = NULL;
kv->data.bo.size = 0;
}
break;
default:
/* silence warnings */
rc = OPAL_ERROR;
break;
}
return rc;
}
/**** INSTANTIATE INTERNAL CLASSES ****/
OBJ_CLASS_INSTANCE(opal_pmix1_jobid_trkr_t,
opal_list_item_t,
NULL, NULL);
static void opcon(pmix1_opcaddy_t *p)
{
memset(&p->p, 0, sizeof(pmix_proc_t));
p->procs = NULL;
p->nprocs = 0;
p->error_procs = NULL;
p->nerror_procs = 0;
p->info = NULL;
p->ninfo = 0;
p->apps = NULL;
p->sz = 0;
p->opcbfunc = NULL;
p->mdxcbfunc = NULL;
p->valcbfunc = NULL;
p->lkcbfunc = NULL;
p->spcbfunc = NULL;
p->cbdata = NULL;
}
static void opdes(pmix1_opcaddy_t *p)
{
if (NULL != p->procs) {
PMIX_PROC_FREE(p->procs, p->nprocs);
}
if (NULL != p->error_procs) {
PMIX_PROC_FREE(p->error_procs, p->nerror_procs);
}
if (NULL != p->info) {
PMIX_INFO_FREE(p->info, p->sz);
}
if (NULL != p->apps) {
PMIX_APP_FREE(p->apps, p->sz);
}
}
OBJ_CLASS_INSTANCE(pmix1_opcaddy_t,
opal_object_t,
opcon, opdes);
static void ocadcon(pmix1_opalcaddy_t *p)
{
OBJ_CONSTRUCT(&p->procs, opal_list_t);
OBJ_CONSTRUCT(&p->info, opal_list_t);
OBJ_CONSTRUCT(&p->apps, opal_list_t);
p->opcbfunc = NULL;
p->dmdxfunc = NULL;
p->mdxcbfunc = NULL;
p->lkupcbfunc = NULL;
p->spwncbfunc = NULL;
p->cbdata = NULL;
p->odmdxfunc = NULL;
p->ocbdata = NULL;
}
static void ocaddes(pmix1_opalcaddy_t *p)
{
OPAL_LIST_DESTRUCT(&p->procs);
OPAL_LIST_DESTRUCT(&p->info);
OPAL_LIST_DESTRUCT(&p->apps);
}
OBJ_CLASS_INSTANCE(pmix1_opalcaddy_t,
opal_object_t,
ocadcon, ocaddes);

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

@ -1,105 +0,0 @@
/*
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/class/opal_list.h"
#include "opal/util/proc.h"
#include "opal/mca/pmix/pmix.h"
#include "pmix1.h"
/*
* Public string showing the pmix pmix114 component version number
*/
const char *opal_pmix_pmix114_component_version_string =
"OPAL pmix114 pmix MCA component version " OPAL_VERSION;
/*
* Local function
*/
static int pmix114_open(void);
static int pmix114_close(void);
static int pmix114_component_query(mca_base_module_t **module, int *priority);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
mca_pmix_pmix1_component_t mca_pmix_pmix114_component = {
{
/* First, the mca_component_t struct containing meta information
about the component itself */
.base_version = {
/* Indicate that we are a pmix v1.1.0 component (which also
implies a specific MCA version) */
OPAL_PMIX_BASE_VERSION_2_0_0,
/* Component name and version */
.mca_component_name = "pmix114",
MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION),
/* Component open and close functions */
.mca_open_component = pmix114_open,
.mca_close_component = pmix114_close,
.mca_query_component = pmix114_component_query,
},
/* Next the MCA v1.0.0 component meta data */
.base_data = {
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
},
.native_launch = false
};
static int pmix114_open(void)
{
OBJ_CONSTRUCT(&mca_pmix_pmix114_component.jobids, opal_list_t);
return OPAL_SUCCESS;
}
static int pmix114_close(void)
{
OPAL_LIST_DESTRUCT(&mca_pmix_pmix114_component.jobids);
return OPAL_SUCCESS;
}
static int pmix114_component_query(mca_base_module_t **module, int *priority)
{
char *t, *id;
/* see if a PMIx server is present */
if (NULL != (t = getenv("PMIX_SERVER_URI")) ||
NULL != (id = getenv("PMIX_ID"))) {
/* if PMIx is present, then we are a client and need to use it */
*priority = 80;
} else {
/* we could be a server, so we still need to be considered */
*priority = 5;
}
*module = (mca_base_module_t *)&opal_pmix_pmix114_module;
return OPAL_SUCCESS;
}

53
opal/mca/pmix/pmix2x/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,53 @@
#
# Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
EXTRA_DIST = autogen.subdirs
SUBDIRS = pmix
sources = \
pmix2x.h \
pmix2x_component.c \
pmix2x.c \
pmix2x_client.c \
pmix2x_server_south.c \
pmix2x_server_north.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_opal_pmix_pmix2x_DSO
component_noinst =
component_install = mca_pmix_pmix2x.la
else
component_noinst = libmca_pmix_pmix2x.la
component_install =
endif
mcacomponentdir = $(opallibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_pmix_pmix2x_la_SOURCES = $(sources)
mca_pmix_pmix2x_la_CFLAGS = $(opal_pmix_pmix2x_CFLAGS)
mca_pmix_pmix2x_la_CPPFLAGS = \
-I$(srcdir)/pmix/include $(opal_pmix_pmix2x_CPPFLAGS)
mca_pmix_pmix2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_pmix2x_LDFLAGS)
mca_pmix_pmix2x_la_LIBADD = $(opal_pmix_pmix2x_LIBS)
mca_pmix_pmix2x_la_DEPENDENCIES = $(mca_pmix_pmix2x_la_LIBADD)
noinst_LTLIBRARIES = $(component_noinst)
libmca_pmix_pmix2x_la_SOURCES =$(sources)
libmca_pmix_pmix2x_la_CFLAGS = $(opal_pmix_pmix2x_CFLAGS)
libmca_pmix_pmix2x_la_CPPFLAGS = -I$(srcdir)/pmix/include $(opal_pmix_pmix2x_CPPFLAGS)
libmca_pmix_pmix2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_pmix2x_LDFLAGS)
libmca_pmix_pmix2x_la_LIBADD = $(opal_pmix_pmix2x_LIBS)
libmca_pmix_pmix2x_la_DEPENDENCIES = $(mca_pmix_pmix2x_la_LIBADD)

75
opal/mca/pmix/pmix2x/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,75 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 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) 2011-2013 Los Alamos National Security, LLC.
# All rights reserved.
# Copyright (c) 2010-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_pmix_pmix2x_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_opal_pmix_pmix2x_CONFIG],[
AC_CONFIG_FILES([opal/mca/pmix/pmix2x/Makefile])
OPAL_VAR_SCOPE_PUSH([PMIX_VERSION opal_pmix_pmix2x_save_CPPFLAGS opal_pmix_pmix2x_save_LDFLAGS opal_pmix_pmix2x_save_LIBS opal_pmix_pmix2x_basedir opal_pmix_pmix2x_save_cflags])
AS_IF([test "$opal_external_pmix_happy" = "yes"],
[AC_MSG_WARN([using an external pmix; disqualifiying this component])
opal_pmix_pmix2x_happy=0],
[PMIX_VERSION=
opal_pmix_pmix2x_basedir=opal/mca/pmix/pmix2x
opal_pmix_pmix2x_save_CFLAGS=$CFLAGS
opal_pmix_pmix2x_save_CPPFLAGS=$CPPFLAGS
opal_pmix_pmix2x_save_LDFLAGS=$LDFLAGS
opal_pmix_pmix2x_save_LIBS=$LIBS
opal_pmix_pmix2x_args="--enable-embedded-mode --with-pmix-symbol-prefix=opal_pmix_pmix2x_ --disable-visibility --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --with-hwloc-header=\\\"$opal_hwloc_base_include\\\""
AS_IF([test "$enable_debug" = "yes"],
[opal_pmix_pmix2x_args="--enable-debug $opal_pmix_pmix2x_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"],
[opal_pmix_pmix2x_args="--disable-debug $opal_pmix_pmix2x_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"])
CPPFLAGS="-I$OPAL_TOP_SRCDIR -I$OPAL_TOP_BUILDDIR -I$OPAL_TOP_SRCDIR/opal/include -I$OPAL_TOP_BUILDDIR/opal/include $CPPFLAGS"
OPAL_CONFIG_SUBDIR([$opal_pmix_pmix2x_basedir/pmix],
[$opal_pmix_pmix2x_args $opal_subdir_args 'CFLAGS=$CFLAGS' 'CPPFLAGS=$CPPFLAGS'],
[opal_pmix_pmix2x_happy=1], [opal_pmix_pmix2x_happy=0])
AS_IF([test $opal_pmix_pmix2x_happy -eq 1],
[PMIX_VERSION="internal v`$srcdir/$opal_pmix_pmix2x_basedir/pmix/config/pmix_get_version.sh $srcdir/$opal_pmix_pmix2x_basedir/pmix/VERSION`"
# Build flags for our Makefile.am
opal_pmix_pmix2x_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_pmix_pmix2x_basedir"'/pmix/libpmix.la'
opal_pmix_pmix2x_CPPFLAGS='-I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix2x/pmix/include/pmix -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix2x/pmix/include -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix2x/pmix -I$(OPAL_TOP_SRCDIR)/opal/mca/pmix/pmix2x/pmix'
AC_SUBST([opal_pmix_pmix2x_LIBS])
AC_SUBST([opal_pmix_pmix2x_CPPFLAGS])])
CFLAGS=$opal_pmix_pmix2x_save_CFLAGS
CPPFLAGS=$opal_pmix_pmix2x_save_CPPFLAGS
LDFLAGS=$opal_pmix_pmix2x_save_LDFLAGS
LIBS=$opal_pmix_pmix2x_save_LIBS
])
AS_IF([test $opal_pmix_pmix2x_happy -eq 1],
[$1],
[$2])
OPAL_VAR_SCOPE_POP
])dnl

30
opal/mca/pmix/pmix2x/pmix/AUTHORS Обычный файл
Просмотреть файл

@ -0,0 +1,30 @@
PMIx Authors
================
The following cumulative list contains the names and GitHub IDs of
all individuals who have committed code to the PMIx repository.
Email Name Affiliation(s)
------------------------------- --------------------------- -------------------
alinask Elena Shipunova Mellanox
annu13 Annapurna Dasari Intel
artpol84 Artem Polyakov Mellanox
dsolt Dave Solt IBM
ggouaillardet Gilles Gouaillardet RIST
hjelmn Nathan Hjelm LANL
igor-ivanov Igor Ivanov Mellanox
jladd-mlnx Joshua Ladd Mellanox
jsquyres Jeff Squyres Cisco, IU
nkogteva Nadezhda Kogteva Mellanox
rhc54 Ralph Castain LANL, Cisco, Intel
------------------------------- --------------------------- -------------------
Affiliation abbreviations:
--------------------------
Cisco = Cisco Systems, Inc.
IBM = International Business Machines, Inc.
Intel = Intel, Inc.
IU = Indiana University
LANL = Los Alamos National Laboratory
Mellanox = Mellanox
RIST = Research Organization for Information Science and Technology

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

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

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

@ -11,7 +11,7 @@
# All rights reserved.
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -57,7 +57,12 @@ 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
include src/event/Makefile.am
if WANT_DSTORE
include src/sm/Makefile.am
include src/dstore/Makefile.am
endif
if PMIX_EMBEDDED_MODE
noinst_LTLIBRARIES = libpmix.la
@ -87,7 +92,7 @@ nroff:
contrib/md2nroff.pl --source=$$source.md; \
done
EXTRA_DIST += README INSTALL VERSION LICENSE autogen.sh \
EXTRA_DIST += AUTHORS README INSTALL VERSION LICENSE autogen.sh \
config/pmix_get_version.sh $(man_MANS) \
contrib/platform/optimized \
test/test_common.h test/cli_stages.h \

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

@ -43,9 +43,6 @@ Master (not on release branches yet)
- Do not install internal headers unless specifically
requested to do so
- Add support for multiple calls to Put/Commit
- Silence some "return code unchecked" warnings. Thanks
to Jim Garlick for pointing them out
- Resolve a race condition during register_clients
1.1.3

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

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

@ -3,7 +3,7 @@
# Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
# Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
# Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
# This is the VERSION file for PMIx, describing the precise
# version of PMIx in this distribution. The various components of
@ -13,9 +13,9 @@
# major, minor, and release are generally combined in the form
# <major>.<minor>.<release>.
major=1
minor=1
release=4
major=2
minor=0
release=0
# greek is used for alpha or beta release tags. If it is non-empty,
# it will be appended to the version number. It does not have to be
@ -23,14 +23,14 @@ release=4
# The only requirement is that it must be entirely printable ASCII
# characters and have no white space.
greek=rc3
greek=a1
# If repo_rev is empty, then the repository version number will be
# obtained during "make dist" via the "git describe --tags --always"
# command, or with the date (if "git describe" fails) in the form of
# "date<date>".
repo_rev=git4695e45
repo_rev=git99b989f
# 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="Jun 01, 2016"
date="Jun 14, 2016"
# The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library
@ -75,4 +75,4 @@ date="Jun 01, 2016"
# Version numbers are described in the Libtool current:revision:age
# format.
libpmix_so_version=2:3:0
libpmix_so_version=0:0:0

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

@ -753,6 +753,26 @@ AC_DEFINE_UNQUOTED([PMIX_WANT_PRETTY_PRINT_STACKTRACE],
[$WANT_PRETTY_PRINT_STACKTRACE],
[if want pretty-print stack trace feature])
#
# Do we want the shared memory datastore usage?
#
AC_MSG_CHECKING([if want special dstore usage])
AC_ARG_ENABLE([dstore],
[AC_HELP_STRING([--enable-dstore],
[Using special datastore (default: disabled)])])
if test "$enable_dstore" = "yes" ; then
AC_MSG_RESULT([yes])
WANT_DSTORE=1
else
AC_MSG_RESULT([no])
WANT_DSTORE=0
fi
AC_DEFINE_UNQUOTED([PMIX_ENABLE_DSTORE],
[$WANT_DSTORE],
[if want special dstore feature])
AM_CONDITIONAL([WANT_DSTORE],[test "x$enable_dstore" = "xyes"])
#
# Ident string
#

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

@ -95,7 +95,7 @@ AC_DEFUN([_PMIX_CHECK_COMPILER_VENDOR], [
# Fujitsu
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(__FUJITSU)],
[PMIX_IF_IFELSE([defined(__FUJITSU)],
[pmix_check_compiler_vendor_result="fujitsu"])])
# GNU

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

@ -2,9 +2,9 @@
#
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
#
# Additional copyrights may follow
#
#
# $HEADER$
#

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

@ -21,7 +21,7 @@
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/src/api
noinst_PROGRAMS = client dmodex dynamic fault pub
noinst_PROGRAMS = client dmodex dynamic fault pub server
client_SOURCES = client.c
client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
@ -43,5 +43,9 @@ pub_SOURCES = pub.c
pub_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
pub_LDADD = $(top_builddir)/libpmix.la
server_SOURCES = pub.c
server_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
server_LDADD = $(top_builddir)/libpmix.la
distclean-local:
rm -f *.o client dmodex dynamic fault pub server

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

@ -13,7 +13,7 @@
* 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-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
@ -45,7 +45,7 @@ int main(int argc, char **argv)
bool flag;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
@ -163,7 +163,7 @@ int main(int argc, char **argv)
done:
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
} else {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);

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

@ -13,7 +13,7 @@
* 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-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
@ -101,7 +101,7 @@ int main(int argc, char **argv)
bool active;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
@ -221,7 +221,7 @@ int main(int argc, char **argv)
done:
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
} else {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);

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

@ -13,7 +13,7 @@
* 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-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
@ -58,7 +58,7 @@ int main(int argc, char **argv)
}
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
@ -189,7 +189,7 @@ int main(int argc, char **argv)
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
} else {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);

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

@ -13,7 +13,7 @@
* 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-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
@ -34,9 +34,12 @@
static pmix_proc_t myproc;
static bool completed;
static void notification_fn(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo)
static void notification_fn(size_t evhdlr_registration_id,
pmix_status_t status,
const pmix_proc_t *source,
pmix_info_t info[], size_t ninfo,
pmix_event_notification_cbfunc_fn_t cbfunc,
void *cbdata)
{
fprintf(stderr, "Client %s:%d NOTIFIED with status %d\n", myproc.nspace, myproc.rank, status);
completed = true;
@ -48,12 +51,12 @@ static void op_callbk(pmix_status_t status,
fprintf(stderr, "client: OP CALLBACK CALLED WITH STATUS %d", status);
}
static void errhandler_reg_callbk (pmix_status_t status,
int errhandler_ref,
void *cbdata)
static void errhandler_reg_callbk(pmix_status_t status,
size_t errhandler_ref,
void *cbdata)
{
fprintf(stderr, "cleint: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%d",
status, errhandler_ref);
fprintf(stderr, "client: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu",
status, (unsigned long)errhandler_ref);
}
int main(int argc, char **argv)
@ -65,7 +68,7 @@ int main(int argc, char **argv)
uint32_t nprocs;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
@ -82,7 +85,8 @@ int main(int argc, char **argv)
completed = false;
/* register our errhandler */
PMIx_Register_errhandler(NULL, 0, notification_fn, errhandler_reg_callbk, NULL);
PMIx_Register_event_handler(NULL, 0, NULL, 0,
notification_fn, errhandler_reg_callbk, NULL);
/* call fence to sync */
PMIX_PROC_CONSTRUCT(&proc);
@ -110,9 +114,9 @@ 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(0, op_callbk, NULL);
PMIx_Deregister_event_handler(1, op_callbk, NULL);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
} else {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);

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

@ -13,7 +13,7 @@
* 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-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
@ -43,7 +43,7 @@ int main(int argc, char **argv)
pmix_pdata_t *pdata;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
@ -154,7 +154,7 @@ int main(int argc, char **argv)
done:
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
} else {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);

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

@ -220,7 +220,7 @@ Return values:
int PMI_Get_appnum( int *appnum );
/*@
PMI_Publish_name - publish a name
PMI_Publish_name - publish a name
Input parameters:
. service_name - string representing the service being published
@ -444,7 +444,7 @@ This function returns the string length required to store a keyval space name.
A routine is used rather than setting a maximum value in 'pmi.h' to allow
different implementations of PMI to be used with the same executable. These
different implementations may allow different maximum lengths; by using a
different implementations may allow different maximum lengths; by using a
routine here, we can interface with a variety of implementations of PMI.
@*/
@ -544,7 +544,7 @@ Return values:
Notes:
This function puts the key/value pair in the specified keyval space. The
value is not visible to other processes until 'PMI_KVS_Commit()' is called.
value is not visible to other processes until 'PMI_KVS_Commit()' is called.
The function may complete locally. After 'PMI_KVS_Commit()' is called, the
value may be retrieved by calling 'PMI_KVS_Get()'. All keys put to a keyval
space must be unique to the keyval space. You may not put more than once
@ -649,7 +649,7 @@ Return values:
- PMI_FAIL - failed to get the next keyval pair
Notes:
This function retrieves the next keyval pair from the specified keyval space.
This function retrieves the next keyval pair from the specified keyval space.
'PMI_KVS_Iter_first()' must have been previously called. The end of the keyval
space is specified by returning an empty key string. The output parameters,
key and val, must be at least as long as the values returned by
@ -682,7 +682,7 @@ Input Parameters:
. cmds - array of command strings
. argvs - array of argv arrays for each command string
. maxprocs - array of maximum processes to spawn for each command string
. info_keyval_sizes - array giving the number of elements in each of the
. info_keyval_sizes - array giving the number of elements in each of the
'info_keyval_vectors'
. info_keyval_vectors - array of keyval vector arrays
. preput_keyval_size - Number of elements in 'preput_keyval_vector'
@ -703,7 +703,7 @@ field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs',
to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector'
contains keyval pairs that will be put in the keyval space of the newly
created process group before the processes are started. The 'maxprocs' array
specifies the desired number of processes to create for each 'cmd' string.
specifies the desired number of processes to create for each 'cmd' string.
The actual number of processes may be less than the numbers specified in
maxprocs. The acceptable number of processes spawned may be controlled by
``soft'' keyvals in the info arrays. The ``soft'' option is specified by
@ -774,7 +774,7 @@ Notes:
This function removes PMI specific arguments from the command line and
creates the corresponding 'PMI_keyval_t' structures for them. It returns
an array and size to the caller that can then be passed to 'PMI_Spawn_multiple()'.
The array can be freed by 'PMI_Free_keyvals()'. The routine 'free()' should
The array can be freed by 'PMI_Free_keyvals()'. The routine 'free()' should
not be used to free this array as there is no requirement that the array be
allocated with 'malloc()'.
@ -795,7 +795,7 @@ Return values:
Notes:
This function frees the data returned by 'PMI_Args_to_keyval' and 'PMI_Parse_option'.
Using this routine instead of 'free' allows the PMI package to track
Using this routine instead of 'free' allows the PMI package to track
allocation of storage or to use interal storage as it sees fit.
@*/
int PMI_Free_keyvals(PMI_keyval_t keyvalp[], int size);

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

@ -76,19 +76,34 @@ BEGIN_C_DECLS
*
* Note that the PMIx client library is referenced counted, and so multiple
* calls to PMIx_Init are allowed. Thus, one way to obtain the namespace and
* rank of the process is to simply call PMIx_Init with a non-NULL parameter. */
pmix_status_t PMIx_Init(pmix_proc_t *proc);
* rank of the process is to simply call PMIx_Init with a non-NULL parameter.
*
* The info array is used to pass user requests pertaining to the init
* and subsequent operations. Pass a _NULL_ value for the array pointer
* is supported if no directives are desired.
*/
pmix_status_t PMIx_Init(pmix_proc_t *proc,
pmix_info_t info[], size_t ninfo);
/* Finalize the PMIx client, closing the connection to the local server.
* An error code will be returned if, for some reason, the connection
* cannot be closed. */
pmix_status_t PMIx_Finalize(void);
* cannot be closed.
*
* The info array is used to pass user requests regarding the finalize
* operation. This can include:
*
* (a) PMIX_EMBED_BARRIER - By default, PMIx_Finalize does not include an
* internal barrier operation. This attribute directs PMIx_Finalize to
* execute a barrier as part of the finalize operation.
*/
pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo);
/* Returns _true_ if the PMIx client has been successfully initialized,
* returns _false_ otherwise. Note that the function only reports the
* internal state of the PMIx client - it does not verify an active
* connection with the server, nor that the server is functional. */
int PMIx_Initialized(void);
int PMIx_Initialized(void);
/* Request that the provided array of procs be aborted, returning the
@ -108,22 +123,22 @@ int PMIx_Initialized(void);
* caused by multiple processes calling PMIx_Abort are left to the
* server implementation to resolve with regard to which status is
* returned and what messages (if any) are printed. */
pmix_status_t PMIx_Abort(int status, const char msg[],
pmix_proc_t procs[], size_t nprocs);
pmix_status_t PMIx_Abort(int status, const char msg[],
pmix_proc_t procs[], size_t nprocs);
/* Push a value into the client's namespace. The client library will cache
* the information locally until _PMIx_Commit_ is called. The provided scope
* value is passed to the local PMIx server, which will distribute the data
* as directed. */
pmix_status_t PMIx_Put(pmix_scope_t scope, const char key[], pmix_value_t *val);
pmix_status_t PMIx_Put(pmix_scope_t scope, const char key[], pmix_value_t *val);
/* Push all previously _PMIx_Put_ values to the local PMIx server.
* This is an asynchronous operation - the library will immediately
* return to the caller while the data is transmitted to the local
* server in the background */
pmix_status_t PMIx_Commit(void);
pmix_status_t PMIx_Commit(void);
/* Execute a blocking barrier across the processes identified in the
@ -161,14 +176,14 @@ pmix_status_t PMIx_Commit(void);
* the timeout parameter can help avoid "hangs" due to programming errors
* that prevent one or more procs from reaching the "fence".
*/
pmix_status_t PMIx_Fence(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Fence(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo);
/* Non-blocking version of PMIx_Fence. Note that the function will return
* an error if a _NULL_ callback function is given. */
pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Retrieve information for the specified _key_ as published by the process
@ -187,17 +202,17 @@ pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs,
* an error. The timeout parameter can help avoid "hangs" due to programming
* errors that prevent the target proc from ever exposing its data.
*/
pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
const pmix_info_t info[], size_t ninfo,
pmix_value_t **val);
pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
const pmix_info_t info[], size_t ninfo,
pmix_value_t **val);
/* A non-blocking operation version of PMIx_Get - the callback function will
* be executed once the specified data has been _PMIx_Put_
* by the identified process and retrieved by the local server. The info
* array is used as described above for the blocking form of this call. */
pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char key[],
const pmix_info_t info[], size_t ninfo,
pmix_value_cbfunc_t cbfunc, void *cbdata);
pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char key[],
const pmix_info_t info[], size_t ninfo,
pmix_value_cbfunc_t cbfunc, void *cbdata);
/* Publish the data in the info array for lookup. By default,
@ -219,9 +234,9 @@ pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char key[],
* return immediately, executing the callback when the server confirms
* availability of the data.
*/
pmix_status_t PMIx_Publish(const pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Publish_nb(const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
pmix_status_t PMIx_Publish(const pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Publish_nb(const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Lookup information published by this or another process. By default,
@ -260,8 +275,8 @@ pmix_status_t PMIx_Publish_nb(const pmix_info_t info[], size_t ninfo,
* (b) PMIX_TIMEOUT - max time to wait for data to become available.
*
*/
pmix_status_t PMIx_Lookup(pmix_pdata_t data[], size_t ndata,
const pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Lookup(pmix_pdata_t data[], size_t ndata,
const pmix_info_t info[], size_t ninfo);
/* Non-blocking form of the _PMIx_Lookup_ function. Data for
* the provided NULL-terminated keys array will be returned
@ -269,8 +284,8 @@ pmix_status_t PMIx_Lookup(pmix_pdata_t data[], size_t ndata,
* behavior is to _not_ wait for data to be published. The
* info keys can be used to modify the behavior as previously
* described */
pmix_status_t PMIx_Lookup_nb(char **keys, const pmix_info_t info[], size_t ninfo,
pmix_lookup_cbfunc_t cbfunc, void *cbdata);
pmix_status_t PMIx_Lookup_nb(char **keys, const pmix_info_t info[], size_t ninfo,
pmix_lookup_cbfunc_t cbfunc, void *cbdata);
/* Unpublish data posted by this process using the given keys.
@ -281,15 +296,15 @@ pmix_status_t PMIx_Lookup_nb(char **keys, const pmix_info_t info[], size_t ninfo
* By default, the range is assumed to be PMIX_SESSION. Changes
* to the range, and any additional directives, can be provided
* in the pmix_info_t array */
pmix_status_t PMIx_Unpublish(char **keys,
const pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Unpublish(char **keys,
const pmix_info_t info[], size_t ninfo);
/* Non-blocking form of the _PMIx_Unpublish_ function. The
* callback function will be executed once the server confirms
* removal of the specified data. */
pmix_status_t PMIx_Unpublish_nb(char **keys,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
pmix_status_t PMIx_Unpublish_nb(char **keys,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Spawn a new job. The assigned namespace of the spawned applications
@ -322,17 +337,17 @@ pmix_status_t PMIx_Unpublish_nb(char **keys,
* (c) PMIX_NOTIFY_COMPLETION - notify the parent process when the
* child job terminates, either normally or with error
*/
pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo,
const pmix_app_t apps[], size_t napps,
char nspace[]);
pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo,
const pmix_app_t apps[], size_t napps,
char nspace[]);
/* Non-blocking form of the _PMIx_Spawn_ function. The callback
* will be executed upon launch of the specified applications,
* or upon failure to launch any of them. */
pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t ninfo,
const pmix_app_t apps[], size_t napps,
pmix_spawn_cbfunc_t cbfunc, void *cbdata);
pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t ninfo,
const pmix_app_t apps[], size_t napps,
pmix_spawn_cbfunc_t cbfunc, void *cbdata);
/* Record the specified processes as "connected". Both blocking and non-blocking
* versions are provided. This means that the resource manager should treat the
@ -354,12 +369,12 @@ pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t ninfo,
* user-level directives regarding the algorithm to be used for the collective
* operation involved in the "connect", timeout constraints, and other options
* available from the host RM */
pmix_status_t PMIx_Connect(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Connect(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Connect_nb(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
pmix_status_t PMIx_Connect_nb(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Disconnect a previously connected set of processes. An error will be returned
* if the specified set of procs was not previously "connected". As above, a process
@ -367,12 +382,12 @@ pmix_status_t PMIx_Connect_nb(const pmix_proc_t procs[], size_t nprocs,
* is not allowed to reconnect to a set of procs that has not fully completed
* disconnect - i.e., you have to fully disconnect before you can reconnect to the
* _same_ group of processes. The info array is used as above. */
pmix_status_t PMIx_Disconnect(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Disconnect(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo);
pmix_status_t PMIx_Disconnect_nb(const pmix_proc_t ranges[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
pmix_status_t PMIx_Disconnect_nb(const pmix_proc_t ranges[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Given a node name, return an array of processes within the specified nspace
* on that node. If the nspace is NULL, then all processes on the node will
@ -381,15 +396,15 @@ pmix_status_t PMIx_Disconnect_nb(const pmix_proc_t ranges[], size_t nprocs,
* for releasing the array when done with it - the PMIX_PROC_FREE macro is
* provided for this purpose.
*/
pmix_status_t PMIx_Resolve_peers(const char *nodename, const char *nspace,
pmix_proc_t **procs, size_t *nprocs);
pmix_status_t PMIx_Resolve_peers(const char *nodename, const char *nspace,
pmix_proc_t **procs, size_t *nprocs);
/* Given an nspace, return the list of nodes hosting processes within
* that nspace. The returned string will contain a comma-delimited list
* of nodenames. The caller is responsible for releasing the string
* when done with it */
pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist);
pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist);
END_C_DECLS
#endif

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

@ -5,15 +5,15 @@
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* 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) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*
* This file includes the C99 stdint.h file if available, and otherwise
@ -188,7 +188,7 @@ typedef unsigned long long uintptr_t;
/* inttypes.h printf specifiers */
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#else
#else
# if SIZEOF_LONG == 8
# define __PRI64_PREFIX "l"
@ -307,7 +307,7 @@ typedef unsigned long long uintptr_t;
# define PRIoPTR __PRIPTR_PREFIX "o"
# define PRIuPTR __PRIPTR_PREFIX "u"
# define PRIxPTR __PRIPTR_PREFIX "x"
# define PRIXPTR __PRIPTR_PREFIX "X"
# define PRIXPTR __PRIPTR_PREFIX "X"
#endif

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

@ -1,5 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -89,35 +90,39 @@ BEGIN_C_DECLS
* these keys are RESERVED */
#define PMIX_ATTR_UNDEF NULL
/* initialization attributes */
#define PMIX_EVENT_BASE "pmix.evbase" // (struct event_base *) pointer to libevent event_base to use in place
// of the internal progress thread
/* identification attributes */
#define PMIX_USERID "pmix.euid" // (uint32_t) effective user id
#define PMIX_GRPID "pmix.egid" // (uint32_t) effective group id
#define PMIX_USERID "pmix.euid" // (uint32_t) effective user id
#define PMIX_GRPID "pmix.egid" // (uint32_t) effective group id
/* attributes for the rendezvous socket */
#define PMIX_SOCKET_MODE "pmix.sockmode" // (uint32_t) POSIX mode_t (9 bits valid)
#define PMIX_SOCKET_MODE "pmix.sockmode" // (uint32_t) POSIX mode_t (9 bits valid)
/* general proc-level attributes */
#define PMIX_CPUSET "pmix.cpuset" // (char*) hwloc bitmap applied to proc upon launch
#define PMIX_CREDENTIAL "pmix.cred" // (char*) security credential assigned to proc
#define PMIX_SPAWNED "pmix.spawned" // (bool) true if this proc resulted from a call to PMIx_Spawn
#define PMIX_ARCH "pmix.arch" // (uint32_t) datatype architecture flag
#define PMIX_CPUSET "pmix.cpuset" // (char*) hwloc bitmap applied to proc upon launch
#define PMIX_CREDENTIAL "pmix.cred" // (char*) security credential assigned to proc
#define PMIX_SPAWNED "pmix.spawned" // (bool) true if this proc resulted from a call to PMIx_Spawn
#define PMIX_ARCH "pmix.arch" // (uint32_t) datatype architecture flag
/* scratch directory locations for use by applications */
#define PMIX_TMPDIR "pmix.tmpdir" // (char*) top-level tmp dir assigned to session
#define PMIX_NSDIR "pmix.nsdir" // (char*) sub-tmpdir assigned to namespace
#define PMIX_PROCDIR "pmix.pdir" // (char*) sub-nsdir assigned to proc
#define PMIX_TMPDIR "pmix.tmpdir" // (char*) top-level tmp dir assigned to session
#define PMIX_NSDIR "pmix.nsdir" // (char*) sub-tmpdir assigned to namespace
#define PMIX_PROCDIR "pmix.pdir" // (char*) sub-nsdir assigned to proc
/* information about relative ranks as assigned by the RM */
#define PMIX_JOBID "pmix.jobid" // (char*) jobid assigned by scheduler
#define PMIX_APPNUM "pmix.appnum" // (uint32_t) app number within the job
#define PMIX_RANK "pmix.rank" // (uint32_t) process rank within the job
#define PMIX_GLOBAL_RANK "pmix.grank" // (uint32_t) rank spanning across all jobs in this session
#define PMIX_APP_RANK "pmix.apprank" // (uint32_t) rank within this app
#define PMIX_NPROC_OFFSET "pmix.offset" // (uint32_t) starting global rank of this job
#define PMIX_LOCAL_RANK "pmix.lrank" // (uint16_t) rank on this node within this job
#define PMIX_NODE_RANK "pmix.nrank" // (uint16_t) rank on this node spanning all jobs
#define PMIX_LOCALLDR "pmix.lldr" // (uint64_t) opal_identifier of lowest rank on this node within this job
#define PMIX_APPLDR "pmix.aldr" // (uint32_t) lowest rank in this app within this job
#define PMIX_JOBID "pmix.jobid" // (char*) jobid assigned by scheduler
#define PMIX_APPNUM "pmix.appnum" // (uint32_t) app number within the job
#define PMIX_RANK "pmix.rank" // (uint32_t) process rank within the job
#define PMIX_GLOBAL_RANK "pmix.grank" // (uint32_t) rank spanning across all jobs in this session
#define PMIX_APP_RANK "pmix.apprank" // (uint32_t) rank within this app
#define PMIX_NPROC_OFFSET "pmix.offset" // (uint32_t) starting global rank of this job
#define PMIX_LOCAL_RANK "pmix.lrank" // (uint16_t) rank on this node within this job
#define PMIX_NODE_RANK "pmix.nrank" // (uint16_t) rank on this node spanning all jobs
#define PMIX_LOCALLDR "pmix.lldr" // (uint64_t) opal_identifier of lowest rank on this node within this job
#define PMIX_APPLDR "pmix.aldr" // (uint32_t) lowest rank in this app within this job
/* proc location-related info */
/* For PMIX_HOSTNAME, three use-cases exist for PMIx_Get:
@ -133,147 +138,145 @@ BEGIN_C_DECLS
* (c) Specifying a namespace and a rank will return the name of the
* host that proc is on
*/
#define PMIX_HOSTNAME "pmix.hname" // (char*) see above comment
#define PMIX_NODEID "pmix.nodeid" // (uint32_t) node identifier
#define PMIX_LOCAL_PEERS "pmix.lpeers" // (char*) comma-delimited string of ranks on this node within the specified nspace
#define PMIX_LOCAL_CPUSETS "pmix.lcpus" // (char*) colon-delimited cpusets of local peers within the specified nspace
#define PMIX_PROC_URI "pmix.puri" // (char*) URI containing contact info for proc
#define PMIX_HOSTNAME "pmix.hname" // (char*) see above comment
#define PMIX_NODEID "pmix.nodeid" // (uint32_t) node identifier
#define PMIX_LOCAL_PEERS "pmix.lpeers" // (char*) comma-delimited string of ranks on this node within the specified nspace
#define PMIX_LOCAL_CPUSETS "pmix.lcpus" // (char*) colon-delimited cpusets of local peers within the specified nspace
#define PMIX_PROC_URI "pmix.puri" // (char*) URI containing contact info for proc
/* size info */
#define PMIX_UNIV_SIZE "pmix.univ.size" // (uint32_t) #procs in this nspace
#define PMIX_JOB_SIZE "pmix.job.size" // (uint32_t) #procs in this job
#define PMIX_LOCAL_SIZE "pmix.local.size" // (uint32_t) #procs in this job on this node
#define PMIX_NODE_SIZE "pmix.node.size" // (uint32_t) #procs across all jobs on this node
#define PMIX_MAX_PROCS "pmix.max.size" // (uint32_t) max #procs for this job
#define PMIX_UNIV_SIZE "pmix.univ.size" // (uint32_t) #procs in this nspace
#define PMIX_JOB_SIZE "pmix.job.size" // (uint32_t) #procs in this job
#define PMIX_APP_SIZE "pmix.app.size" // (uint32_t) #procs in this application
#define PMIX_LOCAL_SIZE "pmix.local.size" // (uint32_t) #procs in this job on this node
#define PMIX_NODE_SIZE "pmix.node.size" // (uint32_t) #procs across all jobs on this node
#define PMIX_MAX_PROCS "pmix.max.size" // (uint32_t) max #procs for this job
/* topology info */
#define PMIX_NET_TOPO "pmix.ntopo" // (char*) xml-representation of network topology
#define PMIX_LOCAL_TOPO "pmix.ltopo" // (char*) xml-representation of local node topology
#define PMIX_NODE_LIST "pmix.nlist" // (char*) comma-delimited list of nodes running procs for this job
#define PMIX_TOPOLOGY "pmix.topo" // (hwloc_topology_t) pointer to the PMIx client's internal topology object
#define PMIX_NET_TOPO "pmix.ntopo" // (char*) xml-representation of network topology
#define PMIX_LOCAL_TOPO "pmix.ltopo" // (char*) xml-representation of local node topology
#define PMIX_NODE_LIST "pmix.nlist" // (char*) comma-delimited list of nodes running procs for this job
#define PMIX_TOPOLOGY "pmix.topo" // (hwloc_topology_t) pointer to the PMIx client's internal topology object
/* request-related info */
#define PMIX_COLLECT_DATA "pmix.collect" // (bool) collect data and return it at the end of the operation
#define PMIX_TIMEOUT "pmix.timeout" // (int) time in sec before specified operation should time out
#define PMIX_WAIT "pmix.wait" // (int) caller requests that the server wait until at least the specified
// #values are found (0 => all and is the default)
#define PMIX_COLLECTIVE_ALGO "pmix.calgo" // (char*) comma-delimited list of algorithms to use for collective
#define PMIX_COLLECTIVE_ALGO_REQD "pmix.calreqd" // (bool) if true, indicates that the requested choice of algo is mandatory
#define PMIX_NOTIFY_COMPLETION "pmix.notecomp" // (bool) notify parent process upon termination of child job
#define PMIX_RANGE "pmix.range" // (int) pmix_data_range_t value for calls to publish/lookup/unpublish
#define PMIX_PERSISTENCE "pmix.persist" // (int) pmix_persistence_t value for calls to publish
#define PMIX_OPTIONAL "pmix.optional" // (bool) look only in the immediate data store for the requested value - do
// not request data from the server if not found
#define PMIX_COLLECT_DATA "pmix.collect" // (bool) collect data and return it at the end of the operation
#define PMIX_TIMEOUT "pmix.timeout" // (int) time in sec before specified operation should time out
#define PMIX_WAIT "pmix.wait" // (int) caller requests that the server wait until at least the specified
// #values are found (0 => all and is the default)
#define PMIX_COLLECTIVE_ALGO "pmix.calgo" // (char*) comma-delimited list of algorithms to use for collective
#define PMIX_COLLECTIVE_ALGO_REQD "pmix.calreqd" // (bool) if true, indicates that the requested choice of algo is mandatory
#define PMIX_NOTIFY_COMPLETION "pmix.notecomp" // (bool) notify parent process upon termination of child job
#define PMIX_RANGE "pmix.range" // (int) pmix_data_range_t value for calls to publish/lookup/unpublish
#define PMIX_PERSISTENCE "pmix.persist" // (int) pmix_persistence_t value for calls to publish
#define PMIX_OPTIONAL "pmix.optional" // (bool) look only in the immediate data store for the requested value - do
// not request data from the server if not found
#define PMIX_EMBED_BARRIER "pmix.embed.barrier" // (bool) execute a blocking fence operation before executing the
// specified operation
/* attributes used by host server to pass data to the server convenience library - the
* data will then be parsed and provided to the local clients */
#define PMIX_PROC_DATA "pmix.pdata" // (pmix_value_array_t) starts with rank, then contains more data
#define PMIX_NODE_MAP "pmix.nmap" // (char*) regex of nodes containing procs for this job
#define PMIX_PROC_MAP "pmix.pmap" // (char*) regex describing procs on each node within this job
#define PMIX_ANL_MAP "pmix.anlmap" // (char*) process mapping in ANL notation (used in PMI-1/PMI-2)
#define PMIX_PROC_DATA "pmix.pdata" // (pmix_value_array_t) starts with rank, then contains more data
#define PMIX_NODE_MAP "pmix.nmap" // (char*) regex of nodes containing procs for this job
#define PMIX_PROC_MAP "pmix.pmap" // (char*) regex describing procs on each node within this job
#define PMIX_ANL_MAP "pmix.anlmap" // (char*) process mapping in ANL notation (used in PMI-1/PMI-2)
/* attributes used internally to communicate data from the server to the client */
#define PMIX_PROC_BLOB "pmix.pblob" // (pmix_byte_object_t) packed blob of process data
#define PMIX_MAP_BLOB "pmix.mblob" // (pmix_byte_object_t) packed blob of process location
#define PMIX_PROC_BLOB "pmix.pblob" // (pmix_byte_object_t) packed blob of process data
#define PMIX_MAP_BLOB "pmix.mblob" // (pmix_byte_object_t) packed blob of process location
/* error handler registration and notification info keys */
#define PMIX_ERROR_NAME "pmix.errname" // enum pmix_status_t specific error to be notified
#define PMIX_ERROR_GROUP_COMM "pmix.errgroup.comm" // bool - set true to get comm errors notification
#define PMIX_ERROR_GROUP_ABORT "pmix.errgroup.abort" // bool -set true to get abort errors notification
#define PMIX_ERROR_GROUP_MIGRATE "pmix.errgroup.migrate" // bool -set true to get migrate errors notification
#define PMIX_ERROR_GROUP_RESOURCE "pmix.errgroup.resource" // bool -set true to get resource errors notification
#define PMIX_ERROR_GROUP_SPAWN "pmix.errgroup.spawn" // bool - set true to get spawn errors notification
#define PMIX_ERROR_GROUP_NODE "pmix.errgroup.node" // bool -set true to get node status errors
#define PMIX_ERROR_GROUP_LOCAL "pmix.errgroup.local" // bool set true to get local errors
#define PMIX_ERROR_GROUP_GENERAL "pmix.errgroup.gen" // bool set true to get notified af generic errors
#define PMIX_ERROR_HANDLER_ID "pmix.errhandler.id" // int - errhandler reference id of notification being reported
/* event handler registration and notification info keys */
#define PMIX_EVENT_HDLR_NAME "pmix.evname" // (char*) string name identifying this handler
#define PMIX_EVENT_JOB_LEVEL "pmix.evjob" // (bool) register for job-specific events only
#define PMIX_EVENT_ENVIRO_LEVEL "pmix.evenv" // (bool) register for environment events only
#define PMIX_EVENT_ORDER_PREPEND "pmix.evprepend" // (bool) prepend this handler to the precedence list
#define PMIX_EVENT_CUSTOM_RANGE "pmix.evrange" // (pmix_proc_t*) array of pmix_proc_t defining range of event notification
#define PMIX_EVENT_AFFECTED_PROCS "pmix.evaffected" // (pmix_proc_t*) array of pmix_proc_t defining affected procs
#define PMIX_EVENT_NON_DEFAULT "pmix.evnondef" // (bool) event is not to be delivered to default event handlers
/* fault tolerance-related events */
#define PMIX_EVENT_TERMINATE_SESSION "pmix.evterm.sess" // (bool) RM intends to terminate session
#define PMIX_EVENT_TERMINATE_JOB "pmix.evterm.job" // (bool) RM intends to terminate this job
#define PMIX_EVENT_TERMINATE_NODE "pmix.evterm.node" // (bool) RM intends to terminate all procs on this node
#define PMIX_EVENT_TERMINATE_PROC "pmix.evterm.proc" // (bool) RM intends to terminate just this process
#define PMIX_EVENT_ACTION_TIMEOUT "pmix.evtimeout" // (int) time in sec before RM will execute error response
/* error notification keys */
#define PMIX_ERROR_SCOPE "pmix.errscope" // int (enum pmix_scope_t) scope of error notification
#define PMIX_ERROR_NODE_NAME "pmix.errnode.name" // name of the node that is in error or which reported the error.
#define PMIX_ERROR_SEVERITY "pmix.errseverity" // the severity of the notified (reported) error
/* attributes used to describe "spawm" attributes */
#define PMIX_PERSONALITY "pmix.pers" // (char*) name of personality to use
#define PMIX_HOST "pmix.host" // (char*) comma-delimited list of hosts to use for spawned procs
#define PMIX_HOSTFILE "pmix.hostfile" // (char*) hostfile to use for spawned procs
#define PMIX_ADD_HOST "pmix.addhost" // (char*) comma-delimited list of hosts to add to allocation
#define PMIX_ADD_HOSTFILE "pmix.addhostfile" // (char*) hostfile to add to existing allocation
#define PMIX_PREFIX "pmix.prefix" // (char*) prefix to use for starting spawned procs
#define PMIX_WDIR "pmix.wdir" // (char*) working directory for spawned procs
#define PMIX_MAPPER "pmix.mapper" // (char*) mapper to use for placing spawned procs
#define PMIX_DISPLAY_MAP "pmix.dispmap" // (bool) display process map upon spawn
#define PMIX_PPR "pmix.ppr" // (char*) #procs to spawn on each identified resource
#define PMIX_MAPBY "pmix.mapby" // (char*) mapping policy
#define PMIX_RANKBY "pmix.rankby" // (char*) ranking policy
#define PMIX_BINDTO "pmix.bindto" // (char*) binding policy
#define PMIX_PRELOAD_BIN "pmix.preloadbin" // (bool) preload binaries
#define PMIX_PRELOAD_FILES "pmix.preloadfiles" // (char*) comma-delimited list of files to pre-position
#define PMIX_NON_PMI "pmix.nonpmi" // (bool) spawned procs will not call PMIx_Init
#define PMIX_STDIN_TGT "pmix.stdin" // (uint32_t) spawned proc rank that is to receive stdin
/* attributes used to describe "spawn" attributes */
#define PMIX_PERSONALITY "pmix.pers" // (char*) name of personality to use
#define PMIX_HOST "pmix.host" // (char*) comma-delimited list of hosts to use for spawned procs
#define PMIX_HOSTFILE "pmix.hostfile" // (char*) hostfile to use for spawned procs
#define PMIX_ADD_HOST "pmix.addhost" // (char*) comma-delimited list of hosts to add to allocation
#define PMIX_ADD_HOSTFILE "pmix.addhostfile" // (char*) hostfile to add to existing allocation
#define PMIX_PREFIX "pmix.prefix" // (char*) prefix to use for starting spawned procs
#define PMIX_WDIR "pmix.wdir" // (char*) working directory for spawned procs
#define PMIX_MAPPER "pmix.mapper" // (char*) mapper to use for placing spawned procs
#define PMIX_DISPLAY_MAP "pmix.dispmap" // (bool) display process map upon spawn
#define PMIX_PPR "pmix.ppr" // (char*) #procs to spawn on each identified resource
#define PMIX_MAPBY "pmix.mapby" // (char*) mapping policy
#define PMIX_RANKBY "pmix.rankby" // (char*) ranking policy
#define PMIX_BINDTO "pmix.bindto" // (char*) binding policy
#define PMIX_PRELOAD_BIN "pmix.preloadbin" // (bool) preload binaries
#define PMIX_PRELOAD_FILES "pmix.preloadfiles" // (char*) comma-delimited list of files to pre-position
#define PMIX_NON_PMI "pmix.nonpmi" // (bool) spawned procs will not call PMIx_Init
#define PMIX_STDIN_TGT "pmix.stdin" // (uint32_t) spawned proc rank that is to receive stdin
/**** PMIX ERROR CONSTANTS ****/
/* PMIx errors are always negative, with 0 reserved for success */
#define PMIX_ERROR_MIN -50 // set equal to number of non-zero entries in enum
#define PMIX_ERR_BASE 0
typedef enum {
PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER = PMIX_ERROR_MIN,
PMIX_ERR_COMM_FAILURE,
PMIX_ERR_NOT_IMPLEMENTED,
PMIX_ERR_NOT_SUPPORTED,
PMIX_ERR_NOT_FOUND,
PMIX_ERR_SERVER_NOT_AVAIL,
PMIX_ERR_INVALID_NAMESPACE,
PMIX_ERR_INVALID_SIZE,
PMIX_ERR_INVALID_KEYVALP,
PMIX_ERR_INVALID_NUM_PARSED,
typedef int pmix_status_t;
PMIX_ERR_INVALID_ARGS,
PMIX_ERR_INVALID_NUM_ARGS,
PMIX_ERR_INVALID_LENGTH,
PMIX_ERR_INVALID_VAL_LENGTH,
PMIX_ERR_INVALID_VAL,
PMIX_ERR_INVALID_KEY_LENGTH,
PMIX_ERR_INVALID_KEY,
PMIX_ERR_INVALID_ARG,
PMIX_ERR_NOMEM,
PMIX_ERR_INIT,
#define PMIX_SUCCESS (PMIX_ERR_BASE)
#define PMIX_ERROR (PMIX_ERR_BASE - 1) // general error
/* debugger release flag */
#define PMIX_ERR_DEBUGGER_RELEASE (PMIX_ERR_BASE - 2)
/* fault tolerance */
#define PMIX_ERR_PROC_RESTART (PMIX_ERR_BASE - 3)
#define PMIX_ERR_PROC_CHECKPOINT (PMIX_ERR_BASE - 4)
#define PMIX_ERR_PROC_MIGRATE (PMIX_ERR_BASE - 5)
#define PMIX_ERR_UPDATE_ENDPOINTS (PMIX_ERR_BASE - 6)
/* abort */
#define PMIX_ERR_PROC_ABORTED (PMIX_ERR_BASE - 7)
#define PMIX_ERR_PROC_REQUESTED_ABORT (PMIX_ERR_BASE - 8)
#define PMIX_ERR_PROC_ABORTING (PMIX_ERR_BASE - 9)
/* communication failures */
#define PMIX_ERR_UNREACH (PMIX_ERR_BASE - 10)
#define PMIX_ERR_LOST_CONNECTION_TO_SERVER (PMIX_ERR_BASE - 11)
#define PMIX_ERR_LOST_PEER_CONNECTION (PMIX_ERR_BASE - 12)
#define PMIX_ERR_LOST_CONNECTION_TO_CLIENT (PMIX_ERR_BASE - 13)
/* operational */
#define PMIX_ERR_NO_PERMISSIONS (PMIX_ERR_BASE - 14)
#define PMIX_ERR_TIMEOUT (PMIX_ERR_BASE - 15)
#define PMIX_ERR_WOULD_BLOCK (PMIX_ERR_BASE - 16)
#define PMIX_EXISTS (PMIX_ERR_BASE - 17)
#define PMIX_ERR_SERVER_FAILED_REQUEST (PMIX_ERR_BASE - 18)
#define PMIX_ERR_NOT_SUPPORTED (PMIX_ERR_BASE - 19)
#define PMIX_ERR_NOT_FOUND (PMIX_ERR_BASE - 20)
#define PMIX_ERR_BAD_PARAM (PMIX_ERR_BASE - 21)
#define PMIX_ERR_DATA_VALUE_NOT_FOUND (PMIX_ERR_BASE - 22)
#define PMIX_ERR_OUT_OF_RESOURCE (PMIX_ERR_BASE - 23)
#define PMIX_ERR_INVALID_NAMESPACE (PMIX_ERR_BASE - 24)
#define PMIX_ERR_INVALID_SIZE (PMIX_ERR_BASE - 25)
#define PMIX_ERR_INIT (PMIX_ERR_BASE - 26)
#define PMIX_ERR_EVENT_REGISTRATION (PMIX_ERR_BASE - 27)
/* system failures */
#define PMIX_ERR_NODE_DOWN (PMIX_ERR_BASE - 28)
#define PMIX_ERR_NODE_OFFLINE (PMIX_ERR_BASE - 29)
/* used by event handlers */
#define PMIX_EVENT_NO_ACTION_TAKEN (PMIX_ERR_BASE - 30)
#define PMIX_EVENT_PARTIAL_ACTION_TAKEN (PMIX_ERR_BASE - 31)
#define PMIX_EVENT_ACTION_DEFERRED (PMIX_ERR_BASE - 32)
#define PMIX_EVENT_ACTION_COMPLETE (PMIX_ERR_BASE - 33)
PMIX_ERR_DATA_VALUE_NOT_FOUND,
PMIX_ERR_OUT_OF_RESOURCE,
PMIX_ERR_RESOURCE_BUSY,
PMIX_ERR_BAD_PARAM,
PMIX_ERR_IN_ERRNO,
PMIX_ERR_UNREACH,
PMIX_ERR_TIMEOUT,
PMIX_ERR_NO_PERMISSIONS,
PMIX_ERR_PACK_MISMATCH,
PMIX_ERR_PACK_FAILURE,
PMIX_ERR_UNPACK_FAILURE,
PMIX_ERR_UNPACK_INADEQUATE_SPACE,
PMIX_ERR_TYPE_MISMATCH,
PMIX_ERR_PROC_ENTRY_NOT_FOUND,
PMIX_ERR_UNKNOWN_DATA_TYPE,
PMIX_ERR_WOULD_BLOCK,
PMIX_ERR_READY_FOR_HANDSHAKE,
PMIX_ERR_HANDSHAKE_FAILED,
PMIX_ERR_INVALID_CRED,
PMIX_EXISTS,
/* define a starting point for PMIx internal error codes
* that are never exposed outside the library */
#define PMIX_INTERNAL_ERR_BASE -1000
PMIX_ERR_SERVER_FAILED_REQUEST,
PMIX_ERR_PROC_ABORTING,
PMIX_ERR_PROC_REQUESTED_ABORT,
PMIX_ERR_PROC_ABORTED,
PMIX_ERR_PROC_MIGRATE,
PMIX_ERR_PROC_CHECKPOINT,
PMIX_ERR_PROC_RESTART,
PMIX_ERR_DEBUGGER_RELEASE,
PMIX_ERR_SILENT,
PMIX_ERROR,
PMIX_SUCCESS
} pmix_status_t;
/* define a starting point for user-level defined error
* constants - negative values larger than this are guaranteed
* not to conflict with PMIx values. Definitions should always
* be based on the PMIX_EXTERNAL_ERR_BASE constant and -not- a
* specific value as the value of the constant may change */
#define PMIX_EXTERNAL_ERR_BASE -2000
/**** PMIX DATA TYPES ****/
@ -303,6 +306,9 @@ typedef enum {
PMIX_TIMEVAL,
PMIX_TIME,
PMIX_STATUS, // needs to be tracked separately from integer for those times
// when we are embedded and it needs to be converted to the
// host error definitions
PMIX_HWLOC_TOPO,
PMIX_VALUE,
PMIX_INFO_ARRAY,
@ -314,7 +320,8 @@ typedef enum {
PMIX_BYTE_OBJECT,
PMIX_KVAL,
PMIX_MODEX,
PMIX_PERSIST
PMIX_PERSIST,
PMIX_POINTER
} pmix_data_type_t;
/* define a scope for data "put" by PMI per the following:
@ -340,9 +347,13 @@ typedef enum {
*/
#define PMIX_DATA_RANGE PMIX_UINT
typedef enum {
PMIX_DATA_RANGE_UNDEF = 0,
PMIX_NAMESPACE, // data is available to procs in the same nspace only
PMIX_SESSION // data available to all procs in session
PMIX_RANGE_UNDEF = 0,
PMIX_RANGE_RM, // data is intended for the host resource manager
PMIX_RANGE_LOCAL, // available on local node only
PMIX_RANGE_NAMESPACE, // data is available to procs in the same nspace only
PMIX_RANGE_SESSION, // data available to all procs in session
PMIX_RANGE_GLOBAL, // data available to all procs
PMIX_RANGE_CUSTOM // range is specified in a pmix_info_t
} pmix_data_range_t;
/* define a "persistence" policy for data published by clients */
@ -426,8 +437,10 @@ typedef struct pmix_value {
float fval;
double dval;
struct timeval tv;
pmix_status_t status;
pmix_info_array_t array;
pmix_byte_object_t bo;
void *ptr;
} data;
} pmix_value_t;
/* allocate and initialize a specified number of value structs */
@ -495,12 +508,13 @@ typedef struct pmix_value {
} \
} while (0)
/* expose a function that is resolved in the
/* expose two functions that are resolved in the
* PMIx library, but part of a header that
* includes internal functions - so we don't
* includes internal functions - we don't
* want to expose the entire header here
*/
void pmix_value_load(pmix_value_t *v, void *data, pmix_data_type_t type);
pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src);
@ -508,6 +522,7 @@ void pmix_value_load(pmix_value_t *v, void *data, pmix_data_type_t type);
/**** PMIX INFO STRUCT ****/
struct pmix_info_t {
char key[PMIX_MAX_KEYLEN+1]; // ensure room for the NULL terminator
bool required; // defaults to optional (i.e., required=false)
pmix_value_t value;
};
@ -545,6 +560,17 @@ struct pmix_info_t {
(void)strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \
pmix_value_load(&((m)->value), (v), (t)); \
} while (0)
#define PMIX_INFO_XFER(d, s) \
do { \
(void)strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \
(d)->required = (s)->required; \
pmix_value_xfer(&(d)->value, &(s)->value); \
} while(0)
#define PMIX_INFO_REQUIRED(m) \
(m)->required = true;
#define PMIX_INFO_OPTIONAL(m) \
(m)->required = false;
/**** PMIX LOOKUP RETURN STRUCT ****/
typedef struct pmix_pdata {
@ -754,31 +780,55 @@ typedef void (*pmix_lookup_cbfunc_t)(pmix_status_t status,
pmix_pdata_t data[], size_t ndata,
void *cbdata);
/* define a callback function for the errhandler. Upon receipt of an
* error notification, PMIx will execute the specified notification
/* define a callback by which an event handler can notify the PMIx library
* that it has completed its response to the notification. The handler
* is _required_ to execute this callback so the library can determine
* if additional handlers need to be called. The handler shall return
* PMIX_SUCCESS if no further action is required. The return status
* of each event handler and any returned pmix_info_t structures
* will be added to the array of pmix_info_t passed to any subsequent
* event handlers to help guide their operation.
*
* If non-NULL, the provided callback function will be called to allow
* the event handler to release the provided info array.
*/
typedef void (*pmix_event_notification_cbfunc_fn_t)(pmix_status_t status,
pmix_info_t *results, size_t nresults,
pmix_op_cbfunc_t cbfunc, void *thiscbdata,
void *notification_cbdata);
/* define a callback function for the event handler. Upon receipt of an
* event notification, PMIx will execute the specified notification
* callback function, providing:
*
* status - the error that occurred
* procs - the nspace and ranks of the affected processes. A NULL
* value indicates that the error occurred in the PMIx
* client library within this process itself
* nprocs - the number of procs in the provided array
* info - any additional info provided regarding the error.
* ninfo - the number of info objects in the provided array
* evhdlr_registration_id - the returned registration number of
* the event handler being called
* status - the event that occurred
* source - the nspace and rank of the process that generated
* the event. If the source is the resource manager,
* then the nspace will be empty and the rank will
* be PMIX_RANK_UNDEF
* info - any additional info provided regarding the event.
* ninfo - the number of info objects in the info array
* results - any provided results from event handlers called
* prior to this one.
* nresults - number of info objects in the results array
* cbfunc - the function to be called upon completion of the handler
* cbdata - pointer to be returned in the completion cbfunc
*
* Note that different resource managers may provide differing levels
* of support for error notification to application processes. Thus, the
* info array may be NULL or may contain detailed information of the error.
* of support for event notification to application processes. Thus, the
* info array may be NULL or may contain detailed information of the event.
* It is the responsibility of the application to parse any provided info array
* for defined key-values if it so desires.
*
* Possible uses of the pmix_info_t object include:
*
* - for the RM to alert the process as to planned actions, such as
* to abort the session, in response to the reported error
* to abort the session, in response to the reported event
*
* - provide a timeout for alternative action to occur, such as for
* the application to request an alternate response to the error
* the application to request an alternate response to the event
*
* For example, the RM might alert the application to the failure of
* a node that resulted in termination of several processes, and indicate
@ -793,23 +843,24 @@ typedef void (*pmix_lookup_cbfunc_t)(pmix_status_t status,
* on a per-RM basis.
*
* On the server side, the notification function is used to inform the host
* server of a detected error in the PMIx subsystem and/or client
*
* The errhandler_ref is included as the first pmix_info_t in the returned
* array for embedded scenarios where the notification callback is to a switchyard
* server of a detected event in the PMIx subsystem and/or client
*/
typedef void (*pmix_notification_fn_t)(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo);
typedef void (*pmix_notification_fn_t)(size_t evhdlr_registration_id,
pmix_status_t status,
const pmix_proc_t *source,
pmix_info_t info[], size_t ninfo,
pmix_info_t *results, size_t nresults,
pmix_event_notification_cbfunc_fn_t cbfunc,
void *cbdata);
/* 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
/* define a callback function for calls to PMIx_Register_evhdlr. The
* status indicates if the request was successful or not, evhdlr_ref is
* an integer reference assigned to the event handler 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);
typedef void (*pmix_evhdlr_reg_cbfunc_t)(pmix_status_t status,
size_t evhdlr_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
@ -819,89 +870,86 @@ typedef void (*pmix_value_cbfunc_t)(pmix_status_t status,
pmix_value_t *kv, void *cbdata);
/**** COMMON SUPPORT FUNCTIONS ****/
/* Register an errhandler to report errors. Three types of errors
/* Register an event handler to report events. Three types of events
* can be reported:
*
* (a) those that occur within the client library, but are not
* reportable via the API itself (e.g., loss of connection to
* the server). These errors typically occur during behind-the-scenes
* the server). These events typically occur during behind-the-scenes
* non-blocking operations.
*
* (b) job-related errors such as the failure of another process in
* (b) job-related events such as the failure of another process in
* the job or in any connected job, impending failure of hardware
* within the job's usage footprint, etc.
*
* (c) system notifications that are made available by the local
* administrators
*
* By default, only errors that directly affect the process and/or
* By default, only events that directly affect the process and/or
* any process to which it is connected (via the PMIx_Connect call)
* 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)
* err handlers for specific events. PMIx client/server calls the registered
* err handler upon receiving event notify notification (via PMIx_Notify_event)
* from the other end (Resource Manager/Client application).
*
* Multiple err handlers can be registered for different errors. PMIX returns
* Multiple err handlers can be registered for different events. 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.
* must retain the reference in order to deregister the evhdlr.
* Modification of the notification behavior can be accomplished by
* deregistering the current errhandler, and then registering it
* deregistering the current evhdlr, 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_errhandler_reg_cbfunc_t cbfunc,
void *cbdata);
void PMIx_Register_event_handler(pmix_status_t codes[], size_t ncodes,
pmix_info_t info[], size_t ninfo,
pmix_notification_fn_t evhdlr,
pmix_evhdlr_reg_cbfunc_t cbfunc,
void *cbdata);
/* 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
/* Deregister an event handler
* evhdlr_ref is the reference returned by PMIx from the call to
* PMIx_Register_event_handler. If non-NULL, the provided cbfunc
* will be called to confirm removal of the designated handler */
void PMIx_Deregister_event_handler(size_t evhdlr_ref,
pmix_op_cbfunc_t cbfunc,
void *cbdata);
/* Report an event to a process for notification via any
* registered evhdlr. The evhdlr registration can be
* called by both the server and the client application. On the
* server side, the errhandler is used to report errors detected
* server side, the evhdlr is used to report events detected
* by PMIx to the host server for handling. On the client side,
* the errhandler is used to notify the process of errors
* the evhdlr is used to notify the process of events
* 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.
* convenience library to notify all registered local procs of
* an event. The event can be local, or anywhere in the cluster.
* The status indicates the event 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.
* resource manager of an event it encountered. It can request the host
* server to notify the indicated processes about the event.
*
* 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
* The array of procs identifies the processes that will be impacted
* by the event. 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
* notify_event 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_status_t PMIx_Notify_event(pmix_status_t status,
const pmix_proc_t *source,
pmix_data_range_t range,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved
* Copyright (c) 2015 Artem Y. Polyakov <artpol84@gmail.com>.
* All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
@ -82,9 +82,12 @@ BEGIN_C_DECLS
* server, which is free to release it upon return from the callback */
/* Notify the host server that a client connected to us */
typedef pmix_status_t (*pmix_server_client_connected_fn_t)(const pmix_proc_t *proc,
void* server_object);
/* Notify the host server that a client connected to us - note
* that the client will be in a blocked state until the host server
* executes the callback function, thus allowing the PMIx server support
* library to release the client */
typedef pmix_status_t (*pmix_server_client_connected_fn_t)(const pmix_proc_t *proc, void* server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Notify the host server that a client called PMIx_Finalize - note
* that the client will be in a blocked state until the host server
@ -235,25 +238,41 @@ 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. 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,
* manager is _required_ to pass along to the local PMIx server all events
* that directly relate to a registered namespace. However, the RM may have
* access to events beyond those - e.g., environmental events. The PMIx server
* will register to receive environmental events that match specific PMIx
* event codes. If the host RM supports such notifications, it will need to
* translate its own internal event codes to fit into a corresponding PMIx event
* code - any specific info beyond that can be passed in via the pmix_info_t
* upon notification.
*
* The info array included in this API is reserved for possible future directives
* to further steer notification.
*/
typedef pmix_status_t (*pmix_server_register_events_fn_t)(pmix_status_t *codes, size_t ncodes,
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);
/* Deregister to receive notifications for the specified environmental events
* for which the PMIx server has previously registered. The host RM remains
* required to notify of any job-related events */
typedef pmix_status_t (*pmix_server_deregister_events_fn_t)(pmix_status_t *codes, size_t ncodes,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Notify the specified processes of an event generated either by
* the PMIx server itself, or by one of its local clients. The process
* generating the event is provided in the source parameter. */
typedef pmix_status_t (*pmix_server_notify_event_fn_t)(pmix_status_t code,
const pmix_proc_t *source,
pmix_data_range_t range,
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);
typedef void (*pmix_connection_cbfunc_t)(int incoming_sd, void *cbdata);
/* Register a socket the host server can monitor for connection
* requests, harvest them, and then call our internal callback
@ -266,23 +285,25 @@ typedef void (*pmix_connection_cbfunc_t)(int incoming_sd);
* will cause the internal PMIx server to spawn its own listener
* thread */
typedef pmix_status_t (*pmix_server_listener_fn_t)(int listening_sd,
pmix_connection_cbfunc_t cbfunc);
pmix_connection_cbfunc_t cbfunc,
void *cbdata);
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_deregister_events_fn_t deregister_events;
pmix_server_listener_fn_t listener;
typedef struct pmix_server_module_2_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_deregister_events_fn_t deregister_events;
pmix_server_notify_event_fn_t notify_event;
pmix_server_listener_fn_t listener;
} pmix_server_module_t;
/**** SERVER SUPPORT INIT/FINALIZE FUNCTIONS ****/
@ -367,7 +388,8 @@ pmix_status_t PMIx_server_register_nspace(const char nspace[], int nlocalprocs,
* intended to support persistent PMIx servers by providing
* an opportunity for the host RM to tell the PMIx server
* library to release all memory for a completed job */
void PMIx_server_deregister_nspace(const char nspace[]);
void PMIx_server_deregister_nspace(const char nspace[],
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Register a client process with the PMIx server library. The
* expected user ID and group ID of the child process helps the
@ -391,7 +413,8 @@ pmix_status_t PMIx_server_register_client(const pmix_proc_t *proc,
* deregister_nspace API will automatically delete all client
* info for that nspace - this API is therefore intended solely
* for use in exception cases */
void PMIx_server_deregister_client(const pmix_proc_t *proc);
void PMIx_server_deregister_client(const pmix_proc_t *proc,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Setup the environment of a child process to be forked
* by the host so it can correctly interact with the PMIx

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше