1
1

Merge pull request #1266 from ggouaillardet/topic/misc_pmix_fixes

Topic/misc pmix fixes
Этот коммит содержится в:
rhc54 2015-12-29 07:02:44 -08:00
родитель b7b4231fbb b20a219ad0
Коммит 5dfb7ac396
212 изменённых файлов: 50036 добавлений и 445 удалений

4
.gitignore поставляемый
Просмотреть файл

@ -303,6 +303,10 @@ opal/mca/installdirs/config/install_dirs.h
opal/mca/pmix/pmix112/pmix/include/pmix/autogen/config.h
opal/mca/pmix/pmix112/pmix/include/private/autogen/config.h
opal/mca/pmix/pmix112/pmix/include/private/autogen/config.h.in
opal/mca/pmix/pmix120/pmix/include/pmix/autogen/config.h
opal/mca/pmix/pmix120/pmix/include/private/autogen/config.h
opal/mca/pmix/pmix120/pmix/include/private/autogen/config.h.in
opal/tools/opal-checkpoint/opal-checkpoint
opal/tools/opal-checkpoint/opal-checkpoint.1

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

@ -232,20 +232,25 @@ AC_DEFUN([OPAL_CHECK_PMIX],[
OPAL_VAR_SCOPE_PUSH([pmix_ext_install_dir])
AC_ARG_WITH([external-pmix],
[AC_HELP_STRING([--with-external-pmix(=DIR)],
[Use external PMIx support, optionally adding DIR to the search path (default: no)])],
[], with_external_pmix=no)
AC_ARG_WITH([pmix],
[AC_HELP_STRING([--with-pmix(=DIR)],
[Build PMIx support. DIR can take one of three values: "internal", "external", or a valid directory name. "internal" (or no DIR value) forces Open MPI to use its internal copy of PMIx. "external" forces Open MPI to use an external installation of PMIx. Supplying a valid directory name also forces Open MPI to use an external installation of PMIx, and adds DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries. Note that Open MPI does not support --without-pmix.])])
AC_MSG_CHECKING([if user requested PMIx support])
AS_IF([test "$with_external_pmix" = "no"],
AS_IF([test "$with_pmix" = "no"],
[AC_MSG_WARN([Open MPI requires PMIx support. It can be built])
AC_MSG_WARN([with either its own internal copy of PMIx, or with])
AC_MSG_WARN([an external copy that you supply.])
AC_MSG_ERROR([Cannot continue])])
AC_MSG_CHECKING([if user requested PMIx support($with_pmix)])
AS_IF([test -z "$with_pmix" || test "$with_pmix" = "yes" || test "$with_mpix" = "internal"],
[AC_MSG_RESULT([no])
opal_external_pmix_happy="no"],
[AC_MSG_RESULT([yes])
# check for external pmix lib */
AS_IF([test "$with_external_pmix" == "yes" || test -z "$with_external_pmix"],
AS_IF([test "$with_pmix" = "external"],
[pmix_ext_install_dir=/usr],
[pmix_ext_install_dir=$with_external_pmix])
[pmix_ext_install_dir=$with_pmix])
# cannot use check_package because there are
# external dependencies to make the headers

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

@ -14,6 +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$
*
* Additional copyrights may follow
@ -30,6 +31,7 @@
#include "ompi/errhandler/errhandler.h"
#include "ompi/errhandler/errhandler_predefined.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/mca/pmix/pmix.h"
/*
@ -37,6 +39,10 @@
*/
opal_pointer_array_t ompi_errhandler_f_to_c_table = {{0}};
/*
* default errhandler id
*/
static int default_errhandler_id = -1;
/*
* Class information
@ -157,6 +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);
/* Remove errhandler F2C table */
@ -169,7 +176,7 @@ int ompi_errhandler_finalize(void)
ompi_errhandler_t *ompi_errhandler_create(ompi_errhandler_type_t object_type,
ompi_errhandler_generic_handler_fn_t *func,
ompi_errhandler_generic_handler_fn_t *func,
ompi_errhandler_lang_t lang)
{
ompi_errhandler_t *new_errhandler;
@ -213,20 +220,33 @@ ompi_errhandler_t *ompi_errhandler_create(ompi_errhandler_type_t object_type,
return new_errhandler;
}
/* registration callback */
void ompi_errhandler_registration_callback(int status,
int errhandler_ref,
void *cbdata)
{
ompi_errhandler_errtrk_t *errtrk = (ompi_errhandler_errtrk_t*)cbdata;
default_errhandler_id = errhandler_ref;
errtrk->status = status;
errtrk->active = false;
}
/**
* Default runtime errhandler callback
* Default errhandler callback
*/
int ompi_errhandler_runtime_callback(opal_pointer_array_t *errors) {
ompi_rte_error_report_t *err;
int errcode = 1;
if (NULL != errors &&
(NULL != (err = (ompi_rte_error_report_t*)opal_pointer_array_get_item(errors, 0)))) {
errcode = err->errcode;
void ompi_errhandler_callback(int status,
opal_list_t *procs,
opal_list_t *info,
opal_pmix_release_cbfunc_t cbfunc,
void *cbdata)
{
/* allow the caller to release its data */
if (NULL != cbfunc) {
cbfunc(cbdata);
}
ompi_mpi_abort(MPI_COMM_WORLD, errcode);
return OMPI_SUCCESS;
/* our default action is to abort */
ompi_mpi_abort(MPI_COMM_WORLD, status);
}
/**************************************************************************

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

@ -12,6 +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$
*
* Additional copyrights may follow
@ -30,6 +31,7 @@
#include "opal/prefetch.h"
#include "opal/class/opal_object.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/mca/pmix/pmix.h"
#include "ompi/mca/rte/rte.h"
#include "ompi/runtime/mpiruntime.h"
@ -364,29 +366,28 @@ struct ompi_request_t;
ompi_errhandler_lang_t language);
/**
* Callback function from runtime layer to alert the MPI layer of an error at
* the runtime layer.
*
* @param errors A pointer array containing structs of type
* ompi_rte_error_report_t that consists of at least
* {
* ompi_process_name_t proc;
* int errcode;
* }
* Each RTE is allowed to add additional information
* as required
* Callback function to alert the MPI layer of an error or notification
* from the internal RTE and/or the resource manager.
*
* This function is used to alert the MPI layer to a specific fault detected by the
* runtime layer. This could be a process failure, a lost connection, or the inability
* runtime layer or host RM. This could be a process failure, a lost connection, or the inability
* to send an OOB message. The MPI layer has the option to perform whatever actions it
* needs to stabilize itself and continue running, abort, etc.
*
* Upon completion, the error handler should return OMPI_SUCCESS if the error has
* been resolved and no further callbacks are to be executed. Return of any other
* value will cause the RTE to continue executing error callbacks.
*/
OMPI_DECLSPEC int ompi_errhandler_runtime_callback(opal_pointer_array_t *errors);
typedef struct {
volatile bool active;
int status;
} 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,
void *cbdata);
OMPI_DECLSPEC void ompi_errhandler_registration_callback(int status,
int errhandler_ref,
void *cbdata);
/**
* Check to see if an errhandler is intrinsic.
*

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

@ -5,6 +5,7 @@
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -83,12 +84,6 @@ typedef orte_local_rank_t ompi_local_rank_t;
OMPI_DECLSPEC void __opal_attribute_noreturn__
ompi_rte_abort(int error_code, char *fmt, ...);
#define ompi_rte_abort_peers(a, b, c) orte_errmgr.abort_peers(a, b, c)
#define OMPI_RTE_ERRHANDLER_FIRST ORTE_ERRMGR_CALLBACK_FIRST
#define OMPI_RTE_ERRHANDLER_LAST ORTE_ERRMGR_CALLBACK_LAST
#define OMPI_RTE_ERRHANDLER_PREPEND ORTE_ERRMGR_CALLBACK_PREPEND
#define OMPI_RTE_ERRHANDLER_APPEND ORTE_ERRMGR_CALLBACK_APPEND
typedef orte_error_t ompi_rte_error_report_t;
#define ompi_rte_register_errhandler(a, b) orte_errmgr.register_error_callback(a, b)
#define OMPI_ERROR_LOG ORTE_ERROR_LOG
/* Init and finalize objects and operations */

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

@ -3,7 +3,7 @@
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights reserved.
* Copyright (c) 2013 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
*
* $COPYRIGHT$
*
@ -111,8 +111,6 @@
* 2. int ompi_rte_abort_peers(ompi_process_name_t *procs, size_t nprocs) -
* Abort the specified list of peers
* 3. OMPI_ERROR_LOG(rc) - print error message regarding the given return code
* 4. ompi_rte_register_errhandler - register a callback function for the RTE
* to report asynchronous errors to the caller
*
* (e) Init and finalize objects and operations
* 1. ompi_rte_init - a function to initialize the RTE. The function

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

@ -378,6 +378,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
size_t nprocs;
char *error = NULL;
char *cmd=NULL, *av=NULL;
ompi_errhandler_errtrk_t errtrk;
OPAL_TIMING_DECLARE(tm);
OPAL_TIMING_INIT_EXT(&tm, OPAL_TIMING_GET_TIME_OF_DAY);
@ -504,11 +505,18 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
}
}
/* Register the default errhandler callback - RTE will ignore if it
* doesn't support this capability
*/
ompi_rte_register_errhandler(ompi_errhandler_runtime_callback,
OMPI_RTE_ERRHANDLER_LAST);
/* 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);
OMPI_WAIT_FOR_COMPLETION(errtrk.active);
if (OPAL_SUCCESS != errtrk.status) {
error = "Error handler registration";
ret = errtrk.status;
goto error;
}
/* Figure out the final MPI thread levels. If we were not
compiled for support for MPI threads, then don't allow

15
opal/mca/hwloc/external/configure.m4 поставляемый
Просмотреть файл

@ -181,6 +181,21 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([Cannot continue])])
AC_MSG_CHECKING([if external hwloc version is lower than 2.0])
AS_IF([test "$opal_hwloc_dir" != ""],
[opal_hwloc_external_CFLAGS_save=$CFLAGS
CFLAGS="-I$opal_hwloc_dir/include $opal_hwloc_external_CFLAGS_save"])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <hwloc.h>]],
[[
#if HWLOC_API_VERSION >= 0x00020000
#error "hwloc API version is greater or equal than 0x00020000"
#endif
]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([OMPI does not currently support hwloc v2 API
Cannot continue])])
AS_IF([test "$opal_hwloc_dir" != ""],
[CFLAGS=$opal_hwloc_external_CFLAGS_save])
$1],

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

@ -32,11 +32,17 @@ 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_pmix_errhandler_fn_t err);
OPAL_DECLSPEC void opal_pmix_base_deregister_handler(void);
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,
void *cbdata);
OPAL_DECLSPEC void opal_pmix_base_deregister_handler(int 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_list_t *info,
opal_pmix_release_cbfunc_t cbfunc, void *cbdata);
OPAL_DECLSPEC int opal_pmix_base_exchange(opal_value_t *info,
opal_pmix_pdata_t *pdat,
int timeout);

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

@ -38,26 +38,40 @@
#define OPAL_PMI_PAD 10
/******** ERRHANDLER SUPPORT ********/
static opal_pmix_errhandler_fn_t errhandler = NULL;
/******** ERRHANDLER SUPPORT FOR COMPONENTS THAT
******** DO NOT NATIVELY SUPPORT IT
********/
static opal_pmix_notification_fn_t errhandler = NULL;
void opal_pmix_base_register_handler(opal_pmix_errhandler_fn_t err)
void opal_pmix_base_register_handler(opal_list_t *info,
opal_pmix_notification_fn_t err,
opal_pmix_errhandler_reg_cbfunc_t cbfunc,
void *cbdata)
{
errhandler = 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_list_t *info,
opal_pmix_release_cbfunc_t cbfunc, void *cbdata)
{
if (NULL != errhandler) {
errhandler(status);
errhandler(status, procs, info, cbfunc, cbdata);
}
}
void opal_pmix_base_deregister_handler(void)
void opal_pmix_base_deregister_handler(int errid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
errhandler = NULL;
if (NULL != cbfunc) {
cbfunc(OPAL_SUCCESS, cbdata);
}
}
struct lookup_caddy_t {

6
opal/mca/pmix/external/Makefile.am поставляемый
Просмотреть файл

@ -44,7 +44,5 @@ noinst_LTLIBRARIES = $(component_noinst)
libmca_pmix_external_la_SOURCES =$(sources)
libmca_pmix_external_la_CFLAGS =
libmca_pmix_external_la_CPPFLAGS = $(opal_pmix_ext_CPPFLAGS)
libmca_pmix_external_la_LDFLAGS = -module -avoid-version -L$(opal_pmix_ext_LDFLAGS)
libmca_pmix_external_la_LIBADD = $(opal_pmix_ext_LIBS) \
$(OPAL_TOP_BUILDDIR)/opal/mca/event/lib@OPAL_LIB_PREFIX@mca_event.la \
$(OPAL_TOP_BUILDDIR)/opal/mca/hwloc/lib@OPAL_LIB_PREFIX@mca_hwloc.la
libmca_pmix_external_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext_LDFLAGS)
libmca_pmix_external_la_LIBADD = $(opal_pmix_ext_LIBS)

19
opal/mca/pmix/external/pmix_ext_client.c поставляемый
Просмотреть файл

@ -36,6 +36,18 @@ static pmix_proc_t my_proc;
static char *dbgvalue=NULL;
static int errhdler_ref = 0;
static void completion_handler (void * cbdata) {
int * cond = (int *)cbdata;
*cond = 0;
}
#define PMIX_WAIT_FOR_COMPLETION(a) \
do { \
while ((a)) { \
usleep(10); \
} \
} while (0);
static void myerr(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo)
@ -45,6 +57,7 @@ static void myerr(pmix_status_t status,
opal_namelist_t *nm;
opal_value_t *iptr;
size_t n;
volatile int cond = 1;
/* convert the incoming status */
rc = pmix1_convert_rc(status);
@ -64,11 +77,13 @@ static void myerr(pmix_status_t status,
iptr = OBJ_NEW(opal_value_t);
iptr->key = strdup(info[n].key);
pmix1_value_unload(iptr, &info[n].value);
opal_list_append(&plist, &nm->super);
opal_list_append(&plist, &iptr->super);
}
/* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist);
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
PMIX_WAIT_FOR_COMPLETION(cond);
OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist);
}

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

@ -50,6 +50,18 @@ 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;
*cond = 0;
}
#define PMIX_WAIT_FOR_COMPLETION(a) \
do { \
while ((a)) { \
usleep(10); \
} \
} while (0);
static void myerr(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo)
@ -58,6 +70,7 @@ static void myerr(pmix_status_t status,
opal_list_t plist, ilist;
opal_namelist_t *nm;
opal_value_t *iptr;
volatile int cond = 1;
size_t n;
/* convert the incoming status */
@ -78,11 +91,13 @@ static void myerr(pmix_status_t status,
iptr = OBJ_NEW(opal_value_t);
iptr->key = strdup(info[n].key);
pmix1_value_unload(iptr, &info[n].value);
opal_list_append(&plist, &nm->super);
opal_list_append(&plist, &iptr->super);
}
/* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist);
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
PMIX_WAIT_FOR_COMPLETION(cond);
OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist);
}

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

@ -280,10 +280,6 @@ extern int opal_pmix_base_exchange(opal_value_t *info,
} while(0);
/* callback handler for errors */
typedef void (*opal_pmix_errhandler_fn_t)(int error);
/************************************************************
* CLIENT APIs *
************************************************************/
@ -690,17 +686,6 @@ typedef int (*opal_pmix_base_module_server_dmodex_request_fn_t)(const opal_proce
* The info array contains any further info the RM can and/or chooses
* to provide.
*
* If the payload and size parameters are non-NULL, then the function
* will assume that the caller intends to send the message itself. In
* this situation, the convenience library will simply pack the message
* for transmission, and return the payload and size in the provided
* variables (external comm should have been indicated during server_init).
* The caller will be responsible for thread protection.
*
* Otherwise, the convenience library will transmit the message to
* the identified target processes, and the function call will be
* internally thread protected.
*
* The callback function will be called upon completion of the
* notify_error function's actions. Note that any messages will
* have been queued, but may not have been transmitted by this
@ -720,11 +705,92 @@ 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 loss of connection to the server */
typedef void (*opal_pmix_base_module_register_fn_t)(opal_pmix_errhandler_fn_t errhandler);
/* Register an errhandler to report errors. Three types of errors
* 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
* non-blocking operations.
*
* (b) job-related errors 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
* 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)
* from the other end (Resource Manager/Client application).
*
* Multiple err handlers can be registered for different errors. PMIX returns
* an integer reference to each register handler in the callback fn. The caller
* must retain the reference in order to deregister the errhandler.
* Modification of the notification behavior can be accomplished by
* deregistering the current errhandler, and then registering it
* using a new set of info values.
*
* See pmix_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,
void *cbdata);
/* deregister the errhandler */
typedef void (*opal_pmix_base_module_deregister_fn_t)(void);
/* 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,
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.
*
* The client application can also call this function to notify the
* resource manager of an error it encountered. It can request the host
* server to notify the indicated processes about the error.
*
* The first array of procs informs the server library as to which
* processes should be alerted - e.g., the processes that are in
* a directly-affected job or are connected to one that is affected.
* Passing a NULL for this array will indicate that all local procs
* are to be notified.
*
* The second array identifies the processes that will be impacted
* by the error. This could consist of a single process, or a number
* of processes.
*
* The info array contains any further info the RM can and/or chooses
* to provide.
*
* The callback function will be called upon completion of the
* notify_error function's actions. Note that any messages will
* have been queued, but may not have been transmitted by this
* time. Note that the caller is required to maintain the input
* data until the callback function has been executed!
*/
typedef int (*opal_pmix_base_module_notify_error_fn_t)(int status,
opal_list_t *procs,
opal_list_t *error_procs,
opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
/* store data internally, but don't push it out to be shared - this is
* intended solely for storage of info on other procs that comes thru
@ -784,6 +850,7 @@ typedef struct {
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_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;

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

@ -28,50 +28,46 @@
AC_DEFUN([MCA_opal_pmix_pmix112_CONFIG],[
AC_CONFIG_FILES([opal/mca/pmix/pmix112/Makefile])
OPAL_VAR_SCOPE_PUSH([PMIX_VERSION opal_pmix_pmix112_save_CPPFLAGS opal_pmix_pmix112_save_LDFLAGS opal_pmix_pmix112_save_LIBS opal_pmix_pmix112_basedir opal_pmix_pmix112_save_cflags])
AS_IF([test "$opal_external_pmix_happy" = "yes"],
[AC_MSG_WARN([using an external pmix; disqualifiying this component])
opal_pmix_pmix112_happy=0],
[PMIX_VERSION=
opal_pmix_pmix112_basedir=opal/mca/pmix/pmix112
[OPAL_VAR_SCOPE_PUSH([PMIX_VERSION opal_pmix_pmix112_save_CPPFLAGS opal_pmix_pmix112_save_LDFLAGS opal_pmix_pmix112_save_LIBS opal_pmix_pmix112_basedir opal_pmix_pmix112_save_cflags])
opal_pmix_pmix112_save_CFLAGS=$CFLAGS
opal_pmix_pmix112_save_CPPFLAGS=$CPPFLAGS
opal_pmix_pmix112_save_LDFLAGS=$LDFLAGS
opal_pmix_pmix112_save_LIBS=$LIBS
PMIX_VERSION=
opal_pmix_pmix112_basedir=opal/mca/pmix/pmix112
opal_pmix_pmix112_args="--enable-embedded-mode --with-pmix-symbol-prefix=opal_pmix_pmix112_ --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_pmix112_args="--enable-debug $opal_pmix_pmix112_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"],
[opal_pmix_pmix112_args="--disable-debug $opal_pmix_pmix112_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_pmix_pmix112_save_CFLAGS=$CFLAGS
opal_pmix_pmix112_save_CPPFLAGS=$CPPFLAGS
opal_pmix_pmix112_save_LDFLAGS=$LDFLAGS
opal_pmix_pmix112_save_LIBS=$LIBS
OPAL_CONFIG_SUBDIR([$opal_pmix_pmix112_basedir/pmix],
[$opal_pmix_pmix112_args $opal_subdir_args 'CFLAGS=$CFLAGS' 'CPPFLAGS=$CPPFLAGS'],
[opal_pmix_pmix112_happy=1], [opal_pmix_pmix112_happy=0])
opal_pmix_pmix112_args="--enable-embedded-mode --with-pmix-symbol-prefix=opal_pmix_pmix112_ --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --with-hwloc-header=\\\"$opal_hwloc_base_include\\\""
if test "$enable_debug" = "yes"; then
opal_pmix_pmix112_args="--enable-debug $opal_pmix_pmix112_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"
else
opal_pmix_pmix112_args="--disable-debug $opal_pmix_pmix112_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"
fi
CPPFLAGS="-I$OPAL_TOP_SRCDIR -I$OPAL_TOP_BUILDDIR -I$OPAL_TOP_SRCDIR/opal/include -I$OPAL_TOP_BUILDDIR/opal/include $CPPFLAGS"
AS_IF([test $opal_pmix_pmix112_happy -eq 1],
[PMIX_VERSION="internal v`$srcdir/$opal_pmix_pmix112_basedir/pmix/config/pmix_get_version.sh $srcdir/$opal_pmix_pmix112_basedir/pmix/VERSION`"
# Build flags for our Makefile.am
opal_pmix_pmix112_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_pmix_pmix112_basedir"'/pmix/libpmix.la'
opal_pmix_pmix112_CPPFLAGS='-I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix112/pmix/include/pmix -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix112/pmix/include -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix112/pmix -I$(OPAL_TOP_SRCDIR)/opal/mca/pmix/pmix112/pmix'
AC_SUBST([opal_pmix_pmix112_LIBS])
AC_SUBST([opal_pmix_pmix112_CPPFLAGS])])
OPAL_CONFIG_SUBDIR([$opal_pmix_pmix112_basedir/pmix],
[$opal_pmix_pmix112_args $opal_subdir_args 'CFLAGS=$CFLAGS' 'CPPFLAGS=$CPPFLAGS'],
[opal_pmix_pmix112_happy=1], [opal_pmix_pmix112_happy=0])
# Finally, add a flag to support static builds
pmix_pmix112_WRAPPER_EXTRA_LIBS=-lpmix
if test $opal_pmix_pmix112_happy -eq 1; then
PMIX_VERSION="internal v`$srcdir/$opal_pmix_pmix112_basedir/pmix/config/pmix_get_version.sh $srcdir/$opal_pmix_pmix112_basedir/pmix/VERSION`"
# Build flags for our Makefile.am
opal_pmix_pmix112_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_pmix_pmix112_basedir"'/pmix/libpmix.la'
opal_pmix_pmix112_CPPFLAGS='-I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix112/pmix/include/pmix -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix112/pmix/include -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix112/pmix -I$(OPAL_TOP_SRCDIR)/opal/mca/pmix/pmix112/pmix'
AC_SUBST([opal_pmix_pmix112_LIBS])
AC_SUBST([opal_pmix_pmix112_CPPFLAGS])
fi
# Finally, add a flag to support static builds
pmix_pmix112_WRAPPER_EXTRA_LIBS=-lpmix
CFLAGS=$opal_pmix_pmix112_save_CFLAGS
CPPFLAGS=$opal_pmix_pmix112_save_CPPFLAGS
LDFLAGS=$opal_pmix_pmix112_save_LDFLAGS
LIBS=$opal_pmix_pmix112_save_LIBS
CFLAGS=$opal_pmix_pmix112_save_CFLAGS
CPPFLAGS=$opal_pmix_pmix112_save_CPPFLAGS
LDFLAGS=$opal_pmix_pmix112_save_LDFLAGS
LIBS=$opal_pmix_pmix112_save_LIBS
])
AS_IF([test $opal_pmix_pmix112_happy -eq 1],

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

@ -57,10 +57,16 @@ include src/server/Makefile.am
include src/sec/Makefile.am
include src/common/Makefile.am
if PMIX_EMBEDDED_MODE
noinst_LTLIBRARIES = libpmix.la
libpmix_la_SOURCES = $(headers) $(sources)
libpmix_la_LDFLAGS =
else
lib_LTLIBRARIES = libpmix.la
libpmix_la_SOURCES = $(headers) $(sources)
libpmix_la_LDFLAGS = -version-info $(libpmix_so_version)
endif
if ! PMIX_EMBEDDED_MODE
SUBDIRS = . test

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

@ -38,255 +38,383 @@ BEGIN_C_DECLS
name under the covers. */
/* PMIx APIs */
#define PMIx_Abort PMIX_NAME_CAPS(Abort)
#define PMIx_Commit PMIX_NAME_CAPS(Commit)
#define PMIx_Connect PMIX_NAME_CAPS(Connect)
#define PMIx_Connect_nb PMIX_NAME_CAPS(Connect_nb)
#define PMIx_Deregister_errhandler PMIX_NAME_CAPS(Deregister_errhandler)
#define PMIx_Disconnect PMIX_NAME_CAPS(Disconnect)
#define PMIx_Disconnect_nb PMIX_NAME_CAPS(Disconnect_nb)
#define PMIx_Error_string PMIX_NAME_CAPS(Error_string)
#define PMIx_Fence PMIX_NAME_CAPS(Fence)
#define PMIx_Fence_nb PMIX_NAME_CAPS(Fence_nb)
#define PMIx_Finalize PMIX_NAME_CAPS(Finalize)
#define PMIx_Get PMIX_NAME_CAPS(Get)
#define PMIx_Get_nb PMIX_NAME_CAPS(Get_nb)
#define PMIx_Get_version PMIX_NAME_CAPS(Get_version)
#define PMIx_Init PMIX_NAME_CAPS(Init)
#define PMIx_Initialized PMIX_NAME_CAPS(Initialized)
#define PMIx_Lookup PMIX_NAME_CAPS(Lookup)
#define PMIx_Lookup_nb PMIX_NAME_CAPS(Lookup_nb)
#define PMIx_Publish PMIX_NAME_CAPS(Publish)
#define PMIx_Publish_nb PMIX_NAME_CAPS(Publish_nb)
#define PMIx_Put PMIX_NAME_CAPS(Put)
#define PMIx_Register_errhandler PMIX_NAME_CAPS(Register_errhandler)
#define PMIx_Resolve_nodes PMIX_NAME_CAPS(Resolve_nodes)
#define PMIx_Resolve_peers PMIX_NAME_CAPS(Resolve_peers)
#define PMIx_Spawn PMIX_NAME_CAPS(Spawn)
#define PMIx_Spawn_nb PMIX_NAME_CAPS(Spawn_nb)
#define PMIx_Unpublish PMIX_NAME_CAPS(Unpublish)
#define PMIx_Unpublish_nb PMIX_NAME_CAPS(Unpublish_nb)
#define PMI2_Abort PMIX_NAME_CAPS(PMI2_Abort)
#define PMI2_Finalize PMIX_NAME_CAPS(PMI2_Finalize)
#define PMI2_Info_GetJobAttr PMIX_NAME_CAPS(PMI2_Info_GetJobAttr)
#define PMI2_Info_GetJobAttrIntArray PMIX_NAME_CAPS(PMI2_Info_GetJobAttrIntArray)
#define PMI2_Info_GetNodeAttr PMIX_NAME_CAPS(PMI2_Info_GetNodeAttr)
#define PMI2_Info_GetSize PMIX_NAME_CAPS(PMI2_Info_GetSize)
#define PMI2_Info_PutNodeAttr PMIX_NAME_CAPS(PMI2_Info_PutNodeAttr)
#define PMI2_Init PMIX_NAME_CAPS(PMI2_Init)
#define PMI2_Initialized PMIX_NAME_CAPS(PMI2_Initialized)
#define PMI2_Job_Connect PMIX_NAME_CAPS(PMI2_Job_Connect)
#define PMI2_Job_Disconnect PMIX_NAME_CAPS(PMI2_Job_Disconnect)
#define PMI2_Job_GetId PMIX_NAME_CAPS(PMI2_Job_GetId)
#define PMI2_Job_GetRank PMIX_NAME_CAPS(PMI2_Job_GetRank)
#define PMI2_Job_Spawn PMIX_NAME_CAPS(PMI2_Job_Spawn)
#define PMI2_KVS_Fence PMIX_NAME_CAPS(PMI2_KVS_Fence)
#define PMI2_KVS_Get PMIX_NAME_CAPS(PMI2_KVS_Get)
#define PMI2_KVS_Put PMIX_NAME_CAPS(PMI2_KVS_Put)
#define PMI2_Nameserv_lookup PMIX_NAME_CAPS(PMI2_Nameserv_lookup)
#define PMI2_Nameserv_publish PMIX_NAME_CAPS(PMI2_Nameserv_publish)
#define PMI2_Nameserv_unpublish PMIX_NAME_CAPS(PMI2_Nameserv_unpublish)
#define PMI_Abort PMIX_NAME_CAPS(PMI_Abort)
#define PMI_Args_to_keyval PMIX_NAME_CAPS(PMI_Args_to_keyval)
#define PMI_Barrier PMIX_NAME_CAPS(PMI_Barrier)
#define PMI_Finalize PMIX_NAME_CAPS(PMI_Finalize)
#define PMI_Free_keyvals PMIX_NAME_CAPS(PMI_Free_keyvals)
#define PMI_Get_appnum PMIX_NAME_CAPS(PMI_Get_appnum)
#define PMI_Get_clique_ranks PMIX_NAME_CAPS(PMI_Get_clique_ranks)
#define PMI_Get_clique_size PMIX_NAME_CAPS(PMI_Get_clique_size)
#define PMI_Get_id PMIX_NAME_CAPS(PMI_Get_id)
#define PMI_Get_id_length_max PMIX_NAME_CAPS(PMI_Get_id_length_max)
#define PMI_Get_kvs_domain_id PMIX_NAME_CAPS(PMI_Get_kvs_domain_id)
#define PMI_Get_options PMIX_NAME_CAPS(PMI_Get_options)
#define PMI_Get_rank PMIX_NAME_CAPS(PMI_Get_rank)
#define PMI_Get_size PMIX_NAME_CAPS(PMI_Get_size)
#define PMI_Get_universe_size PMIX_NAME_CAPS(PMI_Get_universe_size)
#define PMI_Init PMIX_NAME_CAPS(PMI_Init)
#define PMI_Initialized PMIX_NAME_CAPS(PMI_Initialized)
#define PMI_KVS_Commit PMIX_NAME_CAPS(PMI_KVS_Commit)
#define PMI_KVS_Create PMIX_NAME_CAPS(PMI_KVS_Create)
#define PMI_KVS_Destroy PMIX_NAME_CAPS(PMI_KVS_Destroy)
#define PMI_KVS_Get PMIX_NAME_CAPS(PMI_KVS_Get)
#define PMI_KVS_Get_key_length_max PMIX_NAME_CAPS(PMI_KVS_Get_key_length_max)
#define PMI_KVS_Get_my_name PMIX_NAME_CAPS(PMI_KVS_Get_my_name)
#define PMI_KVS_Get_name_length_max PMIX_NAME_CAPS(PMI_KVS_Get_name_length_max)
#define PMI_KVS_Get_value_length_max PMIX_NAME_CAPS(PMI_KVS_Get_value_length_max)
#define PMI_KVS_Iter_first PMIX_NAME_CAPS(PMI_KVS_Iter_first)
#define PMI_KVS_Iter_next PMIX_NAME_CAPS(PMI_KVS_Iter_next)
#define PMI_KVS_Put PMIX_NAME_CAPS(PMI_KVS_Put)
#define PMI_Lookup_name PMIX_NAME_CAPS(PMI_Lookup_name)
#define PMI_Parse_option PMIX_NAME_CAPS(PMI_Parse_option)
#define PMI_Publish_name PMIX_NAME_CAPS(PMI_Publish_name)
#define PMI_Spawn_multiple PMIX_NAME_CAPS(PMI_Spawn_multiple)
#define PMI_Unpublish_name PMIX_NAME_CAPS(PMI_Unpublish_name)
#define PMIx_Abort PMIX_NAME_CAPS(Abort)
#define PMIx_Commit PMIX_NAME_CAPS(Commit)
#define PMIx_Connect PMIX_NAME_CAPS(Connect)
#define PMIx_Connect_nb PMIX_NAME_CAPS(Connect_nb)
#define PMIx_Deregister_errhandler PMIX_NAME_CAPS(Deregister_errhandler)
#define PMIx_Disconnect PMIX_NAME_CAPS(Disconnect)
#define PMIx_Disconnect_nb PMIX_NAME_CAPS(Disconnect_nb)
#define PMIx_Error_string PMIX_NAME_CAPS(Error_string)
#define PMIx_Fence PMIX_NAME_CAPS(Fence)
#define PMIx_Fence_nb PMIX_NAME_CAPS(Fence_nb)
#define PMIx_Finalize PMIX_NAME_CAPS(Finalize)
#define PMIx_Get PMIX_NAME_CAPS(Get)
#define PMIx_Get_nb PMIX_NAME_CAPS(Get_nb)
#define PMIx_Get_version PMIX_NAME_CAPS(Get_version)
#define PMIx_Init PMIX_NAME_CAPS(Init)
#define PMIx_Initialized PMIX_NAME_CAPS(Initialized)
#define PMIx_Lookup PMIX_NAME_CAPS(Lookup)
#define PMIx_Lookup_nb PMIX_NAME_CAPS(Lookup_nb)
#define PMIx_Notify_error PMIX_NAME_CAPS(Notify_error)
#define PMIx_Publish PMIX_NAME_CAPS(Publish)
#define PMIx_Publish_nb PMIX_NAME_CAPS(Publish_nb)
#define PMIx_Put PMIX_NAME_CAPS(Put)
#define PMIx_Register_errhandler PMIX_NAME_CAPS(Register_errhandler)
#define PMIx_Resolve_nodes PMIX_NAME_CAPS(Resolve_nodes)
#define PMIx_Resolve_peers PMIX_NAME_CAPS(Resolve_peers)
#define PMIx_Spawn PMIX_NAME_CAPS(Spawn)
#define PMIx_Spawn_nb PMIX_NAME_CAPS(Spawn_nb)
#define PMIx_Store_internal PMIX_NAME_CAPS(Store_internal)
#define PMIx_Unpublish PMIX_NAME_CAPS(Unpublish)
#define PMIx_Unpublish_nb PMIX_NAME_CAPS(Unpublish_nb)
#define PMIx_generate_ppn PMIX_NAME_CAPS(generate_ppn)
#define PMIx_generate_regex PMIX_NAME_CAPS(generate_regex)
#define PMIx_server_deregister_client PMIX_NAME_CAPS(server_deregister_client)
#define PMIx_server_deregister_nspace PMIX_NAME_CAPS(server_deregister_nspace)
#define PMIx_server_dmodex_request PMIX_NAME_CAPS(server_dmodex_request)
#define PMIx_server_finalize PMIX_NAME_CAPS(server_finalize)
#define PMIx_server_init PMIX_NAME_CAPS(server_init)
#define PMIx_server_register_client PMIX_NAME_CAPS(server_register_client)
#define PMIx_server_register_nspace PMIX_NAME_CAPS(server_register_nspace)
#define PMIx_server_setup_fork PMIX_NAME_CAPS(server_setup_fork)
/* internal client functions */
#define pmix_client_process_nspace_blob PMIX_NAME(client_process_nspace_blob)
/* src/util directory */
#define pmix_argv_append PMIX_NAME(argv_append)
#define pmix_argv_append_nosize PMIX_NAME(argv_append_nosize)
#define pmix_argv_append_unique_nosize PMIX_NAME(argv_append_unique_nosize)
#define pmix_argv_copy PMIX_NAME(argv_copy)
#define pmix_argv_count PMIX_NAME(argv_count)
#define pmix_argv_delete PMIX_NAME(argv_delete)
#define pmix_argv_free PMIX_NAME(argv_free)
#define pmix_argv_insert PMIX_NAME(argv_insert)
#define pmix_argv_insert_element PMIX_NAME(argv_insert_element)
#define pmix_argv_join PMIX_NAME(argv_join)
#define pmix_argv_join_range PMIX_NAME(argv_join_range)
#define pmix_argv_len PMIX_NAME(argv_len)
#define pmix_argv_prepend_nosize PMIX_NAME(argv_prepend_nosize)
#define pmix_argv_split PMIX_NAME(argv_split)
#define pmix_argv_split_with_empty PMIX_NAME(argv_split_with_empty)
#define pmix_asprintf PMIX_NAME(asprintf)
#define pmix_basename PMIX_NAME(basename)
#define pmix_bcopy_csum_partial PMIX_NAME(bcopy_csum_partial)
#define pmix_bcopy_uicrc_partial PMIX_NAME(bcopy_uicrc_partial)
#define pmix_bcopy_uicsum_partial PMIX_NAME(bcopy_uicsum_partial)
#define pmix_csum_partial PMIX_NAME(csum_partial)
#define pmix_dirname PMIX_NAME(dirname)
#define pmix_environ_merge PMIX_NAME(environ_merge)
#define pmix_errhandler_invoke PMIX_NAME(errhandler_invoke)
#define pmix_fd_read PMIX_NAME(fd_read)
#define pmix_fd_set_cloexec PMIX_NAME(fd_set_cloexec)
#define pmix_fd_write PMIX_NAME(fd_write)
#define pmix_home_directory PMIX_NAME(home_directory)
#define pmix_initialize_crc_table PMIX_NAME(initialize_crc_table)
#define pmix_os_path PMIX_NAME(os_path)
#define pmix_output PMIX_NAME(output)
#define pmix_output_close PMIX_NAME(output_close)
#define pmix_output_finalize PMIX_NAME(output_finalize)
#define pmix_output_get_verbosity PMIX_NAME(output_get_verbosity)
#define pmix_output_init PMIX_NAME(output_init)
#define pmix_output_open PMIX_NAME(output_open)
#define pmix_output_reopen PMIX_NAME(output_reopen)
#define pmix_output_reopen_all PMIX_NAME(output_reopen_all)
#define pmix_output_set_output_file_info PMIX_NAME(output_set_output_file_info)
#define pmix_output_set_verbosity PMIX_NAME(output_set_verbosity)
#define pmix_output_string PMIX_NAME(output_string)
#define pmix_output_switch PMIX_NAME(output_switch)
#define pmix_output_verbose PMIX_NAME(output_verbose)
#define pmix_output_vstring PMIX_NAME(output_vstring)
#define pmix_output_vverbose PMIX_NAME(output_vverbose)
#define pmix_setenv PMIX_NAME(setenv)
#define pmix_snprintf PMIX_NAME(snprintf)
#define pmix_start_progress_thread PMIX_NAME(start_progress_thread)
#define pmix_stop_progress_thread PMIX_NAME(stop_progress_thread)
#define pmix_tmp_directory PMIX_NAME(tmp_directory)
#define pmix_uicrc_partial PMIX_NAME(uicrc_partial)
#define pmix_uicsum_partial PMIX_NAME(uicsum_partial)
#define pmix_unsetenv PMIX_NAME(unsetenv)
#define pmix_vasprintf PMIX_NAME(vasprintf)
#define pmix_vsnprintf PMIX_NAME(vsnprintf)
/* buffer operations */
#define pmix_bfrop_buffer_extend PMIX_NAME(bfrop_buffer_extend)
#define pmix_bfrop_close PMIX_NAME(bfrop_close)
#define pmix_bfrop_copy PMIX_NAME(bfrop_copy)
#define pmix_bfrop_copy_app PMIX_NAME(bfrop_copy_app)
#define pmix_bfrop_copy_array PMIX_NAME(bfrop_copy_array)
#define pmix_bfrop_copy_bo PMIX_NAME(bfrop_copy_bo)
#define pmix_bfrop_copy_buf PMIX_NAME(bfrop_copy_buf)
#define pmix_bfrop_copy_info PMIX_NAME(bfrop_copy_info)
#define pmix_bfrop_copy_kval PMIX_NAME(bfrop_copy_kval)
#define pmix_bfrop_copy_modex PMIX_NAME(bfrop_copy_modex)
#define pmix_bfrop_copy_payload PMIX_NAME(bfrop_copy_payload)
#define pmix_bfrop_copy_pdata PMIX_NAME(bfrop_copy_pdata)
#define pmix_bfrop_copy_persist PMIX_NAME(bfrop_copy_persist)
#define pmix_bfrop_copy_proc PMIX_NAME(bfrop_copy_proc)
#define pmix_bfrop_copy_string PMIX_NAME(bfrop_copy_string)
#define pmix_bfrop_copy_value PMIX_NAME(bfrop_copy_value)
#define pmix_bfrop_get_data_type PMIX_NAME(bfrop_get_data_type)
#define pmix_bfrop_open PMIX_NAME(bfrop_open)
#define pmix_bfrop_pack PMIX_NAME(bfrop_pack)
#define pmix_bfrop_pack_app PMIX_NAME(bfrop_pack_app)
#define pmix_bfrop_pack_array PMIX_NAME(bfrop_pack_array)
#define pmix_bfrop_pack_bo PMIX_NAME(bfrop_pack_bo)
#define pmix_bfrop_pack_buf PMIX_NAME(bfrop_pack_buf)
#define pmix_bfrop_pack_buffer PMIX_NAME(bfrop_pack_buffer)
#define pmix_bfrop_pack_byte PMIX_NAME(bfrop_pack_byte)
#define pmix_bfrop_pack_datatype PMIX_NAME(bfrop_pack_datatype)
#define pmix_bfrop_pack_double PMIX_NAME(bfrop_pack_double)
#define pmix_bfrop_pack_float PMIX_NAME(bfrop_pack_float)
#define pmix_bfrop_pack_info PMIX_NAME(bfrop_pack_info)
#define pmix_bfrop_pack_int PMIX_NAME(bfrop_pack_int)
#define pmix_bfrop_pack_int16 PMIX_NAME(bfrop_pack_int16)
#define pmix_bfrop_pack_int32 PMIX_NAME(bfrop_pack_int32)
#define pmix_bfrop_pack_int64 PMIX_NAME(bfrop_pack_int64)
#define pmix_bfrop_pack_kval PMIX_NAME(bfrop_pack_kval)
#define pmix_bfrop_pack_modex PMIX_NAME(bfrop_pack_modex)
#define pmix_bfrop_pack_pdata PMIX_NAME(bfrop_pack_pdata)
#define pmix_bfrop_pack_persist PMIX_NAME(bfrop_pack_persist)
#define pmix_bfrop_pack_pid PMIX_NAME(bfrop_pack_pid)
#define pmix_bfrop_pack_proc PMIX_NAME(bfrop_pack_proc)
#define pmix_bfrop_pack_sizet PMIX_NAME(bfrop_pack_sizet)
#define pmix_bfrop_pack_string PMIX_NAME(bfrop_pack_string)
#define pmix_bfrop_pack_time PMIX_NAME(bfrop_pack_time)
#define pmix_bfrop_pack_timeval PMIX_NAME(bfrop_pack_timeval)
#define pmix_bfrop_pack_value PMIX_NAME(bfrop_pack_value)
#define pmix_bfrop_print PMIX_NAME(bfrop_print)
#define pmix_bfrop_print_app PMIX_NAME(bfrop_print_app)
#define pmix_bfrop_print_array PMIX_NAME(bfrop_print_array)
#define pmix_bfrop_print_bo PMIX_NAME(bfrop_print_bo)
#define pmix_bfrop_print_buf PMIX_NAME(bfrop_print_buf)
#define pmix_bfrop_print_byte PMIX_NAME(bfrop_print_byte)
#define pmix_bfrop_print_double PMIX_NAME(bfrop_print_double)
#define pmix_bfrop_print_float PMIX_NAME(bfrop_print_float)
#define pmix_bfrop_print_info PMIX_NAME(bfrop_print_info)
#define pmix_bfrop_print_int PMIX_NAME(bfrop_print_int)
#define pmix_bfrop_print_int16 PMIX_NAME(bfrop_print_int16)
#define pmix_bfrop_print_int32 PMIX_NAME(bfrop_print_int32)
#define pmix_bfrop_print_int64 PMIX_NAME(bfrop_print_int64)
#define pmix_bfrop_print_int8 PMIX_NAME(bfrop_print_int8)
#define pmix_bfrop_print_kval PMIX_NAME(bfrop_print_kval)
#define pmix_bfrop_print_modex PMIX_NAME(bfrop_print_modex)
#define pmix_bfrop_print_pdata PMIX_NAME(bfrop_print_pdata)
#define pmix_bfrop_print_persist PMIX_NAME(bfrop_print_persist)
#define pmix_bfrop_print_pid PMIX_NAME(bfrop_print_pid)
#define pmix_bfrop_print_proc PMIX_NAME(bfrop_print_proc)
#define pmix_bfrop_print_size PMIX_NAME(bfrop_print_size)
#define pmix_bfrop_print_string PMIX_NAME(bfrop_print_string)
#define pmix_bfrop_print_time PMIX_NAME(bfrop_print_time)
#define pmix_bfrop_print_timeval PMIX_NAME(bfrop_print_timeval)
#define pmix_bfrop_print_uint PMIX_NAME(bfrop_print_uint)
#define pmix_bfrop_print_uint16 PMIX_NAME(bfrop_print_uint16)
#define pmix_bfrop_print_uint32 PMIX_NAME(bfrop_print_uint32)
#define pmix_bfrop_print_uint64 PMIX_NAME(bfrop_print_uint64)
#define pmix_bfrop_print_uint8 PMIX_NAME(bfrop_print_uint8)
#define pmix_bfrop_print_value PMIX_NAME(bfrop_print_value)
#define pmix_bfrop_std_copy PMIX_NAME(bfrop_std_copy)
#define pmix_bfrop_store_data_type PMIX_NAME(bfrop_store_data_type)
#define pmix_bfrop_too_small PMIX_NAME(bfrop_too_small)
#define pmix_bfrop_unpack PMIX_NAME(bfrop_unpack)
#define pmix_bfrop_unpack_app PMIX_NAME(bfrop_unpack_app)
#define pmix_bfrop_unpack_array PMIX_NAME(bfrop_unpack_array)
#define pmix_bfrop_unpack_bo PMIX_NAME(bfrop_unpack_bo)
#define pmix_bfrop_unpack_buf PMIX_NAME(bfrop_unpack_buf)
#define pmix_bfrop_unpack_buffer PMIX_NAME(bfrop_unpack_buffer)
#define pmix_bfrop_unpack_byte PMIX_NAME(bfrop_unpack_byte)
#define pmix_bfrop_unpack_datatype PMIX_NAME(bfrop_unpack_datatype)
#define pmix_bfrop_unpack_double PMIX_NAME(bfrop_unpack_double)
#define pmix_bfrop_unpack_float PMIX_NAME(bfrop_unpack_float)
#define pmix_bfrop_unpack_info PMIX_NAME(bfrop_unpack_info)
#define pmix_bfrop_unpack_int PMIX_NAME(bfrop_unpack_int)
#define pmix_bfrop_unpack_int16 PMIX_NAME(bfrop_unpack_int16)
#define pmix_bfrop_unpack_int32 PMIX_NAME(bfrop_unpack_int32)
#define pmix_bfrop_unpack_int64 PMIX_NAME(bfrop_unpack_int64)
#define pmix_bfrop_unpack_kval PMIX_NAME(bfrop_unpack_kval)
#define pmix_bfrop_unpack_modex PMIX_NAME(bfrop_unpack_modex)
#define pmix_bfrop_unpack_pdata PMIX_NAME(bfrop_unpack_pdata)
#define pmix_bfrop_unpack_persist PMIX_NAME(bfrop_unpack_persist)
#define pmix_bfrop_unpack_pid PMIX_NAME(bfrop_unpack_pid)
#define pmix_bfrop_unpack_proc PMIX_NAME(bfrop_unpack_proc)
#define pmix_bfrop_unpack_sizet PMIX_NAME(bfrop_unpack_sizet)
#define pmix_bfrop_unpack_string PMIX_NAME(bfrop_unpack_string)
#define pmix_bfrop_unpack_time PMIX_NAME(bfrop_unpack_time)
#define pmix_bfrop_unpack_timeval PMIX_NAME(bfrop_unpack_timeval)
#define pmix_bfrop_unpack_value PMIX_NAME(bfrop_unpack_value)
#define pmix_value_load PMIX_NAME(value_load)
#define pmix_value_unload PMIX_NAME(value_unload)
#define pmix_value_xfer PMIX_NAME(value_xfer)
/* class system */
#define pmix_class_finalize PMIX_NAME(class_finalize)
#define pmix_class_initialize PMIX_NAME(class_initialize)
#define pmix_hash_fetch PMIX_NAME(hash_fetch)
#define pmix_hash_remove_data PMIX_NAME(hash_remove_data)
#define pmix_hash_store PMIX_NAME(hash_store)
#define pmix_hash_table_get_first_key_uint32 PMIX_NAME(hash_table_get_first_key_uint32)
#define pmix_hash_table_get_first_key_uint64 PMIX_NAME(hash_table_get_first_key_uint64)
#define pmix_hash_table_get_next_key_uint32 PMIX_NAME(hash_table_get_next_key_uint32)
#define pmix_hash_table_get_next_key_uint64 PMIX_NAME(hash_table_get_next_key_uint64)
#define pmix_hash_table_get_value_ptr PMIX_NAME(hash_table_get_value_ptr)
#define pmix_hash_table_get_value_uint32 PMIX_NAME(hash_table_get_value_uint32)
#define pmix_hash_table_get_value_uint64 PMIX_NAME(hash_table_get_value_uint64)
#define pmix_hash_table_init PMIX_NAME(hash_table_init)
#define pmix_hash_table_remove_all PMIX_NAME(hash_table_remove_all)
#define pmix_hash_table_remove_value_ptr PMIX_NAME(hash_table_remove_value_ptr)
#define pmix_hash_table_remove_value_uint32 PMIX_NAME(hash_table_remove_value_uint32)
#define pmix_hash_table_remove_value_uint64 PMIX_NAME(hash_table_remove_value_uint64)
#define pmix_hash_table_set_value_ptr PMIX_NAME(hash_table_set_value_ptr)
#define pmix_hash_table_set_value_uint32 PMIX_NAME(hash_table_set_value_uint32)
#define pmix_hash_table_set_value_uint64 PMIX_NAME(hash_table_set_value_uint64)
#define pmix_list_insert PMIX_NAME(list_insert)
#define pmix_list_join PMIX_NAME(list_join)
#define pmix_list_sort PMIX_NAME(list_sort)
#define pmix_list_splice PMIX_NAME(list_splice)
#define pmix_pointer_array_add PMIX_NAME(pointer_array_add)
#define pmix_pointer_array_init PMIX_NAME(pointer_array_init)
#define pmix_pointer_array_set_item PMIX_NAME(pointer_array_set_item)
#define pmix_pointer_array_set_size PMIX_NAME(pointer_array_set_size)
#define pmix_pointer_array_test_and_set_item PMIX_NAME(pointer_array_test_and_set_item)
/* security system */
#define pmix_sec_finalize PMIX_NAME(sec_finalize)
#define pmix_sec_init PMIX_NAME(sec_init)
/* usock messaging system */
#define pmix_usock_finalize PMIX_NAME(usock_finalize)
#define pmix_usock_init PMIX_NAME(usock_init)
#define pmix_usock_process_msg PMIX_NAME(usock_process_msg)
#define pmix_usock_recv_blocking PMIX_NAME(usock_recv_blocking)
#define pmix_usock_recv_handler PMIX_NAME(usock_recv_handler)
#define pmix_usock_send_blocking PMIX_NAME(usock_send_blocking)
#define pmix_usock_send_handler PMIX_NAME(usock_send_handler)
#define pmix_usock_send_recv PMIX_NAME(usock_send_recv)
#define pmix_usock_set_blocking PMIX_NAME(usock_set_blocking)
#define pmix_usock_set_nonblocking PMIX_NAME(usock_set_nonblocking)
/* internal functions */
#define pmix_argv_append PMIX_NAME(argv_append)
#define pmix_argv_append_nosize PMIX_NAME(argv_append_nosize)
#define pmix_argv_append_unique_nosize PMIX_NAME(argv_append_unique_nosize)
#define pmix_argv_copy PMIX_NAME(argv_copy)
#define pmix_argv_count PMIX_NAME(argv_count)
#define pmix_argv_delete PMIX_NAME(argv_delete)
#define pmix_argv_free PMIX_NAME(argv_free)
#define pmix_argv_insert PMIX_NAME(argv_insert)
#define pmix_argv_insert_element PMIX_NAME(argv_insert_element)
#define pmix_argv_join PMIX_NAME(argv_join)
#define pmix_argv_join_range PMIX_NAME(argv_join_range)
#define pmix_argv_len PMIX_NAME(argv_len)
#define pmix_argv_prepend_nosize PMIX_NAME(argv_prepend_nosize)
#define pmix_argv_split PMIX_NAME(argv_split)
#define pmix_argv_split_with_empty PMIX_NAME(argv_split_with_empty)
#define pmix_asprintf PMIX_NAME(asprintf)
#define pmix_basename PMIX_NAME(basename)
#define pmix_bcopy_csum_partial PMIX_NAME(bcopy_csum_partial)
#define pmix_bcopy_uicrc_partial PMIX_NAME(bcopy_uicrc_partial)
#define pmix_bcopy_uicsum_partial PMIX_NAME(bcopy_uicsum_partial)
#define pmix_bfrop PMIX_NAME(bfrop)
#define pmix_bfrop_buffer_extend PMIX_NAME(bfrop_buffer_extend)
#define pmix_bfrop_close PMIX_NAME(bfrop_close)
#define pmix_bfrop_copy PMIX_NAME(bfrop_copy)
#define pmix_bfrop_copy_app PMIX_NAME(bfrop_copy_app)
#define pmix_bfrop_copy_array PMIX_NAME(bfrop_copy_array)
#define pmix_bfrop_copy_bo PMIX_NAME(bfrop_copy_bo)
#define pmix_bfrop_copy_buf PMIX_NAME(bfrop_copy_buf)
#define pmix_bfrop_copy_info PMIX_NAME(bfrop_copy_info)
#define pmix_bfrop_copy_kval PMIX_NAME(bfrop_copy_kval)
#define pmix_bfrop_copy_modex PMIX_NAME(bfrop_copy_modex)
#define pmix_bfrop_copy_payload PMIX_NAME(bfrop_copy_payload)
#define pmix_bfrop_copy_pdata PMIX_NAME(bfrop_copy_pdata)
#define pmix_bfrop_copy_persist PMIX_NAME(bfrop_copy_persist)
#define pmix_bfrop_copy_proc PMIX_NAME(bfrop_copy_proc)
#define pmix_bfrop_copy_string PMIX_NAME(bfrop_copy_string)
#define pmix_bfrop_copy_topo PMIX_NAME(bfrop_copy_topo)
#define pmix_bfrop_copy_value PMIX_NAME(bfrop_copy_value)
#define pmix_bfrop_get_data_type PMIX_NAME(bfrop_get_data_type)
#define pmix_bfrop_initial_size PMIX_NAME(pmix_bfrop_initial_size)
#define pmix_bfrop_initialized PMIX_NAME(bfrop_initialized)
#define pmix_bfrop_num_reg_types PMIX_NAME(pmix_bfrop_num_reg_types)
#define pmix_bfrop_open PMIX_NAME(bfrop_open)
#define pmix_bfrop_pack PMIX_NAME(bfrop_pack)
#define pmix_bfrop_pack_app PMIX_NAME(bfrop_pack_app)
#define pmix_bfrop_pack_array PMIX_NAME(bfrop_pack_array)
#define pmix_bfrop_pack_bo PMIX_NAME(bfrop_pack_bo)
#define pmix_bfrop_pack_bool PMIX_NAME(bfrop_pack_bool)
#define pmix_bfrop_pack_buf PMIX_NAME(bfrop_pack_buf)
#define pmix_bfrop_pack_buffer PMIX_NAME(bfrop_pack_buffer)
#define pmix_bfrop_pack_byte PMIX_NAME(bfrop_pack_byte)
#define pmix_bfrop_pack_datatype PMIX_NAME(bfrop_pack_datatype)
#define pmix_bfrop_pack_double PMIX_NAME(bfrop_pack_double)
#define pmix_bfrop_pack_float PMIX_NAME(bfrop_pack_float)
#define pmix_bfrop_pack_info PMIX_NAME(bfrop_pack_info)
#define pmix_bfrop_pack_int PMIX_NAME(bfrop_pack_int)
#define pmix_bfrop_pack_int16 PMIX_NAME(bfrop_pack_int16)
#define pmix_bfrop_pack_int32 PMIX_NAME(bfrop_pack_int32)
#define pmix_bfrop_pack_int64 PMIX_NAME(bfrop_pack_int64)
#define pmix_bfrop_pack_kval PMIX_NAME(bfrop_pack_kval)
#define pmix_bfrop_pack_modex PMIX_NAME(bfrop_pack_modex)
#define pmix_bfrop_pack_pdata PMIX_NAME(bfrop_pack_pdata)
#define pmix_bfrop_pack_persist PMIX_NAME(bfrop_pack_persist)
#define pmix_bfrop_pack_pid PMIX_NAME(bfrop_pack_pid)
#define pmix_bfrop_pack_proc PMIX_NAME(bfrop_pack_proc)
#define pmix_bfrop_pack_sizet PMIX_NAME(bfrop_pack_sizet)
#define pmix_bfrop_pack_string PMIX_NAME(bfrop_pack_string)
#define pmix_bfrop_pack_time PMIX_NAME(bfrop_pack_time)
#define pmix_bfrop_pack_timeval PMIX_NAME(bfrop_pack_timeval)
#define pmix_bfrop_pack_topo PMIX_NAME(bfrop_pack_topo)
#define pmix_bfrop_pack_value PMIX_NAME(bfrop_pack_value)
#define pmix_bfrop_print PMIX_NAME(bfrop_print)
#define pmix_bfrop_print_app PMIX_NAME(bfrop_print_app)
#define pmix_bfrop_print_array PMIX_NAME(bfrop_print_array)
#define pmix_bfrop_print_bo PMIX_NAME(bfrop_print_bo)
#define pmix_bfrop_print_bool PMIX_NAME(bfrop_print_bool)
#define pmix_bfrop_print_buf PMIX_NAME(bfrop_print_buf)
#define pmix_bfrop_print_byte PMIX_NAME(bfrop_print_byte)
#define pmix_bfrop_print_double PMIX_NAME(bfrop_print_double)
#define pmix_bfrop_print_float PMIX_NAME(bfrop_print_float)
#define pmix_bfrop_print_info PMIX_NAME(bfrop_print_info)
#define pmix_bfrop_print_int PMIX_NAME(bfrop_print_int)
#define pmix_bfrop_print_int16 PMIX_NAME(bfrop_print_int16)
#define pmix_bfrop_print_int32 PMIX_NAME(bfrop_print_int32)
#define pmix_bfrop_print_int64 PMIX_NAME(bfrop_print_int64)
#define pmix_bfrop_print_int8 PMIX_NAME(bfrop_print_int8)
#define pmix_bfrop_print_kval PMIX_NAME(bfrop_print_kval)
#define pmix_bfrop_print_modex PMIX_NAME(bfrop_print_modex)
#define pmix_bfrop_print_pdata PMIX_NAME(bfrop_print_pdata)
#define pmix_bfrop_print_persist PMIX_NAME(bfrop_print_persist)
#define pmix_bfrop_print_pid PMIX_NAME(bfrop_print_pid)
#define pmix_bfrop_print_proc PMIX_NAME(bfrop_print_proc)
#define pmix_bfrop_print_size PMIX_NAME(bfrop_print_size)
#define pmix_bfrop_print_string PMIX_NAME(bfrop_print_string)
#define pmix_bfrop_print_time PMIX_NAME(bfrop_print_time)
#define pmix_bfrop_print_timeval PMIX_NAME(bfrop_print_timeval)
#define pmix_bfrop_print_topo PMIX_NAME(bfrop_print_topo)
#define pmix_bfrop_print_uint PMIX_NAME(bfrop_print_uint)
#define pmix_bfrop_print_uint16 PMIX_NAME(bfrop_print_uint16)
#define pmix_bfrop_print_uint32 PMIX_NAME(bfrop_print_uint32)
#define pmix_bfrop_print_uint64 PMIX_NAME(bfrop_print_uint64)
#define pmix_bfrop_print_uint8 PMIX_NAME(bfrop_print_uint8)
#define pmix_bfrop_print_value PMIX_NAME(bfrop_print_value)
#define pmix_bfrop_std_copy PMIX_NAME(bfrop_std_copy)
#define pmix_bfrop_store_data_type PMIX_NAME(bfrop_store_data_type)
#define pmix_bfrop_threshold_size PMIX_NAME(pmix_bfrop_threshold_size)
#define pmix_bfrop_too_small PMIX_NAME(bfrop_too_small)
#define pmix_bfrop_types PMIX_NAME(bfrop_types)
#define pmix_bfrop_type_info_t_class PMIX_NAME(bfrop_type_info_t_class)
#define pmix_bfrop_unpack PMIX_NAME(bfrop_unpack)
#define pmix_bfrop_unpack_app PMIX_NAME(bfrop_unpack_app)
#define pmix_bfrop_unpack_array PMIX_NAME(bfrop_unpack_array)
#define pmix_bfrop_unpack_bo PMIX_NAME(bfrop_unpack_bo)
#define pmix_bfrop_unpack_bool PMIX_NAME(bfrop_unpack_bool)
#define pmix_bfrop_unpack_buf PMIX_NAME(bfrop_unpack_buf)
#define pmix_bfrop_unpack_buffer PMIX_NAME(bfrop_unpack_buffer)
#define pmix_bfrop_unpack_byte PMIX_NAME(bfrop_unpack_byte)
#define pmix_bfrop_unpack_datatype PMIX_NAME(bfrop_unpack_datatype)
#define pmix_bfrop_unpack_double PMIX_NAME(bfrop_unpack_double)
#define pmix_bfrop_unpack_float PMIX_NAME(bfrop_unpack_float)
#define pmix_bfrop_unpack_info PMIX_NAME(bfrop_unpack_info)
#define pmix_bfrop_unpack_int PMIX_NAME(bfrop_unpack_int)
#define pmix_bfrop_unpack_int16 PMIX_NAME(bfrop_unpack_int16)
#define pmix_bfrop_unpack_int32 PMIX_NAME(bfrop_unpack_int32)
#define pmix_bfrop_unpack_int64 PMIX_NAME(bfrop_unpack_int64)
#define pmix_bfrop_unpack_kval PMIX_NAME(bfrop_unpack_kval)
#define pmix_bfrop_unpack_modex PMIX_NAME(bfrop_unpack_modex)
#define pmix_bfrop_unpack_pdata PMIX_NAME(bfrop_unpack_pdata)
#define pmix_bfrop_unpack_persist PMIX_NAME(bfrop_unpack_persist)
#define pmix_bfrop_unpack_pid PMIX_NAME(bfrop_unpack_pid)
#define pmix_bfrop_unpack_proc PMIX_NAME(bfrop_unpack_proc)
#define pmix_bfrop_unpack_sizet PMIX_NAME(bfrop_unpack_sizet)
#define pmix_bfrop_unpack_string PMIX_NAME(bfrop_unpack_string)
#define pmix_bfrop_unpack_time PMIX_NAME(bfrop_unpack_time)
#define pmix_bfrop_unpack_timeval PMIX_NAME(bfrop_unpack_timeval)
#define pmix_bfrop_unpack_topo PMIX_NAME(bfrop_unpack_topo)
#define pmix_bfrop_unpack_value PMIX_NAME(bfrop_unpack_value)
#define pmix_buffer_t_class PMIX_NAME(buffer_t_class)
#define pmix_cb_t_class PMIX_NAME(cb_t_class)
#define pmix_class_finalize PMIX_NAME(class_finalize)
#define pmix_class_initialize PMIX_NAME(class_initialize)
#define pmix_client_globals PMIX_NAME(pmix_client_globals)
#define pmix_client_process_nspace_blob PMIX_NAME(client_process_nspace_blob)
#define pmix_csum_partial PMIX_NAME(csum_partial)
#define pmix_dirname PMIX_NAME(dirname)
#define pmix_dmdx_local_t_class PMIX_NAME(dmdx_local_t_class)
#define pmix_dmdx_remote_t_class PMIX_NAME(dmdx_remote_t_class)
#define pmix_dmdx_reply_caddy_t_class PMIX_NAME(dmdx_reply_caddy_t_class)
#define pmix_dmdx_request_t_class PMIX_NAME(dmdx_request_t_class)
#define pmix_environ_merge PMIX_NAME(environ_merge)
#define pmix_errhandler_invoke PMIX_NAME(errhandler_invoke)
#define pmix_fd_read PMIX_NAME(fd_read)
#define pmix_fd_set_cloexec PMIX_NAME(fd_set_cloexec)
#define pmix_fd_write PMIX_NAME(fd_write)
#define pmix_globals PMIX_NAME(globals)
#define pmix_globals_finalize PMIX_NAME(globals_finalize)
#define pmix_globals_init PMIX_NAME(globals_init)
#define pmix_hash_fetch PMIX_NAME(hash_fetch)
#define pmix_hash_remove_data PMIX_NAME(hash_remove_data)
#define pmix_hash_store PMIX_NAME(hash_store)
#define pmix_hash_table_get_first_key_uint32 PMIX_NAME(hash_table_get_first_key_uint32)
#define pmix_hash_table_get_first_key_uint64 PMIX_NAME(hash_table_get_first_key_uint64)
#define pmix_hash_table_get_next_key_uint32 PMIX_NAME(hash_table_get_next_key_uint32)
#define pmix_hash_table_get_next_key_uint64 PMIX_NAME(hash_table_get_next_key_uint64)
#define pmix_hash_table_get_value_ptr PMIX_NAME(hash_table_get_value_ptr)
#define pmix_hash_table_get_value_uint32 PMIX_NAME(hash_table_get_value_uint32)
#define pmix_hash_table_get_value_uint64 PMIX_NAME(hash_table_get_value_uint64)
#define pmix_hash_table_init PMIX_NAME(hash_table_init)
#define pmix_hash_table_remove_all PMIX_NAME(hash_table_remove_all)
#define pmix_hash_table_remove_value_ptr PMIX_NAME(hash_table_remove_value_ptr)
#define pmix_hash_table_remove_value_uint32 PMIX_NAME(hash_table_remove_value_uint32)
#define pmix_hash_table_remove_value_uint64 PMIX_NAME(hash_table_remove_value_uint64)
#define pmix_hash_table_set_value_ptr PMIX_NAME(hash_table_set_value_ptr)
#define pmix_hash_table_set_value_uint32 PMIX_NAME(hash_table_set_value_uint32)
#define pmix_hash_table_set_value_uint64 PMIX_NAME(hash_table_set_value_uint64)
#define pmix_hash_table_t_class PMIX_NAME(hash_table_t_class)
#define pmix_home_directory PMIX_NAME(home_directory)
#define pmix_host_server PMIX_NAME(pmix_host_server)
#define pmix_initialize_crc_table PMIX_NAME(initialize_crc_table)
#define pmix_kval_t_class PMIX_NAME(kval_t_class)
#define pmix_list_insert PMIX_NAME(list_insert)
#define pmix_list_item_t_class PMIX_NAME(list_item_t_class)
#define pmix_list_join PMIX_NAME(list_join)
#define pmix_list_sort PMIX_NAME(list_sort)
#define pmix_list_splice PMIX_NAME(list_splice)
#define pmix_list_t_class PMIX_NAME(list_t_class)
#define pmix_munge_module PMIX_NAME(munge_module)
#define pmix_native_module PMIX_NAME(native_module)
#define pmix_notify_caddy_t_class PMIX_NAME(notify_caddy_t_class)
#define pmix_nrec_t_class PMIX_NAME(nrec_t_class)
#define pmix_nspace_t_class PMIX_NAME(nspace_t_class)
#define pmix_object_t_class PMIX_NAME(object_t_class)
#define pmix_os_path PMIX_NAME(os_path)
#define pmix_output PMIX_NAME(output)
#define pmix_output_close PMIX_NAME(output_close)
#define pmix_output_finalize PMIX_NAME(output_finalize)
#define pmix_output_get_verbosity PMIX_NAME(output_get_verbosity)
#define pmix_output_init PMIX_NAME(output_init)
#define pmix_output_open PMIX_NAME(output_open)
#define pmix_output_redirected_syslog_pri PMIX_NAME(pmix_output_redirected_syslog_pri)
#define pmix_output_redirected_to_syslog PMIX_NAME(output_redirected_to_syslog)
#define pmix_output_reopen PMIX_NAME(output_reopen)
#define pmix_output_reopen_all PMIX_NAME(output_reopen_all)
#define pmix_output_set_output_file_info PMIX_NAME(output_set_output_file_info)
#define pmix_output_set_verbosity PMIX_NAME(output_set_verbosity)
#define pmix_output_stream_t_class PMIX_NAME(output_stream_t_class)
#define pmix_output_string PMIX_NAME(output_string)
#define pmix_output_switch PMIX_NAME(output_switch)
#define pmix_output_verbose PMIX_NAME(output_verbose)
#define pmix_output_vstring PMIX_NAME(output_vstring)
#define pmix_output_vverbose PMIX_NAME(output_vverbose)
#define pmix_pack_proc_map PMIX_NAME(pack_proc_map)
#define pmix_peer_t_class PMIX_NAME(peer_t_class)
#define pmix_pending_connection_t_class PMIX_NAME(pending_connection_t_class)
#define pmix_pending_nspace_requests PMIX_NAME(pending_nspace_requests)
#define pmix_pending_resolve PMIX_NAME(pending_resolve)
#define pmix_pointer_array_add PMIX_NAME(pointer_array_add)
#define pmix_pointer_array_init PMIX_NAME(pointer_array_init)
#define pmix_pointer_array_set_item PMIX_NAME(pointer_array_set_item)
#define pmix_pointer_array_set_size PMIX_NAME(pointer_array_set_size)
#define pmix_pointer_array_t_class PMIX_NAME(pointer_array_t_class)
#define pmix_pointer_array_test_and_set_item PMIX_NAME(pointer_array_test_and_set_item)
#define pmix_rank_info_t_class PMIX_NAME(rank_info_t_class)
#define pmix_regex_parse_nodes PMIX_NAME(regex_parse_nodes)
#define pmix_regex_parse_procs PMIX_NAME(regex_parse_procs)
#define pmix_regex_range_t_class PMIX_NAME(regex_range_t_class)
#define pmix_regex_value_t_class PMIX_NAME(regex_value_t_class)
#define pmix_sec PMIX_NAME(pmix_sec)
#define pmix_sec_finalize PMIX_NAME(sec_finalize)
#define pmix_sec_init PMIX_NAME(sec_init)
#define pmix_server_abort PMIX_NAME(server_abort)
#define pmix_server_caddy_t_class PMIX_NAME(server_caddy_t_class)
#define pmix_server_commit PMIX_NAME(server_commit)
#define pmix_server_connect PMIX_NAME(server_connect)
#define pmix_server_deregister_errhandler PMIX_NAME(server_deregister_errhandler)
#define pmix_server_fence PMIX_NAME(server_fence)
#define pmix_server_get PMIX_NAME(server_get)
#define pmix_server_globals PMIX_NAME(pmix_server_globals)
#define pmix_server_lookup PMIX_NAME(server_lookup)
#define pmix_server_notify_error PMIX_NAME(server_notify_error)
#define pmix_server_nspace_t_class PMIX_NAME(server_nspace_t_class)
#define pmix_server_publish PMIX_NAME(server_publish)
#define pmix_server_register_errhandler PMIX_NAME(server_register_errhandler)
#define pmix_server_spawn PMIX_NAME(server_spawn)
#define pmix_server_trkr_t_class PMIX_NAME(server_trkr_t_class)
#define pmix_server_unpublish PMIX_NAME(server_unpublish)
#define pmix_setenv PMIX_NAME(setenv)
#define pmix_setup_caddy_t_class PMIX_NAME(setup_caddy_t_class)
#define pmix_shift_caddy_t_class PMIX_NAME(shift_caddy_t_class)
#define pmix_snd_caddy_t_class PMIX_NAME(snd_caddy_t_class)
#define pmix_snprintf PMIX_NAME(snprintf)
#define pmix_start_listening PMIX_NAME(start_listening)
#define pmix_start_progress_thread PMIX_NAME(start_progress_thread)
#define pmix_stop_listening PMIX_NAME(stop_listening)
#define pmix_stop_progress_thread PMIX_NAME(stop_progress_thread)
#define pmix_timer_t_class PMIX_NAME(timer_t_class)
#define pmix_tmp_directory PMIX_NAME(tmp_directory)
#define pmix_trkr_caddy_t_class PMIX_NAME(trkr_caddy_t_class)
#define pmix_uicrc_partial PMIX_NAME(uicrc_partial)
#define pmix_uicsum_partial PMIX_NAME(uicsum_partial)
#define pmix_unsetenv PMIX_NAME(unsetenv)
#define pmix_usock_finalize PMIX_NAME(usock_finalize)
#define pmix_usock_globals PMIX_NAME(pmix_usock_globals)
#define pmix_usock_init PMIX_NAME(usock_init)
#define pmix_usock_posted_recv_t_class PMIX_NAME(usock_posted_recv_t_class)
#define pmix_usock_process_msg PMIX_NAME(usock_process_msg)
#define pmix_usock_queue_t_class PMIX_NAME(usock_queue_t_class)
#define pmix_usock_recv_blocking PMIX_NAME(usock_recv_blocking)
#define pmix_usock_recv_handler PMIX_NAME(usock_recv_handler)
#define pmix_usock_recv_t_class PMIX_NAME(usock_recv_t_class)
#define pmix_usock_send_blocking PMIX_NAME(usock_send_blocking)
#define pmix_usock_send_handler PMIX_NAME(usock_send_handler)
#define pmix_usock_send_recv PMIX_NAME(usock_send_recv)
#define pmix_usock_send_t_class PMIX_NAME(usock_send_t_class)
#define pmix_usock_set_blocking PMIX_NAME(usock_set_blocking)
#define pmix_usock_set_nonblocking PMIX_NAME(usock_set_nonblocking)
#define pmix_usock_sr_t_class PMIX_NAME(usock_sr_t_class)
#define pmix_value_load PMIX_NAME(value_load)
#define pmix_value_unload PMIX_NAME(value_unload)
#define pmix_value_xfer PMIX_NAME(value_xfer)
#define pmix_vasprintf PMIX_NAME(vasprintf)
#define pmix_vsnprintf PMIX_NAME(vsnprintf)
#endif /* PMIX_SYM_TRANSFORM */

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

@ -38,8 +38,6 @@
BEGIN_C_DECLS
PMIX_DECLSPEC extern const char pmix_version_string[];
/* internally used object for transferring data
* to/from the server and for storing in the
* hash tables */

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

@ -34,13 +34,6 @@
#include "src/util/argv.h"
#include "src/buffer_ops/internal.h"
#if PMIX_CC_USE_PRAGMA_IDENT
#pragma ident PMIX_VERSION
#elif PMIX_CC_USE_IDENT
#ident PMIX_VERSION
#endif
const char pmix_version_string[] = PMIX_VERSION;
/**
* globals

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

@ -45,6 +45,14 @@
#endif
#include PMIX_EVENT_HEADER
#if PMIX_CC_USE_PRAGMA_IDENT
#pragma ident PMIX_VERSION
#elif PMIX_CC_USE_IDENT
#ident PMIX_VERSION
#endif
static const char pmix_version_string[] = PMIX_VERSION;
#include "src/class/pmix_list.h"
#include "src/buffer_ops/buffer_ops.h"
#include "src/util/argv.h"

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

@ -36,41 +36,49 @@ static pmix_proc_t my_proc;
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_list_t plist, ilist;
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 */
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);
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, procs[n].nspace))) {
OPAL_ERROR_LOG(rc);
OBJ_RELEASE(cd);
return;
}
nm->name.vpid = procs[n].rank;
opal_list_append(&plist, &nm->super);
opal_list_append(&cd->procs, &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);
opal_list_append(&cd->info, &iptr->super);
}
/* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist);
OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist);
opal_pmix_base_errhandler(rc, &cd->procs, &cd->info, release_cbfunc, cd);
}
static void errreg_cbfunc (pmix_status_t status,

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

@ -80,11 +80,11 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro
static pmix_status_t server_register_events(const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
static pmix_status_t server_deregister_events(const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
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 pmix112_module = {
server_client_connected_fn,
server_client_finalized_fn,
server_abort_fn,
@ -101,7 +101,7 @@ pmix_server_module_t mymodule = {
server_listener_fn
};
opal_pmix_server_module_t *host_module = NULL;
opal_pmix_server_module_t *pmix112_host_module = NULL;
static void opal_opcbfunc(int status, void *cbdata)
@ -119,7 +119,7 @@ static pmix_status_t server_client_connected_fn(const pmix_proc_t *p, void *serv
int rc;
opal_process_name_t proc;
if (NULL == host_module || NULL == host_module->client_connected) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->client_connected) {
return PMIX_SUCCESS;
}
@ -130,7 +130,7 @@ 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 = pmix112_host_module->client_connected(&proc, server_object);
return pmix1_convert_opalrc(rc);
}
@ -141,7 +141,7 @@ static pmix_status_t server_client_finalized_fn(const pmix_proc_t *p, void* serv
pmix1_opalcaddy_t *opalcaddy;
opal_process_name_t proc;
if (NULL == host_module || NULL == host_module->client_finalized) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->client_finalized) {
return PMIX_SUCCESS;
}
@ -157,7 +157,7 @@ static pmix_status_t server_client_finalized_fn(const pmix_proc_t *p, void* serv
opalcaddy->cbdata = cbdata;
/* pass it up */
rc = host_module->client_finalized(&proc, server_object, opal_opcbfunc, opalcaddy);
rc = pmix112_host_module->client_finalized(&proc, server_object, opal_opcbfunc, opalcaddy);
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
@ -175,7 +175,7 @@ static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object,
int rc;
pmix1_opalcaddy_t *opalcaddy;
if (NULL == host_module || NULL == host_module->abort) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->abort) {
return PMIX_ERR_NOT_SUPPORTED;
}
@ -206,7 +206,7 @@ static pmix_status_t server_abort_fn(const pmix_proc_t *p, void *server_object,
}
/* pass it up */
rc = host_module->abort(&proc, server_object, status, msg,
rc = pmix112_host_module->abort(&proc, server_object, status, msg,
&opalcaddy->procs, opal_opcbfunc, opalcaddy);
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
@ -252,7 +252,7 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
opal_value_t *iptr;
int rc;
if (NULL == host_module || NULL == host_module->fence_nb) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->fence_nb) {
return PMIX_ERR_NOT_SUPPORTED;
}
@ -288,7 +288,7 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
}
/* pass it up */
rc = host_module->fence_nb(&opalcaddy->procs, &opalcaddy->info,
rc = pmix112_host_module->fence_nb(&opalcaddy->procs, &opalcaddy->info,
data, ndata, opmdx_response, opalcaddy);
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
@ -306,7 +306,7 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
opal_value_t *iptr;
size_t n;
if (NULL == host_module || NULL == host_module->direct_modex) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->direct_modex) {
return PMIX_ERR_NOT_SUPPORTED;
}
@ -337,7 +337,7 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
}
/* pass it up */
rc = host_module->direct_modex(&proc, &opalcaddy->info, opmdx_response, opalcaddy);
rc = pmix112_host_module->direct_modex(&proc, &opalcaddy->info, opmdx_response, opalcaddy);
if (OPAL_SUCCESS != rc && OPAL_ERR_IN_PROCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
@ -357,7 +357,7 @@ static pmix_status_t server_publish_fn(const pmix_proc_t *p,
opal_process_name_t proc;
opal_value_t *oinfo;
if (NULL == host_module || NULL == host_module->publish) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->publish) {
return PMIX_ERR_NOT_SUPPORTED;
}
@ -388,7 +388,7 @@ static pmix_status_t server_publish_fn(const pmix_proc_t *p,
}
/* pass it up */
rc = host_module->publish(&proc, &opalcaddy->info, opal_opcbfunc, opalcaddy);
rc = pmix112_host_module->publish(&proc, &opalcaddy->info, opal_opcbfunc, opalcaddy);
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
@ -436,7 +436,7 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys,
opal_value_t *iptr;
size_t n;
if (NULL == host_module || NULL == host_module->lookup) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->lookup) {
return PMIX_ERR_NOT_SUPPORTED;
}
@ -467,7 +467,7 @@ static pmix_status_t server_lookup_fn(const pmix_proc_t *p, char **keys,
}
/* pass it up */
rc = host_module->lookup(&proc, keys, &opalcaddy->info, opal_lkupcbfunc, opalcaddy);
rc = pmix112_host_module->lookup(&proc, keys, &opalcaddy->info, opal_lkupcbfunc, opalcaddy);
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
@ -486,7 +486,7 @@ static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys,
opal_value_t *iptr;
size_t n;
if (NULL == host_module || NULL == host_module->unpublish) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->unpublish) {
return PMIX_SUCCESS;
}
@ -517,7 +517,7 @@ static pmix_status_t server_unpublish_fn(const pmix_proc_t *p, char **keys,
}
/* pass it up */
rc = host_module->unpublish(&proc, keys, &opalcaddy->info, opal_opcbfunc, opalcaddy);
rc = pmix112_host_module->unpublish(&proc, keys, &opalcaddy->info, opal_opcbfunc, opalcaddy);
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
@ -552,7 +552,7 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p,
size_t k, n;
int rc;
if (NULL == host_module || NULL == host_module->spawn) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->spawn) {
return PMIX_ERR_NOT_SUPPORTED;
}
@ -609,7 +609,7 @@ static pmix_status_t server_spawn_fn(const pmix_proc_t *p,
}
/* pass it up */
rc = host_module->spawn(&proc, &opalcaddy->info, &opalcaddy->apps, opal_spncbfunc, opalcaddy);
rc = pmix112_host_module->spawn(&proc, &opalcaddy->info, &opalcaddy->apps, opal_spncbfunc, opalcaddy);
if (OPAL_SUCCESS != rc) {
OPAL_ERROR_LOG(rc);
OBJ_RELEASE(opalcaddy);
@ -629,7 +629,7 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs,
size_t n;
opal_value_t *oinfo;
if (NULL == host_module || NULL == host_module->connect) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->connect) {
return PMIX_ERR_NOT_SUPPORTED;
}
@ -665,7 +665,7 @@ static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs,
}
/* pass it up */
rc = host_module->connect(&opalcaddy->procs, &opalcaddy->info, opal_opcbfunc, opalcaddy);
rc = pmix112_host_module->connect(&opalcaddy->procs, &opalcaddy->info, opal_opcbfunc, opalcaddy);
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
@ -684,7 +684,7 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro
size_t n;
opal_value_t *oinfo;
if (NULL == host_module || NULL == host_module->disconnect) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->disconnect) {
return PMIX_ERR_NOT_SUPPORTED;
}
@ -720,7 +720,7 @@ static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t npro
}
/* pass it up */
rc = host_module->disconnect(&opalcaddy->procs, &opalcaddy->info, opal_opcbfunc, opalcaddy);
rc = pmix112_host_module->disconnect(&opalcaddy->procs, &opalcaddy->info, opal_opcbfunc, opalcaddy);
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
@ -753,7 +753,7 @@ static pmix_status_t server_register_events(const pmix_info_t info[], size_t nin
}
/* pass it up */
rc = host_module->register_events(&opalcaddy->info, opal_opcbfunc, opalcaddy);
rc = pmix112_host_module->register_events(&opalcaddy->info, opal_opcbfunc, opalcaddy);
if (OPAL_SUCCESS != rc) {
OBJ_RELEASE(opalcaddy);
}
@ -771,10 +771,10 @@ static pmix_status_t server_listener_fn(int listening_sd,
{
int rc;
if (NULL == host_module || NULL == host_module->listener) {
if (NULL == pmix112_host_module || NULL == pmix112_host_module->listener) {
return PMIX_ERR_NOT_SUPPORTED;
}
rc = host_module->listener(listening_sd, cbfunc);
rc = pmix112_host_module->listener(listening_sd, cbfunc);
return pmix1_convert_opalrc(rc);
}

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

@ -44,46 +44,50 @@
/* These are the interfaces used by the OMPI/ORTE/OPAL layer to call
* down into the embedded PMIx server. */
extern pmix_server_module_t mymodule;
extern opal_pmix_server_module_t *host_module;
extern pmix_server_module_t pmix112_module;
extern opal_pmix_server_module_t *pmix112_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_list_t plist, ilist;
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 */
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);
opal_list_append(&cd->procs, &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);
opal_list_append(&cd->info, &iptr->super);
}
/* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist);
OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist);
opal_pmix_base_errhandler(rc, &cd->procs, &cd->info, release_cbfunc, cd);
}
static void errreg_cbfunc(pmix_status_t status,
@ -125,14 +129,14 @@ int pmix1_server_init(opal_pmix_server_module_t *module,
pinfo = NULL;
}
if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, pinfo, sz))) {
if (PMIX_SUCCESS != (rc = PMIx_server_init(&pmix112_module, pinfo, sz))) {
PMIX_INFO_FREE(pinfo, sz);
return pmix1_convert_rc(rc);
}
PMIX_INFO_FREE(pinfo, sz);
/* record the host module */
host_module = module;
pmix112_host_module = module;
/* register the errhandler */
PMIx_Register_errhandler(NULL, 0, myerr, errreg_cbfunc, NULL);
@ -428,7 +432,7 @@ int pmix1_server_notify_error(int status,
rc = pmix1_convert_opalrc(status);
rc = PMIx_Notify_error(rc, ps, psz, eps, esz,
pinfo, sz, opcbfunc, op);
pinfo, sz, opcbfunc, op);
if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op);
}

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

@ -0,0 +1,51 @@
#
# Copyright (c) 2014-2015 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 = \
pmix120.h \
pmix_pmix120_component.c \
pmix_pmix120.c \
pmix120_client.c \
pmix120_server_south.c \
pmix120_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_pmix120_DSO
component_noinst =
component_install = mca_pmix_pmix120.la
else
component_noinst = libmca_pmix_pmix120.la
component_install =
endif
mcacomponentdir = $(opallibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_pmix_pmix120_la_SOURCES = $(sources)
mca_pmix_pmix120_la_CFLAGS = $(opal_pmix_pmix120_CFLAGS)
mca_pmix_pmix120_la_CPPFLAGS = \
-I$(srcdir)/pmix/include $(opal_pmix_pmix120_CPPFLAGS)
mca_pmix_pmix120_la_LDFLAGS = -module -avoid-version $(opal_pmix_pmix120_LDFLAGS)
mca_pmix_pmix120_la_LIBADD = $(opal_pmix_pmix120_LIBS)
noinst_LTLIBRARIES = $(component_noinst)
libmca_pmix_pmix120_la_SOURCES =$(sources)
libmca_pmix_pmix120_la_CFLAGS = $(opal_pmix_pmix120_CFLAGS)
libmca_pmix_pmix120_la_CPPFLAGS = -I$(srcdir)/pmix/include $(opal_pmix_pmix120_CPPFLAGS)
libmca_pmix_pmix120_la_LDFLAGS = -module -avoid-version $(opal_pmix_pmix120_LDFLAGS)
libmca_pmix_pmix120_la_LIBADD = $(opal_pmix_pmix120_LIBS)

1
opal/mca/pmix/pmix120/autogen.subdirs Обычный файл
Просмотреть файл

@ -0,0 +1 @@
pmix

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

@ -0,0 +1,78 @@
# -*- 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-2015 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_pmix120_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_opal_pmix_pmix120_CONFIG],[
AC_CONFIG_FILES([opal/mca/pmix/pmix120/Makefile])
OPAL_VAR_SCOPE_PUSH([PMIX_VERSION opal_pmix_pmix120_save_CPPFLAGS opal_pmix_pmix120_save_LDFLAGS opal_pmix_pmix120_save_LIBS opal_pmix_pmix120_basedir opal_pmix_pmix120_save_cflags])
AS_IF([test "$opal_external_pmix_happy" = "yes"],
[AC_MSG_WARN([using an external pmix; disqualifiying this component])
opal_pmix_pmix120_happy=0],
[PMIX_VERSION=
opal_pmix_pmix120_basedir=opal/mca/pmix/pmix120
opal_pmix_pmix120_save_CFLAGS=$CFLAGS
opal_pmix_pmix120_save_CPPFLAGS=$CPPFLAGS
opal_pmix_pmix120_save_LDFLAGS=$LDFLAGS
opal_pmix_pmix120_save_LIBS=$LIBS
opal_pmix_pmix120_args="--enable-embedded-mode --with-pmix-symbol-prefix=opal_pmix_pmix120_ --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_pmix120_args="--enable-debug $opal_pmix_pmix120_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"],
[opal_pmix_pmix120_args="--disable-debug $opal_pmix_pmix120_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_pmix120_basedir/pmix],
[$opal_pmix_pmix120_args $opal_subdir_args 'CFLAGS=$CFLAGS' 'CPPFLAGS=$CPPFLAGS'],
[opal_pmix_pmix120_happy=1], [opal_pmix_pmix120_happy=0])
AS_IF([test $opal_pmix_pmix120_happy -eq 1],
[PMIX_VERSION="internal v`$srcdir/$opal_pmix_pmix120_basedir/pmix/config/pmix_get_version.sh $srcdir/$opal_pmix_pmix120_basedir/pmix/VERSION`"
# Build flags for our Makefile.am
opal_pmix_pmix120_LIBS='$(OPAL_TOP_BUILDDIR)/'"$opal_pmix_pmix120_basedir"'/pmix/libpmix.la'
opal_pmix_pmix120_CPPFLAGS='-I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix120/pmix/include/pmix -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix120/pmix/include -I$(OPAL_TOP_BUILDDIR)/opal/mca/pmix/pmix120/pmix -I$(OPAL_TOP_SRCDIR)/opal/mca/pmix/pmix120/pmix'
AC_SUBST([opal_pmix_pmix120_LIBS])
AC_SUBST([opal_pmix_pmix120_CPPFLAGS])])
# Finally, add a flag to support static builds
pmix_pmix120_WRAPPER_EXTRA_LIBS=-lpmix
CFLAGS=$opal_pmix_pmix120_save_CFLAGS
CPPFLAGS=$opal_pmix_pmix120_save_CPPFLAGS
LDFLAGS=$opal_pmix_pmix120_save_LDFLAGS
LIBS=$opal_pmix_pmix120_save_LIBS
])
AS_IF([test $opal_pmix_pmix120_happy -eq 1],
[$1],
[$2])
OPAL_VAR_SCOPE_POP
])dnl

30
opal/mca/pmix/pmix120/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

88
opal/mca/pmix/pmix120/pmix/INSTALL Обычный файл
Просмотреть файл

@ -0,0 +1,88 @@
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) 2008-2015 Cisco Systems, Inc. All rights reserved.
Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
For More Information
====================
This file is a *very* short overview of building and installing
the PMIx library. Much more information is available on the
PMIx web site (e.g., see the FAQ section):
http://pmix.github.io/pmix/master
Developer Builds
================
If you have checked out a DEVELOPER'S COPY of PMIx (i.e., you checked
out from Git), you should read the HACKING file before attempting to
build PMIx. You must then run:
shell$ ./autogen.sh
You will need very recent versions of GNU Autoconf, Automake, and
Libtool. If autogen.sh fails, read the HACKING file. If anything
else fails, read the HACKING file. Finally, we suggest reading the
HACKING file.
*** NOTE: Developer's copies of PMIx typically include a large
performance penalty at run-time because of extra debugging overhead.
User Builds
===========
Building PMIx is typically a combination of running "configure"
and "make". Execute the following commands to install the PMIx
system from within the directory at the top of the tree:
shell$ ./configure --prefix=/where/to/install
[...lots of output...]
shell$ make all install
If you need special access to install, then you can execute "make
all" as a user with write permissions in the build tree, and a
separate "make install" as a user with write permissions to the
install tree.
Compiling support for specific compilers and environments may
require additional command line flags when running configure. See the
README file for more details. Note that VPATH builds are fully
supported. For example:
shell$ gtar zxf pmix-X.Y.Z.tar.gz
shell$ cd pmix-X.Y.Z
shell$ mkdir build
shell$ cd build
shell$ ../configure ...your options...
[...lots of output...]
shell$ make all install
Parallel builds are also supported (although some versions of "make",
such as GNU make, will only use the first target listed on the command
line when executable parallel builds). For example (assume GNU make):
shell$ make -j 4 all
[...lots of output...]
shell$ make install
Parallel make is generally only helpful in the build phase; the
installation process is mostly serial and does not benefit much from
parallel make.

93
opal/mca/pmix/pmix120/pmix/LICENSE Обычный файл
Просмотреть файл

@ -0,0 +1,93 @@
Most files in this release are marked with the copyrights of the
organizations who have edited them. The copyrights below are in no
particular order and generally reflect members of the Open MPI core
team who have contributed code that may or may not have been ported
to PMIx. Per the terms of that LICENSE, we include the list here.
The copyrights for code used under license from other parties
are included in the corresponding files.
Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
University Research and Technology
Corporation. All rights reserved.
Copyright (c) 2004-2010 The University of Tennessee and The University
of Tennessee Research Foundation. All rights
reserved.
Copyright (c) 2004-2010 High Performance Computing Center Stuttgart,
University of Stuttgart. All rights reserved.
Copyright (c) 2004-2008 The Regents of the University of California.
All rights reserved.
Copyright (c) 2006-2010 Los Alamos National Security, LLC. All rights
reserved.
Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
Copyright (c) 2006-2010 Voltaire, Inc. All rights reserved.
Copyright (c) 2006-2011 Sandia National Laboratories. All rights reserved.
Copyright (c) 2006-2010 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Copyright (c) 2006-2010 The University of Houston. All rights reserved.
Copyright (c) 2006-2009 Myricom, Inc. All rights reserved.
Copyright (c) 2007-2008 UT-Battelle, LLC. All rights reserved.
Copyright (c) 2007-2010 IBM Corporation. All rights reserved.
Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing
Centre, Federal Republic of Germany
Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany
Copyright (c) 2007 Evergrid, Inc. All rights reserved.
Copyright (c) 2008 Chelsio, Inc. All rights reserved.
Copyright (c) 2008-2009 Institut National de Recherche en
Informatique. All rights reserved.
Copyright (c) 2007 Lawrence Livermore National Security, LLC.
All rights reserved.
Copyright (c) 2007-2009 Mellanox Technologies. All rights reserved.
Copyright (c) 2006-2010 QLogic Corporation. All rights reserved.
Copyright (c) 2008-2010 Oak Ridge National Labs. All rights reserved.
Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2009 Bull SAS. All rights reserved.
Copyright (c) 2010 ARM ltd. All rights reserved.
Copyright (c) 2010-2011 Alex Brick <bricka@ccs.neu.edu>. All rights reserved.
Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights
reserved.
Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
The following LICENSE pertains to both PMIx and any code ported
from Open MPI.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer listed
in this license in the documentation and/or other materials
provided with the distribution.
- Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
The copyright holders provide no reassurances that the source code
provided does not infringe any patent, copyright, or any other
intellectual property rights of third parties. The copyright holders
disclaim any liability to any recipient for claims brought against
recipient by any third party for infringement of that parties
intellectual property rights.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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

@ -0,0 +1,96 @@
#
# 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-2009 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-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$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Note that the -I directory must *exactly* match what was specified
# via AC_CONFIG_MACRO_DIR in configure.ac.
ACLOCAL_AMFLAGS = -I ./config
headers =
sources =
nodist_headers =
EXTRA_DIST =
# Only install the valgrind suppressions file if we're building in
# standalone mode
dist_pmixdata_DATA =
if ! PMIX_EMBEDDED_MODE
dist_pmixdata_DATA += contrib/pmix-valgrind.supp
endif
man_MANS = \
man/man3/pmix_init.3 \
man/man3/pmix_finalize.3 \
man/man3/pmix_initialized.3 \
man/man3/pmix_abort.3 \
man/man3/pmix_put.3 \
man/man3/pmix_commit.3 \
man/man7/pmix.7 \
man/man7/pmix_constants.7
include config/Makefile.am
include include/Makefile.am
include src/class/Makefile.am
include src/include/Makefile.am
include src/buffer_ops/Makefile.am
include src/util/Makefile.am
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
if PMIX_EMBEDDED_MODE
noinst_LTLIBRARIES = libpmix.la
libpmix_la_SOURCES = $(headers) $(sources)
libpmix_la_LDFLAGS =
else
lib_LTLIBRARIES = libpmix.la
libpmix_la_SOURCES = $(headers) $(sources)
libpmix_la_LDFLAGS = -version-info $(libpmix_so_version)
endif
if ! PMIX_EMBEDDED_MODE
SUBDIRS = . test
pmixdir = $(pmixincludedir)/$(subdir)
nobase_pmix_HEADERS = $(headers)
endif
nroff:
@for file in $(man_MANS); do \
source=`echo $$file | sed -e 's@/man[0-9]@@'`; \
contrib/md2nroff.pl --source=$$source.md; \
done
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 \
test/server_callbacks.h test/test_fence.h \
test/test_publish.h test/test_resolve_peers.h \
test/test_spawn.h test/utils.h test/test_cd.h \
examples/client.c examples/dmodex.c examples/dynamic.c \
examples/fault.c examples/pub.c
dist-hook:
env LS_COLORS= sh "$(top_srcdir)/config/distscript.sh" "$(top_srcdir)" "$(distdir)" "$(PMIX_VERSION)" "$(PMIX_REPO_REV)"

46
opal/mca/pmix/pmix120/pmix/NEWS Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
Copyright (c) 2015 Intel, Inc. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
===========================================================================
This file contains the main features as well as overviews of specific
bug fixes (and other actions) for each version of PMIx since
version 1.0.
As more fully described in the "Software Version Number" section in
the README file, PMIx typically maintains two separate version
series simultaneously - the current release and one that is locked
to only bug fixes. Since these series are semi-independent of each
other, a single NEWS-worthy item might apply to different series. For
example, a bug might be fixed in the master, and then moved to the
current release as well as the "stable" bug fix release branch.
Master (not on release branches yet)
------------------------------------
1.1.1
-----
- Fix an issue where the example and test programs
were incorrectly being installed. Thanks to Orion
Poplawski for reporting it
1.1.0
-----
- major update of APIs to reflect comments received from 1.0.0
non-production release
- fixed thread-safety issues
- fixed a range of pack/unpack issues
- added unit tests for all APIs
1.0.0
------
Initial public release of draft APIs for comment - not production
intended

315
opal/mca/pmix/pmix120/pmix/README Обычный файл
Просмотреть файл

@ -0,0 +1,315 @@
Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
University Research and Technology
Corporation. All rights reserved.
Copyright (c) 2004-2007 The University of Tennessee and The University
of Tennessee Research Foundation. All rights
reserved.
Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
University of Stuttgart. All rights reserved.
Copyright (c) 2004-2007 The Regents of the University of California.
All rights reserved.
Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
Copyright (c) 2006-2011 Mellanox Technologies. All rights reserved.
Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007 Myricom, Inc. All rights reserved.
Copyright (c) 2008 IBM Corporation. All rights reserved.
Copyright (c) 2010 Oak Ridge National Labs. All rights reserved.
Copyright (c) 2011 University of Houston. All rights reserved.
Copyright (c) 2013-2015 Intel, Inc. All rights reserved
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
===========================================================================
When submitting questions and problems, be sure to include as much
extra information as possible. This web page details all the
information that we request in order to provide assistance:
http://pmix.github.io/master/community/help/
The best way to report bugs, send comments, or ask questions is to
sign up on the PMIx mailing list, which is hosted by GoogleGroups:
pmix@googlegroups.com
Because of spam, only subscribers are allowed to post to this list
(ensure that you subscribe with and post from exactly the same e-mail
address -- joe@example.com is considered different than
joe@mycomputer.example.com!). You can subscribe to the list here:
https://groups.google.com/d/forum/pmix
Thanks for your time.
===========================================================================
More information is available in the PMIx FAQ:
http://pmix.github.io/master/faq/
We are in early days, so please be patient - info will grow as questions
are addressed.
===========================================================================
The following abbreviated list of release notes applies to this code
base as of this writing (12 November 2015):
General notes
-------------
- The majority of PMIx's documentation is here in this file, the
included man pages, and on the web site FAQ
(http://pmix.github.io/master/faq). This will eventually be
supplemented with cohesive installation and user documentation files.
- Systems that have been tested are:
- Linux (various flavors/distros), 32 bit, with gcc
- Linux (various flavors/distros), 64 bit (x86), with gcc, Intel,
and Portland (*)
- OS X (10.7 and above), 32 and 64 bit (x86_64), with gcc (*)
(*) Compiler Notes
--------------
- The Portland Group compilers prior to version 7.0 require the
"-Msignextend" compiler flag to extend the sign bit when converting
from a shorter to longer integer. This is is different than other
compilers (such as GNU). When compiling PMIx with the Portland
compiler suite, the following flags should be passed to PMIx's
configure script:
shell$ ./configure CFLAGS=-Msignextend ...
This will compile PMIx with the proper compile flags
- Running on nodes with different endian and/or different datatype
sizes within a single parallel job is supported in this release.
However, PMIx does not resize data when datatypes differ in size
(for example, sending a 4 byte double and receiving an 8 byte
double will fail).
===========================================================================
Building PMIx
-----------------
PMIx uses a traditional configure script paired with "make" to
build. Typical installs can be of the pattern:
---------------------------------------------------------------------------
shell$ ./configure [...options...]
shell$ make all install
---------------------------------------------------------------------------
There are many available configure options (see "./configure --help"
for a full list); a summary of the more commonly used ones follows:
INSTALLATION OPTIONS
--prefix=<directory>
Install PMIx into the base directory named <directory>. Hence,
PMIx will place its executables in <directory>/bin, its header
files in <directory>/include, its libraries in <directory>/lib, etc.
--disable-shared
By default, libpmix is built as a shared library. This switch disables
this default; it is really only useful when used with
--enable-static. Specifically, this option does *not* imply
--enable-static; enabling static libraries and disabling shared
libraries are two independent options.
--enable-static
Build libpmix as a static library. Note that this option does *not* imply
--disable-shared; enabling static libraries and disabling shared
libraries are two independent options.
--with-platform=FILE
Load configure options for the build from FILE. Options on the
command line that are not in FILE are also used. Options on the
command line and in FILE are replaced by what is in FILE.
Once PMIx has been built and installed, it is safe to run "make
clean" and/or remove the entire build tree.
VPATH and parallel builds are fully supported.
Generally speaking, the only thing that users need to do to use PMIx
is ensure that <prefix>/lib is in their LD_LIBRARY_PATH. Users may
need to ensure to set LD_LIBRARY_PATH in their shell setup files (e.g.,
.bashrc, .cshrc) so that non-interactive rsh/ssh-based logins will
be able to find the PMIx library.
===========================================================================
PMIx Version Numbers and Binary Compatibility
-------------------------------------------------
PMIx has two sets of version numbers that are likely of interest
to end users / system administrator:
* Software version number
* Shared library version numbers
Both are described below, followed by a discussion of application
binary interface (ABI) compatibility implications.
Software Version Number
-----------------------
PMIx's version numbers are the union of several different values:
major, minor, release, and an optional quantifier.
* Major: The major number is the first integer in the version string
(e.g., v1.2.3). Changes in the major number typically indicate a
significant change in the code base and/or end-user
functionality. The major number is always included in the version
number.
* Minor: The minor number is the second integer in the version
string (e.g., v1.2.3). Changes in the minor number typically
indicate a incremental change in the code base and/or end-user
functionality. The minor number is always included in the version
number:
* Release: The release number is the third integer in the version
string (e.g., v1.2.3). Changes in the release number typically
indicate a bug fix in the code base and/or end-user
functionality.
* Quantifier: PMIx version numbers sometimes have an arbitrary
string affixed to the end of the version number. Common strings
include:
o aX: Indicates an alpha release. X is an integer indicating
the number of the alpha release (e.g., v1.2.3a5 indicates the
5th alpha release of version 1.2.3).
o bX: Indicates a beta release. X is an integer indicating
the number of the beta release (e.g., v1.2.3b3 indicates the 3rd
beta release of version 1.2.3).
o rcX: Indicates a release candidate. X is an integer
indicating the number of the release candidate (e.g., v1.2.3rc4
indicates the 4th release candidate of version 1.2.3).
Although the major, minor, and release values (and optional
quantifiers) are reported in PMIx nightly snapshot tarballs, the
filenames of these snapshot tarballs follow a slightly different
convention.
Specifically, the snapshot tarball filename contains three distinct
values:
* Most recent Git tag name on the branch from which the tarball was
created.
* An integer indicating how many Git commits have occurred since
that Git tag.
* The Git hash of the tip of the branch.
For example, a snapshot tarball filename of
"pmix-v1.0.2-57-gb9f1fd9.tar.bz2" indicates that this tarball was
created from the v1.0 branch, 57 Git commits after the "v1.0.2" tag,
specifically at Git hash gb9f1fd9.
PMIx's Git master branch contains a single "dev" tag. For example,
"pmix-dev-8-gf21c349.tar.bz2" represents a snapshot tarball created
from the master branch, 8 Git commits after the "dev" tag,
specifically at Git hash gf21c349.
The exact value of the "number of Git commits past a tag" integer is
fairly meaningless; its sole purpose is to provide an easy,
human-recognizable ordering for snapshot tarballs.
Shared Library Version Number
-----------------------------
PMIx uses the GNU Libtool shared library versioning scheme.
NOTE: Only official releases of PMIx adhere to this versioning
scheme. "Beta" releases, release candidates, and nightly
tarballs, developer snapshots, and Git snapshot tarballs likely
will all have arbitrary/meaningless shared library version
numbers.
The GNU Libtool official documentation details how the versioning
scheme works. The quick version is that the shared library versions
are a triple of integers: (current,revision,age), or "c:r:a". This
triple is not related to the PMIx software version number. There
are six simple rules for updating the values (taken almost verbatim
from the Libtool docs):
1. Start with version information of "0:0:0" for each shared library.
2. Update the version information only immediately before a public
release of your software. More frequent updates are unnecessary,
and only guarantee that the current interface number gets larger
faster.
3. If the library source code has changed at all since the last
update, then increment revision ("c:r:a" becomes "c:r+1:a").
4. If any interfaces have been added, removed, or changed since the
last update, increment current, and set revision to 0.
5. If any interfaces have been added since the last public release,
then increment age.
6. If any interfaces have been removed since the last public release,
then set age to 0.
Application Binary Interface (ABI) Compatibility
------------------------------------------------
PMIx provides forward ABI compatibility in all versions of a given
feature release series and its corresponding
super stable series. For example, on a single platform, an pmix
application linked against PMIx v1.3.2 shared libraries can be
updated to point to the shared libraries in any successive v1.3.x or
v1.4 release and still work properly (e.g., via the LD_LIBRARY_PATH
environment variable or other operating system mechanism).
PMIx reserves the right to break ABI compatibility at new feature
release series. For example, the same pmix application from above
(linked against PMIx v1.3.2 shared libraries) will *not* work with
PMIx v1.5 shared libraries.
===========================================================================
Common Questions
----------------
Many common questions about building and using PMIx are answered
on the FAQ:
http://pmix.github.io/master/faq/
===========================================================================
Got more questions?
-------------------
Found a bug? Got a question? Want to make a suggestion? Want to
contribute to PMIx? Please let us know!
When submitting questions and problems, be sure to include as much
extra information as possible. This web page details all the
information that we request in order to provide assistance:
http://pmix.github.io/master/community/help/
Questions and comments should generally be sent to the PMIx mailing
list (pmix@googlegroups.com). Because of spam, only
subscribers are allowed to post to this list (ensure that you
subscribe with and post from *exactly* the same e-mail address --
joe@example.com is considered different than
joe@mycomputer.example.com!). Visit this page to subscribe to the
user's list:
https://groups.google.com/d/forum/pmix
Make today an PMIx day!

65
opal/mca/pmix/pmix120/pmix/VERSION Обычный файл
Просмотреть файл

@ -0,0 +1,65 @@
# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, 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
# the version number below are combined to form a single version
# number string.
# major, minor, and release are generally combined in the form
# <major>.<minor>.<release>.
major=1
minor=2
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
# numeric. Common examples include a1 (alpha release 1), b1 or (beta release 1).
# The only requirement is that it must be entirely printable ASCII
# characters and have no white space.
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=git843fa89
# If tarball_version is not empty, it is used as the version string in
# the tarball filename, regardless of all other versions listed in
# this file. For example, if tarball_version is empty, the tarball
# filename will be of the form
# openmpi-<major>.<minor>.<release><greek>.tar.*. However, if
# tarball_version is not empty, the tarball filename will be of the
# form openmpi-<tarball_version>.tar.*.
tarball_version=
# The date when this release was created
date="Dec 08, 2015"
# The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library
# Interface Versions" chapter from the GNU Libtool documentation.
# All changes in these version numbers are dictated by the PMIx
# release managers (not individual developers). Notes:
# 1. Since these version numbers are associated with *releases*, the
# version numbers maintained on the PMIx Github trunk (and developer
# branches) is always 0:0:0 for all libraries.
# 2. The version number of libpmix refers to the public pmix interfaces.
# It does not refer to any internal interfaces.
# Version numbers are described in the Libtool current:revision:age
# format.
libpmix_so_version=0:0:0

5
opal/mca/pmix/pmix120/pmix/autogen.sh Исполняемый файл
Просмотреть файл

@ -0,0 +1,5 @@
#!/bin/sh
# Run all the rest of the Autotools
echo "==> Running autoreconf";
autoreconf ${autoreconf_args:-"-ivf"}

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

@ -0,0 +1,50 @@
# PMIx copyrights:
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved
#
#########################
#
# Copyright (c) 2004-2006 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) 2006-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2010 Oracle and/or its affiliates. All rights
# reserved.
#########################
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
EXTRA_DIST += \
config/c_get_alignment.m4 \
config/pmix_get_version.sh \
config/distscript.sh \
config/pmix_check_attributes.m4 \
config/pmix_check_broken_qsort.m4 \
config/pmix_check_compiler_version.m4 \
config/pmix_check_ident.m4 \
config/pmix_check_munge.m4 \
config/pmix_check_package.m4 \
config/pmix_check_sasl.m4 \
config/pmix_check_vendor.m4 \
config/pmix_check_visibility.m4 \
config/pmix_ensure_contains_optflags.m4 \
config/pmix_functions.m4 \
config/pmix.m4 \
config/pmix_search_libs.m4 \
config/pmix_setup_cc.m4 \
config/pmix_setup_hwloc.m4 \
config/pmix_setup_libevent.m4
maintainer-clean-local:
rm -f config/pmix_get_version.sh

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

@ -0,0 +1,72 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# PMIX_C_GET_ALIGN(type, config_var)
# ----------------------------------
# Determine datatype alignment.
# First arg is type, 2nd arg is config var to define.
# Now that we require C99 compilers, we include stdbool.h
# in the alignment test so that we can find the definition
# of "bool" when we test for its alignment. We might be able
# to avoid this if we test for alignment of _Bool, but
# since we use "bool" in the code, let's be safe and check
# what we use. Yes, they should be the same - but "should" and
# "are" frequently differ
AC_DEFUN([PMIX_C_GET_ALIGNMENT],[
AC_CACHE_CHECK([alignment of $1],
[AS_TR_SH([pmix_cv_c_align_$1])],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
#include <stdbool.h> ],
[[
struct foo { char c; $1 x; };
struct foo *p = (struct foo *) malloc(sizeof(struct foo));
int diff;
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
diff = ((char *)&p->x) - ((char *)&p->c);
fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
]])], [AS_TR_SH([pmix_cv_c_align_$1])=`cat conftestval`],
[AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])],
[ # cross compile - do a non-executable test. Trick
# taken from the Autoconf 2.59c. Switch to using
# AC_CHECK_ALIGNOF when we can require Autoconf 2.60.
_AC_COMPUTE_INT([(long int) offsetof (pmix__type_alignof_, y)],
[AS_TR_SH([pmix_cv_c_align_$1])],
[AC_INCLUDES_DEFAULT
#include <stdbool.h>
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; $1 y; } pmix__type_alignof_;
],
[AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])])])])
AC_DEFINE_UNQUOTED([$2], [$AS_TR_SH([pmix_cv_c_align_$1])], [Alignment of type $1])
eval "$2=$AS_TR_SH([pmix_cv_c_align_$1])"
rm -rf conftest* ]) dnl

56
opal/mca/pmix/pmix120/pmix/config/distscript.sh Исполняемый файл
Просмотреть файл

@ -0,0 +1,56 @@
#!/bin/sh
#
# 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) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2015 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
srcdir=$1
builddir=$PWD
distdir=$builddir/$2
PMIX_REPO_REV=$3
if test x"$2" = x ; then
echo "*** ERROR: Must supply relative distdir as argv[2] -- aborting"
exit 1
elif test ! -d "$distdir" ; then
echo "*** ERROR: dist dir does not exist"
echo "*** ERROR: $distdir"
exit 1
fi
# We can catch some hard (but possible) to do mistakes by looking at
# our repo's revision, but only if we are in the source tree.
# Otherwise, use what configure told us, at the cost of allowing one
# or two corner cases in (but otherwise VPATH builds won't work).
repo_rev=$PMIX_REPO_REV
if test -d .git ; then
repo_rev=$(config/pmix_get_version.sh VERSION --repo-rev)
fi
#
# Update VERSION:repo_rev with the best value we have.
#
perl -pi -e 's/^repo_rev=.*/repo_rev='$repo_rev'/' -- "${distdir}/VERSION"
# need to reset the timestamp to not annoy AM dependencies
touch -r "${srcdir}/VERSION" "${distdir}/VERSION"
echo "*** Updated VERSION file with repo rev: $repo_rev"
echo "*** (via dist-hook / config/distscript.sh)"

767
opal/mca/pmix/pmix120/pmix/config/pmix.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,767 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009 IBM Corporation. All rights reserved.
dnl Copyright (c) 2009 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved.
dnl Copyright (c) 2013-2015 Intel, Inc. All rights reserved
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([PMIX_SETUP_CORE],[
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([AC_CANONICAL_TARGET])
AC_REQUIRE([AC_PROG_CC])
# If no prefix was defined, set a good value
m4_ifval([$1],
[m4_define([pmix_config_prefix],[$1/])],
[m4_define([pmix_config_prefix], [])])
# Get pmix's absolute top builddir (which may not be the same as
# the real $top_builddir)
PMIX_startdir=`pwd`
if test x"pmix_config_prefix" != "x" && test ! -d "pmix_config_prefix"; then
mkdir -p "pmix_config_prefix"
fi
if test x"pmix_config_prefix" != "x"; then
cd "pmix_config_prefix"
fi
PMIX_top_builddir=`pwd`
AC_SUBST(PMIX_top_builddir)
# Get pmix's absolute top srcdir (which may not be the same as the
# real $top_srcdir. First, go back to the startdir incase the
# $srcdir is relative.
cd "$PMIX_startdir"
cd "$srcdir"/pmix_config_prefix
PMIX_top_srcdir="`pwd`"
AC_SUBST(PMIX_top_srcdir)
# Go back to where we started
cd "$PMIX_startdir"
AC_MSG_NOTICE([pmix builddir: $PMIX_top_builddir])
AC_MSG_NOTICE([pmix srcdir: $PMIX_top_srcdir])
if test "$PMIX_top_builddir" != "$PMIX_top_srcdir"; then
AC_MSG_NOTICE([Detected VPATH build])
fi
# Get the version of pmix that we are installing
AC_MSG_CHECKING([for pmix version])
PMIX_VERSION="`$PMIX_top_srcdir/config/pmix_get_version.sh $PMIX_top_srcdir/VERSION`"
if test "$?" != "0"; then
AC_MSG_ERROR([Cannot continue])
fi
PMIX_RELEASE_DATE="`$PMIX_top_srcdir/config/pmix_get_version.sh $PMIX_top_srcdir/VERSION --release-date`"
AC_SUBST(PMIX_VERSION)
AC_DEFINE_UNQUOTED([PMIX_VERSION], ["$PMIX_VERSION"],
[The library version is always available, contrary to VERSION])
AC_SUBST(PMIX_RELEASE_DATE)
AC_MSG_RESULT([$PMIX_VERSION])
# Debug mode?
AC_MSG_CHECKING([if want pmix maintainer support])
pmix_debug=
AS_IF([test "$pmix_debug" = "" && test "$enable_debug" = "yes"],
[pmix_debug=1
pmix_debug_msg="enabled"])
AS_IF([test "$pmix_debug" = ""],
[pmix_debug=0
pmix_debug_msg="disabled"])
# Grr; we use #ifndef for PMIX_DEBUG! :-(
AH_TEMPLATE(PMIX_ENABLE_DEBUG, [Whether we are in debugging mode or not])
AS_IF([test "$pmix_debug" = "1"], [AC_DEFINE([PMIX_ENABLE_DEBUG])])
AC_MSG_RESULT([$pmix_debug_msg])
AC_MSG_CHECKING([for pmix directory prefix])
AC_MSG_RESULT(m4_ifval([$1], pmix_config_prefix, [(none)]))
# Note that private/config.h *MUST* be listed first so that it
# becomes the "main" config header file. Any AC-CONFIG-HEADERS
# after that (pmix/config.h) will only have selective #defines
# replaced, not the entire file.
AC_CONFIG_HEADERS(pmix_config_prefix[include/private/autogen/config.h])
AC_CONFIG_HEADERS(pmix_config_prefix[include/pmix/autogen/config.h])
# What prefix are we using?
AC_MSG_CHECKING([for pmix symbol prefix])
AS_IF([test "$pmix_symbol_prefix_value" = ""],
[AS_IF([test "$with_pmix_symbol_prefix" = ""],
[pmix_symbol_prefix_value=pmix_],
[pmix_symbol_prefix_value=$with_pmix_symbol_prefix])])
AC_DEFINE_UNQUOTED(PMIX_SYM_PREFIX, [$pmix_symbol_prefix_value],
[The pmix symbol prefix])
# Ensure to [] escape the whole next line so that we can get the
# proper tr tokens
[pmix_symbol_prefix_value_caps="`echo $pmix_symbol_prefix_value | tr '[:lower:]' '[:upper:]'`"]
AC_DEFINE_UNQUOTED(PMIX_SYM_PREFIX_CAPS, [$pmix_symbol_prefix_value_caps],
[The pmix symbol prefix in all caps])
AC_MSG_RESULT([$pmix_symbol_prefix_value])
# Give an easy #define to know if we need to transform all the
# pmix names
AH_TEMPLATE([PMIX_SYM_TRANSFORM], [Whether we need to re-define all the pmix public symbols or not])
AS_IF([test "$pmix_symbol_prefix_value" = "pmix_"],
[AC_DEFINE([PMIX_SYM_TRANSFORM], [0])],
[AC_DEFINE([PMIX_SYM_TRANSFORM], [1])])
# GCC specifics.
if test "x$GCC" = "xyes"; then
PMIX_GCC_CFLAGS="-Wall -Wmissing-prototypes -Wundef"
PMIX_GCC_CFLAGS="$PMIX_GCC_CFLAGS -Wpointer-arith -Wcast-align"
fi
############################################################################
# Check for compilers and preprocessors
############################################################################
pmix_show_title "Compiler and preprocessor tests"
#
# Check for some types
#
AC_CHECK_TYPES(int8_t)
AC_CHECK_TYPES(uint8_t)
AC_CHECK_TYPES(int16_t)
AC_CHECK_TYPES(uint16_t)
AC_CHECK_TYPES(int32_t)
AC_CHECK_TYPES(uint32_t)
AC_CHECK_TYPES(int64_t)
AC_CHECK_TYPES(uint64_t)
AC_CHECK_TYPES(long long)
AC_CHECK_TYPES(intptr_t)
AC_CHECK_TYPES(uintptr_t)
AC_CHECK_TYPES(ptrdiff_t)
#
# Check for type sizes
#
AC_CHECK_SIZEOF(_Bool)
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
if test "$ac_cv_type_long_long" = yes; then
AC_CHECK_SIZEOF(long long)
fi
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(size_t)
if test "$ac_cv_type_ssize_t" = yes ; then
AC_CHECK_SIZEOF(ssize_t)
fi
if test "$ac_cv_type_ptrdiff_t" = yes; then
AC_CHECK_SIZEOF(ptrdiff_t)
fi
AC_CHECK_SIZEOF(wchar_t)
AC_CHECK_SIZEOF(pid_t)
#
# Check for type alignments
#
PMIX_C_GET_ALIGNMENT(bool, PMIX_ALIGNMENT_BOOL)
PMIX_C_GET_ALIGNMENT(int8_t, PMIX_ALIGNMENT_INT8)
PMIX_C_GET_ALIGNMENT(int16_t, PMIX_ALIGNMENT_INT16)
PMIX_C_GET_ALIGNMENT(int32_t, PMIX_ALIGNMENT_INT32)
PMIX_C_GET_ALIGNMENT(int64_t, PMIX_ALIGNMENT_INT64)
PMIX_C_GET_ALIGNMENT(char, PMIX_ALIGNMENT_CHAR)
PMIX_C_GET_ALIGNMENT(short, PMIX_ALIGNMENT_SHORT)
PMIX_C_GET_ALIGNMENT(wchar_t, PMIX_ALIGNMENT_WCHAR)
PMIX_C_GET_ALIGNMENT(int, PMIX_ALIGNMENT_INT)
PMIX_C_GET_ALIGNMENT(long, PMIX_ALIGNMENT_LONG)
if test "$ac_cv_type_long_long" = yes; then
PMIX_C_GET_ALIGNMENT(long long, PMIX_ALIGNMENT_LONG_LONG)
fi
PMIX_C_GET_ALIGNMENT(float, PMIX_ALIGNMENT_FLOAT)
PMIX_C_GET_ALIGNMENT(double, PMIX_ALIGNMENT_DOUBLE)
if test "$ac_cv_type_long_double" = yes; then
PMIX_C_GET_ALIGNMENT(long double, PMIX_ALIGNMENT_LONG_DOUBLE)
fi
PMIX_C_GET_ALIGNMENT(void *, PMIX_ALIGNMENT_VOID_P)
PMIX_C_GET_ALIGNMENT(size_t, PMIX_ALIGNMENT_SIZE_T)
#
# Does the C compiler native support "bool"? (i.e., without
# <stdbool.h> or any other help)
#
PMIX_VAR_SCOPE_PUSH([MSG])
AC_MSG_CHECKING(for C bool type)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
AC_INCLUDES_DEFAULT],
[[bool bar, foo = true; bar = foo;]])],
[PMIX_NEED_C_BOOL=0 MSG=yes],[PMIX_NEED_C_BOOL=1 MSG=no])
AC_DEFINE_UNQUOTED(PMIX_NEED_C_BOOL, $PMIX_NEED_C_BOOL,
[Whether the C compiler supports "bool" without any other help (such as <stdbool.h>)])
AC_MSG_RESULT([$MSG])
AC_CHECK_SIZEOF(_Bool)
PMIX_VAR_SCOPE_POP
#
# Check for other compiler characteristics
#
PMIX_VAR_SCOPE_PUSH([PMIX_CFLAGS_save])
if test "$GCC" = "yes"; then
# gcc 2.96 will emit oodles of warnings if you use "inline" with
# -pedantic (which we do in developer builds). However,
# "__inline__" is ok. So we have to force gcc to select the
# right one. If you use -pedantic, the AC_C_INLINE test will fail
# (because it names a function foo() -- without the (void)). So
# we turn off all the picky flags, turn on -ansi mode (which is
# implied by -pedantic), and set warnings to be errors. Hence,
# this does the following (for 2.96):
#
# - causes the check for "inline" to emit a warning, which then
# fails
# - checks for __inline__, which then emits no error, and works
#
# This also works nicely for gcc 3.x because "inline" will work on
# the first check, and all is fine. :-)
PMIX_CFLAGS_save=$CFLAGS
CFLAGS="$PMIX_CFLAGS_BEFORE_PICKY -Werror -ansi"
fi
AC_C_INLINE
if test "$GCC" = "yes"; then
CFLAGS=$PMIX_CFLAGS_save
fi
PMIX_VAR_SCOPE_POP
if test "x$CC" = "xicc"; then
PMIX_CHECK_ICC_VARARGS
fi
##################################
# Only after setting up
# C do we check compiler attributes.
##################################
pmix_show_subtitle "Compiler characteristics"
PMIX_CHECK_ATTRIBUTES
PMIX_CHECK_COMPILER_VERSION_ID
##################################
# Header files
##################################
pmix_show_title "Header file tests"
AC_CHECK_HEADERS([arpa/inet.h \
fcntl.h inttypes.h libgen.h \
netinet/in.h \
stdint.h stddef.h \
stdlib.h string.h strings.h \
sys/param.h \
sys/select.h sys/socket.h \
stdarg.h sys/stat.h sys/time.h \
sys/types.h sys/un.h sys/uio.h net/uio.h \
sys/wait.h syslog.h \
time.h unistd.h \
crt_externs.h signal.h \
ioLib.h sockLib.h hostLib.h limits.h])
# Note that sometimes we have <stdbool.h>, but it doesn't work (e.g.,
# have both Portland and GNU installed; using pgcc will find GNU's
# <stdbool.h>, which all it does -- by standard -- is define "bool" to
# "_Bool" [see
# http://www.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html],
# and Portland has no idea what to do with _Bool).
# So first figure out if we have <stdbool.h> (i.e., check the value of
# the macro HAVE_STDBOOL_H from the result of AC_CHECK_HEADERS,
# above). If we do have it, then check to see if it actually works.
# Define PMIX_USE_STDBOOL_H as approrpaite.
AC_CHECK_HEADERS([stdbool.h], [have_stdbool_h=1], [have_stdbool_h=0])
AC_MSG_CHECKING([if <stdbool.h> works])
if test "$have_stdbool_h" = "1"; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT[
#if HAVE_STDBOOL_H
#include <stdbool.h>
#endif
]],
[[bool bar, foo = true; bar = foo;]])],
[PMIX_USE_STDBOOL_H=1 MSG=yes],[PMIX_USE_STDBOOL_H=0 MSG=no])
else
PMIX_USE_STDBOOL_H=0
MSG="no (don't have <stdbool.h>)"
fi
AC_DEFINE_UNQUOTED(PMIX_USE_STDBOOL_H, $PMIX_USE_STDBOOL_H,
[Whether to use <stdbool.h> or not])
AC_MSG_RESULT([$MSG])
# checkpoint results
AC_CACHE_SAVE
##################################
# Types
##################################
pmix_show_title "Type tests"
AC_CHECK_TYPES([socklen_t, struct sockaddr_in, struct sockaddr_un,
struct sockaddr_in6, struct sockaddr_storage],
[], [], [AC_INCLUDES_DEFAULT
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
])
AC_CHECK_DECLS([AF_UNSPEC, PF_UNSPEC, AF_INET6, PF_INET6],
[], [], [AC_INCLUDES_DEFAULT
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
])
# SA_RESTART in signal.h
PMIX_VAR_SCOPE_PUSH([MSG2])
AC_MSG_CHECKING([if SA_RESTART defined in signal.h])
AC_EGREP_CPP(yes, [
#include <signal.h>
#ifdef SA_RESTART
yes
#endif
], [MSG2=yes VALUE=1], [MSG2=no VALUE=0])
AC_DEFINE_UNQUOTED(PMIX_HAVE_SA_RESTART, $VALUE,
[Whether we have SA_RESTART in <signal.h> or not])
AC_MSG_RESULT([$MSG2])
PMIX_VAR_SCOPE_POP
AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [], [
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
])
AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [
#include <sys/types.h>
#include <dirent.h>])
AC_CHECK_MEMBERS([siginfo_t.si_fd],,,[#include <signal.h>])
AC_CHECK_MEMBERS([siginfo_t.si_band],,,[#include <signal.h>])
#
# Checks for struct member names in struct statfs
#
AC_CHECK_MEMBERS([struct statfs.f_type], [], [], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
])
AC_CHECK_MEMBERS([struct statfs.f_fstypename], [], [], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
])
#
# Checks for struct member names in struct statvfs
#
AC_CHECK_MEMBERS([struct statvfs.f_basetype], [], [], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif
])
AC_CHECK_MEMBERS([struct statvfs.f_fstypename], [], [], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif
])
#
# Check for ptrdiff type. Yes, there are platforms where
# sizeof(void*) != sizeof(long) (64 bit Windows, apparently).
#
AC_MSG_CHECKING([for pointer diff type])
if test $ac_cv_type_ptrdiff_t = yes ; then
pmix_ptrdiff_t="ptrdiff_t"
pmix_ptrdiff_size=$ac_cv_sizeof_ptrdiff_t
elif test $ac_cv_sizeof_void_p -eq $ac_cv_sizeof_long ; then
pmix_ptrdiff_t="long"
pmix_ptrdiff_size=$ac_cv_sizeof_long
elif test $ac_cv_type_long_long = yes && test $ac_cv_sizeof_void_p -eq $ac_cv_sizeof_long_long ; then
pmix_ptrdiff_t="long long"
pmix_ptrdiff_size=$ac_cv_sizeof_long_long
#else
# AC_MSG_ERROR([Could not find datatype to emulate ptrdiff_t. Cannot continue])
fi
AC_DEFINE_UNQUOTED([PMIX_PTRDIFF_TYPE], [$pmix_ptrdiff_t],
[type to use for ptrdiff_t])
AC_MSG_RESULT([$pmix_ptrdiff_t (size: $pmix_ptrdiff_size)])
##################################
# Libraries
##################################
pmix_show_title "Library and Function tests"
PMIX_SEARCH_LIBS_CORE([socket], [socket])
# IRIX and CentOS have dirname in -lgen, usually in libc
PMIX_SEARCH_LIBS_CORE([dirname], [gen])
# Darwin doesn't need -lm, as it's a symlink to libSystem.dylib
PMIX_SEARCH_LIBS_CORE([ceil], [m])
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strsignal socketpair strncpy_s usleep])
# On some hosts, htonl is a define, so the AC_CHECK_FUNC will get
# confused. On others, it's in the standard library, but stubbed with
# the magic glibc foo as not implemented. and on other systems, it's
# just not there. This covers all cases.
AC_CACHE_CHECK([for htonl define],
[ompi_cv_htonl_define],
[AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif],[
#ifndef ntohl
#error "ntohl not defined"
#endif
])], [ompi_cv_htonl_define=yes], [ompi_cv_htonl_define=no])])
AC_CHECK_FUNC([htonl], [ompi_have_htonl=yes], [ompi_have_htonl=no])
AS_IF([test "$ompi_cv_htonl_define" = "yes" || test "$ompi_have_htonl" = "yes"],
[AC_DEFINE_UNQUOTED([HAVE_UNIX_BYTESWAP], [1],
[whether unix byteswap routines -- htonl, htons, nothl, ntohs -- are available])])
#
# Make sure we can copy va_lists (need check declared, not linkable)
#
AC_CHECK_DECL(va_copy, PMIX_HAVE_VA_COPY=1, PMIX_HAVE_VA_COPY=0,
[#include <stdarg.h>])
AC_DEFINE_UNQUOTED(PMIX_HAVE_VA_COPY, $PMIX_HAVE_VA_COPY,
[Whether we have va_copy or not])
AC_CHECK_DECL(__va_copy, PMIX_HAVE_UNDERSCORE_VA_COPY=1,
PMIX_HAVE_UNDERSCORE_VA_COPY=0, [#include <stdarg.h>])
AC_DEFINE_UNQUOTED(PMIX_HAVE_UNDERSCORE_VA_COPY, $PMIX_HAVE_UNDERSCORE_VA_COPY,
[Whether we have __va_copy or not])
AC_CHECK_DECLS(__func__)
# checkpoint results
AC_CACHE_SAVE
##################################
# System-specific tests
##################################
pmix_show_title "System-specific tests"
AC_C_BIGENDIAN
PMIX_CHECK_BROKEN_QSORT
##################################
# Visibility
##################################
# Check the visibility declspec at the end to avoid problem with
# the previous tests that are not necessarily prepared for
# the visibility feature.
pmix_show_title "Symbol visibility feature"
PMIX_CHECK_VISIBILITY
##################################
# Libevent
##################################
pmix_show_title "Libevent"
PMIX_LIBEVENT_CONFIG
##################################
# HWLOC
##################################
pmix_show_title "HWLOC"
PMIX_HWLOC_CONFIG
##################################
# SASL
##################################
pmix_show_title "SASL"
PMIX_SASL_CONFIG
##################################
# Munge
##################################
pmix_show_title "Munge"
PMIX_MUNGE_CONFIG
############################################################################
# final compiler config
############################################################################
pmix_show_subtitle "Set path-related compiler flags"
#
# This is needed for VPATH builds, so that it will -I the appropriate
# include directory. We delayed doing it until now just so that
# '-I$(top_srcdir)' doesn't show up in any of the configure output --
# purely aesthetic.
#
# Because pmix_config.h is created by AC_CONFIG_HEADERS, we
# don't need to -I the builddir for pmix/include. However, if we
# are VPATH building, we do need to include the source directories.
#
if test "$PMIX_top_builddir" != "$PMIX_top_srcdir"; then
# Note the embedded m4 directives here -- we must embed them
# rather than have successive assignments to these shell
# variables, lest the $(foo) names try to get evaluated here.
# Yuck!
CPPFLAGS='-I$(PMIX_top_srcdir) -I$(PMIX_top_builddir) -I$(PMIX_top_srcdir)/src -I$(PMIX_top_srcdir)/include -I$(PMIX_top_builddir)/include'" $CPPFLAGS"
else
CPPFLAGS='-I$(PMIX_top_srcdir) -I$(PMIX_top_srcdir)/src -I$(PMIX_top_srcdir)/include'" $CPPFLAGS"
fi
# pmixdatadir, pmixlibdir, and pmixinclude are essentially the same as
# pkg*dir, but will always be */pmix.
pmixdatadir='${datadir}/pmix'
pmixlibdir='${libdir}/pmix'
pmixincludedir='${includedir}/pmix'
AC_SUBST(pmixdatadir)
AC_SUBST(pmixlibdir)
AC_SUBST(pmixincludedir)
############################################################################
# final output
############################################################################
pmix_show_subtitle "Final output"
AC_CONFIG_FILES(pmix_config_prefix[Makefile])
# Success
$2
])dnl
AC_DEFUN([PMIX_DEFINE_ARGS],[
# Embedded mode, or standalone?
AC_ARG_ENABLE([embedded-mode],
[AC_HELP_STRING([--enable-embedded-mode],
[Using --enable-embedded-mode causes PMIx to skip a few configure checks and install nothing. It should only be used when building PMIx within the scope of a larger package.])])
AS_IF([test ! -z "$enable_embedded_mode" && test "$enable_embedded_mode" = "yes"],
[pmix_mode=embedded],
[pmix_mode=standalone])
# Change the symbol prefix?
AC_ARG_WITH([pmix-symbol-prefix],
AC_HELP_STRING([--with-pmix-symbol-prefix=STRING],
[STRING can be any valid C symbol name. It will be prefixed to all public PMIx symbols. Default: "pmix_"]))
#
# Is this a developer copy?
#
if test -d .git; then
PMIX_DEVEL=1
else
PMIX_DEVEL=0
fi
#
# Developer picky compiler options
#
AC_MSG_CHECKING([if want developer-level compiler pickyness])
AC_ARG_ENABLE(picky,
AC_HELP_STRING([--enable-picky],
[enable developer-level compiler pickyness when building PMIx (default: disabled)]))
if test "$enable_picky" = "yes"; then
AC_MSG_RESULT([yes])
WANT_PICKY_COMPILER=1
else
AC_MSG_RESULT([no])
WANT_PICKY_COMPILER=0
fi
#################### Early development override ####################
if test "$WANT_PICKY_COMPILER" = "0" && test -z "$enable_picky" && test "$PMIX_DEVEL" = "1"; then
WANT_PICKY_COMPILER=1
echo "--> developer override: enable picky compiler by default"
fi
#################### Early development override ####################
#
# Developer debugging
#
AC_MSG_CHECKING([if want developer-level debugging code])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[enable developer-level debugging code (not for general PMIx users!) (default: disabled)]))
if test "$enable_debug" = "yes"; then
AC_MSG_RESULT([yes])
WANT_DEBUG=1
else
AC_MSG_RESULT([no])
WANT_DEBUG=0
fi
#################### Early development override ####################
if test "$WANT_DEBUG" = "0" && test -z "$enable_debug" && test "$PMIX_DEVEL" = "1"; then
WANT_DEBUG=1
echo "--> developer override: enable debugging code by default"
fi
#################### Early development override ####################
if test "$WANT_DEBUG" = "0"; then
CFLAGS="-DNDEBUG $CFLAGS"
CXXFLAGS="-DNDEBUG $CXXFLAGS"
fi
AC_DEFINE_UNQUOTED(PMIX_ENABLE_DEBUG, $WANT_DEBUG,
[Whether we want developer-level debugging code or not])
AC_ARG_ENABLE(debug-symbols,
AC_HELP_STRING([--disable-debug-symbols],
[Disable adding compiler flags to enable debugging symbols if --enable-debug is specified. For non-debugging builds, this flag has no effect.]))
#
# Do we want the pretty-print stack trace feature?
#
AC_MSG_CHECKING([if want pretty-print stacktrace])
AC_ARG_ENABLE([pretty-print-stacktrace],
[AC_HELP_STRING([--enable-pretty-print-stacktrace],
[Pretty print stacktrace on process signal (default: enabled)])])
if test "$enable_pretty_print_stacktrace" = "no" ; then
AC_MSG_RESULT([no])
WANT_PRETTY_PRINT_STACKTRACE=0
else
AC_MSG_RESULT([yes])
WANT_PRETTY_PRINT_STACKTRACE=1
fi
AC_DEFINE_UNQUOTED([PMIX_WANT_PRETTY_PRINT_STACKTRACE],
[$WANT_PRETTY_PRINT_STACKTRACE],
[if want pretty-print stack trace feature])
#
# Ident string
#
AC_MSG_CHECKING([if want ident string])
AC_ARG_WITH([ident-string],
[AC_HELP_STRING([--with-ident-string=STRING],
[Embed an ident string into PMIx object files])])
if test "$with_ident_string" = "" || test "$with_ident_string" = "no"; then
with_ident_string="%VERSION%"
fi
# This is complicated, because $PMIX_VERSION may have spaces in it.
# So put the whole sed expr in single quotes -- i.e., directly
# substitute %VERSION% for (not expanded) $PMIX_VERSION.
with_ident_string="`echo $with_ident_string | sed -e 's/%VERSION%/$PMIX_VERSION/'`"
# Now eval an echo of that so that the "$PMIX_VERSION" token is
# replaced with its value. Enclose the whole thing in "" so that it
# ends up as 1 token.
with_ident_string="`eval echo $with_ident_string`"
AC_DEFINE_UNQUOTED([PMIX_IDENT_STRING], ["$with_ident_string"],
[ident string for PMIX])
AC_MSG_RESULT([$with_ident_string])
#
# Timing support
#
AC_MSG_CHECKING([if want developer-level timing support])
AC_ARG_ENABLE(timing,
AC_HELP_STRING([--enable-timing],
[enable developer-level timing code (default: disabled)]))
if test "$enable_timing" = "yes"; then
AC_MSG_RESULT([yes])
WANT_TIMING=1
else
AC_MSG_RESULT([no])
WANT_TIMING=0
fi
AC_DEFINE_UNQUOTED([PMIX_ENABLE_TIMING], [$WANT_TIMING],
[Whether we want developer-level timing support or not])
])dnl
# Specify the symbol prefix
AC_DEFUN([PMIX_SET_SYMBOL_PREFIX],[
pmix_symbol_prefix_value=$1
])dnl
# This must be a standalone routine so that it can be called both by
# PMIX_INIT and an external caller (if PMIX_INIT is not invoked).
AC_DEFUN([PMIX_DO_AM_CONDITIONALS],[
AS_IF([test "$pmix_did_am_conditionals" != "yes"],[
AM_CONDITIONAL([PMIX_EMBEDDED_MODE], [test "x$pmix_mode" = "xembedded"])
AM_CONDITIONAL([PMIX_COMPILE_TIMING], [test "$WANT_TIMING" = "1"])
AM_CONDITIONAL([PMIX_WANT_MUNGE], [test "$pmix_munge_support" = "1"])
AM_CONDITIONAL([PMIX_WANT_SASL], [test "$pmix_sasl_support" = "1"])
])
pmix_did_am_conditionals=yes
])dnl

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

@ -0,0 +1,539 @@
# -*- shell-script -*-
# PMIx copyrights:
# Copyright (c) 2013 Intel, Inc. All rights reserved
#
#########################
#
# Copyright (c) 2004-2007 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-2010 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) 2009 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
# Copyright (c) 2015 Intel, Inc. All rights reserved.
#########################
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
#
# Search the generated warnings for
# keywords regarding skipping or ignoring certain attributes
# Intel: ignore
# Sun C++: skip
#
AC_DEFUN([_PMIX_ATTRIBUTE_FAIL_SEARCH],[
AC_REQUIRE([AC_PROG_GREP])
if test -s conftest.err ; then
# icc uses 'invalid attribute' and 'attribute "__XXX__" ignored'
# Sun 12.1 emits 'warning: attribute parameter "__printf__" is undefined'
for i in invalid ignore skip undefined ; do
$GREP -iq $i conftest.err
if test "$?" = "0" ; then
pmix_cv___attribute__[$1]=0
break;
fi
done
fi
])
#
# Check for one specific attribute by compiling with C
#
# The last argument is for specific CFLAGS, that need to be set
# for the compiler to generate a warning on the cross-check.
# This may need adaption for future compilers / CFLAG-settings.
#
AC_DEFUN([_PMIX_CHECK_SPECIFIC_ATTRIBUTE], [
AC_MSG_CHECKING([for __attribute__([$1])])
AC_CACHE_VAL(pmix_cv___attribute__[$1], [
#
# Try to compile using the C compiler
#
AC_TRY_COMPILE([$2],[],
[
#
# In case we did succeed: Fine, but was this due to the
# attribute being ignored/skipped? Grep for IgNoRe/skip in conftest.err
# and if found, reset the pmix_cv__attribute__var=0
#
pmix_cv___attribute__[$1]=1
_PMIX_ATTRIBUTE_FAIL_SEARCH([$1])
],
[pmix_cv___attribute__[$1]=0])
])
if test "$pmix_cv___attribute__[$1]" = "1" ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
])
#
# Test the availability of __attribute__ and with the help
# of _PMIX_CHECK_SPECIFIC_ATTRIBUTE for the support of
# particular attributes. Compilers, that do not support an
# attribute most often fail with a warning (when the warning
# level is set).
# The compilers output is parsed in _PMIX_ATTRIBUTE_FAIL_SEARCH
#
# To add a new attributes __NAME__ add the
# pmix_cv___attribute__NAME
# add a new check with _PMIX_CHECK_SPECIFIC_ATTRIBUTE (possibly with a cross-check)
# _PMIX_CHECK_SPECIFIC_ATTRIBUTE([name], [int foo (int arg) __attribute__ ((__name__));], [], [])
# and define the corresponding
# AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_NAME, [$pmix_cv___attribute__NAME],
# [Whether your compiler has __attribute__ NAME or not])
# and decide on a correct macro (in pmix/include/pmix_config_bottom.h):
# # define __pmix_attribute_NAME(x) __attribute__(__NAME__)
#
# Please use the "__"-notation of the attribute in order not to
# clash with predefined names or macros (e.g. const, which some compilers
# do not like..)
#
AC_DEFUN([PMIX_CHECK_ATTRIBUTES], [
AC_LANG(C)
AC_MSG_CHECKING(for __attribute__)
AC_CACHE_VAL(pmix_cv___attribute__, [
AC_TRY_COMPILE(
[#include <stdlib.h>
/* Check for the longest available __attribute__ (since gcc-2.3) */
struct foo {
char a;
int x[2] __attribute__ ((__packed__));
};
],
[],
[pmix_cv___attribute__=1],
[pmix_cv___attribute__=0],
)
if test "$pmix_cv___attribute__" = "1" ; then
AC_TRY_COMPILE(
[#include <stdlib.h>
/* Check for the longest available __attribute__ (since gcc-2.3) */
struct foo {
char a;
int x[2] __attribute__ ((__packed__));
};
],
[],
[pmix_cv___attribute__=1],
[pmix_cv___attribute__=0],
)
fi
])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE, [$pmix_cv___attribute__],
[Whether your compiler has __attribute__ or not])
#
# Now that we know the compiler support __attribute__ let's check which kind of
# attributed are supported.
#
if test "$pmix_cv___attribute__" = "0" ; then
AC_MSG_RESULT([no])
pmix_cv___attribute__aligned=0
pmix_cv___attribute__always_inline=0
pmix_cv___attribute__cold=0
pmix_cv___attribute__const=0
pmix_cv___attribute__deprecated=0
pmix_cv___attribute__deprecated_argument=0
pmix_cv___attribute__format=0
pmix_cv___attribute__format_funcptr=0
pmix_cv___attribute__hot=0
pmix_cv___attribute__malloc=0
pmix_cv___attribute__may_alias=0
pmix_cv___attribute__no_instrument_function=0
pmix_cv___attribute__nonnull=0
pmix_cv___attribute__noreturn=0
pmix_cv___attribute__noreturn_funcptr=0
pmix_cv___attribute__packed=0
pmix_cv___attribute__pure=0
pmix_cv___attribute__sentinel=0
pmix_cv___attribute__unused=0
pmix_cv___attribute__visibility=0
pmix_cv___attribute__warn_unused_result=0
pmix_cv___attribute__destructor=0
else
AC_MSG_RESULT([yes])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([aligned],
[struct foo { char text[4]; } __attribute__ ((__aligned__(8)));],
[],
[])
#
# Ignored by PGI-6.2.5; -- recognized by output-parser
#
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([always_inline],
[int foo (int arg) __attribute__ ((__always_inline__));],
[],
[])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([cold],
[
int foo(int arg1, int arg2) __attribute__ ((__cold__));
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
],
[],
[])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([const],
[
int foo(int arg1, int arg2) __attribute__ ((__const__));
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
],
[],
[])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([deprecated],
[
int foo(int arg1, int arg2) __attribute__ ((__deprecated__));
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
],
[],
[])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([deprecated_argument],
[
int foo(int arg1, int arg2) __attribute__ ((__deprecated__("compiler allows argument")));
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
],
[],
[])
ATTRIBUTE_CFLAGS=
case "$pmix_c_vendor" in
gnu)
ATTRIBUTE_CFLAGS="-Wall"
;;
intel)
# we want specifically the warning on format string conversion
ATTRIBUTE_CFLAGS="-we181"
;;
esac
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([format],
[
int this_printf (void *my_object, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
],
[
static int usage (int * argument);
extern int this_printf (int arg1, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
static int usage (int * argument) {
return this_printf (*argument, "%d", argument); /* This should produce a format warning */
}
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
int main(void);
],
[$ATTRIBUTE_CFLAGS])
ATTRIBUTE_CFLAGS=
case "$pmix_c_vendor" in
gnu)
ATTRIBUTE_CFLAGS="-Wall"
;;
intel)
# we want specifically the warning on format string conversion
ATTRIBUTE_CFLAGS="-we181"
;;
esac
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([format_funcptr],
[
int (*this_printf)(void *my_object, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
],
[
static int usage (int * argument);
extern int (*this_printf) (int arg1, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
static int usage (int * argument) {
return (*this_printf) (*argument, "%d", argument); /* This should produce a format warning */
}
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
int main(void);
],
[$ATTRIBUTE_CFLAGS])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([hot],
[
int foo(int arg1, int arg2) __attribute__ ((__hot__));
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
],
[],
[])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([malloc],
[
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
int * foo(int arg1) __attribute__ ((__malloc__));
int * foo(int arg1) { return (int*) malloc(arg1); }
],
[],
[])
#
# Attribute may_alias: No suitable cross-check available, that works for non-supporting compilers
# Ignored by intel-9.1.045 -- turn off with -wd1292
# Ignored by PGI-6.2.5; ignore not detected due to missing cross-check
#
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([may_alias],
[int * p_value __attribute__ ((__may_alias__));],
[],
[])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([no_instrument_function],
[int * foo(int arg1) __attribute__ ((__no_instrument_function__));],
[],
[])
#
# Attribute nonnull:
# Ignored by intel-compiler 9.1.045 -- recognized by cross-check
# Ignored by PGI-6.2.5 (pgCC) -- recognized by cross-check
#
ATTRIBUTE_CFLAGS=
case "$pmix_c_vendor" in
gnu)
ATTRIBUTE_CFLAGS="-Wall"
;;
intel)
# we do not want to get ignored attributes warnings, but rather real warnings
ATTRIBUTE_CFLAGS="-wd1292"
;;
esac
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([nonnull],
[
int square(int *arg) __attribute__ ((__nonnull__));
int square(int *arg) { return *arg; }
],
[
static int usage(int * argument);
int square(int * argument) __attribute__ ((__nonnull__));
int square(int * argument) { return (*argument) * (*argument); }
static int usage(int * argument) {
return square( ((void*)0) ); /* This should produce an argument must be nonnull warning */
}
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
int main(void);
],
[$ATTRIBUTE_CFLAGS])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([noreturn],
[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
void fatal(int arg1) __attribute__ ((__noreturn__));
void fatal(int arg1) { exit(arg1); }
],
[],
[])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([noreturn_funcptr],
[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
extern void (*fatal_exit)(int arg1) __attribute__ ((__noreturn__));
void fatal(int arg1) { fatal_exit (arg1); }
],
[],
[$ATTRIBUTE_CFLAGS])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([packed],
[
struct foo {
char a;
int x[2] __attribute__ ((__packed__));
};
],
[],
[])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([pure],
[
int square(int arg) __attribute__ ((__pure__));
int square(int arg) { return arg * arg; }
],
[],
[])
#
# Attribute sentinel:
# Ignored by the intel-9.1.045 -- recognized by cross-check
# intel-10.0beta works fine
# Ignored by PGI-6.2.5 (pgCC) -- recognized by output-parser and cross-check
# Ignored by pathcc-2.2.1 -- recognized by cross-check (through grep ignore)
#
ATTRIBUTE_CFLAGS=
case "$pmix_c_vendor" in
gnu)
ATTRIBUTE_CFLAGS="-Wall"
;;
intel)
# we do not want to get ignored attributes warnings
ATTRIBUTE_CFLAGS="-wd1292"
;;
esac
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([sentinel],
[
int my_execlp(const char * file, const char *arg, ...) __attribute__ ((__sentinel__));
],
[
static int usage(int * argument);
int my_execlp(const char * file, const char *arg, ...) __attribute__ ((__sentinel__));
static int usage(int * argument) {
void * last_arg_should_be_null = argument;
return my_execlp ("lala", "/home/there", last_arg_should_be_null); /* This should produce a warning */
}
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
int main(void);
],
[$ATTRIBUTE_CFLAGS])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([unused],
[
int square(int arg1 __attribute__ ((__unused__)), int arg2);
int square(int arg1, int arg2) { return arg2; }
],
[],
[])
#
# Ignored by PGI-6.2.5 (pgCC) -- recognized by the output-parser
#
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([visibility],
[
int square(int arg1) __attribute__ ((__visibility__("hidden")));
],
[],
[])
#
# Attribute warn_unused_result:
# Ignored by the intel-compiler 9.1.045 -- recognized by cross-check
# Ignored by pathcc-2.2.1 -- recognized by cross-check (through grep ignore)
#
ATTRIBUTE_CFLAGS=
case "$pmix_c_vendor" in
gnu)
ATTRIBUTE_CFLAGS="-Wall"
;;
intel)
# we do not want to get ignored attributes warnings
ATTRIBUTE_CFLAGS="-wd1292"
;;
esac
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([warn_unused_result],
[
int foo(int arg) __attribute__ ((__warn_unused_result__));
int foo(int arg) { return arg + 3; }
],
[
static int usage(int * argument);
int foo(int arg) __attribute__ ((__warn_unused_result__));
int foo(int arg) { return arg + 3; }
static int usage(int * argument) {
foo (*argument); /* Should produce an unused result warning */
return 0;
}
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
int main(void);
],
[$ATTRIBUTE_CFLAGS])
_PMIX_CHECK_SPECIFIC_ATTRIBUTE([destructor],
[
void foo(void) __attribute__ ((__destructor__));
void foo(void) { return ; }
],
[],
[])
fi
# Now that all the values are set, define them
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_ALIGNED, [$pmix_cv___attribute__aligned],
[Whether your compiler has __attribute__ aligned or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_ALWAYS_INLINE, [$pmix_cv___attribute__always_inline],
[Whether your compiler has __attribute__ always_inline or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_COLD, [$pmix_cv___attribute__cold],
[Whether your compiler has __attribute__ cold or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_CONST, [$pmix_cv___attribute__const],
[Whether your compiler has __attribute__ const or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_DEPRECATED, [$pmix_cv___attribute__deprecated],
[Whether your compiler has __attribute__ deprecated or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_DEPRECATED_ARGUMENT, [$pmix_cv___attribute__deprecated_argument],
[Whether your compiler has __attribute__ deprecated with optional argument])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_FORMAT, [$pmix_cv___attribute__format],
[Whether your compiler has __attribute__ format or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_FORMAT_FUNCPTR, [$pmix_cv___attribute__format_funcptr],
[Whether your compiler has __attribute__ format and it works on function pointers])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_HOT, [$pmix_cv___attribute__hot],
[Whether your compiler has __attribute__ hot or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_MALLOC, [$pmix_cv___attribute__malloc],
[Whether your compiler has __attribute__ malloc or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_MAY_ALIAS, [$pmix_cv___attribute__may_alias],
[Whether your compiler has __attribute__ may_alias or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_NO_INSTRUMENT_FUNCTION, [$pmix_cv___attribute__no_instrument_function],
[Whether your compiler has __attribute__ no_instrument_function or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_NONNULL, [$pmix_cv___attribute__nonnull],
[Whether your compiler has __attribute__ nonnull or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_NORETURN, [$pmix_cv___attribute__noreturn],
[Whether your compiler has __attribute__ noreturn or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_NORETURN_FUNCPTR, [$pmix_cv___attribute__noreturn_funcptr],
[Whether your compiler has __attribute__ noreturn and it works on function pointers])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_PACKED, [$pmix_cv___attribute__packed],
[Whether your compiler has __attribute__ packed or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_PURE, [$pmix_cv___attribute__pure],
[Whether your compiler has __attribute__ pure or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_SENTINEL, [$pmix_cv___attribute__sentinel],
[Whether your compiler has __attribute__ sentinel or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_UNUSED, [$pmix_cv___attribute__unused],
[Whether your compiler has __attribute__ unused or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_VISIBILITY, [$pmix_cv___attribute__visibility],
[Whether your compiler has __attribute__ visibility or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_WARN_UNUSED_RESULT, [$pmix_cv___attribute__warn_unused_result],
[Whether your compiler has __attribute__ warn unused result or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_WEAK_ALIAS, [$pmix_cv___attribute__weak_alias],
[Whether your compiler has __attribute__ weak alias or not])
AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_DESTRUCTOR, [$pmix_cv___attribute__destructor],
[Whether your compiler has __attribute__ destructor or not])
])

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

@ -0,0 +1,55 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
dnl There was some mentioning of broken qsort happened for Solaris that could
dnl cause qsort to return a bad pointer which could cause some badness.
dnl The problem should have been corrected with these patches from SunSolve.
dnl Solaris 10 should be free from this problem.
dnl
dnl 5.8_sparc #108827-27 or later
dnl 5.8_x86 #108828-28 or later
dnl 5.9_sparc #112874-20 or later
dnl 5.9_x86 #114432-07 or later
dnl
dnl For users who could not patch their systems or are convinced that their
dnl native qsort is broken, they could specify this configure flag to use
dnl the pmix_qsort instead.
# check for broken qsort
# PMIX_CHECK_BROKEN_QSORT(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
AC_DEFUN([PMIX_CHECK_BROKEN_QSORT],[
AC_ARG_WITH([broken-qsort],
[AC_HELP_STRING([--with-broken-qsort],
[Build with FreeBSD qsort instead of native qsort (default: no)])])
AC_MSG_CHECKING([for broken qsort])
if test "$with_broken_qsort" = "yes"; then
result="yes"
define_result=1
else
result="no"
define_result=0
fi
AC_MSG_RESULT([$result])
AC_DEFINE_UNQUOTED([PMIX_HAVE_BROKEN_QSORT], [$define_result],
[whether qsort is broken or not])
])

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

@ -0,0 +1,92 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2013 Intel, Inc. All rights reserved
dnl
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# PMIX_CHECK_COMPILER_VERSION_ID()
# ----------------------------------------------------
# Try to figure out the compiler's name and version to detect cases,
# where users compile PMIx with one version and compile the application
# with a different compiler.
#
AC_DEFUN([PMIX_CHECK_COMPILER_VERSION_ID],
[
PMIX_CHECK_COMPILER(FAMILYID)
PMIX_CHECK_COMPILER_STRINGIFY(FAMILYNAME)
PMIX_CHECK_COMPILER(VERSION)
PMIX_CHECK_COMPILER_STRINGIFY(VERSION_STR)
])dnl
AC_DEFUN([PMIX_CHECK_COMPILER], [
lower=m4_tolower($1)
AC_CACHE_CHECK([for compiler $lower], pmix_cv_compiler_[$1],
[
CPPFLAGS_orig=$CPPFLAGS
CPPFLAGS="-I${top_pmix_srcdir}/src/include $CPPFLAGS"
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include "pmix_portable_platform.h"
int main (int argc, char * argv[])
{
FILE * f;
f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf (f, "%d", PLATFORM_COMPILER_$1);
return 0;
}
], [
eval pmix_cv_compiler_$1=`cat conftestval`;
], [
eval pmix_cv_compiler_$1=0
], [
eval pmix_cv_compiler_$1=0
])
CPPFLAGS=$CPPFLAGS_orig
])
AC_DEFINE_UNQUOTED([PMIX_BUILD_PLATFORM_COMPILER_$1], $pmix_cv_compiler_[$1],
[The compiler $lower which PMIx was built with])
])dnl
AC_DEFUN([PMIX_CHECK_COMPILER_STRINGIFY], [
lower=m4_tolower($1)
AC_CACHE_CHECK([for compiler $lower], pmix_cv_compiler_[$1],
[
CPPFLAGS_orig=$CPPFLAGS
CPPFLAGS="-I${top_pmix_srcdir}/src/include $CPPFLAGS"
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include "pmix_portable_platform.h"
int main (int argc, char * argv[])
{
FILE * f;
f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf (f, "%s", _STRINGIFY(PLATFORM_COMPILER_$1));
return 0;
}
], [
eval pmix_cv_compiler_$1=`cat conftestval`;
], [
eval pmix_cv_compiler_$1=UNKNOWN
], [
eval pmix_cv_compiler_$1=UNKNOWN
])
CPPFLAGS=$CPPFLAGS_orig
])
AC_DEFINE_UNQUOTED([PMIX_BUILD_PLATFORM_COMPILER_$1], $pmix_cv_compiler_[$1],
[The compiler $lower which PMIX was built with])
])dnl

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

@ -0,0 +1,103 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2015 Intel, Inc. All rights reserved
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
dnl defines:
dnl PMIX_$1_USE_PRAGMA_IDENT
dnl PMIX_$1_USE_IDENT
dnl PMIX_$1_USE_CONST_CHAR_IDENT
dnl
# PMIX_CHECK_IDENT(compiler-env, compiler-flags,
# file-suffix, lang) Try to compile a source file containing
# a #pragma ident, and determine whether the ident was
# inserted into the resulting object file
# -----------------------------------------------------------
AC_DEFUN([PMIX_CHECK_IDENT], [
AC_MSG_CHECKING([for $4 ident string support])
pmix_pragma_ident_happy=0
pmix_ident_happy=0
pmix_static_const_char_happy=0
_PMIX_CHECK_IDENT(
[$1], [$2], [$3],
[[#]pragma ident], [],
[pmix_pragma_ident_happy=1
pmix_message="[#]pragma ident"],
_PMIX_CHECK_IDENT(
[$1], [$2], [$3],
[[#]ident], [],
[pmix_ident_happy=1
pmix_message="[#]ident"],
_PMIX_CHECK_IDENT(
[$1], [$2], [$3],
[[#]pragma comment(exestr, ], [)],
[pmix_pragma_comment_happy=1
pmix_message="[#]pragma comment"],
[pmix_static_const_char_happy=1
pmix_message="static const char[[]]"])))
AC_DEFINE_UNQUOTED([PMIX_$1_USE_PRAGMA_IDENT],
[$pmix_pragma_ident_happy], [Use #pragma ident strings for $4 files])
AC_DEFINE_UNQUOTED([PMIX_$1_USE_IDENT],
[$pmix_ident_happy], [Use #ident strings for $4 files])
AC_DEFINE_UNQUOTED([PMIX_$1_USE_PRAGMA_COMMENT],
[$pmix_pragma_comment_happy], [Use #pragma comment for $4 files])
AC_DEFINE_UNQUOTED([PMIX_$1_USE_CONST_CHAR_IDENT],
[$pmix_static_const_char_happy], [Use static const char[] strings for $4 files])
AC_MSG_RESULT([$pmix_message])
unset pmix_pragma_ident_happy pmix_ident_happy pmix_static_const_char_happy pmix_message
])
# _PMIX_CHECK_IDENT(compiler-env, compiler-flags,
# file-suffix, header_prefix, header_suffix, action-if-success, action-if-fail)
# Try to compile a source file containing a #-style ident,
# and determine whether the ident was inserted into the
# resulting object file
# -----------------------------------------------------------
AC_DEFUN([_PMIX_CHECK_IDENT], [
eval pmix_compiler="\$$1"
eval pmix_flags="\$$2"
pmix_ident="string_not_coincidentally_inserted_by_the_compiler"
cat > conftest.$3 <<EOF
$4 "$pmix_ident" $5
int main(int argc, char** argv);
int main(int argc, char** argv) { return 0; }
EOF
# "strings" won't always return the ident string. objdump isn't
# universal (e.g., OS X doesn't have it), and ...other
# complications. So just try to "grep" for the string in the
# resulting object file. If the ident is found in "strings" or
# the grep succeeds, rule that we have this flavor of ident.
echo "configure:__oline__: $1" >&5
pmix_output=`$pmix_compiler $pmix_flags -c conftest.$3 -o conftest.${OBJEXT} 2>&1 1>/dev/null`
pmix_status=$?
AS_IF([test $pmix_status = 0],
[test -z "$pmix_output"
pmix_status=$?])
PMIX_LOG_MSG([\$? = $pmix_status], 1)
AS_IF([test $pmix_status = 0 && test -f conftest.${OBJEXT}],
[pmix_output="`strings -a conftest.${OBJEXT} | grep $pmix_ident`"
grep $pmix_ident conftest.${OBJEXT} 2>&1 1>/dev/null
pmix_status=$?
AS_IF([test "$pmix_output" != "" || test "$pmix_status" = "0"],
[$6],
[$7])],
[PMIX_LOG_MSG([the failed program was:])
PMIX_LOG_FILE([conftest.$3])
$7])
unset pmix_compiler pmix_flags pmix_output pmix_status
rm -rf conftest.* conftest${EXEEXT}
])dnl

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

@ -0,0 +1,83 @@
# -*- shell-script -*-
#
# Copyright (c) 2015 Intel, Inc. All rights reserved
# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_munge_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([PMIX_MUNGE_CONFIG],[
PMIX_VAR_SCOPE_PUSH([pmix_munge_dir pmix_munge_libdir])
AC_ARG_WITH([munge],
[AC_HELP_STRING([--with-munge=DIR],
[Search for munge headers and libraries in DIR ])])
AC_ARG_WITH([munge-libdir],
[AC_HELP_STRING([--with-munge-libdir=DIR],
[Search for munge libraries in DIR ])])
pmix_munge_support=0
if test "$with_munge" != "no"; then
AC_MSG_CHECKING([for munge in])
if test ! -z "$with_munge" && test "$with_munge" != "yes"; then
if test -d $with_munge/include/munge; then
pmix_munge_dir=$with_munge/include/munge
else
pmix_munge_dir=$with_munge
fi
if test -d $with_munge/lib; then
pmix_munge_libdir=$with_munge/lib
elif test -d $with_munge/lib64; then
pmix_munge_libdir=$with_munge/lib64
else
AC_MSG_RESULT([Could not find $with_munge/lib or $with_munge/lib64])
AC_MSG_ERROR([Can not continue])
fi
AC_MSG_RESULT([$pmix_munge_dir and $pmix_munge_libdir])
else
AC_MSG_RESULT([(default search paths)])
pmix_munge_dir=
fi
AS_IF([test ! -z "$with_munge_libdir" && test "$with_munge_libdir" != "yes"],
[pmix_munge_libdir="$with_munge_libdir"])
PMIX_CHECK_PACKAGE([pmix_munge],
[munge.h],
[munge],
[munge_encode],
[-lmunge],
[$pmix_munge_dir],
[$pmix_munge_libdir],
[pmix_munge_support=1],
[pmix_munge_support=0])
if test $pmix_munge_support == "1"; then
CPPFLAGS="$pmix_munge_CPPFLAGS $CPPFLAGS"
LIBS="$LIBS -lmunge"
LDFLAGS="$pmix_munge_LDFLAGS $LDFLAGS"
fi
fi
if test ! -z "$with_munge" && test "$with_munge" != "no" && test "$pmix_munge_support" != "1"; then
AC_MSG_WARN([MUNGE SUPPORT REQUESTED AND NOT FOUND.])
AC_MSG_ERROR([CANNOT CONTINUE])
fi
AC_MSG_CHECKING([will munge support be built])
if test "$pmix_munge_support" != "1"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
AC_DEFINE_UNQUOTED([PMIX_HAVE_MUNGE], [$pmix_munge_support],
[Whether we have munge support or not])
PMIX_VAR_SCOPE_POP
])dnl

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

@ -0,0 +1,176 @@
# -*- 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) 2012-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# _PMIX_CHECK_PACKAGE_HEADER(prefix, header, dir-prefix,
# [action-if-found], [action-if-not-found],
# includes)
# --------------------------------------------------------------------
AC_DEFUN([_PMIX_CHECK_PACKAGE_HEADER], [
# This is stolen from autoconf to peek under the covers to get the
# cache variable for the library check. one should not copy this
# code into other places unless you want much pain and suffering
AS_VAR_PUSHDEF([pmix_Header], [ac_cv_header_$2])
# so this sucks, but there's no way to get through the progression
# of header includes without killing off the cache variable and trying
# again...
unset pmix_Header
pmix_check_package_header_happy="no"
AS_IF([test "$3" = "/usr" || test "$3" = "/usr/local"],
[ # try as is...
AC_VERBOSE([looking for header without includes])
AC_CHECK_HEADERS([$2], [pmix_check_package_header_happy="yes"], [])
AS_IF([test "$pmix_check_package_header_happy" = "no"],
[# no go on the as is - reset the cache and try again
unset pmix_Header])])
AS_IF([test "$pmix_check_package_header_happy" = "no"],
[AS_IF([test "$3" != ""],
[$1_CPPFLAGS="$$1_CPPFLAGS -I$3/include"
CPPFLAGS="$CPPFLAGS -I$3/include"])
AC_CHECK_HEADERS([$2], [pmix_check_package_header_happy="yes"], [], [$6])
AS_IF([test "$pmix_check_package_header_happy" = "yes"], [$4], [$5])],
[$4])
unset pmix_check_package_header_happy
AS_VAR_POPDEF([pmix_Header])dnl
])
# _PMIX_CHECK_PACKAGE_LIB(prefix, library, function, extra-libraries,
# dir-prefix, libdir,
# [action-if-found], [action-if-not-found]])
# --------------------------------------------------------------------
AC_DEFUN([_PMIX_CHECK_PACKAGE_LIB], [
# This is stolen from autoconf to peek under the covers to get the
# cache variable for the library check. one should not copy this
# code into other places unless you want much pain and suffering
AS_LITERAL_IF([$2],
[AS_VAR_PUSHDEF([pmix_Lib], [ac_cv_lib_$2_$3])],
[AS_VAR_PUSHDEF([pmix_Lib], [ac_cv_lib_$2''_$3])])dnl
# see comment above
unset pmix_Lib
pmix_check_package_lib_happy="no"
AS_IF([test "$6" != ""],
[ # libdir was specified - search only there
$1_LDFLAGS="$$1_LDFLAGS -L$6"
LDFLAGS="$LDFLAGS -L$6"
AC_CHECK_LIB([$2], [$3],
[pmix_check_package_lib_happy="yes"],
[pmix_check_package_lib_happy="no"], [$4])
AS_IF([test "$pmix_check_package_lib_happy" = "no"],
[LDFLAGS="$pmix_check_package_$1_save_LDFLAGS"
$1_LDFLAGS="$pmix_check_package_$1_orig_LDFLAGS"
unset pmix_Lib])],
[ # libdir was not specified - go through search path
pmix_check_package_libdir="$5"
AS_IF([test "$pmix_check_package_libdir" = "" || test "$pmix_check_package_libdir" = "/usr" || test "$pmix_check_package_libdir" = "/usr/local"],
[ # try as is...
AC_VERBOSE([looking for library without search path])
AC_CHECK_LIB([$2], [$3],
[pmix_check_package_lib_happy="yes"],
[pmix_check_package_lib_happy="no"], [$4])
AS_IF([test "$pmix_check_package_lib_happy" = "no"],
[ # no go on the as is.. see what happens later...
LDFLAGS="$pmix_check_package_$1_save_LDFLAGS"
$1_LDFLAGS="$pmix_check_package_$1_orig_LDFLAGS"
unset pmix_Lib])])
AS_IF([test "$pmix_check_package_lib_happy" = "no"],
[AS_IF([test "$pmix_check_package_libdir" != ""],
[$1_LDFLAGS="$$1_LDFLAGS -L$pmix_check_package_libdir/lib"
LDFLAGS="$LDFLAGS -L$pmix_check_package_libdir/lib"
AC_VERBOSE([looking for library in lib])
AC_CHECK_LIB([$2], [$3],
[pmix_check_package_lib_happy="yes"],
[pmix_check_package_lib_happy="no"], [$4])
AS_IF([test "$pmix_check_package_lib_happy" = "no"],
[ # no go on the as is.. see what happens later...
LDFLAGS="$pmix_check_package_$1_save_LDFLAGS"
$1_LDFLAGS="$pmix_check_package_$1_orig_LDFLAGS"
unset pmix_Lib])])])
AS_IF([test "$pmix_check_package_lib_happy" = "no"],
[AS_IF([test "$pmix_check_package_libdir" != ""],
[$1_LDFLAGS="$$1_LDFLAGS -L$pmix_check_package_libdir/lib64"
LDFLAGS="$LDFLAGS -L$pmix_check_package_libdir/lib64"
AC_VERBOSE([looking for library in lib64])
AC_CHECK_LIB([$2], [$3],
[pmix_check_package_lib_happy="yes"],
[pmix_check_package_lib_happy="no"], [$4])
AS_IF([test "$pmix_check_package_lib_happy" = "no"],
[ # no go on the as is.. see what happens later...
LDFLAGS="$pmix_check_package_$1_save_LDFLAGS"
$1_LDFLAGS="$pmix_check_package_$1_orig_LDFLAGS"
unset pmix_Lib])])])])
AS_IF([test "$pmix_check_package_lib_happy" = "yes"],
[$1_LIBS="-l$2 $4"
$7], [$8])
AS_VAR_POPDEF([pmix_Lib])dnl
])
# PMIX_CHECK_PACKAGE(prefix,
# header,
# library,
# function,
# extra-libraries,
# dir-prefix,
# libdir-prefix,
# [action-if-found], [action-if-not-found],
# includes)
# -----------------------------------------------------------
# check for package defined by header and libs, and probably
# located in dir-prefix, possibly with libs in libdir-prefix.
# Both dir-prefix and libdir-prefix can be empty. Will set
# prefix_{CPPFLAGS, LDFLAGS, LIBS} as needed
AC_DEFUN([PMIX_CHECK_PACKAGE],[
pmix_check_package_$1_save_CPPFLAGS="$CPPFLAGS"
pmix_check_package_$1_save_LDFLAGS="$LDFLAGS"
pmix_check_package_$1_save_LIBS="$LIBS"
pmix_check_package_$1_orig_CPPFLAGS="$$1_CPPFLAGS"
pmix_check_package_$1_orig_LDFLAGS="$$1_LDFLAGS"
pmix_check_package_$1_orig_LIBS="$$1_LIBS"
_PMIX_CHECK_PACKAGE_HEADER([$1], [$2], [$6],
[_PMIX_CHECK_PACKAGE_LIB([$1], [$3], [$4], [$5], [$6], [$7],
[pmix_check_package_happy="yes"],
[pmix_check_package_happy="no"])],
[pmix_check_package_happy="no"],
[$10])
AS_IF([test "$pmix_check_package_happy" = "yes"],
[$8],
[$1_CPPFLAGS="$pmix_check_package_$1_orig_CPPFLAGS"
$1_LDFLAGS="$pmix_check_package_$1_orig_LDFLAGS"
$1_LIBS="$pmix_check_package_$1_orig_LIBS"
$9])
CPPFLAGS="$pmix_check_package_$1_save_CPPFLAGS"
LDFLAGS="$pmix_check_package_$1_save_LDFLAGS"
LIBS="$pmix_check_package_$1_save_LIBS"
])

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

@ -0,0 +1,82 @@
# -*- shell-script -*-
#
# Copyright (c) 2015 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$
#
# MCA_sasl_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([PMIX_SASL_CONFIG],[
PMIX_VAR_SCOPE_PUSH([pmix_sasl_dir pmix_sasl_libdir])
AC_ARG_WITH([sasl],
[AC_HELP_STRING([--with-sasl=DIR],
[Search for sasl headers and libraries in DIR ])],
[], [with_sasl=no])
AC_ARG_WITH([sasl-libdir],
[AC_HELP_STRING([--with-sasl-libdir=DIR],
[Search for sasl libraries in DIR ])])
pmix_sasl_support=0
if test "$with_sasl" != "no"; then
AC_MSG_CHECKING([for sasl in])
if test ! -z "$with_sasl" && test "$with_sasl" != "yes"; then
pmix_sasl_dir=$with_sasl/include/sasl
if test -d $with_sasl/lib; then
pmix_sasl_libdir=$with_sasl/lib
elif test -d $with_sasl/lib64; then
pmix_sasl_libdir=$with_sasl/lib64
else
AC_MSG_RESULT([Could not find $with_sasl/lib or $with_sasl/lib64])
AC_MSG_ERROR([Can not continue])
fi
AC_MSG_RESULT([$pmix_sasl_dir and $pmix_sasl_libdir])
else
AC_MSG_RESULT([(default search paths)])
pmix_sasl_dir=
fi
AS_IF([test ! -z "$with_sasl_libdir" && test "$with_sasl_libdir" != "yes"],
[pmix_sasl_libdir="$with_sasl_libdir"])
PMIX_CHECK_PACKAGE([pmix_sasl],
[sasl/sasl.h],
[sasl2],
[sasl_server_init],
[-lsasl2],
[$pmix_sasl_dir],
[$pmix_sasl_libdir],
[pmix_sasl_support=1],
[pmix_sasl_support=0])
if test $pmix_sasl_support == "1"; then
CPPFLAGS="$pmix_sasl_CPPFLAGS $CPPFLAGS"
LIBS="$LIBS -lsasl2"
LDFLAGS="$pmix_sasl_LDFLAGS $LDFLAGS"
fi
fi
if test ! -z "$with_sasl" && test "$with_sasl" != "no" && test "$pmix_sasl_support" != "1"; then
AC_MSG_WARN([SASL SUPPORT REQUESTED AND NOT FOUND.])
AC_MSG_ERROR([CANNOT CONTINUE])
fi
AC_MSG_CHECKING([will sasl support be built])
if test "$pmix_sasl_support" != "1"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
AC_DEFINE_UNQUOTED(PMIX_HAVE_SASL, [$pmix_sasl_support],
[Whether we have sasl support or not])
PMIX_VAR_SCOPE_POP
])dnl

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

@ -0,0 +1,252 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2013 Intel, Inc. All rights reserved
dnl Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# PMIX_C_COMPILER_VENDOR(VENDOR_VARIABLE)
# ---------------------------------------
# Set shell variable VENDOR_VARIABLE to the name of the compiler
# vendor for the current C compiler.
#
# See comment for _PMIX_CHECK_COMPILER_VENDOR for a complete
# list of currently detected compilers.
AC_DEFUN([PMIX_C_COMPILER_VENDOR], [
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for the C compiler vendor],
[pmix_cv_c_compiler_vendor],
[AC_LANG_PUSH(C)
_PMIX_CHECK_COMPILER_VENDOR([pmix_cv_c_compiler_vendor])
AC_LANG_POP(C)])
$1="$pmix_cv_c_compiler_vendor"
])
# workaround to avoid syntax error with Autoconf < 2.68:
m4_ifndef([AC_LANG_DEFINES_PROVIDED],
[m4_define([AC_LANG_DEFINES_PROVIDED])])
# PMIX_IFDEF_IFELSE(symbol, [action-if-defined],
# [action-if-not-defined])
# ----------------------------------------------
# Run compiler to determine if preprocessor symbol "symbol" is
# defined by the compiler.
AC_DEFUN([PMIX_IFDEF_IFELSE], [
AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED
#ifndef $1
#error "symbol $1 not defined"
choke me
#endif], [$2], [$3])])
# PMIX_IF_IFELSE(symbol, [action-if-defined],
# [action-if-not-defined])
# ----------------------------------------------
# Run compiler to determine if preprocessor symbol "symbol" is
# defined by the compiler.
AC_DEFUN([PMIX_IF_IFELSE], [
AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED
#if !( $1 )
#error "condition $1 not met"
choke me
#endif], [$2], [$3])])
# _PMIX_CHECK_COMPILER_VENDOR(VENDOR_VARIABLE)
# --------------------------------------------
# Set shell variable VENDOR_VARIABLE to the name of the compiler
# vendor for the compiler for the current language. Language must be
# one of C, OBJC, or C++.
#
# thanks to http://predef.sourceforge.net/precomp.html for the list
# of defines to check.
AC_DEFUN([_PMIX_CHECK_COMPILER_VENDOR], [
pmix_check_compiler_vendor_result="unknown"
# GNU is probably the most common, so check that one as soon as
# possible. Intel pretends to be GNU, so need to check Intel
# before checking for GNU.
# Intel
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(__INTEL_COMPILER) || defined(__ICC)],
[pmix_check_compiler_vendor_result="intel"])])
# Fujitsu
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(__FUJITSU)],
[pmix_check_compiler_vendor_result="fujitsu"])])
# GNU
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__GNUC__],
[pmix_check_compiler_vendor_result="gnu"
# We do not support gccfss as a compiler so die if
# someone tries to use said compiler. gccfss (gcc
# for SPARC Systems) is a compiler that is no longer
# supported by Oracle and it has some major flaws
# that prevents it from actually compiling PMIX code.
# So if we detect it we automatically bail.
if ($CC --version | grep gccfss) >/dev/null 2>&1; then
AC_MSG_RESULT([gccfss])
AC_MSG_WARN([Detected gccfss being used to compile PMIx.])
AC_MSG_WARN([Because of several issues PMIx does not support])
AC_MSG_WARN([the gccfss compiler. Please use a different compiler.])
AC_MSG_WARN([If you didn't think you used gccfss you may want to])
AC_MSG_WARN([check to see if the compiler you think you used is])
AC_MSG_WARN([actually a link to gccfss.])
AC_MSG_ERROR([Cannot continue])
fi])])
# Borland Turbo C
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__TURBOC__],
[pmix_check_compiler_vendor_result="borland"])])
# Borland C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__BORLANDC__],
[pmix_check_compiler_vendor_result="borland"])])
# Comeau C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__COMO__],
[pmix_check_compiler_vendor_result="comeau"])])
# Compaq C/C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(__DECC) || defined(VAXC) || defined(__VAXC)],
[pmix_check_compiler_vendor_result="compaq"],
[PMIX_IF_IFELSE([defined(__osf__) && defined(__LANGUAGE_C__)],
[pmix_check_compiler_vendor_result="compaq"],
[PMIX_IFDEF_IFELSE([__DECCXX],
[pmix_check_compiler_vendor_result="compaq"])])])])
# Cray C/C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([_CRAYC],
[pmix_check_compiler_vendor_result="cray"])])
# Diab C/C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__DCC__],
[pmix_check_compiler_vendor_result="diab"])])
# Digital Mars
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(__DMC__) || defined(__SC__) || defined(__ZTC__)],
[pmix_check_compiler_vendor_result="digital mars"])])
# HP ANSI C / aC++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(__HP_cc) || defined(__HP_aCC)],
[pmix_check_compiler_vendor_result="hp"])])
# IBM XL C/C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)],
[pmix_check_compiler_vendor_result="ibm"],
[PMIX_IF_IFELSE([defined(_AIX) && !defined(__GNUC__)],
[pmix_check_compiler_vendor_result="ibm"])])])
# KAI C++ (rest in peace)
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__KCC],
[pmix_check_compiler_vendor_result="kai"])])
# LCC
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__LCC__],
[pmix_check_compiler_vendor_result="lcc"])])
# MetaWare High C/C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__HIGHC__],
[pmix_check_compiler_vendor_result="metaware high"])])
# Metrowerks Codewarrior
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__MWERKS__],
[pmix_check_compiler_vendor_result="metrowerks"])])
# MIPSpro (SGI)
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(sgi) || defined(__sgi)],
[pmix_check_compiler_vendor_result="sgi"])])
# MPW C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(__MRC__) || defined(MPW_C) || defined(MPW_CPLUS)],
[pmix_check_compiler_vendor_result="mpw"])])
# Norcroft C
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__CC_NORCROFT],
[pmix_check_compiler_vendor_result="norcroft"])])
# Pelles C
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__POCC__],
[pmix_check_compiler_vendor_result="pelles"])])
# Portland Group
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__PGI],
[pmix_check_compiler_vendor_result="portland group"])])
# SAS/C
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(SASC) || defined(__SASC) || defined(__SASC__)],
[pmix_check_compiler_vendor_result="sas"])])
# Sun Workshop C/C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IF_IFELSE([defined(__SUNPRO_C) || defined(__SUNPRO_CC)],
[pmix_check_compiler_vendor_result="sun"])])
# TenDRA C/C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__TenDRA__],
[pmix_check_compiler_vendor_result="tendra"])])
# Tiny C
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__TINYC__],
[pmix_check_compiler_vendor_result="tiny"])])
# USL C
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__USLC__],
[pmix_check_compiler_vendor_result="usl"])])
# Watcom C++
AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"],
[PMIX_IFDEF_IFELSE([__WATCOMC__],
[pmix_check_compiler_vendor_result="watcom"])])
$1="$pmix_check_compiler_vendor_result"
unset pmix_check_compiler_vendor_result
])

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

@ -0,0 +1,90 @@
# -*- 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-2007 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# PMIX_CHECK_VISIBILITY
# --------------------------------------------------------
AC_DEFUN([PMIX_CHECK_VISIBILITY],[
AC_REQUIRE([AC_PROG_GREP])
# Check if the compiler has support for visibility, like some
# versions of gcc, icc Sun Studio cc.
AC_ARG_ENABLE(visibility,
AC_HELP_STRING([--enable-visibility],
[enable visibility feature of certain compilers/linkers (default: enabled)]))
pmix_visibility_define=0
pmix_msg="whether to enable symbol visibility"
if test "$enable_visibility" = "no"; then
AC_MSG_CHECKING([$pmix_msg])
AC_MSG_RESULT([no (disabled)])
else
CFLAGS_orig=$CFLAGS
pmix_add=
case "$pmix_c_vendor" in
sun)
# Check using Sun Studio -xldscope=hidden flag
pmix_add=-xldscope=hidden
CFLAGS="$PMIX_CFLAGS_BEFORE_PICKY $pmix_add -errwarn=%all"
;;
*)
# Check using -fvisibility=hidden
pmix_add=-fvisibility=hidden
CFLAGS="$PMIX_CFLAGS_BEFORE_PICKY $pmix_add -Werror"
;;
esac
AC_MSG_CHECKING([if $CC supports $pmix_add])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
__attribute__((visibility("default"))) int foo;
]],[[fprintf(stderr, "Hello, world\n");]])],
[AS_IF([test -s conftest.err],
[$GREP -iq visibility conftest.err
# If we find "visibility" in the stderr, then
# assume it doesn't work
AS_IF([test "$?" = "0"], [pmix_add=])])
], [pmix_add=])
AS_IF([test "$pmix_add" = ""],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])])
CFLAGS=$CFLAGS_orig
PMIX_VISIBILITY_CFLAGS=$pmix_add
if test "$pmix_add" != "" ; then
pmix_visibility_define=1
AC_MSG_CHECKING([$pmix_msg])
AC_MSG_RESULT([yes (via $pmix_add)])
elif test "$enable_visibility" = "yes"; then
AC_MSG_ERROR([Symbol visibility support requested but compiler does not seem to support it. Aborting])
else
AC_MSG_CHECKING([$pmix_msg])
AC_MSG_RESULT([no (unsupported)])
fi
unset pmix_add
fi
AC_DEFINE_UNQUOTED([PMIX_C_HAVE_VISIBILITY], [$pmix_visibility_define],
[Whether C compiler supports symbol visibility or not])
])

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

@ -0,0 +1,67 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2013 Intel, Inc. All rights reserved
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([PMIX_ENSURE_CONTAINS_OPTFLAGS],[
# Modularize this setup so that sub-configure.in scripts can use this
# same setup code.
##################################
# Optimization flags
##################################
# If the user did not specify optimization flags, add some (the value
# from $OPTFLAGS)
co_arg="$1"
co_found=0
for co_word in $co_arg; do
# See http://www.gnu.org/software/autoconf/manual/html_node/Quadrigraphs.html#Quadrigraphs
# for an explanation of @<:@ and @:>@ -- they m4 expand to [ and ]
case $co_word in
-g) co_found=1 ;;
-g@<:@1-3@:>@) co_found=1 ;;
+K@<:@0-5@:>@) co_found=1 ;;
-O) co_found=1 ;;
-O@<:@0-9@:>@) co_found=1 ;;
-xO) co_found=1 ;;
-xO@<:@0-9@:>@) co_found=1 ;;
-fast) co_found=1 ;;
# The below Sun Studio flags require or
# trigger -xO optimization
-xvector*) co_found=1 ;;
-xdepend=yes) co_found=1 ;;
esac
done
if test "$co_found" = "0"; then
co_result="$OPTFLAGS $co_arg"
else
co_result="$co_arg"
fi
# Clean up
unset co_found co_word co_arg
])

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

@ -0,0 +1,533 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2013 Intel, Inc. All rights reserved
dnl
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
dnl Portions of this file derived from GASNet v1.12 (see "GASNet"
dnl comments, below)
dnl Copyright 2004, Dan Bonachea <bonachea@cs.berkeley.edu>
dnl
dnl IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
dnl DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
dnl OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
dnl CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dnl
dnl THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
dnl AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
dnl ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
dnl PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
dnl
AC_DEFUN([PMIX_CONFIGURE_SETUP],[
# Some helper script functions. Unfortunately, we cannot use $1 kinds
# of arugments here because of the m4 substitution. So we have to set
# special variable names before invoking the function. :-\
pmix_show_title() {
cat <<EOF
============================================================================
== ${1}
============================================================================
EOF
PMIX_LOG_MSG([=== ${1}], 1)
}
pmix_show_subtitle() {
cat <<EOF
*** ${1}
EOF
PMIX_LOG_MSG([*** ${1}], 1)
}
pmix_show_subsubtitle() {
cat <<EOF
+++ ${1}
EOF
PMIX_LOG_MSG([+++ ${1}], 1)
}
pmix_show_subsubsubtitle() {
cat <<EOF
--- ${1}
EOF
PMIX_LOG_MSG([--- ${1}], 1)
}
#
# Save some stats about this build
#
PMIX_CONFIGURE_USER="`whoami`"
PMIX_CONFIGURE_HOST="`hostname | head -n 1`"
PMIX_CONFIGURE_DATE="`date`"
#
# Save these details so that they can be used in pmix_info later
#
AC_SUBST(PMIX_CONFIGURE_USER)
AC_SUBST(PMIX_CONFIGURE_HOST)
AC_SUBST(PMIX_CONFIGURE_DATE)])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
AC_DEFUN([PMIX_BASIC_SETUP],[
#
# Save some stats about this build
#
PMIX_CONFIGURE_USER="`whoami`"
PMIX_CONFIGURE_HOST="`hostname | head -n 1`"
PMIX_CONFIGURE_DATE="`date`"
#
# Make automake clean emacs ~ files for "make clean"
#
CLEANFILES="*~ .\#*"
AC_SUBST(CLEANFILES)
#
# See if we can find an old installation of PMIX to overwrite
#
# Stupid autoconf 2.54 has a bug in AC_PREFIX_PROGRAM -- if pmix_clean
# is not found in the path and the user did not specify --prefix,
# we'll get a $prefix of "."
pmix_prefix_save="$prefix"
AC_PREFIX_PROGRAM(pmix_clean)
if test "$prefix" = "."; then
prefix="$pmix_prefix_save"
fi
unset pmix_prefix_save
#
# Basic sanity checking; we can't install to a relative path
#
case "$prefix" in
/*/bin)
prefix="`dirname $prefix`"
echo installing to directory \"$prefix\"
;;
/*)
echo installing to directory \"$prefix\"
;;
NONE)
echo installing to directory \"$ac_default_prefix\"
;;
@<:@a-zA-Z@:>@:*)
echo installing to directory \"$prefix\"
;;
*)
AC_MSG_ERROR(prefix "$prefix" must be an absolute directory path)
;;
esac
# BEGIN: Derived from GASNet
# Suggestion from Paul Hargrove to disable --program-prefix and
# friends. Heavily influenced by GASNet 1.12 acinclude.m4
# functionality to do the same thing (copyright listed at top of this
# file).
# echo program_prefix=$program_prefix program_suffix=$program_suffix program_transform_name=$program_transform_name
# undo prefix autoconf automatically adds during cross-compilation
if test "$cross_compiling" = yes && test "$program_prefix" = "${target_alias}-" ; then
program_prefix=NONE
fi
# normalize empty prefix/suffix
if test -z "$program_prefix" ; then
program_prefix=NONE
fi
if test -z "$program_suffix" ; then
program_suffix=NONE
fi
# undo transforms caused by empty prefix/suffix
if expr "$program_transform_name" : 's.^..$' >/dev/null || \
expr "$program_transform_name" : 's.$$..$' >/dev/null || \
expr "$program_transform_name" : 's.$$..;s.^..$' >/dev/null ; then
program_transform_name="s,x,x,"
fi
if test "$program_prefix$program_suffix$program_transform_name" != "NONENONEs,x,x," ; then
AC_MSG_WARN([*** The PMIx configure script does not support --program-prefix, --program-suffix or --program-transform-name. Users are recommended to instead use --prefix with a unique directory and make symbolic links as desired for renaming.])
AC_MSG_ERROR([*** Cannot continue])
fi
# END: Derived from GASNet
])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
AC_DEFUN([PMIX_LOG_MSG],[
# 1 is the message
# 2 is whether to put a prefix or not
if test -n "$2"; then
echo "configure:__oline__: $1" >&5
else
echo $1 >&5
fi])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
AC_DEFUN([PMIX_LOG_FILE],[
# 1 is the filename
if test -n "$1" && test -f "$1"; then
cat $1 >&5
fi])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
AC_DEFUN([PMIX_LOG_COMMAND],[
# 1 is the command
# 2 is actions to do if success
# 3 is actions to do if fail
echo "configure:__oline__: $1" >&5
$1 1>&5 2>&1
pmix_status=$?
PMIX_LOG_MSG([\$? = $pmix_status], 1)
if test "$pmix_status" = "0"; then
unset pmix_status
$2
else
unset pmix_status
$3
fi])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
AC_DEFUN([PMIX_UNIQ],[
# 1 is the variable name to be uniq-ized
pmix_name=$1
# Go through each item in the variable and only keep the unique ones
pmix_count=0
for val in ${$1}; do
pmix_done=0
pmix_i=1
pmix_found=0
# Loop over every token we've seen so far
pmix_done="`expr $pmix_i \> $pmix_count`"
while test "$pmix_found" = "0" && test "$pmix_done" = "0"; do
# Have we seen this token already? Prefix the comparison with
# "x" so that "-Lfoo" values won't be cause an error.
pmix_eval="expr x$val = x\$pmix_array_$pmix_i"
pmix_found=`eval $pmix_eval`
# Check the ending condition
pmix_done="`expr $pmix_i \>= $pmix_count`"
# Increment the counter
pmix_i="`expr $pmix_i + 1`"
done
# Check for special cases where we do want to allow repeated
# arguments (per
# http://www.open-mpi.org/community/lists/devel/2012/08/11362.php).
case $val in
-Xclang)
pmix_found=0
pmix_i=`expr $pmix_count + 1`
;;
esac
# If we didn't find the token, add it to the "array"
if test "$pmix_found" = "0"; then
pmix_eval="pmix_array_$pmix_i=$val"
eval $pmix_eval
pmix_count="`expr $pmix_count + 1`"
else
pmix_i="`expr $pmix_i - 1`"
fi
done
# Take all the items in the "array" and assemble them back into a
# single variable
pmix_i=1
pmix_done="`expr $pmix_i \> $pmix_count`"
pmix_newval=
while test "$pmix_done" = "0"; do
pmix_eval="pmix_newval=\"$pmix_newval \$pmix_array_$pmix_i\""
eval $pmix_eval
pmix_eval="unset pmix_array_$pmix_i"
eval $pmix_eval
pmix_done="`expr $pmix_i \>= $pmix_count`"
pmix_i="`expr $pmix_i + 1`"
done
# Done; do the assignment
pmix_newval="`echo $pmix_newval`"
pmix_eval="$pmix_name=\"$pmix_newval\""
eval $pmix_eval
# Clean up
unset pmix_name pmix_i pmix_done pmix_newval pmix_eval pmix_count])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
# PMIX_APPEND_UNIQ(variable, new_argument)
# ----------------------------------------
# Append new_argument to variable if not already in variable. This assumes a
# space seperated list.
#
# This could probably be made more efficient :(.
AC_DEFUN([PMIX_APPEND_UNIQ], [
for arg in $2; do
pmix_found=0;
for val in ${$1}; do
if test "x$val" = "x$arg" ; then
pmix_found=1
break
fi
done
if test "$pmix_found" = "0" ; then
if test -z "$$1"; then
$1="$arg"
else
$1="$$1 $arg"
fi
fi
done
unset pmix_found
])
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
# Macro that serves as an alternative to using `which <prog>`. It is
# preferable to simply using `which <prog>` because backticks (`) (aka
# backquotes) invoke a sub-shell which may source a "noisy"
# ~/.whatever file (and we do not want the error messages to be part
# of the assignment in foo=`which <prog>`). This macro ensures that we
# get a sane executable value.
AC_DEFUN([PMIX_WHICH],[
# 1 is the variable name to do "which" on
# 2 is the variable name to assign the return value to
PMIX_VAR_SCOPE_PUSH([pmix_prog pmix_file pmix_dir pmix_sentinel])
pmix_prog=$1
IFS_SAVE=$IFS
IFS="$PATH_SEPARATOR"
for pmix_dir in $PATH; do
if test -x "$pmix_dir/$pmix_prog"; then
$2="$pmix_dir/$pmix_prog"
break
fi
done
IFS=$IFS_SAVE
PMIX_VAR_SCOPE_POP
])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
# Declare some variables; use PMIX_VAR_SCOPE_END to ensure that they
# are cleaned up / undefined.
AC_DEFUN([PMIX_VAR_SCOPE_PUSH],[
# Is the private index set? If not, set it.
if test "x$pmix_scope_index" = "x"; then
pmix_scope_index=1
fi
# First, check to see if any of these variables are already set.
# This is a simple sanity check to ensure we're not already
# overwriting pre-existing variables (that have a non-empty
# value). It's not a perfect check, but at least it's something.
for pmix_var in $1; do
pmix_str="pmix_str=\"\$$pmix_var\""
eval $pmix_str
if test "x$pmix_str" != "x"; then
AC_MSG_WARN([Found configure shell variable clash!])
AC_MSG_WARN([[PMIX_VAR_SCOPE_PUSH] called on "$pmix_var",])
AC_MSG_WARN([but it is already defined with value "$pmix_str"])
AC_MSG_WARN([This usually indicates an error in configure.])
AC_MSG_ERROR([Cannot continue])
fi
done
# Ok, we passed the simple sanity check. Save all these names so
# that we can unset them at the end of the scope.
pmix_str="pmix_scope_$pmix_scope_index=\"$1\""
eval $pmix_str
unset pmix_str
env | grep pmix_scope
pmix_scope_index=`expr $pmix_scope_index + 1`
])dnl
# Unset a bunch of variables that were previously set
AC_DEFUN([PMIX_VAR_SCOPE_POP],[
# Unwind the index
pmix_scope_index=`expr $pmix_scope_index - 1`
pmix_scope_test=`expr $pmix_scope_index \> 0`
if test "$pmix_scope_test" = "0"; then
AC_MSG_WARN([[PMIX_VAR_SCOPE_POP] popped too many PMIX configure scopes.])
AC_MSG_WARN([This usually indicates an error in configure.])
AC_MSG_ERROR([Cannot continue])
fi
# Get the variable names from that index
pmix_str="pmix_str=\"\$pmix_scope_$pmix_scope_index\""
eval $pmix_str
# Iterate over all the variables and unset them all
for pmix_var in $pmix_str; do
unset $pmix_var
done
])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
#
# PMIX_WITH_OPTION_MIN_MAX_VALUE(NAME,DEFAULT_VALUE,LOWER_BOUND,UPPER_BOUND)
# Defines a variable PMIX_MAX_xxx, with "xxx" being specified as parameter $1 as "variable_name".
# If not set at configure-time using --with-max-xxx, the default-value ($2) is assumed.
# If set, value is checked against lower (value >= $3) and upper bound (value <= $4)
#
AC_DEFUN([PMIX_WITH_OPTION_MIN_MAX_VALUE], [
max_value=[$2]
AC_MSG_CHECKING([maximum length of ]m4_translit($1, [_], [ ]))
AC_ARG_WITH([max-]m4_translit($1, [_], [-]),
AC_HELP_STRING([--with-max-]m4_translit($1, [_], [-])[=VALUE],
[maximum length of ]m4_translit($1, [_], [ ])[s. VALUE argument has to be specified (default: [$2]).]))
if test ! -z "$with_max_[$1]" && test "$with_max_[$1]" != "no" ; then
# Ensure it's a number (hopefully an integer!), and >0
expr $with_max_[$1] + 1 > /dev/null 2> /dev/null
AS_IF([test "$?" != "0"], [happy=0],
[AS_IF([test $with_max_[$1] -ge $3 && test $with_max_[$1] -le $4],
[happy=1], [happy=0])])
# If badness in the above tests, bail
AS_IF([test "$happy" = "0"],
[AC_MSG_RESULT([bad value ($with_max_[$1])])
AC_MSG_WARN([--with-max-]m4_translit($1, [_], [-])[s value must be >= $3 and <= $4])
AC_MSG_ERROR([Cannot continue])])
max_value=$with_max_[$1]
fi
AC_MSG_RESULT([$max_value])
AC_DEFINE_UNQUOTED([PMIX_MAX_]m4_toupper($1), $max_value,
[Maximum length of ]m4_translit($1, [_], [ ])[s (default is $2)])
[PMIX_MAX_]m4_toupper($1)=$max_value
AC_SUBST([PMIX_MAX_]m4_toupper($1))
])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
# Usage: PMIX_COMPUTE_MAX_VALUE(number_bytes, variable_to_set, action if overflow)
# Compute maximum value of datatype of
# number_bytes, setting the result in the second argument. Assumes a
# signed datatype.
AC_DEFUN([PMIX_COMPUTE_MAX_VALUE], [
# This is more complicated than it really should be. But some
# expr implementations (OpenBSD) have an expr with a max value of
# 2^31 - 1, and we sometimes want to compute the max value of a
# type as big or bigger than that...
pmix_num_bits=`expr $1 \* 8 - 1`
newval=1
value=1
overflow=0
while test $pmix_num_bits -ne 0 ; do
newval=`expr $value \* 2`
if test 0 -eq `expr $newval \< 0` ; then
# if the new value is not negative, next iteration...
value=$newval
pmix_num_bits=`expr $pmix_num_bits - 1`
# if this was the last iteration, subtract 1 (as signed
# max positive is 2^num_bits - 1). Do this here instead
# of outside of the while loop because we might have
# already subtracted 1 by then if we're trying to find the
# max value of the same datatype expr uses as it's
# internal representation (ie, if we hit the else
# below...)
if test 0 -eq $pmix_num_bits ; then
value=`expr $value - 1`
fi
else
# if the new value is negative, we've over flowed. First,
# try adding value - 1 instead of value (see if we can get
# to positive max of expr)
newval=`expr $value - 1 + $value`
if test 0 -eq `expr $newval \< 0` ; then
value=$newval
# Still positive, this is as high as we can go. If
# pmix_num_bits is 1, we didn't actually overflow.
# Otherwise, we overflowed.
if test 1 -ne $pmix_num_bits ; then
overflow=1
fi
else
# stil negative. Time to give up.
overflow=1
fi
pmix_num_bits=0
fi
done
AS_VAR_SET([$2], [$value])
AS_IF([test $overflow -ne 0], [$3])
])dnl

161
opal/mca/pmix/pmix120/pmix/config/pmix_get_version.sh Исполняемый файл
Просмотреть файл

@ -0,0 +1,161 @@
#!/bin/sh
#
# Copyright (c) 2004-2006 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) 2008-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Intel, Inc. All rights reserved
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# PMIX_GET_VERSION(version_file, variable_prefix)
# -----------------------------------------------
# parse version_file for version information, setting
# the following shell variables:
#
# prefix_VERSION
# prefix_BASE_VERSION
# prefix_MAJOR_VERSION
# prefix_MINOR_VERSION
# prefix_RELEASE_VERSION
# prefix_GREEK_VERSION
# prefix_REPO_REV
# prefix_TARBALL_VERSION
# prefix_RELEASE_DATE
srcfile="$1"
option="$2"
if test -z "$srcfile"; then
option="--help"
else
if test -f "$srcfile"; then
srcdir=`dirname $srcfile`
pmix_vers=`sed -n "
t clear
: clear
s/^major/PMIX_MAJOR_VERSION/
s/^minor/PMIX_MINOR_VERSION/
s/^release/PMIX_RELEASE_VERSION/
s/^greek/PMIX_GREEK_VERSION/
s/^repo_rev/PMIX_REPO_REV/
s/^tarball_version/PMIX_TARBALL_VERSION/
s/^date/PMIX_RELEASE_DATE/
t print
b
: print
p" < "$srcfile"`
eval "$pmix_vers"
PMIX_VERSION="$PMIX_MAJOR_VERSION.$PMIX_MINOR_VERSION.$PMIX_RELEASE_VERSION"
PMIX_VERSION="${PMIX_VERSION}${PMIX_GREEK_VERSION}"
if test "$PMIX_TARBALL_VERSION" = ""; then
PMIX_TARBALL_VERSION=$PMIX_VERSION
fi
# If repo_rev was not set in the VERSION file, then get it now
if test "$PMIX_REPO_REV" = ""; then
# See if we can find the "git" command.
git_happy=0
git --version > /dev/null 2>&1
if test $? -eq 0; then
git_happy=1
fi
# If we're in a git repo and we found the git command, use
# git describe to get the repo rev
if test -d "$srcdir/.git" && test $git_happy -eq 1; then
if test "$srcdir" != "`pwd`"; then
git_save_dir=`pwd`
cd $srcdir
PMIX_REPO_REV=`git describe --tags --always`
cd $git_save_dir
unset git_save_dir
else
PMIX_REPO_REV=`git describe --tags --always`
fi
else
PMIX_REPO_REV="date`date '+%Y-%m-%d'`"
fi
fi
fi
if test "$option" = ""; then
option="--full"
fi
fi
case "$option" in
--full|-v|--version)
echo $PMIX_VERSION
;;
--major)
echo $PMIX_MAJOR_VERSION
;;
--minor)
echo $PMIX_MINOR_VERSION
;;
--release)
echo $PMIX_RELEASE_VERSION
;;
--greek)
echo $PMIX_GREEK_VERSION
;;
--repo-rev)
echo $PMIX_REPO_REV
;;
--tarball)
echo $PMIX_TARBALL_VERSION
;;
--release-date)
echo $PMIX_RELEASE_DATE
;;
--all)
echo ${PMIX_VERSION} : ${PMIX_MAJOR_VERSION} : ${PMIX_MINOR_VERSION} : ${PMIX_RELEASE_VERSION} : ${PMIX_GREEK_VERSION} : ${PMIX_REPO_REV} : ${PMIX_TARBALL_VERSION}
;;
-h|--help)
cat <<EOF
$0 <srcfile> <option>
<srcfile> - Text version file
<option> - One of:
--full - Full version number
--major - Major version number
--minor - Minor version number
--release - Release version number
--greek - Greek (alpha, beta, etc) version number
--repo-rev - Repository version
--tarball - Show tarball filename version string
--all - Show all version numbers, separated by :
--release-date - Show the release date
--help - This message
EOF
;;
*)
echo "Unrecognized option $option. Run $0 --help for options"
;;
esac
# All done
exit 0

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

@ -0,0 +1,81 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# PMIX_LOAD_PLATFORM()
# --------------------
AC_DEFUN([PMIX_LOAD_PLATFORM], [
AC_ARG_WITH([platform],
[AC_HELP_STRING([--with-platform=FILE],
[Load options for build from FILE. Options on the
command line not in FILE are used. Options on the
command line and in FILE are replaced by what is
in FILE.])])
if test "$with_platform" = "yes" ; then
AC_MSG_ERROR([--with-platform argument must include FILE option])
elif test "$with_platform" = "no" ; then
AC_MSG_ERROR([--without-platform is not a valid argument])
elif test "$with_platform" != "" ; then
# if not an absolute path, check in contrib/platform
if test ! "`echo $with_platform | cut -c1`" = "/" && test ! "`echo $with_platform | cut -c2`" = ".." ; then
if test -r "${srcdir}/contrib/platform/$with_platform" ; then
with_platform="${srcdir}/contrib/platform/$with_platform"
fi
fi
# make sure file exists
if test ! -r "$with_platform" ; then
AC_MSG_ERROR([platform file $with_platform not found])
fi
# eval into environment
PMIX_LOG_MSG([Loading environment file $with_platform, with contents below])
PMIX_LOG_FILE([$with_platform])
# setup by getting full pathname for the platform directories
platform_base="`dirname $with_platform`"
platform_file="`basename $with_platform`"
# get full pathname of where we are so we can return
platform_savedir="`pwd`"
# go to where the platform file is located
cd "$platform_base"
# get the full path to this location
platform_file_dir=`pwd`
. ./"$platform_file"
# see if they left us a name
if test "$PMIX_PLATFORM_LOADED" != "" ; then
platform_loaded="$PMIX_PLATFORM_LOADED"
else
platform_loaded="$with_platform"
fi
echo "Loaded platform arguments for $platform_loaded"
PMIX_LOG_MSG([Loaded platform arguments for $platform_loaded])
# look for default mca param file
# return to where we started
cd "$platform_savedir"
fi
])

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

@ -0,0 +1,34 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# PMIX SEARCH_LIBS_CORE(func, list-of-libraries,
# action-if-found, action-if-not-found,
# other-libraries)
#
# Wrapper around AC SEARCH_LIBS. If a library ends up being added to
# $LIBS, then also add it to the wrapper LIBS list (so that it is
# added to the link command line for the static link case).
#
# NOTE: COMPONENTS SHOULD NOT USE THIS MACRO! Components should use
# PMIX_SEARCH_LIBS_COMPONENT. The reason why is because this macro
# calls PMIX_WRAPPER_FLAGS_ADD -- see big comment in
# pmix_setup_wrappers.m4 for an explanation of why this is bad).
AC_DEFUN([PMIX_SEARCH_LIBS_CORE],[
AC_SEARCH_LIBS([$1], [$2],
[pmix_have_$1=1
$3],
[pmix_have_$1=0
$4], [$5])
AC_DEFINE_UNQUOTED([PMIX_HAVE_]m4_toupper($1), [$pmix_have_$1],
[whether $1 is found and available])
])dnl

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

@ -0,0 +1,334 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2006 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2012 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2015 Intel, Inc. All rights reserved
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# PMIX_SETUP_CC()
# ---------------
# Do everything required to setup the C compiler. Safe to AC_REQUIRE
# this macro.
AC_DEFUN([PMIX_SETUP_CC],[
# AM_PROG_CC_C_O AC_REQUIREs AC_PROG_CC, so we have to be a little
# careful about ordering here, and AC_REQUIRE these things so that
# they get stamped out in the right order.
AC_REQUIRE([_PMIX_START_SETUP_CC])
AC_REQUIRE([_PMIX_PROG_CC])
AC_REQUIRE([AM_PROG_CC_C_O])
# We require a C99 compiant compiler
AC_PROG_CC_C99
# The result of AC_PROG_CC_C99 is stored in ac_cv_prog_cc_c99
if test "x$ac_cv_prog_cc_c99" = xno ; then
AC_MSG_WARN([PMIx requires a C99 compiler])
AC_MSG_ERROR([Aborting.])
fi
PMIX_C_COMPILER_VENDOR([pmix_c_vendor])
# Check for standard headers, needed here because needed before
# the types checks.
AC_HEADER_STDC
# GNU C and autotools are inconsistent about whether this is
# defined so let's make it true everywhere for now... However, IBM
# XL compilers on PPC Linux behave really badly when compiled with
# _GNU_SOURCE defined, so don't define it in that situation.
#
# Don't use AC_GNU_SOURCE because it requires that no compiler
# tests are done before setting it, and we need to at least do
# enough tests to figure out if we're using XL or not.
AS_IF([test "$pmix_cv_c_compiler_vendor" != "ibm"],
[AH_VERBATIM([_GNU_SOURCE],
[/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif])
AC_DEFINE([_GNU_SOURCE])])
# Do we want debugging?
if test "$WANT_DEBUG" = "1" && test "$enable_debug_symbols" != "no" ; then
CFLAGS="$CFLAGS -g"
PMIX_UNIQ(CFLAGS)
AC_MSG_WARN([-g has been added to CFLAGS (--enable-debug)])
fi
# These flags are generally gcc-specific; even the
# gcc-impersonating compilers won't accept them.
PMIX_CFLAGS_BEFORE_PICKY="$CFLAGS"
if test $WANT_PICKY_COMPILER -eq 1; then
CFLAGS_orig=$CFLAGS
add=
# These flags are likely GCC-specific (or, more specifically,
# we don't have general tests for each one, and we know they
# work with all versions of GCC that we have used throughout
# the years, so we'll keep them limited just to GCC).
if test "$pmix_c_vendor" = "gnu" ; then
add="$add -Wall -Wundef -Wno-long-long -Wsign-compare"
add="$add -Wmissing-prototypes -Wstrict-prototypes"
add="$add -Wcomment -pedantic"
fi
# see if -Wno-long-double works...
# Starting with GCC-4.4, the compiler complains about not
# knowing -Wno-long-double, only if -Wstrict-prototypes is set, too.
#
# Actually, this is not real fix, as GCC will pass on any -Wno- flag,
# have fun with the warning: -Wno-britney
CFLAGS="$CFLAGS_orig $add -Wno-long-double -Wstrict-prototypes"
AC_CACHE_CHECK([if $CC supports -Wno-long-double],
[pmix_cv_cc_wno_long_double],
[AC_TRY_COMPILE([], [],
[
dnl So -Wno-long-double did not produce any errors...
dnl We will try to extract a warning regarding
dnl unrecognized or ignored options
AC_TRY_COMPILE([], [long double test;],
[
pmix_cv_cc_wno_long_double="yes"
if test -s conftest.err ; then
dnl Yes, it should be "ignor", in order to catch ignoring and ignore
for i in unknown invalid ignor unrecognized ; do
$GREP -iq $i conftest.err
if test "$?" = "0" ; then
pmix_cv_cc_wno_long_double="no"
break;
fi
done
fi
],
[pmix_cv_cc_wno_long_double="no"])],
[pmix_cv_cc_wno_long_double="no"])
])
if test "$pmix_cv_cc_wno_long_double" = "yes" ; then
add="$add -Wno-long-double"
fi
# Per above, we know that this flag works with GCC / haven't
# really tested it elsewhere.
if test "$pmix_c_vendor" = "gnu" ; then
add="$add -Werror-implicit-function-declaration "
fi
CFLAGS="$CFLAGS_orig $add"
PMIX_UNIQ(CFLAGS)
AC_MSG_WARN([$add has been added to CFLAGS (--enable-picky)])
unset add
fi
# See if this version of gcc allows -finline-functions and/or
# -fno-strict-aliasing. Even check the gcc-impersonating compilers.
if test "$GCC" = "yes"; then
CFLAGS_orig="$CFLAGS"
# Note: Some versions of clang (at least >= 3.5 -- perhaps
# older versions, too?) will *warn* about -finline-functions,
# but still allow it. This is very annoying, so check for
# that warning, too. The clang warning looks like this:
# clang: warning: optimization flag '-finline-functions' is not supported
# clang: warning: argument unused during compilation: '-finline-functions'
CFLAGS="$CFLAGS_orig -finline-functions"
add=
AC_CACHE_CHECK([if $CC supports -finline-functions],
[pmix_cv_cc_finline_functions],
[AC_TRY_COMPILE([], [],
[pmix_cv_cc_finline_functions="yes"
if test -s conftest.err ; then
for i in unused 'not supported' ; do
if $GREP -iq "$i" conftest.err; then
pmix_cv_cc_finline_functions="no"
break;
fi
done
fi
],
[pmix_cv_cc_finline_functions="no"])])
if test "$pmix_cv_cc_finline_functions" = "yes" ; then
add=" -finline-functions"
fi
CFLAGS="$CFLAGS_orig$add"
CFLAGS_orig="$CFLAGS"
CFLAGS="$CFLAGS_orig -fno-strict-aliasing"
add=
AC_CACHE_CHECK([if $CC supports -fno-strict-aliasing],
[pmix_cv_cc_fno_strict_aliasing],
[AC_TRY_COMPILE([], [],
[pmix_cv_cc_fno_strict_aliasing="yes"],
[pmix_cv_cc_fno_strict_aliasing="no"])])
if test "$pmix_cv_cc_fno_strict_aliasing" = "yes" ; then
add=" -fno-strict-aliasing"
fi
CFLAGS="$CFLAGS_orig$add"
PMIX_UNIQ(CFLAGS)
AC_MSG_WARN([$add has been added to CFLAGS])
unset add
fi
# Try to enable restrict keyword
RESTRICT_CFLAGS=
case "$pmix_c_vendor" in
intel)
RESTRICT_CFLAGS="-restrict"
;;
sgi)
RESTRICT_CFLAGS="-LANG:restrict=ON"
;;
esac
if test ! -z "$RESTRICT_CFLAGS" ; then
CFLAGS_orig="$CFLAGS"
CFLAGS="$CFLAGS_orig $RESTRICT_CFLAGS"
add=
AC_CACHE_CHECK([if $CC supports $RESTRICT_CFLAGS],
[pmix_cv_cc_restrict_cflags],
[AC_TRY_COMPILE([], [],
[pmix_cv_cc_restrict_cflags="yes"],
[pmix_cv_cc_restrict_cflags="no"])])
if test "$pmix_cv_cc_restrict_cflags" = "yes" ; then
add=" $RESTRICT_CFLAGS"
fi
CFLAGS="${CFLAGS_orig}${add}"
PMIX_UNIQ([CFLAGS])
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CFLAGS])
fi
unset add
fi
# see if the C compiler supports __builtin_expect
AC_CACHE_CHECK([if $CC supports __builtin_expect],
[pmix_cv_cc_supports___builtin_expect],
[AC_TRY_LINK([],
[void *ptr = (void*) 0;
if (__builtin_expect (ptr != (void*) 0, 1)) return 0;],
[pmix_cv_cc_supports___builtin_expect="yes"],
[pmix_cv_cc_supports___builtin_expect="no"])])
if test "$pmix_cv_cc_supports___builtin_expect" = "yes" ; then
have_cc_builtin_expect=1
else
have_cc_builtin_expect=0
fi
AC_DEFINE_UNQUOTED([PMIX_C_HAVE_BUILTIN_EXPECT], [$have_cc_builtin_expect],
[Whether C compiler supports __builtin_expect])
# see if the C compiler supports __builtin_prefetch
AC_CACHE_CHECK([if $CC supports __builtin_prefetch],
[pmix_cv_cc_supports___builtin_prefetch],
[AC_TRY_LINK([],
[int ptr;
__builtin_prefetch(&ptr,0,0);],
[pmix_cv_cc_supports___builtin_prefetch="yes"],
[pmix_cv_cc_supports___builtin_prefetch="no"])])
if test "$pmix_cv_cc_supports___builtin_prefetch" = "yes" ; then
have_cc_builtin_prefetch=1
else
have_cc_builtin_prefetch=0
fi
AC_DEFINE_UNQUOTED([PMIX_C_HAVE_BUILTIN_PREFETCH], [$have_cc_builtin_prefetch],
[Whether C compiler supports __builtin_prefetch])
# see if the C compiler supports __builtin_clz
AC_CACHE_CHECK([if $CC supports __builtin_clz],
[pmix_cv_cc_supports___builtin_clz],
[AC_TRY_LINK([],
[int value = 0xffff; /* we know we have 16 bits set */
if ((8*sizeof(int)-16) != __builtin_clz(value)) return 0;],
[pmix_cv_cc_supports___builtin_clz="yes"],
[pmix_cv_cc_supports___builtin_clz="no"])])
if test "$pmix_cv_cc_supports___builtin_clz" = "yes" ; then
have_cc_builtin_clz=1
else
have_cc_builtin_clz=0
fi
AC_DEFINE_UNQUOTED([PMIX_C_HAVE_BUILTIN_CLZ], [$have_cc_builtin_clz],
[Whether C compiler supports __builtin_clz])
# Preload the optflags for the case where the user didn't specify
# any. If we're using GNU compilers, use -O3 (since it GNU
# doesn't require all compilation units to be compiled with the
# same level of optimization -- selecting a high level of
# optimization is not prohibitive). If we're using anything else,
# be conservative and just use -O.
#
# Note: gcc-impersonating compilers accept -O3
if test "$WANT_DEBUG" = "1"; then
OPTFLAGS=
else
if test "$GCC" = yes; then
OPTFLAGS="-O3"
else
OPTFLAGS="-O"
fi
fi
PMIX_ENSURE_CONTAINS_OPTFLAGS("$PMIX_CFLAGS_BEFORE_PICKY")
PMIX_CFLAGS_BEFORE_PICKY="$co_result"
AC_MSG_CHECKING([for C optimization flags])
PMIX_ENSURE_CONTAINS_OPTFLAGS(["$CFLAGS"])
AC_MSG_RESULT([$co_result])
CFLAGS="$co_result"
##################################
# C compiler characteristics
##################################
# Does the compiler support "ident"-like constructs?
PMIX_CHECK_IDENT([CC], [CFLAGS], [c], [C])
])
AC_DEFUN([_PMIX_START_SETUP_CC],[
pmix_show_subtitle "C compiler and preprocessor"
# $%@#!@#% AIX!! This has to be called before anything invokes the C
# compiler.
dnl AC_AIX
])
AC_DEFUN([_PMIX_PROG_CC],[
#
# Check for the compiler
#
PMIX_VAR_SCOPE_PUSH([pmix_cflags_save dummy pmix_cc_arvgv0])
pmix_cflags_save="$CFLAGS"
AC_PROG_CC
BASECC="`basename $CC`"
CFLAGS="$pmix_cflags_save"
AC_DEFINE_UNQUOTED(PMIX_CC, "$CC", [PMIx underlying C compiler])
set dummy $CC
pmix_cc_argv0=[$]2
PMIX_WHICH([$pmix_cc_argv0], [PMIX_CC_ABSOLUTE])
AC_SUBST(PMIX_CC_ABSOLUTE)
PMIX_VAR_SCOPE_POP
])

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

@ -0,0 +1,119 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_hwloc_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([PMIX_HWLOC_CONFIG],[
AC_ARG_WITH([hwloc-header],
[AC_HELP_STRING([--with-hwloc-header=HEADER],
[The value that should be included in C files to include hwloc.h])])
pmix_hwloc_support=0
AS_IF([test "$enable_embedded_mode" = "yes"],
[_PMIX_HWLOC_EMBEDDED_MODE],
[_PMIX_HWLOC_EXTERNAL])
AC_DEFINE_UNQUOTED(PMIX_HAVE_HWLOC, [$pmix_hwloc_support],
[Whether we have hwloc support or not])
AC_MSG_CHECKING([hwloc header])
AC_DEFINE_UNQUOTED([PMIX_HWLOC_HEADER], [$PMIX_HWLOC_HEADER],
[Location of hwloc.h])
AC_MSG_RESULT([$PMIX_HWLOC_HEADER])
CPPFLAGS="$CPPFLAGS $PMIX_HWLOC_CPPFLAGS"
LDFLAGS="$LDFLAGS $PMIX_HWLOC_LDFLAGS"
LIBS="$LIBS $PMIX_HWLOC_LIBS"
])
AC_DEFUN([_PMIX_HWLOC_EMBEDDED_MODE],[
AC_MSG_CHECKING([for hwloc])
AC_MSG_RESULT([assumed available (embedded mode)])
PMIX_HWLOC_HEADER="$with_hwloc_header"
PMIX_HWLOC_CPPFLAGS=
PMIX_HWLOC_LIB=
PMIX_HWLOC_LDFLAGS=
pmix_hwloc_support=1
])
AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[
PMIX_VAR_SCOPE_PUSH([pmix_hwloc_dir pmix_hwloc_libdir])
AC_ARG_WITH([hwloc],
[AC_HELP_STRING([--with-hwloc=DIR],
[Search for hwloc headers and libraries in DIR ])])
AC_ARG_WITH([hwloc-libdir],
[AC_HELP_STRING([--with-hwloc-libdir=DIR],
[Search for hwloc libraries in DIR ])])
pmix_hwloc_support=0
if test "$with_hwloc" != "no"; then
AC_MSG_CHECKING([for hwloc in])
if test ! -z "$with_hwloc" && test "$with_hwloc" != "yes"; then
pmix_hwloc_dir=$with_hwloc
if test -d $with_hwloc/lib; then
pmix_hwloc_libdir=$with_hwloc/lib
elif test -d $with_hwloc/lib64; then
pmix_hwloc_libdir=$with_hwloc/lib64
else
AC_MSG_RESULT([Could not find $with_hwloc/lib or $with_hwloc/lib64])
AC_MSG_ERROR([Can not continue])
fi
AC_MSG_RESULT([$pmix_hwloc_dir and $pmix_hwloc_libdir])
else
AC_MSG_RESULT([(default search paths)])
fi
AS_IF([test ! -z "$with_hwloc_libdir" && test "$with_hwloc_libdir" != "yes"],
[pmix_hwloc_libdir="$with_hwloc_libdir"])
PMIX_CHECK_PACKAGE([pmix_hwloc],
[hwloc.h],
[hwloc],
[hwloc_topology_dup],
[-lhwloc],
[$pmix_hwloc_dir],
[$pmix_hwloc_libdir],
[pmix_hwloc_support=1],
[pmix_hwloc_support=0])
if test $pmix_hwloc_support == "1"; then
CPPFLAGS="$pmix_hwloc_CPPFLAGS $CPPFLAGS"
LIBS="$LIBS -lhwloc"
LDFLAGS="$pmix_hwloc_LDFLAGS $LDFLAGS"
fi
fi
if test ! -z "$with_hwloc" && test "$with_hwloc" != "no" && test "$pmix_hwloc_support" != "1"; then
AC_MSG_WARN([HWLOC SUPPORT REQUESTED AND NOT FOUND. PMIX HWLOC])
AC_MSG_WARN([SUPPORT REQUIRES A MINIMUM OF VERSION 1.9.1])
AC_MSG_ERROR([CANNOT CONTINUE])
fi
# Set output variables
PMIX_HWLOC_HEADER="<hwloc.h>"
PMIX_HWLOC_LIB=-lhwloc
AS_IF([test "$pmix_hwloc_dir" != ""],
[PMIX_HWLOC_CPPFLAGS="-I$pmix_hwloc_dir/include"])
AS_IF([test "$pmix_hwloc_libdir" != ""],
[PMIX_HWLOC_LDFLAGS="-L$pmix_hwloc_libdir"])
AC_MSG_CHECKING([will hwloc support be built])
if test "$pmix_hwloc_support" != "1"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
PMIX_VAR_SCOPE_POP
])dnl

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

@ -0,0 +1,130 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_libevent_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([PMIX_LIBEVENT_CONFIG],[
AC_ARG_WITH([libevent-header],
[AC_HELP_STRING([--with-libevent-header=HEADER],
[The value that should be included in C files to include event.h])])
AS_IF([test "$enable_embedded_mode" = "yes"],
[_PMIX_LIBEVENT_EMBEDDED_MODE],
[_PMIX_LIBEVENT_EXTERNAL])
AC_MSG_CHECKING([libevent header])
AC_DEFINE_UNQUOTED([PMIX_EVENT_HEADER], [$PMIX_EVENT_HEADER],
[Location of event.h])
AC_MSG_RESULT([$PMIX_EVENT_HEADER])
AC_MSG_CHECKING([libevent2/thread header])
AC_DEFINE_UNQUOTED([PMIX_EVENT2_THREAD_HEADER], [$PMIX_EVENT2_THREAD_HEADER],
[Location of event2/thread.h])
AC_MSG_RESULT([$PMIX_EVENT2_THREAD_HEADER])
CPPFLAGS="$CPPFLAGS $PMIX_EVENT_CPPFLAGS"
LDFLAGS="$LDFLAGS $PMIX_EVENT_LDFLAGS"
LIBS="$LIBS $PMIX_EVENT_LIBS"
])
AC_DEFUN([_PMIX_LIBEVENT_EMBEDDED_MODE],[
AC_MSG_CHECKING([for libevent])
AC_MSG_RESULT([assumed available (embedded mode)])
PMIX_EVENT_HEADER="$with_libevent_header"
PMIX_EVENT2_THREAD_HEADER="$with_libevent_header"
PMIX_EVENT_CPPFLAGS=
PMIX_EVENT_LIB=
PMIX_EVENT_LDFLAGS=
])
AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[
PMIX_VAR_SCOPE_PUSH([pmix_event_dir pmix_event_libdir])
AC_ARG_WITH([libevent],
[AC_HELP_STRING([--with-libevent=DIR],
[Search for libevent headers and libraries in DIR ])])
# Bozo check
AS_IF([test "$with_libevent" = "no"],
[AC_MSG_WARN([It is not possible to configure PMIx --without-libevent])
AC_MSG_ERROR([Cannot continue])])
AC_ARG_WITH([libevent-libdir],
[AC_HELP_STRING([--with-libevent-libdir=DIR],
[Search for libevent libraries in DIR ])])
AC_MSG_CHECKING([for libevent in])
if test ! -z "$with_libevent" && test "$with_libevent" != "yes"; then
pmix_event_dir=$with_libevent
if test -d $with_libevent/lib; then
pmix_event_libdir=$with_libevent/lib
elif test -d $with_libevent/lib64; then
pmix_event_libdir=$with_libevent/lib64
else
AC_MSG_RESULT([Could not find $with_libevent/lib or $with_libevent/lib64])
AC_MSG_ERROR([Can not continue])
fi
AC_MSG_RESULT([$pmix_event_dir and $pmix_event_libdir])
else
AC_MSG_RESULT([(default search paths)])
fi
AS_IF([test ! -z "$with_libevent_libdir" && "$with_libevent_libdir" != "yes"],
[pmix_event_libdir="$with_libevent_libdir"])
PMIX_CHECK_PACKAGE([pmix_libevent],
[event.h],
[event],
[event_config_new],
[-levent -levent_pthreads],
[$pmix_event_dir],
[$pmix_event_libdir],
[],
[AC_MSG_WARN([LIBEVENT SUPPORT NOT FOUND])
AC_MSG_ERROR([CANNOT CONTINE])])
CPPFLAGS="$pmix_libevent_CPPFLAGS $CPPFLAGS"
LIBS="$pmix_libevent_LIBS $LIBS"
LDFLAGS="$pmix_libevent_LDFLAGS $LDFLAGS"
# Ensure that this libevent has the symbol
# "evthread_set_lock_callbacks", which will only exist if
# libevent was configured with thread support.
AC_CHECK_LIB([event], [evthread_set_lock_callbacks],
[],
[AC_MSG_WARN([External libevent does not have thread support])
AC_MSG_WARN([PMIx requires libevent to be compiled with])
AC_MSG_WARN([thread support enabled])
AC_MSG_ERROR([Cannot continue])])
AC_CHECK_LIB([event_pthreads], [evthread_use_pthreads],
[],
[AC_MSG_WARN([External libevent does not have thread support])
AC_MSG_WARN([PMIx requires libevent to be compiled with])
AC_MSG_WARN([thread support enabled])
AC_MSG_ERROR([Cannot continue])])
# Chck if this libevent has the symbol
# "libevent_global_shutdown", which will only exist in
# libevent version 2.1.1+
AC_CHECK_FUNCS([libevent_global_shutdown],[], [])
# Set output variables
PMIX_EVENT_HEADER="<event.h>"
PMIX_EVENT2_THREAD_HEADER="<event2/thread.h>"
PMIX_EVENT_LIB=-levent
AS_IF([test "$pmix_event_dir" != ""],
[PMIX_EVENT_CPPFLAGS="-I$pmix_event_dir/include"])
AS_IF([test "$pmix_event_libdir" != ""],
[PMIX_EVENT_LDFLAGS="-L$pmix_event_libdir"])
PMIX_VAR_SCOPE_POP
])dnl

214
opal/mca/pmix/pmix120/pmix/configure.ac Обычный файл
Просмотреть файл

@ -0,0 +1,214 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2010 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006-2011 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved.
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
# Copyright (c) 2014-2015 Intel, Inc. All rights reserved
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
############################################################################
# Initialization, version number, and other random setup/init stuff
############################################################################
AC_INIT([pmix],
[m4_normalize(esyscmd([config/pmix_get_version.sh VERSION --tarball]))],
[http://www.open-mpi.org/projects/pmix/], [pmix])
AC_PREREQ(2.69)
AC_CONFIG_AUX_DIR(./config)
# Note that this directory must *exactly* match what was specified via
# -I in ACLOCAL_AMFLAGS in the top-level Makefile.am.
AC_CONFIG_MACRO_DIR(./config)
# Get our platform support file. This has to be done very, very early
# because it twiddles random bits of autoconf
PMIX_LOAD_PLATFORM
# setup configure options (e.g., show_title and friends)
PMIX_CONFIGURE_SETUP
pmix_show_title "Configuring PMIx"
# This must be before AM_INIT_AUTOMAKE
AC_CANONICAL_TARGET
# Init automake
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects no-define 1.12.2 -Wall -Werror])
# SILENT_RULES is new in AM 1.11, but we require 1.11 or higher via
# autogen. Limited testing shows that calling SILENT_RULES directly
# works in more cases than adding "silent-rules" to INIT_AUTOMAKE
# (even though they're supposed to be identical). Shrug.
AM_SILENT_RULES([yes])
# set the language
AC_LANG([C])
# AC_USE_SYSTEM_EXTENSIONS will modify CFLAGS if nothing was in there
# beforehand. We don't want that. So if there was nothing in
# CFLAGS, put nothing back in there.
PMIX_VAR_SCOPE_PUSH([CFLAGS_save])
CFLAGS_save=$CFLAGS
AC_USE_SYSTEM_EXTENSIONS
AS_IF([test -z "$CFLAGS_save"], [CFLAGS=])
PMIX_VAR_SCOPE_POP
####################################################################
# Setup the configure header files
####################################################################
AH_TOP([/* -*- c -*-
*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* 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) 2013-2015 Intel, Inc. All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is automatically generated by configure. Edits will be lost
* the next time you run configure!
*/
#ifndef PMIX_CONFIG_H
#define PMIX_CONFIG_H
#include <pmix/autogen/pmix_config_top.h>
])
AH_BOTTOM([
#include <pmix/autogen/pmix_config_bottom.h>
#endif /* PMIX_CONFIG_H */
])
############################################################################
# Setup Libtool
############################################################################
# We want new Libtool. None of that old stuff. Pfft.
m4_ifdef([LT_PREREQ], [],
[m4_fatal([libtool version 2.2.6 or higher is required], [63])])
LT_PREREQ([2.2.6])
#
# Enable static so that we have the --with tests done up here and can
# check for OS. Save the values of $enable_static and $enable_shared
# before setting the defaults, because if the user specified
# --[en|dis]able-[static|shared] on the command line, they'll already
# be set. In this way, we can tell if the user requested something or
# if the default was set here.
#
pmix_enable_shared="$enable_shared"
pmix_enable_static="$enable_static"
AM_ENABLE_SHARED
AM_DISABLE_STATIC
# This did not exist pre AM 1.11.x (where x is somewhere >0 and <3),
# but it is necessary in AM 1.12.x.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_INIT()
LT_LANG([C])
LT_LANG([C++])
############################################################################
# Configuration options
############################################################################
# Define PMIx configure arguments
PMIX_DEFINE_ARGS
# Define some basic useful values
PMIX_BASIC_SETUP
# If debug mode, add -g
AS_IF([test "$pmix_debug" = "1"],
[CFLAGS="$CFLAGS -g"])
############################################################################
# Setup the core
############################################################################
# Setup the pmix core
PMIX_SETUP_CORE([])
# Run the AM_CONDITIONALs
PMIX_DO_AM_CONDITIONALS
####################################################################
# Setup C compiler
####################################################################
CFLAGS_save="$CFLAGS"
AC_PROG_CC
CFLAGS="$CFLAGS_save"
AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
AS_IF([test -z "$CC_FOR_BUILD"],[
AC_SUBST([CC_FOR_BUILD], [$CC])
])
PMIX_SETUP_CC
#
# Delayed the substitution of CFLAGS and CXXFLAGS until now because
# they may have been modified throughout the course of this script.
#
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
pmix_show_title "Final compiler flags"
AC_MSG_CHECKING([final CPPFLAGS])
AC_MSG_RESULT([$CPPFLAGS])
AC_MSG_CHECKING([final CFLAGS])
AC_MSG_RESULT([$CFLAGS])
####################################################################
# Version information
####################################################################
# PMIX_VERSION was setup by PMIX_SETUP_CORE above.
# Make configure depend on the VERSION file, since it's used in AC_INIT
AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
. $srcdir/VERSION
AC_SUBST([libpmix_so_version])
AC_CONFIG_FILES(pmix_config_prefix[test/Makefile]
pmix_config_prefix[test/simple/Makefile])
pmix_show_title "Configuration complete"
AC_OUTPUT

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

@ -0,0 +1,3 @@
enable_mem_debug=no
enable_mem_profile=no
enable_debug=no

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

@ -0,0 +1,48 @@
# -*- text -*-
#
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
{
fin1
Memcheck:Leak
fun:malloc
fun:evthread_posix_lock_alloc
fun:evutil_secure_rng_global_setup_locks_
fun:event_global_setup_locks_
fun:evthread_use_pthreads
fun:pmix_start_progress_thread
fun:PMIx_server_init
fun:main
}
{
fin2
Memcheck:Leak
fun:malloc
fun:evthread_posix_lock_alloc
fun:evsig_global_setup_locks_
fun:event_global_setup_locks_
fun:evthread_use_pthreads
fun:pmix_start_progress_thread
fun:PMIx_Init
fun:main
}
{
fin3
Memcheck:Leak
fun:malloc
fun:evthread_posix_lock_alloc
fun:evutil_secure_rng_global_setup_locks_
fun:event_global_setup_locks_
fun:evthread_use_pthreads
fun:pmix_start_progress_thread
fun:PMIx_init
fun:main
}

158
opal/mca/pmix/pmix120/pmix/examples/client.c Обычный файл
Просмотреть файл

@ -0,0 +1,158 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#define _GNU_SOURCE
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <pmix.h>
int main(int argc, char **argv)
{
pmix_proc_t myproc;
int rc;
pmix_value_t value;
pmix_value_t *val = &value;
char *tmp;
pmix_proc_t proc;
uint32_t nprocs, n;
pmix_info_t *info;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
/* get our universe size */
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
nprocs = val->data.uint32;
PMIX_VALUE_RELEASE(val);
fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs);
/* put a few values */
(void)asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank);
value.type = PMIX_UINT32;
value.data.uint32 = 1234;
if (PMIX_SUCCESS != (rc = PMIx_Store_internal(&myproc, tmp, &value))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Store_internal failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
(void)asprintf(&tmp, "%s-%d-local", myproc.nspace, myproc.rank);
value.type = PMIX_UINT64;
value.data.uint64 = 1234;
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, tmp, &value))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
(void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, myproc.rank);
value.type = PMIX_STRING;
value.data.string = "1234";
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
if (PMIX_SUCCESS != (rc = PMIx_Commit())) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Commit failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* call fence to ensure the data is received */
PMIX_PROC_CONSTRUCT(&proc);
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
PMIX_INFO_CREATE(info, 1);
(void)strncpy(info->key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN);
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, info, 1))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
PMIX_INFO_FREE(info, 1);
/* check the returned data */
for (n=0; n < nprocs; n++) {
(void)asprintf(&tmp, "%s-%d-local", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc);
goto done;
}
if (PMIX_UINT64 != val->type) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type);
PMIX_VALUE_RELEASE(val);
free(tmp);
goto done;
}
if (1234 != val->data.uint64) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %d\n", myproc.nspace, myproc.rank, tmp, (int)val->data.uint64);
PMIX_VALUE_RELEASE(val);
free(tmp);
goto done;
}
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp);
PMIX_VALUE_RELEASE(val);
free(tmp);
(void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc);
goto done;
}
if (PMIX_STRING != val->type) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type);
PMIX_VALUE_RELEASE(val);
free(tmp);
goto done;
}
if (0 != strcmp(val->data.string, "1234")) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %s\n", myproc.nspace, myproc.rank, tmp, val->data.string);
PMIX_VALUE_RELEASE(val);
free(tmp);
goto done;
}
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp);
PMIX_VALUE_RELEASE(val);
free(tmp);
}
done:
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
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);
}
fflush(stderr);
return(0);
}

217
opal/mca/pmix/pmix120/pmix/examples/dmodex.c Обычный файл
Просмотреть файл

@ -0,0 +1,217 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include <stdbool.h>
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <pmix.h>
static uint32_t nprocs;
static pmix_proc_t myproc;
static uint32_t getcount = 0;
#define WAIT_FOR_COMPLETION(a) \
do { \
while ((a)) { \
usleep(10); \
} \
} while (0);
static void opcbfunc(pmix_status_t status, void *cbdata)
{
bool *active = (bool*)cbdata;
fprintf(stderr, "%s:%d completed fence_nb\n", myproc.nspace, myproc.rank);
*active = false;
}
static void valcbfunc(pmix_status_t status,
pmix_value_t *val, void *cbdata)
{
char *key = (char*)cbdata;
if (PMIX_SUCCESS == status) {
if (NULL != strstr(key, "local")) {
if (PMIX_UINT64 != val->type) {
fprintf(stderr, "%s:%d: PMIx_Get_nb Key %s returned wrong type: %d\n", myproc.nspace, myproc.rank, key, val->type);
goto done;
}
if (1234 != val->data.uint64) {
fprintf(stderr, "%s:%d: PMIx_Get_nb Key %s returned wrong value: %d\n", myproc.nspace, myproc.rank, key, (int)val->data.uint64);
goto done;
}
} else if (NULL != strstr(key, "remote")) {
if (PMIX_STRING != val->type) {
fprintf(stderr, "%s:%d: PMIx_Get_nb Key %s returned wrong type: %d\n", myproc.nspace, myproc.rank, key, val->type);
goto done;
}
if (0 != strcmp(val->data.string, "1234")) {
fprintf(stderr, "%s:%d: PMIx_Get_nb Key %s returned wrong value: %s\n", myproc.nspace, myproc.rank, key, val->data.string);
goto done;
}
} else {
fprintf(stderr, "%s:%d PMIx_Get_nb returned wrong key: %s\n", myproc.nspace, myproc.rank, key);
goto done;
}
fprintf(stderr, "%s:%d PMIx_Get_nb Key %s returned correctly\n", myproc.nspace, myproc.rank, key);
} else {
fprintf(stderr, "%s:%d PMIx_Get_nb Key %s failed\n", myproc.nspace, myproc.rank, key);
}
done:
free(key);
getcount++;
}
int main(int argc, char **argv)
{
int rc;
pmix_value_t value;
pmix_value_t *val = &value;
char *tmp;
pmix_proc_t proc;
uint32_t n, num_gets;
bool active;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
/* get our universe size */
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
nprocs = val->data.uint32;
PMIX_VALUE_RELEASE(val);
fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs);
/* put a few values */
(void)asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank);
value.type = PMIX_UINT32;
value.data.uint32 = 1234;
if (PMIX_SUCCESS != (rc = PMIx_Store_internal(&myproc, tmp, &value))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Store_internal failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
(void)asprintf(&tmp, "%s-%d-local", myproc.nspace, myproc.rank);
value.type = PMIX_UINT64;
value.data.uint64 = 1234;
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, tmp, &value))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
(void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, myproc.rank);
value.type = PMIX_STRING;
value.data.string = "1234";
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* introduce a delay by one rank so we can check what happens
* if a "get" is received prior to data being provided */
if (0 == myproc.rank) {
sleep(2);
}
/* commit the data to the server */
if (PMIX_SUCCESS != (rc = PMIx_Commit())) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Commit failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* call fence_nb, but don't return any data */
PMIX_PROC_CONSTRUCT(&proc);
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
active = true;
if (PMIX_SUCCESS != (rc = PMIx_Fence_nb(&proc, 1, NULL, 0, opcbfunc, &active))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* get the committed data - ask for someone who doesn't exist as well */
num_gets = 0;
for (n=0; n <= nprocs; n++) {
(void)asprintf(&tmp, "%s-%d-local", myproc.nspace, n);
(void)strncpy(proc.nspace, tmp, PMIX_MAX_NSLEN);
proc.rank = n;
if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&proc, tmp,
NULL, 0, valcbfunc, tmp))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, n, tmp, rc);
goto done;
}
++num_gets;
(void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, n);
(void)strncpy(proc.nspace, tmp, PMIX_MAX_NSLEN);
if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&proc, tmp,
NULL, 0, valcbfunc, tmp))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, n, tmp, rc);
goto done;
}
++num_gets;
}
/* wait for the first fence to finish */
WAIT_FOR_COMPLETION(active);
/* wait for all my "get" calls to complete */
while (getcount < num_gets) {
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 100000;
nanosleep(&ts, NULL);
}
/* call fence again so everyone waits before leaving */
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
done:
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
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);
}
fflush(stderr);
return(0);
}

199
opal/mca/pmix/pmix120/pmix/examples/dynamic.c Обычный файл
Просмотреть файл

@ -0,0 +1,199 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include <stdbool.h>
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <pmix.h>
static pmix_proc_t myproc;
int main(int argc, char **argv)
{
int rc;
pmix_value_t value;
pmix_value_t *val = &value;
pmix_proc_t proc;
uint32_t nprocs;
char nsp2[PMIX_MAX_NSLEN+1];
pmix_app_t *app;
char hostname[1024];
pmix_proc_t *peers;
size_t npeers, ntmp=0;
char *nodelist;
gethostname(hostname, 1024);
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
/* get our universe size */
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
nprocs = val->data.uint32;
PMIX_VALUE_RELEASE(val);
fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs);
/* call fence to sync */
PMIX_PROC_CONSTRUCT(&proc);
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* rank=0 calls spawn */
if (0 == myproc.rank) {
PMIX_APP_CREATE(app, 1);
app->cmd = strdup("gumby");
app->maxprocs = 2;
app->argc = 3;
app->argv = (char**)malloc(4 * sizeof(char*));
app->argv[0] = strdup("gumby");
app->argv[1] = strdup("-n");
app->argv[2] = strdup("2");
app->argv[3] = NULL;
app->env = (char**)malloc(2 * sizeof(char*));
app->env[0] = strdup("PMIX_ENV_VALUE=3");
app->env[1] = NULL;
PMIX_INFO_CREATE(app->info, 2);
(void)strncpy(app->info[0].key, "DARTH", PMIX_MAX_KEYLEN);
app->info[0].value.type = PMIX_INT8;
app->info[0].value.data.int8 = 12;
(void)strncpy(app->info[1].key, "VADER", PMIX_MAX_KEYLEN);
app->info[1].value.type = PMIX_DOUBLE;
app->info[1].value.data.dval = 12.34;
fprintf(stderr, "Client ns %s rank %d: calling PMIx_Spawn\n", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Spawn(NULL, 0, app, 1, nsp2))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Spawn failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
PMIX_APP_FREE(app, 1);
/* check to see if we got the expected info back */
if (0 != strncmp(nsp2, "DYNSPACE", PMIX_MAX_NSLEN)) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Spawn returned incorrect nspace: %s\n", myproc.nspace, myproc.rank, nsp2);
goto done;
} else {
fprintf(stderr, "Client ns %s rank %d: PMIx_Spawn succeeded returning nspace: %s\n", myproc.nspace, myproc.rank, nsp2);
}
/* get their universe size */
val = NULL;
(void)strncpy(proc.nspace, nsp2, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val)) ||
NULL == val) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
ntmp = val->data.uint32;
PMIX_VALUE_RELEASE(val);
fprintf(stderr, "Client %s:%d universe %s size %d\n", myproc.nspace, myproc.rank, nsp2, (int)ntmp);
}
/* just cycle the connect/disconnect functions */
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Connect(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Connect failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
fprintf(stderr, "Client ns %s rank %d: PMIx_Connect succeeded\n", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Disconnect(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Disonnect failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
fprintf(stderr, "Client ns %s rank %d: PMIx_Disconnect succeeded\n", myproc.nspace, myproc.rank);
/* finally, test the resolve functions */
if (0 == myproc.rank) {
if (PMIX_SUCCESS != (rc = PMIx_Resolve_peers(hostname, NULL, &peers, &npeers))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers failed for nspace %s: %d\n", myproc.nspace, myproc.rank, nsp2, rc);
goto done;
}
if ((nprocs+ntmp) != npeers) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers returned incorrect npeers: %d vs %d\n", myproc.nspace, myproc.rank, (int)(nprocs+ntmp), (int)npeers);
goto done;
}
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers returned %d npeers\n", myproc.nspace, myproc.rank, (int)npeers);
if (PMIX_SUCCESS != (rc = PMIx_Resolve_nodes(nsp2, &nodelist))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_nodes failed for nspace %s: %d\n", myproc.nspace, myproc.rank, nsp2, rc);
goto done;
}
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_nodes %s", myproc.nspace, myproc.rank, nodelist);
} else {
if (PMIX_SUCCESS != (rc = PMIx_Resolve_peers(hostname, myproc.nspace, &peers, &npeers))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers failed for nspace %s: %d\n", myproc.nspace, myproc.rank, myproc.nspace, rc);
goto done;
}
if (nprocs != npeers) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers returned incorrect npeers: %d vs %d\n", myproc.nspace, myproc.rank, nprocs, (int)npeers);
goto done;
}
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers returned %d npeers\n", myproc.nspace, myproc.rank, (int)npeers);
if (PMIX_SUCCESS != (rc = PMIx_Resolve_nodes(myproc.nspace, &nodelist))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_nodes failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_nodes %s\n", myproc.nspace, myproc.rank, nodelist);
}
PMIX_PROC_FREE(peers, npeers);
free(nodelist);
done:
/* call fence to sync */
PMIX_PROC_CONSTRUCT(&proc);
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
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);
}
fflush(stderr);
return(0);
}

122
opal/mca/pmix/pmix120/pmix/examples/fault.c Обычный файл
Просмотреть файл

@ -0,0 +1,122 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <pmix.h>
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)
{
fprintf(stderr, "Client %s:%d NOTIFIED with status %d\n", myproc.nspace, myproc.rank, status);
completed = true;
}
static void op_callbk(pmix_status_t status,
void *cbdata)
{
fprintf(stderr, "client: OP CALLBACK CALLED WITH STATUS %d", status);
}
static void errhandler_reg_callbk (pmix_status_t status,
int errhandler_ref,
void *cbdata)
{
fprintf(stderr, "cleint: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%d",
status, errhandler_ref);
}
int main(int argc, char **argv)
{
int rc;
pmix_value_t value;
pmix_value_t *val = &value;
pmix_proc_t proc;
uint32_t nprocs;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
/* get our universe size */
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
nprocs = val->data.uint32;
PMIX_VALUE_RELEASE(val);
fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs);
completed = false;
/* register our errhandler */
PMIx_Register_errhandler(NULL, 0, notification_fn, errhandler_reg_callbk, NULL);
/* call fence to sync */
PMIX_PROC_CONSTRUCT(&proc);
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* rank=0 calls abort */
if (0 == myproc.rank) {
PMIx_Abort(PMIX_ERR_OUT_OF_RESOURCE, "Eat rocks",
&proc, 1);
fprintf(stderr, "Client ns %s rank %d: Abort called\n", myproc.nspace, myproc.rank);
}
/* everyone simply waits */
while (!completed) {
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 100000;
nanosleep(&ts, NULL);
}
done:
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
PMIx_Deregister_errhandler(0, op_callbk, NULL);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
} else {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);
}
fflush(stderr);
return(0);
}

164
opal/mca/pmix/pmix120/pmix/examples/pub.c Обычный файл
Просмотреть файл

@ -0,0 +1,164 @@
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <pmix.h>
int main(int argc, char **argv)
{
pmix_proc_t myproc;
int rc;
pmix_value_t value;
pmix_value_t *val = &value;
pmix_proc_t proc;
uint32_t nprocs;
pmix_info_t *info;
pmix_pdata_t *pdata;
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
exit(0);
}
fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
/* get our universe size */
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
nprocs = val->data.uint32;
PMIX_VALUE_RELEASE(val);
fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs);
/* call fence to ensure the data is received */
PMIX_PROC_CONSTRUCT(&proc);
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* publish something */
if (0 == myproc.rank) {
PMIX_INFO_CREATE(info, 2);
(void)strncpy(info[0].key, "FOOBAR", PMIX_MAX_KEYLEN);
info[0].value.type = PMIX_UINT8;
info[0].value.data.uint8 = 1;
(void)strncpy(info[1].key, "PANDA", PMIX_MAX_KEYLEN);
info[1].value.type = PMIX_SIZE;
info[1].value.data.size = 123456;
if (PMIX_SUCCESS != (rc = PMIx_Publish(info, 2))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Publish failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
PMIX_INFO_FREE(info, 2);
}
/* call fence again so all procs know the data
* has been published */
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* lookup something */
if (0 != myproc.rank) {
PMIX_PDATA_CREATE(pdata, 1);
(void)strncpy(pdata[0].key, "FOOBAR", PMIX_MAX_KEYLEN);
if (PMIX_SUCCESS != (rc = PMIx_Lookup(pdata, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Lookup failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
/* check the return for value and source */
if (0 != strncmp(myproc.nspace, pdata[0].proc.nspace, PMIX_MAX_NSLEN)) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Lookup returned wrong nspace: %s\n",
myproc.nspace, myproc.rank, pdata[0].proc.nspace);
goto done;
}
if (0 != pdata[0].proc.rank) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Lookup returned wrong rank: %d\n",
myproc.nspace, myproc.rank, pdata[0].proc.rank);
goto done;
}
if (PMIX_UINT8 != pdata[0].value.type) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Lookup returned wrong type: %d\n",
myproc.nspace, myproc.rank, pdata[0].value.type);
goto done;
}
if (1 != pdata[0].value.data.uint8) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Lookup returned wrong value: %d\n",
myproc.nspace, myproc.rank, (int)pdata[0].value.data.uint8);
goto done;
}
PMIX_PDATA_FREE(pdata, 1);
fprintf(stderr, "PUBLISH-LOOKUP SUCCEEDED\n");
}
/* call fence again so rank 0 waits before leaving */
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
if (0 == myproc.rank) {
char **keys;
keys = (char**)malloc(3 * sizeof(char*));
keys[0] = "FOOBAR";
keys[1] = "PANDA";
keys[2] = NULL;
if (PMIX_SUCCESS != (rc = PMIx_Unpublish(keys, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Unpublish failed: %d\n", myproc.nspace, myproc.rank, rc);
free(keys);
goto done;
}
free(keys);
fprintf(stderr, "UNPUBLISH SUCCEEDED\n");
}
/* call fence again so everyone waits for rank 0 before leaving */
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
goto done;
}
done:
/* finalize us */
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize())) {
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);
}
fflush(stderr);
return(0);
}

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

@ -0,0 +1,42 @@
#
# Copyright 2015 Intel, Inc. All rights reserved
#
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Only install the headers if we're in standalone mode
EXTRA_DIST += include/private/autogen/README.txt
if ! PMIX_EMBEDDED_MODE
include_HEADERS = \
include/pmix.h \
include/pmix_server.h \
include/pmi.h \
include/pmi2.h
headers += \
include/private/align.h \
include/private/hash_string.h \
include/private/pmix_socket_errno.h \
include/private/pmix_stdint.h \
include/private/prefetch.h \
include/private/types.h \
include/private/autogen/config.h
include_pmixdir = $(includedir)/pmix
include_pmix_HEADERS = \
include/pmix/rename.h \
include/pmix/pmix_common.h
include_pmix_autogendir = $(includedir)/pmix/autogen
include_pmix_autogen_HEADERS = \
include/pmix/autogen/pmix_config_top.h \
include/pmix/autogen/pmix_config_bottom.h
nodist_include_pmix_autogen_HEADERS = \
include/pmix/autogen/config.h
endif ! PMIX_EMBEDDED_MODE

829
opal/mca/pmix/pmix120/pmix/include/pmi.h Обычный файл
Просмотреть файл

@ -0,0 +1,829 @@
/*****************************************************************************\
* pmi.h - Process Management Interface for MPICH2
* See http://www-unix.mcs.anl.gov/mpi/mpich2/
*
* NOTE: Dynamic Process Management functions (PMI part 2) are not supported
* at this time. Functions required for MPI-1 (PMI part 1) are supported.
*****************************************************************************
* COPYRIGHT
*
* The following is a notice of limited availability of the code, and
* disclaimer which must be included in the prologue of the code and in all
* source listings of the code.
*
* Copyright Notice + 2002 University of Chicago
*
* Permission is hereby granted to use, reproduce, prepare derivative
* works, and to redistribute to others. This software was authored by:
*
* Argonne National Laboratory Group
* W. Gropp: (630) 252-4318; FAX: (630) 252-5986; e-mail: gropp@mcs.anl.gov
* E. Lusk: (630) 252-7852; FAX: (630) 252-5986; e-mail: lusk@mcs.anl.gov
* Mathematics and Computer Science Division Argonne National Laboratory,
* Argonne IL 60439
*
* GOVERNMENT LICENSE
*
* Portions of this material resulted from work developed under a U.S.
* Government Contract and are subject to the following license: the
* Government is granted for itself and others acting on its behalf a
* paid-up, nonexclusive, irrevocable worldwide license in this computer
* software to reproduce, prepare derivative works, and perform publicly
* and display publicly.
*
* DISCLAIMER
*
* This computer code material was prepared, in part, as an account of work
* sponsored by an agency of the United States Government. Neither the
* United States, nor the University of Chicago, nor any of their
* employees, makes any warranty express or implied, or assumes any legal
* liability or responsibility for the accuracy, completeness, or
* usefulness of any information, apparatus, product, or process disclosed,
* or represents that its use would not infringe privately owned rights.
*
* MCS Division <http://www.mcs.anl.gov> Argonne National Laboratory
* <http://www.anl.gov> University of Chicago <http://www.uchicago.edu>
\*****************************************************************************/
#ifndef PMI_H
#define PMI_H
/* prototypes for the PMI interface in MPICH2 */
#if defined(__cplusplus)
extern "C" {
#endif
/*D
PMI_CONSTANTS - PMI definitions
Error Codes:
+ PMI_SUCCESS - operation completed successfully
. PMI_FAIL - operation failed
. PMI_ERR_NOMEM - input buffer not large enough
. PMI_ERR_INIT - PMI not initialized
. PMI_ERR_INVALID_ARG - invalid argument
. PMI_ERR_INVALID_KEY - invalid key argument
. PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
. PMI_ERR_INVALID_VAL - invalid val argument
. PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
. PMI_ERR_INVALID_NUM_ARGS - invalid number of arguments
. PMI_ERR_INVALID_ARGS - invalid args argument
. PMI_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
. PMI_ERR_INVALID_KEYVALP - invalid keyvalp argument
- PMI_ERR_INVALID_SIZE - invalid size argument
Booleans:
+ PMI_TRUE - true
- PMI_FALSE - false
D*/
#define PMI_SUCCESS 0
#define PMI_FAIL -1
#define PMI_ERR_INIT 1
#define PMI_ERR_NOMEM 2
#define PMI_ERR_INVALID_ARG 3
#define PMI_ERR_INVALID_KEY 4
#define PMI_ERR_INVALID_KEY_LENGTH 5
#define PMI_ERR_INVALID_VAL 6
#define PMI_ERR_INVALID_VAL_LENGTH 7
#define PMI_ERR_INVALID_LENGTH 8
#define PMI_ERR_INVALID_NUM_ARGS 9
#define PMI_ERR_INVALID_ARGS 10
#define PMI_ERR_INVALID_NUM_PARSED 11
#define PMI_ERR_INVALID_KEYVALP 12
#define PMI_ERR_INVALID_SIZE 13
#define PMI_ERR_INVALID_KVS 14
typedef int PMI_BOOL;
#define PMI_TRUE 1
#define PMI_FALSE 0
/* PMI Group functions */
/*@
PMI_Init - initialize the Process Manager Interface
Output Parameter:
. spawned - spawned flag
Return values:
+ PMI_SUCCESS - initialization completed successfully
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - initialization failed
Notes:
Initialize PMI for this process group. The value of spawned indicates whether
this process was created by 'PMI_Spawn_multiple'. 'spawned' will be 'PMI_TRUE' if
this process group has a parent and 'PMI_FALSE' if it does not.
@*/
int PMI_Init( int *spawned );
/*@
PMI_Initialized - check if PMI has been initialized
Output Parameter:
. initialized - boolean value
Return values:
+ PMI_SUCCESS - initialized successfully set
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to set the variable
Notes:
On successful output, initialized will either be 'PMI_TRUE' or 'PMI_FALSE'.
+ PMI_TRUE - initialize has been called.
- PMI_FALSE - initialize has not been called or previously failed.
@*/
int PMI_Initialized( PMI_BOOL *initialized );
/*@
PMI_Finalize - finalize the Process Manager Interface
Return values:
+ PMI_SUCCESS - finalization completed successfully
- PMI_FAIL - finalization failed
Notes:
Finalize PMI for this process group.
@*/
int PMI_Finalize( void );
/*@
PMI_Get_size - obtain the size of the process group
Output Parameters:
. size - pointer to an integer that receives the size of the process group
Return values:
+ PMI_SUCCESS - size successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the size
Notes:
This function returns the size of the process group to which the local process
belongs.
@*/
int PMI_Get_size( int *size );
/*@
PMI_Get_rank - obtain the rank of the local process in the process group
Output Parameters:
. rank - pointer to an integer that receives the rank in the process group
Return values:
+ PMI_SUCCESS - rank successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the rank
Notes:
This function returns the rank of the local process in its process group.
@*/
int PMI_Get_rank( int *rank );
/*@
PMI_Get_universe_size - obtain the universe size
Output Parameters:
. size - pointer to an integer that receives the size
Return values:
+ PMI_SUCCESS - size successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the size
@*/
int PMI_Get_universe_size( int *size );
/*@
PMI_Get_appnum - obtain the application number
Output parameters:
. appnum - pointer to an integer that receives the appnum
Return values:
+ PMI_SUCCESS - appnum successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the size
@*/
int PMI_Get_appnum( int *appnum );
/*@
PMI_Publish_name - publish a name
Input parameters:
. service_name - string representing the service being published
. port - string representing the port on which to contact the service
Return values:
+ PMI_SUCCESS - port for service successfully published
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to publish service
@*/
int PMI_Publish_name( const char service_name[], const char port[] );
/*@
PMI_Unpublish_name - unpublish a name
Input parameters:
. service_name - string representing the service being unpublished
Return values:
+ PMI_SUCCESS - port for service successfully published
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to unpublish service
@*/
int PMI_Unpublish_name( const char service_name[] );
/*@
PMI_Lookup_name - lookup a service by name
Input parameters:
. service_name - string representing the service being published
Output parameters:
. port - string representing the port on which to contact the service
Return values:
+ PMI_SUCCESS - port for service successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to lookup service
@*/
int PMI_Lookup_name( const char service_name[], char port[] );
/*@
PMI_Get_id - obtain the id of the process group
Input Parameter:
. length - length of the id_str character array
Output Parameter:
. id_str - character array that receives the id of the process group
Return values:
+ PMI_SUCCESS - id successfully obtained
. PMI_ERR_INVALID_ARG - invalid rank argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
- PMI_FAIL - unable to return the id
Notes:
This function returns a string that uniquely identifies the process group
that the local process belongs to. The string passed in must be at least
as long as the number returned by 'PMI_Get_id_length_max()'.
@*/
int PMI_Get_id( char id_str[], int length );
/*@
PMI_Get_kvs_domain_id - obtain the id of the PMI domain
Input Parameter:
. length - length of id_str character array
Output Parameter:
. id_str - character array that receives the id of the PMI domain
Return values:
+ PMI_SUCCESS - id successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
- PMI_FAIL - unable to return the id
Notes:
This function returns a string that uniquely identifies the PMI domain
where keyval spaces can be shared. The string passed in must be at least
as long as the number returned by 'PMI_Get_id_length_max()'.
@*/
int PMI_Get_kvs_domain_id( char id_str[], int length );
/*@
PMI_Get_id_length_max - obtain the maximum length of an id string
Output Parameters:
. length - the maximum length of an id string
Return values:
+ PMI_SUCCESS - length successfully set
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the maximum length
Notes:
This function returns the maximum length of a process group id string.
@*/
int PMI_Get_id_length_max( int *length );
/*@
PMI_Barrier - barrier across the process group
Return values:
+ PMI_SUCCESS - barrier successfully finished
- PMI_FAIL - barrier failed
Notes:
This function is a collective call across all processes in the process group
the local process belongs to. It will not return until all the processes
have called 'PMI_Barrier()'.
@*/
int PMI_Barrier( void );
/*@
PMI_Get_clique_size - obtain the number of processes on the local node
Output Parameters:
. size - pointer to an integer that receives the size of the clique
Return values:
+ PMI_SUCCESS - size successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to return the clique size
Notes:
This function returns the number of processes in the local process group that
are on the local node along with the local process. This is a simple topology
function to distinguish between processes that can communicate through IPC
mechanisms (e.g., shared memory) and other network mechanisms.
@*/
int PMI_Get_clique_size( int *size );
/*@
PMI_Get_clique_ranks - get the ranks of the local processes in the process group
Input Parameters:
. length - length of the ranks array
Output Parameters:
. ranks - pointer to an array of integers that receive the local ranks
Return values:
+ PMI_SUCCESS - ranks successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
- PMI_FAIL - unable to return the ranks
Notes:
This function returns the ranks of the processes on the local node. The array
must be at least as large as the size returned by 'PMI_Get_clique_size()'. This
is a simple topology function to distinguish between processes that can
communicate through IPC mechanisms (e.g., shared memory) and other network
mechanisms.
@*/
int PMI_Get_clique_ranks( int ranks[], int length);
/*@
PMI_Abort - abort the process group associated with this process
Input Parameters:
+ exit_code - exit code to be returned by this process
- error_msg - error message to be printed
Return values:
. none - this function should not return
@*/
int PMI_Abort(int exit_code, const char error_msg[]);
/* PMI Keymap functions */
/*@
PMI_KVS_Get_my_name - obtain the name of the keyval space the local process group has access to
Input Parameters:
. length - length of the kvsname character array
Output Parameters:
. kvsname - a string that receives the keyval space name
Return values:
+ PMI_SUCCESS - kvsname successfully obtained
. PMI_ERR_INVALID_ARG - invalid argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
- PMI_FAIL - unable to return the kvsname
Notes:
This function returns the name of the keyval space that this process and all
other processes in the process group have access to. The output parameter,
kvsname, must be at least as long as the value returned by
'PMI_KVS_Get_name_length_max()'.
@*/
int PMI_KVS_Get_my_name( char kvsname[], int length );
/*@
PMI_KVS_Get_name_length_max - obtain the length necessary to store a kvsname
Output Parameter:
. length - maximum length required to hold a keyval space name
Return values:
+ PMI_SUCCESS - length successfully set
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to set the length
Notes:
This function returns the string length required to store a keyval space name.
A routine is used rather than setting a maximum value in 'pmi.h' to allow
different implementations of PMI to be used with the same executable. These
different implementations may allow different maximum lengths; by using a
routine here, we can interface with a variety of implementations of PMI.
@*/
int PMI_KVS_Get_name_length_max( int *length );
/*@
PMI_KVS_Get_key_length_max - obtain the length necessary to store a key
Output Parameter:
. length - maximum length required to hold a key string.
Return values:
+ PMI_SUCCESS - length successfully set
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to set the length
Notes:
This function returns the string length required to store a key.
@*/
int PMI_KVS_Get_key_length_max( int *length );
/*@
PMI_KVS_Get_value_length_max - obtain the length necessary to store a value
Output Parameter:
. length - maximum length required to hold a keyval space value
Return values:
+ PMI_SUCCESS - length successfully set
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to set the length
Notes:
This function returns the string length required to store a value from a
keyval space.
@*/
int PMI_KVS_Get_value_length_max( int *length );
/*@
PMI_KVS_Create - create a new keyval space
Input Parameter:
. length - length of the kvsname character array
Output Parameters:
. kvsname - a string that receives the keyval space name
Return values:
+ PMI_SUCCESS - keyval space successfully created
. PMI_ERR_INVALID_ARG - invalid argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
- PMI_FAIL - unable to create a new keyval space
Notes:
This function creates a new keyval space. Everyone in the same process group
can access this keyval space by the name returned by this function. The
function is not collective. Only one process calls this function. The output
parameter, kvsname, must be at least as long as the value returned by
'PMI_KVS_Get_name_length_max()'.
@*/
int PMI_KVS_Create( char kvsname[], int length );
/*@
PMI_KVS_Destroy - destroy keyval space
Input Parameters:
. kvsname - keyval space name
Return values:
+ PMI_SUCCESS - keyval space successfully destroyed
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - unable to destroy the keyval space
Notes:
This function destroys a keyval space created by 'PMI_KVS_Create()'.
@*/
int PMI_KVS_Destroy( const char kvsname[] );
/*@
PMI_KVS_Put - put a key/value pair in a keyval space
Input Parameters:
+ kvsname - keyval space name
. key - key
- value - value
Return values:
+ PMI_SUCCESS - keyval pair successfully put in keyval space
. PMI_ERR_INVALID_KVS - invalid kvsname argument
. PMI_ERR_INVALID_KEY - invalid key argument
. PMI_ERR_INVALID_VAL - invalid val argument
- PMI_FAIL - put failed
Notes:
This function puts the key/value pair in the specified keyval space. The
value is not visible to other processes until 'PMI_KVS_Commit()' is called.
The function may complete locally. After 'PMI_KVS_Commit()' is called, the
value may be retrieved by calling 'PMI_KVS_Get()'. All keys put to a keyval
space must be unique to the keyval space. You may not put more than once
with the same key.
@*/
int PMI_KVS_Put( const char kvsname[], const char key[], const char value[]);
/*@
PMI_KVS_Commit - commit all previous puts to the keyval space
Input Parameters:
. kvsname - keyval space name
Return values:
+ PMI_SUCCESS - commit succeeded
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - commit failed
Notes:
This function commits all previous puts since the last 'PMI_KVS_Commit()' into
the specified keyval space. It is a process local operation.
@*/
int PMI_KVS_Commit( const char kvsname[] );
/*@
PMI_KVS_Get - get a key/value pair from a keyval space
Input Parameters:
+ kvsname - keyval space name
. key - key
- length - length of value character array
Output Parameters:
. value - value
Return values:
+ PMI_SUCCESS - get succeeded
. PMI_ERR_INVALID_KVS - invalid kvsname argument
. PMI_ERR_INVALID_KEY - invalid key argument
. PMI_ERR_INVALID_VAL - invalid val argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
- PMI_FAIL - get failed
Notes:
This function gets the value of the specified key in the keyval space.
@*/
int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int length);
/*@
PMI_KVS_Iter_first - initialize the iterator and get the first value
Input Parameters:
+ kvsname - keyval space name
. key_len - length of key character array
- val_len - length of val character array
Output Parameters:
+ key - key
- value - value
Return values:
+ PMI_SUCCESS - keyval pair successfully retrieved from the keyval space
. PMI_ERR_INVALID_KVS - invalid kvsname argument
. PMI_ERR_INVALID_KEY - invalid key argument
. PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
. PMI_ERR_INVALID_VAL - invalid val argument
. PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
- PMI_FAIL - failed to initialize the iterator and get the first keyval pair
Notes:
This function initializes the iterator for the specified keyval space and
retrieves the first key/val pair. The end of the keyval space is specified
by returning an empty key string. key and val must be at least as long as
the values returned by 'PMI_KVS_Get_key_length_max()' and
'PMI_KVS_Get_value_length_max()'.
@*/
int PMI_KVS_Iter_first(const char kvsname[], char key[], int key_len, char val[], int val_len);
/*@
PMI_KVS_Iter_next - get the next keyval pair from the keyval space
Input Parameters:
+ kvsname - keyval space name
. key_len - length of key character array
- val_len - length of val character array
Output Parameters:
+ key - key
- value - value
Return values:
+ PMI_SUCCESS - keyval pair successfully retrieved from the keyval space
. PMI_ERR_INVALID_KVS - invalid kvsname argument
. PMI_ERR_INVALID_KEY - invalid key argument
. PMI_ERR_INVALID_KEY_LENGTH - invalid key length argument
. PMI_ERR_INVALID_VAL - invalid val argument
. PMI_ERR_INVALID_VAL_LENGTH - invalid val length argument
- PMI_FAIL - failed to get the next keyval pair
Notes:
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
'PMI_KVS_Get_key_length_max()' and 'PMI_KVS_Get_value_length_max()'.
@*/
int PMI_KVS_Iter_next(const char kvsname[], char key[], int key_len, char val[], int val_len);
/* PMI Process Creation functions */
/*S
PMI_keyval_t - keyval structure used by PMI_Spawn_mulitiple
Fields:
+ key - name of the key
- val - value of the key
S*/
typedef struct PMI_keyval_t
{
char * key;
char * val;
} PMI_keyval_t;
/*@
PMI_Spawn_multiple - spawn a new set of processes
Input Parameters:
+ count - count of commands
. cmds - array of command strings
. argvs - array of argv arrays for each command string
. maxprocs - array of maximum processes to spawn for each command string
. info_keyval_sizes - array giving the number of elements in each of the
'info_keyval_vectors'
. info_keyval_vectors - array of keyval vector arrays
. preput_keyval_size - Number of elements in 'preput_keyval_vector'
- preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space
Output Parameter:
. errors - array of errors for each command
Return values:
+ PMI_SUCCESS - spawn successful
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - spawn failed
Notes:
This function spawns a set of processes into a new process group. The 'count'
field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs',
'info_keyval_sizes' and 'info_keyval_vectors'. The 'preput_keyval_size' refers
to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector'
contains keyval pairs that will be put in the keyval space of the newly
created process group before the processes are started. The 'maxprocs' array
specifies the desired number of processes to create for each 'cmd' string.
The actual number of processes may be less than the numbers specified in
maxprocs. The acceptable number of processes spawned may be controlled by
``soft'' keyvals in the info arrays. The ``soft'' option is specified by
mpiexec in the MPI-2 standard. Environment variables may be passed to the
spawned processes through PMI implementation specific 'info_keyval' parameters.
@*/
int PMI_Spawn_multiple(int count,
const char * cmds[],
const char ** argvs[],
const int maxprocs[],
const int info_keyval_sizesp[],
const PMI_keyval_t * info_keyval_vectors[],
int preput_keyval_size,
const PMI_keyval_t preput_keyval_vector[],
int errors[]);
/*@
PMI_Parse_option - create keyval structures from a single command line argument
Input Parameters:
+ num_args - length of args array
- args - array of command line arguments starting with the argument to be parsed
Output Parameters:
+ num_parsed - number of elements of the argument array parsed
. keyvalp - pointer to an array of keyvals
- size - size of the allocated array
Return values:
+ PMI_SUCCESS - success
. PMI_ERR_INVALID_NUM_ARGS - invalid number of arguments
. PMI_ERR_INVALID_ARGS - invalid args argument
. PMI_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
. PMI_ERR_INVALID_KEYVALP - invalid keyvalp argument
. PMI_ERR_INVALID_SIZE - invalid size argument
- PMI_FAIL - fail
Notes:
This function removes one PMI specific argument from the command line and
creates the corresponding 'PMI_keyval_t' structure for it. It returns
an array and size to the caller. The array must be freed by 'PMI_Free_keyvals()'.
If the first element of the args array is not a PMI specific argument, the function
returns success and sets num_parsed to zero. If there are multiple PMI specific
arguments in the args array, this function may parse more than one argument as long
as the options are contiguous in the args array.
@*/
int PMI_Parse_option(int num_args, char *args[], int *num_parsed, PMI_keyval_t **keyvalp, int *size);
/*@
PMI_Args_to_keyval - create keyval structures from command line arguments
Input Parameters:
+ argcp - pointer to argc
- argvp - pointer to argv
Output Parameters:
+ keyvalp - pointer to an array of keyvals
- size - size of the allocated array
Return values:
+ PMI_SUCCESS - success
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - fail
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
not be used to free this array as there is no requirement that the array be
allocated with 'malloc()'.
@*/
int PMI_Args_to_keyval(int *argcp, char *((*argvp)[]), PMI_keyval_t **keyvalp, int *size);
/*@
PMI_Free_keyvals - free the keyval structures created by PMI_Args_to_keyval
Input Parameters:
+ keyvalp - array of keyvals
- size - size of the array
Return values:
+ PMI_SUCCESS - success
. PMI_ERR_INVALID_ARG - invalid argument
- PMI_FAIL - fail
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
allocation of storage or to use interal storage as it sees fit.
@*/
int PMI_Free_keyvals(PMI_keyval_t keyvalp[], int size);
/*@
PMI_Get_options - get a string of command line argument descriptions that may be printed to the user
Input Parameters:
. length - length of str
Output Parameters:
+ str - description string
- length - length of string or necessary length if input is not large enough
Return values:
+ PMI_SUCCESS - success
. PMI_ERR_INVALID_ARG - invalid argument
. PMI_ERR_INVALID_LENGTH - invalid length argument
. PMI_ERR_NOMEM - input length too small
- PMI_FAIL - fail
Notes:
This function returns the command line options specific to the pmi implementation
@*/
int PMI_Get_options(char *str, int *length);
#if defined(__cplusplus)
}
#endif
#endif

562
opal/mca/pmix/pmix120/pmix/include/pmi2.h Обычный файл
Просмотреть файл

@ -0,0 +1,562 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2007 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef PMI2_H_INCLUDED
#define PMI2_H_INCLUDED
#define PMI2_MAX_KEYLEN 64
#define PMI2_MAX_VALLEN 1024
#define PMI2_MAX_ATTRVALUE 1024
#define PMI2_ID_NULL -1
#if defined(__cplusplus)
extern "C" {
#endif
/*D
PMI2_CONSTANTS - PMI2 definitions
Error Codes:
+ PMI2_SUCCESS - operation completed successfully
. PMI2_FAIL - operation failed
. PMI2_ERR_NOMEM - input buffer not large enough
. PMI2_ERR_INIT - PMI not initialized
. PMI2_ERR_INVALID_ARG - invalid argument
. PMI2_ERR_INVALID_KEY - invalid key argument
. PMI2_ERR_INVALID_KEY_LENGTH - invalid key length argument
. PMI2_ERR_INVALID_VAL - invalid val argument
. PMI2_ERR_INVALID_VAL_LENGTH - invalid val length argument
. PMI2_ERR_INVALID_LENGTH - invalid length argument
. PMI2_ERR_INVALID_NUM_ARGS - invalid number of arguments
. PMI2_ERR_INVALID_ARGS - invalid args argument
. PMI2_ERR_INVALID_NUM_PARSED - invalid num_parsed length argument
. PMI2_ERR_INVALID_KEYVALP - invalid keyvalp argument
. PMI2_ERR_INVALID_SIZE - invalid size argument
- PMI2_ERR_OTHER - other unspecified error
D*/
#define PMI2_SUCCESS 0
#define PMI2_FAIL -1
#define PMI2_ERR_INIT 1
#define PMI2_ERR_NOMEM 2
#define PMI2_ERR_INVALID_ARG 3
#define PMI2_ERR_INVALID_KEY 4
#define PMI2_ERR_INVALID_KEY_LENGTH 5
#define PMI2_ERR_INVALID_VAL 6
#define PMI2_ERR_INVALID_VAL_LENGTH 7
#define PMI2_ERR_INVALID_LENGTH 8
#define PMI2_ERR_INVALID_NUM_ARGS 9
#define PMI2_ERR_INVALID_ARGS 10
#define PMI2_ERR_INVALID_NUM_PARSED 11
#define PMI2_ERR_INVALID_KEYVALP 12
#define PMI2_ERR_INVALID_SIZE 13
#define PMI2_ERR_OTHER 14
/* This is here to allow spawn multiple functions to compile. This
needs to be removed once those functions are fixed for pmi2 */
typedef struct PMI_keyval_t
{
char * key;
char * val;
} PMI_keyval_t;
/*@
PMI2_Connect_comm_t - connection structure used when connecting to other jobs
Fields:
+ read - Read from a connection to the leader of the job to which
this process will be connecting. Returns 0 on success or an MPI
error code on failure.
. write - Write to a connection to the leader of the job to which
this process will be connecting. Returns 0 on success or an MPI
error code on failure.
. ctx - An anonymous pointer to data that may be used by the read
and write members.
- isMaster - Indicates which process is the "master"; may have the
values 1 (is the master), 0 (is not the master), or -1 (neither is
designated as the master). The two processes must agree on which
process is the master, or both must select -1 (neither is the
master).
Notes:
A typical implementation of these functions will use the read and
write calls on a pre-established file descriptor (fd) between the
two leading processes. This will be needed only if the PMI server
cannot access the KVS spaces of another job (this may happen, for
example, if each mpiexec creates the KVS spaces for the processes
that it manages).
@*/
typedef struct PMI2_Connect_comm {
int (*read)( void *buf, int maxlen, void *ctx );
int (*write)( const void *buf, int len, void *ctx );
void *ctx;
int isMaster;
} PMI2_Connect_comm_t;
/*@
PMI2_Init - initialize the Process Manager Interface
Output Parameter:
+ spawned - spawned flag
. size - number of processes in the job
. rank - rank of this process in the job
- appnum - which executable is this on the mpiexec commandline
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes:
Initialize PMI for this process group. The value of spawned indicates whether
this process was created by 'PMI2_Spawn_multiple'. 'spawned' will be non-zero
iff this process group has a parent.
@*/
int PMI2_Init(int *spawned, int *size, int *rank, int *appnum);
/*@
PMI2_Finalize - finalize the Process Manager Interface
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes:
Finalize PMI for this job.
@*/
int PMI2_Finalize(void);
/*@
PMI2_Initialized - check if PMI has been initialized
Return values:
Non-zero if PMI2_Initialize has been called successfully, zero otherwise.
@*/
int PMI2_Initialized(void);
/*@
PMI2_Abort - abort the process group associated with this process
Input Parameters:
+ flag - non-zero if all processes in this job should abort, zero otherwise
- error_msg - error message to be printed
Return values:
If the abort succeeds this function will not return. Returns an MPI
error code otherwise.
@*/
int PMI2_Abort(int flag, const char msg[]);
/*@
PMI2_Spawn - spawn a new set of processes
Input Parameters:
+ count - count of commands
. cmds - array of command strings
. argcs - size of argv arrays for each command string
. argvs - array of argv arrays for each command string
. maxprocs - array of maximum processes to spawn for each command string
. info_keyval_sizes - array giving the number of elements in each of the
'info_keyval_vectors'
. info_keyval_vectors - array of keyval vector arrays
. preput_keyval_size - Number of elements in 'preput_keyval_vector'
. preput_keyval_vector - array of keyvals to be pre-put in the spawned keyval space
- jobIdSize - size of the buffer provided in jobId
Output Parameter:
+ jobId - job id of the spawned processes
- errors - array of errors for each command
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes:
This function spawns a set of processes into a new job. The 'count'
field refers to the size of the array parameters - 'cmd', 'argvs', 'maxprocs',
'info_keyval_sizes' and 'info_keyval_vectors'. The 'preput_keyval_size' refers
to the size of the 'preput_keyval_vector' array. The 'preput_keyval_vector'
contains keyval pairs that will be put in the keyval space of the newly
created job before the processes are started. The 'maxprocs' array
specifies the desired number of processes to create for each 'cmd' string.
The actual number of processes may be less than the numbers specified in
maxprocs. The acceptable number of processes spawned may be controlled by
``soft'' keyvals in the info arrays. The ``soft'' option is specified by
mpiexec in the MPI-2 standard. Environment variables may be passed to the
spawned processes through PMI implementation specific 'info_keyval' parameters.
@*/
int PMI2_Job_Spawn(int count, const char * cmds[],
int argcs[], const char ** argvs[],
const int maxprocs[],
const int info_keyval_sizes[],
const PMI_keyval_t *info_keyval_vectors[],
int preput_keyval_size,
const PMI_keyval_t *preput_keyval_vector[],
char jobId[], int jobIdSize,
int errors[]);
/*@
PMI2_Job_GetId - get job id of this job
Input parameters:
. jobid_size - size of buffer provided in jobid
Output parameters:
. jobid - the job id of this job
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Job_GetId(char jobid[], int jobid_size);
/*@
PMI2_Job_GetRank - get rank of this job
Output parameters:
. rank - the rank of this job
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Job_GetRank(int* rank);
/*@
PMI2_Info_GetSize - get the number of processes on the node
Output parameters:
. rank - the rank of this job
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Info_GetSize(int* size);
/*@
PMI2_Job_Connect - connect to the parallel job with ID jobid
Input parameters:
. jobid - job id of the job to connect to
Output parameters:
. conn - connection structure used to exteblish communication with
the remote job
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes:
This just "registers" the other parallel job as part of a parallel
program, and is used in the PMI2_KVS_xxx routines (see below). This
is not a collective call and establishes a connection between all
processes that are connected to the calling processes (on the one
side) and that are connected to the named jobId on the other
side. Processes that are already connected may call this routine.
@*/
int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn);
/*@
PMI2_Job_Disconnect - disconnects from the job with ID jobid
Input parameters:
. jobid - job id of the job to connect to
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Job_Disconnect(const char jobid[]);
/*@
PMI2_KVS_Put - put a key/value pair in the keyval space for this job
Input Parameters:
+ key - key
- value - value
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes:
If multiple PMI2_KVS_Put calls are made with the same key between
calls to PMI2_KVS_Fence, the behavior is undefined. That is, the
value returned by PMI2_KVS_Get for that key after the PMI2_KVS_Fence
is not defined.
@*/
int PMI2_KVS_Put(const char key[], const char value[]);
/*@
PMI2_KVS_Fence - commit all PMI2_KVS_Put calls made before this fence
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes:
This is a collective call across the job. It has semantics that are
similar to those for MPI_Win_fence and hence is most easily
implemented as a barrier across all of the processes in the job.
Specifically, all PMI2_KVS_Put operations performed by any process in
the same job must be visible to all processes (by using PMI2_KVS_Get)
after PMI2_KVS_Fence completes. However, a PMI implementation could
make this a lazy operation by not waiting for all processes to enter
their corresponding PMI2_KVS_Fence until some process issues a
PMI2_KVS_Get. This might be appropriate for some wide-area
implementations.
@*/
int PMI2_KVS_Fence(void);
/*@
PMI2_KVS_Get - returns the value associated with key in the key-value
space associated with the job ID jobid
Input Parameters:
+ jobid - the job id identifying the key-value space in which to look
for key. If jobid is NULL, look in the key-value space of this job.
. src_pmi_id - the pmi id of the process which put this keypair. This
is just a hint to the server. PMI2_ID_NULL should be passed if no
hint is provided.
. key - key
- maxvalue - size of the buffer provided in value
Output Parameters:
+ value - value associated with key
- vallen - length of the returned value, or, if the length is longer
than maxvalue, the negative of the required length is returned
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_KVS_Get(const char *jobid, int src_pmi_id, const char key[], char value [], int maxvalue, int *vallen);
/*@
PMI2_Info_GetNodeAttr - returns the value of the attribute associated
with this node
Input Parameters:
+ name - name of the node attribute
. valuelen - size of the buffer provided in value
- waitfor - if non-zero, the function will not return until the
attribute is available
Output Parameters:
+ value - value of the attribute
- found - non-zero indicates that the attribute was found
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes:
This provides a way, when combined with PMI2_Info_PutNodeAttr, for
processes on the same node to share information without requiring a
more general barrier across the entire job.
If waitfor is non-zero, the function will never return with found
set to zero.
Predefined attributes:
+ memPoolType - If the process manager allocated a shared memory
pool for the MPI processes in this job and on this node, return
the type of that pool. Types include sysv, anonmmap and ntshm.
. memSYSVid - Return the SYSV memory segment id if the memory pool
type is sysv. Returned as a string.
. memAnonMMAPfd - Return the FD of the anonymous mmap segment. The
FD is returned as a string.
- memNTName - Return the name of the Windows NT shared memory
segment, file mapping object backed by system paging
file. Returned as a string.
@*/
int PMI2_Info_GetNodeAttr(const char name[], char value[], int valuelen, int *found, int waitfor);
/*@
PMI2_Info_GetNodeAttrIntArray - returns the value of the attribute associated
with this node. The value must be an array of integers.
Input Parameters:
+ name - name of the node attribute
- arraylen - number of elements in array
Output Parameters:
+ array - value of attribute
. outlen - number of elements returned
- found - non-zero if attribute was found
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes:
Notice that, unlike PMI2_Info_GetNodeAttr, this function does not
have a waitfor parameter, and will return immediately with found=0
if the attribute was not found.
Predefined array attribute names:
+ localRanksCount - Return the number of local ranks that will be
returned by the key localRanks.
. localRanks - Return the ranks in MPI_COMM_WORLD of the processes
that are running on this node.
- cartCoords - Return the Cartesian coordinates of this process in
the underlying network topology. The coordinates are indexed from
zero. Value only if the Job attribute for physTopology includes
cartesian.
@*/
int PMI2_Info_GetNodeAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found);
/*@
PMI2_Info_PutNodeAttr - stores the value of the named attribute
associated with this node
Input Parameters:
+ name - name of the node attribute
- value - the value of the attribute
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Notes:
For example, it might be used to share segment ids with other
processes on the same SMP node.
@*/
int PMI2_Info_PutNodeAttr(const char name[], const char value[]);
/*@
PMI2_Info_GetJobAttr - returns the value of the attribute associated
with this job
Input Parameters:
+ name - name of the job attribute
- valuelen - size of the buffer provided in value
Output Parameters:
+ value - value of the attribute
- found - non-zero indicates that the attribute was found
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Info_GetJobAttr(const char name[], char value[], int valuelen, int *found);
/*@
PMI2_Info_GetJobAttrIntArray - returns the value of the attribute associated
with this job. The value must be an array of integers.
Input Parameters:
+ name - name of the job attribute
- arraylen - number of elements in array
Output Parameters:
+ array - value of attribute
. outlen - number of elements returned
- found - non-zero if attribute was found
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
Predefined array attribute names:
+ universeSize - The size of the "universe" (defined for the MPI
attribute MPI_UNIVERSE_SIZE
. hasNameServ - The value hasNameServ is true if the PMI2 environment
supports the name service operations (publish, lookup, and
unpublish).
. physTopology - Return the topology of the underlying network. The
valid topology types include cartesian, hierarchical, complete,
kautz, hypercube; additional types may be added as necessary. If
the type is hierarchical, then additional attributes may be
queried to determine the details of the topology. For example, a
typical cluster has a hierarchical physical topology, consisting
of two levels of complete networks - the switched Ethernet or
Infiniband and the SMP nodes. Other systems, such as IBM BlueGene,
have one level that is cartesian (and in virtual node mode, have a
single-level physical topology).
. physTopologyLevels - Return a string describing the topology type
for each level of the underlying network. Only valid if the
physTopology is hierarchical. The value is a comma-separated list
of physical topology types (except for hierarchical). The levels
are ordered starting at the top, with the network closest to the
processes last. The lower level networks may connect only a subset
of processes. For example, for a cartesian mesh of SMPs, the value
is cartesian,complete. All processes are connected by the
cartesian part of this, but for each complete network, only the
processes on the same node are connected.
. cartDims - Return a string of comma-separated values describing
the dimensions of the Cartesian topology. This must be consistent
with the value of cartCoords that may be returned by
PMI2_Info_GetNodeAttrIntArray.
These job attributes are just a start, but they provide both an
example of the sort of external data that is available through the
PMI interface and how extensions can be added within the same API
and wire protocol. For example, adding more complex network
topologies requires only adding new keys, not new routines.
. isHeterogeneous - The value isHeterogeneous is true if the
processes belonging to the job are running on nodes with different
underlying data models.
@*/
int PMI2_Info_GetJobAttrIntArray(const char name[], int array[], int arraylen, int *outlen, int *found);
/*@
PMI2_Nameserv_publish - publish a name
Input parameters:
+ service_name - string representing the service being published
. info_ptr -
- port - string representing the port on which to contact the service
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Nameserv_publish(const char service_name[], const PMI_keyval_t *info_ptr, const char port[]);
/*@
PMI2_Nameserv_lookup - lookup a service by name
Input parameters:
+ service_name - string representing the service being published
. info_ptr -
- portLen - size of buffer provided in port
Output parameters:
. port - string representing the port on which to contact the service
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Nameserv_lookup(const char service_name[], const PMI_keyval_t *info_ptr,
char port[], int portLen);
/*@
PMI2_Nameserv_unpublish - unpublish a name
Input parameters:
+ service_name - string representing the service being unpublished
- info_ptr -
Return values:
Returns 'PMI2_SUCCESS' on success and an PMI error code on failure.
@*/
int PMI2_Nameserv_unpublish(const char service_name[],
const PMI_keyval_t *info_ptr);
#if defined(__cplusplus)
}
#endif
#endif /* PMI2_H_INCLUDED */

401
opal/mca/pmix/pmix120/pmix/include/pmix.h Обычный файл
Просмотреть файл

@ -0,0 +1,401 @@
/*
* Copyright (c) 2013-2015 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
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer listed
* in this license in the documentation and/or other materials
* provided with the distribution.
*
* - Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* The copyright holders provide no reassurances that the source code
* provided does not infringe any patent, copyright, or any other
* intellectual property rights of third parties. The copyright holders
* disclaim any liability to any recipient for claims brought against
* recipient by any third party for infringement of that parties
* intellectual property rights.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIx_H
#define PMIx_H
#include <pmix/autogen/config.h>
#include <stdint.h>
#include <string.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* for struct timeval */
#endif
/* Symbol transforms */
#include <pmix/rename.h>
/* Structure and constant definitions */
#include <pmix/pmix_common.h>
BEGIN_C_DECLS
/**** PMIX API ****/
/* Initialize the PMIx client, returning the process identifier assigned
* to this client's application in the provided pmix_proc_t struct.
* Passing a parameter of _NULL_ for this parameter is allowed if the user
* wishes solely to initialize the PMIx system and does not require
* return of the identifier at that time.
*
* When called the PMIx client will check for the required connection
* information of the local PMIx server and will establish the connection.
* If the information is not found, or the server connection fails, then
* an appropriate error constant will be returned.
*
* If successful, the function will return PMIX_SUCCESS and will fill the
* provided structure with the server-assigned namespace and rank of the
* process within the application.
*
* 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);
/* 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);
/* 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);
/* Request that the provided array of procs be aborted, returning the
* provided _status_ and printing the provided message. A _NULL_
* for the proc array indicates that all processes in the caller's
* nspace are to be aborted.
*
* The response to this request is somewhat dependent on the specific resource
* manager and its configuration (e.g., some resource managers will
* not abort the application if the provided _status_ is zero unless
* specifically configured to do so), and thus lies outside the control
* of PMIx itself. However, the client will inform the RM of
* the request that the application be aborted, regardless of the
* value of the provided _status_.
*
* Passing a _NULL_ msg parameter is allowed. Note that race conditions
* 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);
/* 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);
/* 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);
/* Execute a blocking barrier across the processes identified in the
* specified array. Passing a _NULL_ pointer as the _procs_ parameter
* indicates that the barrier is to span all processes in the client's
* namespace. Each provided pmix_proc_t struct can pass PMIX_RANK_WILDCARD to
* indicate that all processes in the given namespace are
* participating.
*
* The info array is used to pass user requests regarding the fence
* operation. This can include:
*
* (a) PMIX_COLLECT_DATA - a boolean indicating whether or not the barrier
* operation is to return the _put_ data from all participating processes.
* A value of _false_ indicates that the callback is just used as a release
* and no data is to be returned at that time. A value of _true_ indicates
* that all _put_ data is to be collected by the barrier. Returned data is
* cached at the server to reduce memory footprint, and can be retrieved
* as needed by calls to PMIx_Get(nb).
*
* Note that for scalability reasons, the default behavior for PMIx_Fence
* is to _not_ collect the data.
*
* (b) PMIX_COLLECTIVE_ALGO - a comma-delimited string indicating the algos
* to be used for executing the barrier, in priority order.
*
* (c) PMIX_COLLECTIVE_ALGO_REQD - instructs the host RM that it should return
* an error if none of the specified algos are available. Otherwise, the RM
* is to use one of the algos if possible, but is otherwise free to use any
* of its available methods to execute the operation.
*
* (d) PMIX_TIMEOUT - maximum time for the fence to execute before declaring
* an error. By default, the RM shall terminate the operation and notify participants
* if one or more of the indicated procs fails during the fence. However,
* 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);
/* 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);
/* Retrieve information for the specified _key_ as published by the process
* identified in the given pmix_proc_t, returning a pointer to the value in the
* given address.
*
* This is a blocking operation - the caller will block until
* the specified data has been _PMIx_Put_ by the specified rank. The caller is
* responsible for freeing all memory associated with the returned value when
* no longer required.
*
* The info array is used to pass user requests regarding the get
* operation. This can include:
*
* (a) PMIX_TIMEOUT - maximum time for the get to execute before declaring
* 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);
/* 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);
/* Publish the data in the info array for lookup. By default,
* the data will be published into the PMIX_SESSION range and
* with PMIX_PERSIST_APP persistence. Changes to those values,
* and any additional directives, can be included in the pmix_info_t
* array.
*
* Note that the keys must be unique within the specified
* data range or else an error will be returned (first published
* wins). Attempts to access the data by procs outside of
* the provided data range will be rejected.
*
* The persistence parameter instructs the server as to how long
* the data is to be retained.
*
* The blocking form will block until the server confirms that the
* data has been posted and is available. The non-blocking form will
* 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);
/* Lookup information published by this or another process. By default,
* the search will be conducted across the PMIX_SESSION range. Changes
* to the range, and any additional directives, can be provided
* in the pmix_info_t array. Note that the search is also constrained
* to only data published by the current user ID - i.e., the search
* will not return data published by an application being executed
* by another user. There currently is no option to override this
* behavior - such an option may become available later via an
* appropriate pmix_info_t directive.
*
* The "data" parameter consists of an array of pmix_pdata_t struct with the
* keys specifying the requested information. Data will be returned
* for each key in the associated info struct - any key that cannot
* be found will return with a data type of "PMIX_UNDEF". The function
* will return SUCCESS if _any_ values can be found, so the caller
* must check each data element to ensure it was returned.
*
* The proc field in each pmix_pdata_t struct will contain the
* nspace/rank of the process that published the data.
*
* Note: although this is a blocking function, it will _not_ wait
* by default for the requested data to be published. Instead, it
* will block for the time required by the server to lookup its current
* data and return any found items. Thus, the caller is responsible for
* ensuring that data is published prior to executing a lookup, or
* for retrying until the requested data is found
*
* Optionally, the info array can be used to modify this behavior
* by including:
*
* (a) PMIX_WAIT - wait for the requested data to be published. The
* server is to wait until all data has become available.
*
* (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);
/* Non-blocking form of the _PMIx_Lookup_ function. Data for
* the provided NULL-terminated keys array will be returned
* in the provided callback function. As above, the default
* 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);
/* Unpublish data posted by this process using the given keys.
* The function will block until the data has been removed by
* the server. A value of _NULL_ for the keys parameter instructs
* the server to remove _all_ data published by this process.
*
* 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);
/* 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);
/* Spawn a new job. The assigned namespace of the spawned applications
* is returned in the nspace parameter - a _NULL_ value in that
* location indicates that the caller doesn't wish to have the
* namespace returned. The nspace array must be at least of size
* PMIX_MAX_NSLEN+1. Behavior of individual resource managers
* may differ, but it is expected that failure of any application
* process to start will result in termination/cleanup of _all_
* processes in the newly spawned job and return of an error
* code to the caller.
*
* By default, the spawned processes will be PMIx "connected" to
* the parent process upon successful launch (see PMIx_Connect
* description for details). Note that this only means that the
* parent process (a) will be given a copy of the new job's
* information so it can query job-level info without
* incurring any communication penalties, and (b) will receive
* notification of errors from process in the child job.
*
* Job-level directives can be specified in the job_info array. This
* can include:
*
* (a) PMIX_NON_PMI - processes in the spawned job will
* not be calling PMIx_Init
*
* (b) PMIX_TIMEOUT - declare the spawn as having failed if the launched
* procs do not call PMIx_Init within the specified time
*
* (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[]);
/* 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);
/* Record the specified processes as "connected". Both blocking and non-blocking
* versions are provided. This means that the resource manager should treat the
* failure of any process in the specified group as a reportable event, and take
* appropriate action. Note that different resource managers may respond to
* failures in different manners.
*
* The callback function is to be called once all participating processes have
* called connect. The server is required to return any job-level info for the
* connecting processes that might not already have - i.e., if the connect
* request involves procs from different nspaces, then each proc shall receive
* the job-level info from those nspaces other than their own.
*
* Note: a process can only engage in _one_ connect operation involving the identical
* set of processes at a time. However, a process _can_ be simultaneously engaged
* in multiple connect operations, each involving a different set of processes
*
* As in the case of the fence operation, the info array can be used to pass
* 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_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
* may be involved in multiple simultaneous disconnect operations. However, a process
* 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_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
* be returned. If the specified node does not currently host any processes,
* then the returned array will be NULL, and nprocs=0. The caller is responsible
* 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);
/* 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);
END_C_DECLS
#endif

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

@ -0,0 +1,197 @@
/* -*- c -*-
* Copyright © 2009 CNRS
* Copyright © 2009-2014 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
/* The configuration file */
#ifndef PMIX_PUBLIC_CONFIG_H
#define PMIX_PUBLIC_CONFIG_H
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
# define __pmix_restrict __restrict
#else
# if __STDC_VERSION__ >= 199901L
# define __pmix_restrict restrict
# else
# define __pmix_restrict
# endif
#endif
/* Note that if we're compiling C++, then just use the "inline"
keyword, since it's part of C++ */
#if defined(c_plusplus) || defined(__cplusplus)
# define __pmix_inline inline
#elif defined(_MSC_VER) || defined(__HP_cc)
# define __pmix_inline __inline
#else
# define __pmix_inline __inline__
#endif
/*
* Note: this is public. We can not assume anything from the compiler used
* by the application and thus the PMIX_HAVE_* macros below are not
* fetched from the autoconf result here. We only automatically use a few
* well-known easy cases.
*/
/* Some handy constants to make the logic below a little more readable */
#if defined(__cplusplus) && \
(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR >= 4))
#define GXX_ABOVE_3_4 1
#else
#define GXX_ABOVE_3_4 0
#endif
#if !defined(__cplusplus) && \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
#define GCC_ABOVE_2_95 1
#else
#define GCC_ABOVE_2_95 0
#endif
#if !defined(__cplusplus) && \
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
#define GCC_ABOVE_2_96 1
#else
#define GCC_ABOVE_2_96 0
#endif
#if !defined(__cplusplus) && \
(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
#define GCC_ABOVE_3_3 1
#else
#define GCC_ABOVE_3_3 0
#endif
/* Maybe before gcc 2.95 too */
#ifdef PMIX_HAVE_ATTRIBUTE_UNUSED
#define __PMIX_HAVE_ATTRIBUTE_UNUSED PMIX_HAVE_ATTRIBUTE_UNUSED
#elif defined(__GNUC__)
# define __PMIX_HAVE_ATTRIBUTE_UNUSED (GXX_ABOVE_3_4 || GCC_ABOVE_2_95)
#else
# define __PMIX_HAVE_ATTRIBUTE_UNUSED 0
#endif
#if __PMIX_HAVE_ATTRIBUTE_UNUSED
# define __pmix_attribute_unused __attribute__((__unused__))
#else
# define __pmix_attribute_unused
#endif
#ifdef PMIX_HAVE_ATTRIBUTE_MALLOC
#define __PMIX_HAVE_ATTRIBUTE_MALLOC PMIX_HAVE_ATTRIBUTE_MALLOC
#elif defined(__GNUC__)
# define __PMIX_HAVE_ATTRIBUTE_MALLOC (GXX_ABOVE_3_4 || GCC_ABOVE_2_96)
#else
# define __PMIX_HAVE_ATTRIBUTE_MALLOC 0
#endif
#if __PMIX_HAVE_ATTRIBUTE_MALLOC
# define __pmix_attribute_malloc __attribute__((__malloc__))
#else
# define __pmix_attribute_malloc
#endif
#ifdef PMIX_HAVE_ATTRIBUTE_CONST
#define __PMIX_HAVE_ATTRIBUTE_CONST PMIX_HAVE_ATTRIBUTE_CONST
#elif defined(__GNUC__)
# define __PMIX_HAVE_ATTRIBUTE_CONST (GXX_ABOVE_3_4 || GCC_ABOVE_2_95)
#else
# define __PMIX_HAVE_ATTRIBUTE_CONST 0
#endif
#if __PMIX_HAVE_ATTRIBUTE_CONST
# define __pmix_attribute_const __attribute__((__const__))
#else
# define __pmix_attribute_const
#endif
#ifdef PMIX_HAVE_ATTRIBUTE_PURE
#define __PMIX_HAVE_ATTRIBUTE_PURE PMIX_HAVE_ATTRIBUTE_PURE
#elif defined(__GNUC__)
# define __PMIX_HAVE_ATTRIBUTE_PURE (GXX_ABOVE_3_4 || GCC_ABOVE_2_96)
#else
# define __PMIX_HAVE_ATTRIBUTE_PURE 0
#endif
#if __PMIX_HAVE_ATTRIBUTE_PURE
# define __pmix_attribute_pure __attribute__((__pure__))
#else
# define __pmix_attribute_pure
#endif
#ifdef PMIX_HAVE_ATTRIBUTE_DEPRECATED
#define __PMIX_HAVE_ATTRIBUTE_DEPRECATED PMIX_HAVE_ATTRIBUTE_DEPRECATED
#elif defined(__GNUC__)
# define __PMIX_HAVE_ATTRIBUTE_DEPRECATED (GXX_ABOVE_3_4 || GCC_ABOVE_3_3)
#else
# define __PMIX_HAVE_ATTRIBUTE_DEPRECATED 0
#endif
#if __PMIX_HAVE_ATTRIBUTE_DEPRECATED
# define __pmix_attribute_deprecated __attribute__((__deprecated__))
#else
# define __pmix_attribute_deprecated
#endif
#ifdef PMIX_HAVE_ATTRIBUTE_MAY_ALIAS
#define __PMIX_HAVE_ATTRIBUTE_MAY_ALIAS PMIX_HAVE_ATTRIBUTE_MAY_ALIAS
#elif defined(__GNUC__)
# define __PMIX_HAVE_ATTRIBUTE_MAY_ALIAS (GXX_ABOVE_3_4 || GCC_ABOVE_3_3)
#else
# define __PMIX_HAVE_ATTRIBUTE_MAY_ALIAS 0
#endif
#if __PMIX_HAVE_ATTRIBUTE_MAY_ALIAS
# define __pmix_attribute_may_alias __attribute__((__may_alias__))
#else
# define __pmix_attribute_may_alias
#endif
#ifndef PMIX_DECLSPEC
#ifdef PMIX_C_HAVE_VISIBILITY
# if PMIX_C_HAVE_VISIBILITY
# define PMIX_DECLSPEC __attribute__((__visibility__("default")))
# else
# define PMIX_DECLSPEC
# endif
#else
# define PMIX_DECLSPEC
#endif
#endif
/* Defined to 1 on Linux */
#undef PMIX_LINUX_SYS
/* Defined to 1 if the CPU_SET macro works */
#undef PMIX_HAVE_CPU_SET
/* Defined to 1 if you have the `windows.h' header. */
#undef PMIX_HAVE_WINDOWS_H
#undef pmix_pid_t
#undef pmix_thread_t
/* Whether we need to re-define all the pmix public symbols or not */
#undef PMIX_SYM_TRANSFORM
/* The pmix symbol prefix */
#undef PMIX_SYM_PREFIX
/* The pmix symbol prefix in all caps */
#undef PMIX_SYM_PREFIX_CAPS
/* ensure we have the version info available for external users */
#undef PMIX_MAJOR_VERSION
#undef PMIX_MINOR_VERSION
#undef PMIX_RELEASE_VERSION
#undef BEGIN_C_DECLS
#undef END_C_DECLS
#if defined(c_plusplus) || defined(__cplusplus)
# define BEGIN_C_DECLS extern "C" {
# define END_C_DECLS }
#else
#define BEGIN_C_DECLS /* empty */
#define END_C_DECLS /* empty */
#endif
#endif /* PMIX_CONFIG_H */

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

@ -0,0 +1,429 @@
/*
* 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-2010 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) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef PMIX_CONFIG_BOTTOM_H
#define PMIX_CONFIG_BOTTOM_H
/*
* If we build a static library, Visual C define the _LIB symbol. In the
* case of a shared library _USERDLL get defined.
*
*/
#ifndef PMIX_BUILDING
#define PMIX_BUILDING 1
#endif
/*
* Flex is trying to include the unistd.h file. As there is no configure
* option or this, the flex generated files will try to include the file
* even on platforms without unistd.h. Therefore, if we
* know this file is not available, we can prevent flex from including it.
*/
#ifndef HAVE_UNISTD_H
#define YY_NO_UNISTD_H
#endif
/***********************************************************************
*
* code that should be in ompi_config_bottom.h regardless of build
* status
*
**********************************************************************/
/* Do we have posix or solaris thread lib */
#define PMIX_HAVE_THREADS (PMIX_HAVE_POSIX_THREADS || PMIX_HAVE_SOLARIS_THREADS)
/*
* BEGIN_C_DECLS should be used at the beginning of your declarations,
* so that C++ compilers don't mangle their names. Use END_C_DECLS at
* the end of C declarations.
*/
#undef BEGIN_C_DECLS
#undef END_C_DECLS
#if defined(c_plusplus) || defined(__cplusplus)
# define BEGIN_C_DECLS extern "C" {
# define END_C_DECLS }
#else
#define BEGIN_C_DECLS /* empty */
#define END_C_DECLS /* empty */
#endif
/**
* The attribute definition should be included before any potential
* usage.
*/
#if PMIX_HAVE_ATTRIBUTE_ALIGNED
# define __pmix_attribute_aligned__(a) __attribute__((__aligned__(a)))
# define __pmix_attribute_aligned_max__ __attribute__((__aligned__))
#else
# define __pmix_attribute_aligned__(a)
# define __pmix_attribute_aligned_max__
#endif
#if PMIX_HAVE_ATTRIBUTE_ALWAYS_INLINE
# define __pmix_attribute_always_inline__ __attribute__((__always_inline__))
#else
# define __pmix_attribute_always_inline__
#endif
#if PMIX_HAVE_ATTRIBUTE_COLD
# define __pmix_attribute_cold__ __attribute__((__cold__))
#else
# define __pmix_attribute_cold__
#endif
#if PMIX_HAVE_ATTRIBUTE_CONST
# define __pmix_attribute_const__ __attribute__((__const__))
#else
# define __pmix_attribute_const__
#endif
#if PMIX_HAVE_ATTRIBUTE_DEPRECATED
# define __pmix_attribute_deprecated__ __attribute__((__deprecated__))
#else
# define __pmix_attribute_deprecated__
#endif
#if PMIX_HAVE_ATTRIBUTE_FORMAT
# define __pmix_attribute_format__(a,b,c) __attribute__((__format__(a, b, c)))
#else
# define __pmix_attribute_format__(a,b,c)
#endif
/* Use this __atribute__ on function-ptr declarations, only */
#if PMIX_HAVE_ATTRIBUTE_FORMAT_FUNCPTR
# define __pmix_attribute_format_funcptr__(a,b,c) __attribute__((__format__(a, b, c)))
#else
# define __pmix_attribute_format_funcptr__(a,b,c)
#endif
#if PMIX_HAVE_ATTRIBUTE_HOT
# define __pmix_attribute_hot__ __attribute__((__hot__))
#else
# define __pmix_attribute_hot__
#endif
#if PMIX_HAVE_ATTRIBUTE_MALLOC
# define __pmix_attribute_malloc__ __attribute__((__malloc__))
#else
# define __pmix_attribute_malloc__
#endif
#if PMIX_HAVE_ATTRIBUTE_MAY_ALIAS
# define __pmix_attribute_may_alias__ __attribute__((__may_alias__))
#else
# define __pmix_attribute_may_alias__
#endif
#if PMIX_HAVE_ATTRIBUTE_NO_INSTRUMENT_FUNCTION
# define __pmix_attribute_no_instrument_function__ __attribute__((__no_instrument_function__))
#else
# define __pmix_attribute_no_instrument_function__
#endif
#if PMIX_HAVE_ATTRIBUTE_NONNULL
# define __pmix_attribute_nonnull__(a) __attribute__((__nonnull__(a)))
# define __pmix_attribute_nonnull_all__ __attribute__((__nonnull__))
#else
# define __pmix_attribute_nonnull__(a)
# define __pmix_attribute_nonnull_all__
#endif
#if PMIX_HAVE_ATTRIBUTE_NORETURN
# define __pmix_attribute_noreturn__ __attribute__((__noreturn__))
#else
# define __pmix_attribute_noreturn__
#endif
/* Use this __atribute__ on function-ptr declarations, only */
#if PMIX_HAVE_ATTRIBUTE_NORETURN_FUNCPTR
# define __pmix_attribute_noreturn_funcptr__ __attribute__((__noreturn__))
#else
# define __pmix_attribute_noreturn_funcptr__
#endif
#if PMIX_HAVE_ATTRIBUTE_PACKED
# define __pmix_attribute_packed__ __attribute__((__packed__))
#else
# define __pmix_attribute_packed__
#endif
#if PMIX_HAVE_ATTRIBUTE_PURE
# define __pmix_attribute_pure__ __attribute__((__pure__))
#else
# define __pmix_attribute_pure__
#endif
#if PMIX_HAVE_ATTRIBUTE_SENTINEL
# define __pmix_attribute_sentinel__ __attribute__((__sentinel__))
#else
# define __pmix_attribute_sentinel__
#endif
#if PMIX_HAVE_ATTRIBUTE_UNUSED
# define __pmix_attribute_unused__ __attribute__((__unused__))
#else
# define __pmix_attribute_unused__
#endif
#if PMIX_HAVE_ATTRIBUTE_VISIBILITY
# define __pmix_attribute_visibility__(a) __attribute__((__visibility__(a)))
#else
# define __pmix_attribute_visibility__(a)
#endif
#if PMIX_HAVE_ATTRIBUTE_WARN_UNUSED_RESULT
# define __pmix_attribute_warn_unused_result__ __attribute__((__warn_unused_result__))
#else
# define __pmix_attribute_warn_unused_result__
#endif
#if PMIX_HAVE_ATTRIBUTE_DESTRUCTOR
# define __pmix_attribute_destructor__ __attribute__((__destructor__))
#else
# define __pmix_attribute_destructor__
#endif
#ifndef PMIX_DECLSPEC
# if PMIX_C_HAVE_VISIBILITY
# define PMIX_DECLSPEC __pmix_attribute_visibility__("default")
# define PMIX_MODULE_DECLSPEC __pmix_attribute_visibility__("default")
# else
# define PMIX_DECLSPEC
# define PMIX_MODULE_DECLSPEC
# endif
#endif
/*
* Do we have <stdint.h>?
*/
#ifdef HAVE_STDINT_H
#if !defined(__STDC_LIMIT_MACROS) && (defined(c_plusplus) || defined (__cplusplus))
/* When using a C++ compiler, the max / min value #defines for std
types are only included if __STDC_LIMIT_MACROS is set before
including stdint.h */
#define __STDC_LIMIT_MACROS
#endif
#include <pmix/autogen/config.h>
#include <stdint.h>
#else
#include <pmix/autogen/pmix_stdint.h>
#endif
/***********************************************************************
*
* Code that is only for when building PMIx or utilities that are
* using the internals of PMIx. It should not be included when
* building MPI applications
*
**********************************************************************/
#if PMIX_BUILDING
#ifndef HAVE_PTRDIFF_T
typedef PMIX_PTRDIFF_TYPE ptrdiff_t;
#endif
/*
* Maximum size of a filename path.
*/
#include <limits.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if defined(PATH_MAX)
#define PMIX_PATH_MAX (PATH_MAX + 1)
#elif defined(_POSIX_PATH_MAX)
#define PMIX_PATH_MAX (_POSIX_PATH_MAX + 1)
#else
#define PMIX_PATH_MAX 256
#endif
/*
* Set the compile-time path-separator on this system and variable separator
*/
#define PMIX_PATH_SEP "/"
#define PMIX_ENV_SEP ':'
/*
* printf functions for portability (only when building PMIx)
*/
#if !defined(HAVE_VASPRINTF) || !defined(HAVE_VSNPRINTF)
#include <stdarg.h>
#include <stdlib.h>
#endif
#if !defined(HAVE_ASPRINTF) || !defined(HAVE_SNPRINTF) || !defined(HAVE_VASPRINTF) || !defined(HAVE_VSNPRINTF)
#include "util/printf.h"
#endif
#ifndef HAVE_ASPRINTF
# define asprintf pmix_asprintf
#endif
#ifndef HAVE_SNPRINTF
# define snprintf pmix_snprintf
#endif
#ifndef HAVE_VASPRINTF
# define vasprintf pmix_vasprintf
#endif
#ifndef HAVE_VSNPRINTF
# define vsnprintf pmix_vsnprintf
#endif
/*
* Some platforms (Solaris) have a broken qsort implementation. Work
* around by using our own.
*/
#if PMIX_HAVE_BROKEN_QSORT
#ifdef qsort
#undef qsort
#endif
#include "util/qsort.h"
#define qsort pmix_qsort
#endif
/*
* Define __func__-preprocessor directive if the compiler does not
* already define it. Define it to __FILE__ so that we at least have
* a clue where the developer is trying to indicate where the error is
* coming from (assuming that __func__ is typically used for
* printf-style debugging).
*/
#if defined(HAVE_DECL___FUNC__) && !HAVE_DECL___FUNC__
#define __func__ __FILE__
#endif
#define IOVBASE_TYPE void
#include <stdbool.h>
/**
* If we generate our own bool type, we need a special way to cast the result
* in such a way to keep the compilers silent.
*/
# define PMIX_INT_TO_BOOL(VALUE) (bool)(VALUE)
#if !defined(HAVE_STRUCT_SOCKADDR_STORAGE) && defined(HAVE_STRUCT_SOCKADDR_IN)
#define sockaddr_storage sockaddr
#define ss_family sa_family
#endif
/* Compatibility structure so that we don't have to have as many
#if checks in the code base */
#if !defined(HAVE_STRUCT_SOCKADDR_IN6) && defined(HAVE_STRUCT_SOCKADDR_IN)
#define sockaddr_in6 sockaddr_in
#define sin6_len sin_len
#define sin6_family sin_family
#define sin6_port sin_port
#define sin6_addr sin_addr
#endif
#if !HAVE_DECL_AF_UNSPEC
#define AF_UNSPEC 0
#endif
#if !HAVE_DECL_PF_UNSPEC
#define PF_UNSPEC 0
#endif
#if !HAVE_DECL_AF_INET6
#define AF_INET6 AF_UNSPEC
#endif
#if !HAVE_DECL_PF_INET6
#define PF_INET6 PF_UNSPEC
#endif
#if defined(__APPLE__) && defined(HAVE_INTTYPES_H)
/* Prior to Mac OS X 10.3, the length modifier "ll" wasn't
supported, but "q" was for long long. This isn't ANSI
C and causes a warning when using PRI?64 macros. We
don't support versions prior to OS X 10.3, so we dont'
need such backward compatibility. Instead, redefine
the macros to be "ll", which is ANSI C and doesn't
cause a compiler warning. */
#include <inttypes.h>
#if defined(__PRI_64_LENGTH_MODIFIER__)
#undef __PRI_64_LENGTH_MODIFIER__
#define __PRI_64_LENGTH_MODIFIER__ "ll"
#endif
#if defined(__SCN_64_LENGTH_MODIFIER__)
#undef __SCN_64_LENGTH_MODIFIER__
#define __SCN_64_LENGTH_MODIFIER__ "ll"
#endif
#endif
#ifdef MCS_VXWORKS
/* VXWorks puts some common functions in oddly named headers. Rather
than update all the places the functions are used, which would be a
maintenance disatster, just update here... */
#ifdef HAVE_IOLIB_H
/* pipe(), ioctl() */
#include <ioLib.h>
#endif
#ifdef HAVE_SOCKLIB_H
/* socket() */
#include <sockLib.h>
#endif
#ifdef HAVE_HOSTLIB_H
/* gethostname() */
#include <hostLib.h>
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
#endif
#endif
/* If we're in C++, then just undefine restrict and then define it to
nothing. "restrict" is not part of the C++ language, and we don't
have a corresponding AC_CXX_RESTRICT to figure out what the C++
compiler supports. */
#if defined(c_plusplus) || defined(__cplusplus)
#undef restrict
#define restrict
#endif
#else
/* For a similar reason to what is listed in pmix_config_top.h, we
want to protect others from the autoconf/automake-generated
PACKAGE_<foo> macros in pmix_config.h. We can't put these undef's
directly in pmix_config.h because they'll be turned into #defines'
via autoconf.
So put them here in case any one else includes PMIX's
config.h files. */
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef PACKAGE_URL
#undef HAVE_CONFIG_H
#endif /* PMIX_BUILDING */
#endif /* PMIX_CONFIG_BOTTOM_H */

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

@ -0,0 +1,39 @@
/*
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is included at the top of pmix_config.h, and is
* therefore a) before all the #define's that were output from
* configure, and b) included in most/all files in PMIx.
*
* Since this file is *only* ever included by pmix_config.h, and
* pmix_config.h already has #ifndef/#endif protection, there is no
* need to #ifndef/#endif protection here.
*/
#ifndef PMIX_CONFIG_H
#error "pmix_config_top.h should only be included from pmix_config.h"
#endif
/* The only purpose of this file is to undef the PACKAGE_<foo> macros
that are put in by autoconf/automake projects. Specifically, if
you include a .h file from another project that defines these
macros (e.g., gmp.h) and then include PMIX's config.h,
you'll get a preprocessor conflict. So put these undef's here to
protect us from other package's PACKAGE_<foo> macros.
Note that we can't put them directly in pmix_config.h (e.g., via
AH_TOP) because they will be turned into #define's by autoconf. */
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef PACKAGE_URL
#undef HAVE_CONFIG_H

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

@ -0,0 +1,972 @@
/*
* Copyright (c) 2013-2015 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
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer listed
* in this license in the documentation and/or other materials
* provided with the distribution.
*
* - Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* The copyright holders provide no reassurances that the source code
* provided does not infringe any patent, copyright, or any other
* intellectual property rights of third parties. The copyright holders
* disclaim any liability to any recipient for claims brought against
* recipient by any third party for infringement of that parties
* intellectual property rights.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIx_COMMON_H
#define PMIx_COMMON_H
#include <pmix/autogen/config.h>
#include <pmix/rename.h>
#include <stdint.h>
#include <string.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* for struct timeval */
#endif
BEGIN_C_DECLS
/**** PMIX CONSTANTS ****/
/* define maximum value and key sizes */
#define PMIX_MAX_NSLEN 255
#define PMIX_MAX_KEYLEN 511
/* define a *wildcard* value for requests involving rank */
#define PMIX_RANK_WILDCARD -1
/* define a set of "standard" PMIx attributes that can
* be queried. Implementations (and users) are free to extend as
* desired, so the get functions need to be capable
* of handling the "not found" condition. Note that these
* are attributes of the system and the job as opposed to
* values the application (or underlying MPI library)
* might choose to expose - i.e., they are values provided
* by the resource manager as opposed to the application. Thus,
* these keys are RESERVED */
#define PMIX_ATTR_UNDEF NULL
/* identification attributes */
#define PMIX_USERID "pmix.euid" // (uint32_t) effective user id
#define PMIX_GRPID "pmix.egid" // (uint32_t) effective group id
/* 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
/* 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
/* 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
/* proc location-related info */
/* For PMIX_HOSTNAME, three use-cases exist for PMIx_Get:
*
* (a) Specifying a namespace with PMIX_RANK_WILDCARD will return
* a comma-delimited list of nodes that host procs in that namespace
*
* (b) Passing a NULL namespace will return a comma-delimited list of all
* nodes known to this session, regardless of whether or not they
* currently host procs. The rank argument in PMIx_Get is ignored
* for this use-case
*
* (c) Specifying a namespace and a rank will return the name of the
* host this 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
/* 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
/* 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
/* 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
/* 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)
/* 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
/* 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
/* 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
/**** 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
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,
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,
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,
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;
/**** PMIX DATA TYPES ****/
typedef enum {
PMIX_UNDEF = 0,
PMIX_BOOL, // converted to/from native true/false to uint8 for pack/unpack
PMIX_BYTE, // a byte of data
PMIX_STRING, // NULL-terminated string
PMIX_SIZE, // size_t
PMIX_PID, // OS-pid
PMIX_INT,
PMIX_INT8,
PMIX_INT16,
PMIX_INT32,
PMIX_INT64,
PMIX_UINT,
PMIX_UINT8,
PMIX_UINT16,
PMIX_UINT32,
PMIX_UINT64,
PMIX_FLOAT,
PMIX_DOUBLE,
PMIX_TIMEVAL,
PMIX_TIME,
PMIX_HWLOC_TOPO,
PMIX_VALUE,
PMIX_INFO_ARRAY,
PMIX_PROC,
PMIX_APP,
PMIX_INFO,
PMIX_PDATA,
PMIX_BUFFER,
PMIX_BYTE_OBJECT,
PMIX_KVAL,
PMIX_MODEX,
PMIX_PERSIST
} pmix_data_type_t;
/* define a scope for data "put" by PMI per the following:
*
* PMI_LOCAL - the data is intended only for other application
* processes on the same node. Data marked in this way
* will not be included in data packages sent to remote requestors
* PMI_REMOTE - the data is intended solely for applications processes on
* remote nodes. Data marked in this way will not be shared with
* other processes on the same node
* PMI_GLOBAL - the data is to be shared with all other requesting processes,
* regardless of location
*/
#define PMIX_SCOPE PMIX_UINT
typedef enum {
PMIX_SCOPE_UNDEF = 0,
PMIX_LOCAL, // share to procs also on this node
PMIX_REMOTE, // share with procs not on this node
PMIX_GLOBAL, // share with all procs (local + remote)
} pmix_scope_t;
/* define a range for data "published" by PMI
*/
#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_data_range_t;
/* define a "persistence" policy for data published by clients */
typedef enum {
PMIX_PERSIST_INDEF = 0, // retain until specifically deleted
PMIX_PERSIST_FIRST_READ, // delete upon first access
PMIX_PERSIST_PROC, // retain until publishing process terminates
PMIX_PERSIST_APP, // retain until application terminates
PMIX_PERSIST_SESSION // retain until session/allocation terminates
} pmix_persistence_t;
/**** PMIX BYTE OBJECT ****/
typedef struct {
char *bytes;
size_t size;
} pmix_byte_object_t;
/**** PMIX PROC OBJECT ****/
typedef struct {
char nspace[PMIX_MAX_NSLEN+1];
int rank;
} pmix_proc_t;
#define PMIX_PROC_CREATE(m, n) \
do { \
(m) = (pmix_proc_t*)malloc((n) * sizeof(pmix_proc_t)); \
memset((m), 0, (n) * sizeof(pmix_proc_t)); \
} while(0);
#define PMIX_PROC_RELEASE(m) \
do { \
PMIX_PROC_FREE((m)); \
} while(0);
#define PMIX_PROC_CONSTRUCT(m) \
do { \
memset((m), 0, sizeof(pmix_proc_t)); \
} while(0);
#define PMIX_PROC_DESTRUCT(m)
#define PMIX_PROC_FREE(m, n) \
do { \
if (NULL != (m)) { \
free((m)); \
} \
} while(0);
/**** PMIX VALUE STRUCT ****/
struct pmix_info_t;
typedef struct {
size_t size;
struct pmix_info_t *array;
} pmix_info_array_t;
/* NOTE: operations can supply a collection of values under
* a single key by passing a pmix_value_t containing an
* array of type PMIX_INFO_ARRAY, with each array element
* containing its own pmix_info_t object */
typedef struct {
pmix_data_type_t type;
union {
bool flag;
uint8_t byte;
char *string;
size_t size;
pid_t pid;
int integer;
int8_t int8;
int16_t int16;
int32_t int32;
int64_t int64;
unsigned int uint;
uint8_t uint8;
uint16_t uint16;
uint32_t uint32;
uint64_t uint64;
float fval;
double dval;
struct timeval tv;
pmix_info_array_t array;
pmix_byte_object_t bo;
} data;
} pmix_value_t;
/* allocate and initialize a specified number of value structs */
#define PMIX_VALUE_CREATE(m, n) \
do { \
int _ii; \
(m) = (pmix_value_t*)malloc((n) * sizeof(pmix_value_t)); \
memset((m), 0, (n) * sizeof(pmix_value_t)); \
for (_ii=0; _ii < (int)(n); _ii++) { \
(m)[_ii].type = PMIX_UNDEF; \
} \
} while(0);
/* release a single pmix_value_t struct, including its data */
#define PMIX_VALUE_RELEASE(m) \
do { \
PMIX_VALUE_DESTRUCT((m)); \
free((m)); \
} while(0);
/* initialize a single value struct */
#define PMIX_VALUE_CONSTRUCT(m) \
do { \
memset((m), 0, sizeof(pmix_value_t)); \
(m)->type = PMIX_UNDEF; \
} while(0);
/* release the memory in the value struct data field */
#define PMIX_VALUE_DESTRUCT(m) \
do { \
if (PMIX_STRING == (m)->type) { \
if (NULL != (m)->data.string) { \
free((m)->data.string); \
} \
} else if (PMIX_BYTE_OBJECT == (m)->type) { \
if (NULL != (m)->data.bo.bytes) { \
free((m)->data.bo.bytes); \
} \
} else if (PMIX_INFO_ARRAY == (m)->type) { \
size_t _n; \
pmix_info_t *_p = (pmix_info_t*)((m)->data.array.array); \
for (_n=0; _n < (m)->data.array.size; _n++) { \
if (PMIX_STRING == _p[_n].value.type) { \
if (NULL != _p[_n].value.data.string) { \
free(_p[_n].value.data.string); \
} \
} else if (PMIX_BYTE_OBJECT == _p[_n].value.type) { \
if (NULL != _p[_n].value.data.bo.bytes) { \
free(_p[_n].value.data.bo.bytes); \
} \
} \
} \
free(_p); \
} \
} while(0);
#define PMIX_VALUE_FREE(m, n) \
do { \
size_t _s; \
if (NULL != (m)) { \
for (_s=0; _s < (n); _s++) { \
PMIX_VALUE_DESTRUCT(&((m)[_s])); \
} \
free((m)); \
} \
} while(0);
/* expose a function that is resolved in the
* PMIx library, but part of a header that
* includes internal functions - so we don't
* want to expose the entire header here
*/
extern void pmix_value_load(pmix_value_t *v, void *data,
pmix_data_type_t type);
/**** PMIX INFO STRUCT ****/
typedef struct {
char key[PMIX_MAX_KEYLEN+1]; // ensure room for the NULL terminator
pmix_value_t value;
} pmix_info_t;
/* utility macros for working with pmix_info_t structs */
#define PMIX_INFO_CREATE(m, n) \
do { \
(m) = (pmix_info_t*)malloc((n) * sizeof(pmix_info_t)); \
memset((m), 0, (n) * sizeof(pmix_info_t)); \
} while(0);
#define PMIX_INFO_CONSTRUCT(m) \
do { \
memset((m), 0, sizeof(pmix_info_t)); \
(m)->value.type = PMIX_UNDEF; \
} while(0);
#define PMIX_INFO_DESTRUCT(m) \
do { \
PMIX_VALUE_DESTRUCT(&(m)->value); \
} while(0);
#define PMIX_INFO_FREE(m, n) \
do { \
size_t _s; \
if (NULL != (m)) { \
for (_s=0; _s < (n); _s++) { \
PMIX_INFO_DESTRUCT(&((m)[_s])); \
} \
free((m)); \
} \
} while(0);
#define PMIX_INFO_LOAD(m, k, v, t) \
do { \
(void)strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \
pmix_value_load(&((m)->value), (v), (t)); \
} while(0);
/**** PMIX LOOKUP RETURN STRUCT ****/
typedef struct {
pmix_proc_t proc;
char key[PMIX_MAX_KEYLEN+1]; // ensure room for the NULL terminator
pmix_value_t value;
} pmix_pdata_t;
/* utility macros for working with pmix_pdata_t structs */
#define PMIX_PDATA_CREATE(m, n) \
do { \
(m) = (pmix_pdata_t*)malloc((n) * sizeof(pmix_pdata_t)); \
memset((m), 0, (n) * sizeof(pmix_pdata_t)); \
} while(0);
#define PMIX_PDATA_RELEASE(m) \
do { \
PMIX_VALUE_DESTRUCT(&(m)->value); \
free((m)); \
} while(0);
#define PMIX_PDATA_CONSTRUCT(m) \
do { \
memset((m), 0, sizeof(pmix_pdata_t)); \
(m)->value.type = PMIX_UNDEF; \
} while(0);
#define PMIX_PDATA_DESTRUCT(m) \
do { \
PMIX_VALUE_DESTRUCT(&(m)->value); \
} while(0);
#define PMIX_PDATA_FREE(m, n) \
do { \
size_t _s; \
if (NULL != (m)) { \
for (_s=0; _s < (n); _s++) { \
PMIX_PDATA_DESTRUCT(&((m)[_s])); \
} \
free((m)); \
} \
} while(0);
#define PMIX_PDATA_LOAD(m, p, k, v, t) \
do { \
if (NULL != (m)) { \
(void)strncpy((m)->proc.nspace, (p)->nspace, PMIX_MAX_NSLEN); \
(m)->proc.rank = (p)->rank; \
(void)strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \
pmix_value_load(&((m)->value), (v), (t)); \
} while(0);
/**** PMIX APP STRUCT ****/
typedef struct {
char *cmd;
int argc;
char **argv;
char **env;
int maxprocs;
pmix_info_t *info;
size_t ninfo;
} pmix_app_t;
/* utility macros for working with pmix_app_t structs */
#define PMIX_APP_CREATE(m, n) \
do { \
(m) = (pmix_app_t*)malloc((n) * sizeof(pmix_app_t)); \
memset((m), 0, (n) * sizeof(pmix_app_t)); \
} while(0);
#define PMIX_APP_RELEASE(m) \
do { \
PMIX_APP_DESTRUCT((m)); \
free((m)); \
} while(0);
#define PMIX_APP_CONSTRUCT(m) \
do { \
memset((m), 0, sizeof(pmix_app_t)); \
} while(0);
#define PMIX_APP_DESTRUCT(m) \
do { \
size_t _ii; \
if (NULL != (m)->cmd) { \
free((m)->cmd); \
} \
if (NULL != (m)->argv) { \
for (_ii=0; NULL != (m)->argv[_ii]; _ii++) { \
free((m)->argv[_ii]); \
} \
free((m)->argv); \
} \
if (NULL != (m)->env) { \
for (_ii=0; NULL != (m)->env[_ii]; _ii++) { \
free((m)->env[_ii]); \
} \
free((m)->env); \
} \
if (NULL != (m)->info) { \
for (_ii=0; _ii < (m)->ninfo; _ii++) { \
PMIX_INFO_DESTRUCT(&(m)->info[_ii]); \
} \
} \
} while(0);
#define PMIX_APP_FREE(m, n) \
do { \
size_t _s; \
if (NULL != (m)) { \
for (_s=0; _s < (n); _s++) { \
PMIX_APP_DESTRUCT(&((m)[_s])); \
} \
free((m)); \
} \
} while(0);
/**** PMIX MODEX STRUCT ****/
typedef struct {
char nspace[PMIX_MAX_NSLEN+1];
int rank;
uint8_t *blob;
size_t size;
} pmix_modex_data_t;
/* utility macros for working with pmix_modex_t structs */
#define PMIX_MODEX_CREATE(m, n) \
do { \
(m) = (pmix_modex_data_t*)malloc((n) * sizeof(pmix_modex_data_t)); \
memset((m), 0, (n) * sizeof(pmix_modex_data_t)); \
} while(0);
#define PMIX_MODEX_RELEASE(m) \
do { \
PMIX_MODEX_DESTRUCT((m)); \
free((m)); \
} while(0);
#define PMIX_MODEX_CONSTRUCT(m) \
do { \
memset((m), 0, sizeof(pmix_modex_data_t)); \
} while(0);
#define PMIX_MODEX_DESTRUCT(m) \
do { \
if (NULL != (m)->blob) { \
free((m)->blob); \
} \
} while(0);
#define PMIX_MODEX_FREE(m, n) \
do { \
size_t _s; \
if (NULL != (m)) { \
for (_s=0; _s < (n); _s++) { \
PMIX_MODEX_DESTRUCT(&((m)[_s])); \
} \
free((m)); \
} \
} while(0);
/**** CALLBACK FUNCTIONS FOR NON-BLOCKING OPERATIONS ****/
typedef void (*pmix_release_cbfunc_t)(void *cbdata);
/* define a callback function that is solely used by servers, and
* not clients, to return modex data in response to "fence" and "get"
* operations. The returned blob contains the data collected from each
* server participating in the operation.
*
* As the data is "owned" by the host server, provide a secondary
* callback function to notify the host server that we are done
* with the data so it can be released */
typedef void (*pmix_modex_cbfunc_t)(pmix_status_t status,
const char *data, size_t ndata,
void *cbdata,
pmix_release_cbfunc_t release_fn,
void *release_cbdata);
/* define a callback function for calls to PMIx_Spawn_nb - the function
* will be called upon completion of the spawn command. The status
* will indicate whether or not the spawn succeeded. The nspace
* of the spawned processes will be returned, along with any provided
* callback data. Note that the returned nspace value will be
* released by the library upon return from the callback function, so
* the receiver must copy it if it needs to be retained */
typedef void (*pmix_spawn_cbfunc_t)(pmix_status_t status,
char nspace[], void *cbdata);
/* define a callback for common operations that simply return
* a status. Examples include the non-blocking versions of
* Fence, Connect, and Disconnect */
typedef void (*pmix_op_cbfunc_t)(pmix_status_t status, void *cbdata);
/* define a callback function for calls to PMIx_Lookup_nb - the
* function will be called upon completion of the command with the
* status indicating the success of failure of the request. Any
* retrieved data will be returned in an array of pmix_pdata_t structs.
* The nspace/rank of the process that provided each data element is
* also returned.
*
* Note that these structures will be released upon return from
* the callback function, so the receiver must copy/protect the
* data prior to returning if it needs to be retained */
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
* 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
*
* 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.
* 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
*
* - provide a timeout for alternative action to occur, such as for
* the application to request an alternate response to the error
*
* For example, the RM might alert the application to the failure of
* a node that resulted in termination of several processes, and indicate
* that the overall session will be aborted unless the application
* requests an alternative behavior in the next 5 seconds. The application
* then has time to respond with a checkpoint request, or a request to
* recover from the failure by obtaining replacement nodes and restarting
* from some earlier checkpoint.
*
* Support for these options is left to the discretion of the host RM. Info
* keys are included in the common definions above, but also may be augmented
* 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
*/
typedef void (*pmix_notification_fn_t)(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo);
/* define a callback function for calls to PMIx_Register_errhandler. The
* status indicates if the request was successful or not, errhandler_ref is
* an integer reference assigned to the errhandler by PMIX, this reference
* must be used to deregister the err handler. A ptr to the original
* cbdata is returned. */
typedef void (*pmix_errhandler_reg_cbfunc_t)(pmix_status_t status,
int errhandler_ref,
void *cbdata);
/* define a callback function for calls to PMIx_Get_nb. The status
* indicates if the requested data was found or not - a pointer to the
* pmix_value_t structure containing the found data is returned. The
* pointer will be NULL if the requested data was not found. */
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
* 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
* non-blocking operations.
*
* (b) job-related errors 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
* 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)
* from the other end (Resource Manager/Client application).
*
* Multiple err handlers can be registered for different errors. PMIX returns
* an integer reference to each register handler in the callback fn. The caller
* must retain the reference in order to deregister the errhandler.
* Modification of the notification behavior can be accomplished by
* deregistering the current errhandler, and then registering it
* using a new set of info values.
*
* See pmix_common.h for a description of the notification function */
void PMIx_Register_errhandler(pmix_info_t info[], size_t ninfo,
pmix_notification_fn_t errhandler,
pmix_errhandler_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
* called by both the server and the client application. On the
* server side, the errhandler is used to report errors detected
* by PMIx to the host server for handling. On the client side,
* the errhandler is used to notify the process of errors
* reported by the server - e.g., the failure of another process.
*
* This function allows the host server to direct the server
* convenience library to notify all indicated local procs of
* an error. The error can be local, or anywhere in the cluster.
* The status indicates the error being reported.
*
* The client application can also call this function to notify the
* resource manager of an error it encountered. It can request the host
* server to notify the indicated processes about the error.
*
* The first array of procs informs the server library as to which
* processes should be alerted - e.g., the processes that are in
* a directly-affected job or are connected to one that is affected.
* Passing a NULL for this array will indicate that all local procs
* are to be notified.
*
* The second array identifies the processes that will be impacted
* by the error. This could consist of a single process, or a number
* of processes.
*
* The info array contains any further info the RM can and/or chooses
* to provide.
*
* The callback function will be called upon completion of the
* notify_error function's actions. Note that any messages will
* have been queued, but may not have been transmitted by this
* time. Note that the caller is required to maintain the input
* data until the callback function has been executed!
*/
pmix_status_t PMIx_Notify_error(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_proc_t error_procs[], size_t error_nprocs,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Provide a string representation of a pmix_status_t value. Note
* that the provided string is statically defined and must NOT be
* free'd */
const char* PMIx_Error_string(pmix_status_t status);
/* Get the PMIx version string. Note that the provided string is
* statically defined and must NOT be free'd */
const char* PMIx_Get_version(void);
/* Store some data locally for retrieval by other areas of the
* proc. This is data that has only internal scope - it will
* never be "pushed" externally */
pmix_status_t PMIx_Store_internal(const pmix_proc_t *proc,
const char *key, pmix_value_t *val);
/* Key-Value pair management macros */
// TODO: add all possible types/fields here.
#define PMIX_VAL_FIELD_int(x) ((x)->data.integer)
#define PMIX_VAL_FIELD_uint32_t(x) ((x)->data.uint32)
#define PMIX_VAL_FIELD_uint16_t(x) ((x)->data.uint16)
#define PMIX_VAL_FIELD_string(x) ((x)->data.string)
#define PMIX_VAL_FIELD_float(x) ((x)->data.fval)
#define PMIX_VAL_FIELD_byte(x) ((x)->data.byte)
#define PMIX_VAL_FIELD_flag(x) ((x)->data.flag)
#define PMIX_VAL_TYPE_int PMIX_INT
#define PMIX_VAL_TYPE_uint32_t PMIX_UINT32
#define PMIX_VAL_TYPE_uint16_t PMIX_UINT16
#define PMIX_VAL_TYPE_string PMIX_STRING
#define PMIX_VAL_TYPE_float PMIX_FLOAT
#define PMIX_VAL_TYPE_byte PMIX_BYTE
#define PMIX_VAL_TYPE_flag PMIX_BOOL
#define PMIX_VAL_set_assign(_v, _field, _val ) \
do { \
(_v)->type = PMIX_VAL_TYPE_ ## _field; \
PMIX_VAL_FIELD_ ## _field((_v)) = _val; \
} while(0);
#define PMIX_VAL_set_strdup(_v, _field, _val ) \
do { \
(_v)->type = PMIX_VAL_TYPE_ ## _field; \
PMIX_VAL_FIELD_ ## _field((_v)) = strdup(_val); \
} while(0);
#define PMIX_VAL_SET_int PMIX_VAL_set_assign
#define PMIX_VAL_SET_uint32_t PMIX_VAL_set_assign
#define PMIX_VAL_SET_uint16_t PMIX_VAL_set_assign
#define PMIX_VAL_SET_string PMIX_VAL_set_strdup
#define PMIX_VAL_SET_float PMIX_VAL_set_assign
#define PMIX_VAL_SET_byte PMIX_VAL_set_assign
#define PMIX_VAL_SET_flag PMIX_VAL_set_assign
#define PMIX_VAL_SET(_v, _field, _val ) \
PMIX_VAL_SET_ ## _field(_v, _field, _val)
#define PMIX_VAL_cmp_val(_val1, _val2) ((_val1) != (_val2))
#define PMIX_VAL_cmp_float(_val1, _val2) (((_val1)>(_val2))?(((_val1)-(_val2))>0.000001):(((_val2)-(_val1))>0.000001))
#define PMIX_VAL_cmp_ptr(_val1, _val2) strncmp(_val1, _val2, strlen(_val1)+1)
#define PMIX_VAL_CMP_int PMIX_VAL_cmp_val
#define PMIX_VAL_CMP_uint32_t PMIX_VAL_cmp_val
#define PMIX_VAL_CMP_uint16_t PMIX_VAL_cmp_val
#define PMIX_VAL_CMP_float PMIX_VAL_cmp_float
#define PMIX_VAL_CMP_string PMIX_VAL_cmp_ptr
#define PMIX_VAL_CMP_byte PMIX_VAL_cmp_val
#define PMIX_VAL_CMP_flag PMIX_VAL_cmp_val
#define PMIX_VAL_CMP(_field, _val1, _val2) \
PMIX_VAL_CMP_ ## _field(_val1, _val2)
#define PMIX_VAL_FREE(_v) \
PMIx_free_value_data(_v)
END_C_DECLS
#endif

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

@ -0,0 +1,424 @@
/*
* Copyright 2015 Intel, Inc. All rights reserved
*/
#ifndef PMIX_RENAME_H
#define PMIX_RENAME_H
#include <pmix/autogen/config.h>
BEGIN_C_DECLS
/* Only enact these defines if we're actually renaming the symbols
(i.e., avoid trying to have no-op defines if we're *not*
renaming).
Note that we don't symbol shift if we aren't in embedded mode
as that wouldn't make any sense. If we are in embedded mode,
then we aren't building the PMI-1/2 APIs as that also doesn't
make any sense
*/
#if PMIX_SYM_TRANSFORM
/* Use a preprocessor two-step in order to get the prefixing right.
Make 2 macros: PMIX_NAME and PMIX_NAME_CAPS for renaming
things. */
#define PMIX_MUNGE_NAME(a, b) PMIX_MUNGE_NAME2(a, b)
#define PMIX_MUNGE_NAME2(a, b) a ## b
#define PMIX_NAME(name) PMIX_MUNGE_NAME(PMIX_SYM_PREFIX, pmix_ ## name)
#define PMIX_NAME_CAPS(name) PMIX_MUNGE_NAME(PMIX_SYM_PREFIX_CAPS, PMIx_ ## name)
/* Now define all the "real" names to be the prefixed names. This
allows us to use the real names throughout the code base (i.e.,
"pmix_<foo>"); the preprocessor will adjust to have the prefixed
name under the covers. */
/* PMIx APIs */
#define PMI2_Abort PMIX_NAME_CAPS(PMI2_Abort)
#define PMI2_Finalize PMIX_NAME_CAPS(PMI2_Finalize)
#define PMI2_Info_GetJobAttr PMIX_NAME_CAPS(PMI2_Info_GetJobAttr)
#define PMI2_Info_GetJobAttrIntArray PMIX_NAME_CAPS(PMI2_Info_GetJobAttrIntArray)
#define PMI2_Info_GetNodeAttr PMIX_NAME_CAPS(PMI2_Info_GetNodeAttr)
#define PMI2_Info_GetSize PMIX_NAME_CAPS(PMI2_Info_GetSize)
#define PMI2_Info_PutNodeAttr PMIX_NAME_CAPS(PMI2_Info_PutNodeAttr)
#define PMI2_Init PMIX_NAME_CAPS(PMI2_Init)
#define PMI2_Initialized PMIX_NAME_CAPS(PMI2_Initialized)
#define PMI2_Job_Connect PMIX_NAME_CAPS(PMI2_Job_Connect)
#define PMI2_Job_Disconnect PMIX_NAME_CAPS(PMI2_Job_Disconnect)
#define PMI2_Job_GetId PMIX_NAME_CAPS(PMI2_Job_GetId)
#define PMI2_Job_GetRank PMIX_NAME_CAPS(PMI2_Job_GetRank)
#define PMI2_Job_Spawn PMIX_NAME_CAPS(PMI2_Job_Spawn)
#define PMI2_KVS_Fence PMIX_NAME_CAPS(PMI2_KVS_Fence)
#define PMI2_KVS_Get PMIX_NAME_CAPS(PMI2_KVS_Get)
#define PMI2_KVS_Put PMIX_NAME_CAPS(PMI2_KVS_Put)
#define PMI2_Nameserv_lookup PMIX_NAME_CAPS(PMI2_Nameserv_lookup)
#define PMI2_Nameserv_publish PMIX_NAME_CAPS(PMI2_Nameserv_publish)
#define PMI2_Nameserv_unpublish PMIX_NAME_CAPS(PMI2_Nameserv_unpublish)
#define PMI_Abort PMIX_NAME_CAPS(PMI_Abort)
#define PMI_Args_to_keyval PMIX_NAME_CAPS(PMI_Args_to_keyval)
#define PMI_Barrier PMIX_NAME_CAPS(PMI_Barrier)
#define PMI_Finalize PMIX_NAME_CAPS(PMI_Finalize)
#define PMI_Free_keyvals PMIX_NAME_CAPS(PMI_Free_keyvals)
#define PMI_Get_appnum PMIX_NAME_CAPS(PMI_Get_appnum)
#define PMI_Get_clique_ranks PMIX_NAME_CAPS(PMI_Get_clique_ranks)
#define PMI_Get_clique_size PMIX_NAME_CAPS(PMI_Get_clique_size)
#define PMI_Get_id PMIX_NAME_CAPS(PMI_Get_id)
#define PMI_Get_id_length_max PMIX_NAME_CAPS(PMI_Get_id_length_max)
#define PMI_Get_kvs_domain_id PMIX_NAME_CAPS(PMI_Get_kvs_domain_id)
#define PMI_Get_options PMIX_NAME_CAPS(PMI_Get_options)
#define PMI_Get_rank PMIX_NAME_CAPS(PMI_Get_rank)
#define PMI_Get_size PMIX_NAME_CAPS(PMI_Get_size)
#define PMI_Get_universe_size PMIX_NAME_CAPS(PMI_Get_universe_size)
#define PMI_Init PMIX_NAME_CAPS(PMI_Init)
#define PMI_Initialized PMIX_NAME_CAPS(PMI_Initialized)
#define PMI_KVS_Commit PMIX_NAME_CAPS(PMI_KVS_Commit)
#define PMI_KVS_Create PMIX_NAME_CAPS(PMI_KVS_Create)
#define PMI_KVS_Destroy PMIX_NAME_CAPS(PMI_KVS_Destroy)
#define PMI_KVS_Get PMIX_NAME_CAPS(PMI_KVS_Get)
#define PMI_KVS_Get_key_length_max PMIX_NAME_CAPS(PMI_KVS_Get_key_length_max)
#define PMI_KVS_Get_my_name PMIX_NAME_CAPS(PMI_KVS_Get_my_name)
#define PMI_KVS_Get_name_length_max PMIX_NAME_CAPS(PMI_KVS_Get_name_length_max)
#define PMI_KVS_Get_value_length_max PMIX_NAME_CAPS(PMI_KVS_Get_value_length_max)
#define PMI_KVS_Iter_first PMIX_NAME_CAPS(PMI_KVS_Iter_first)
#define PMI_KVS_Iter_next PMIX_NAME_CAPS(PMI_KVS_Iter_next)
#define PMI_KVS_Put PMIX_NAME_CAPS(PMI_KVS_Put)
#define PMI_Lookup_name PMIX_NAME_CAPS(PMI_Lookup_name)
#define PMI_Parse_option PMIX_NAME_CAPS(PMI_Parse_option)
#define PMI_Publish_name PMIX_NAME_CAPS(PMI_Publish_name)
#define PMI_Spawn_multiple PMIX_NAME_CAPS(PMI_Spawn_multiple)
#define PMI_Unpublish_name PMIX_NAME_CAPS(PMI_Unpublish_name)
#define PMIx_Abort PMIX_NAME_CAPS(Abort)
#define PMIx_Commit PMIX_NAME_CAPS(Commit)
#define PMIx_Connect PMIX_NAME_CAPS(Connect)
#define PMIx_Connect_nb PMIX_NAME_CAPS(Connect_nb)
#define PMIx_Deregister_errhandler PMIX_NAME_CAPS(Deregister_errhandler)
#define PMIx_Disconnect PMIX_NAME_CAPS(Disconnect)
#define PMIx_Disconnect_nb PMIX_NAME_CAPS(Disconnect_nb)
#define PMIx_Error_string PMIX_NAME_CAPS(Error_string)
#define PMIx_Fence PMIX_NAME_CAPS(Fence)
#define PMIx_Fence_nb PMIX_NAME_CAPS(Fence_nb)
#define PMIx_Finalize PMIX_NAME_CAPS(Finalize)
#define PMIx_Get PMIX_NAME_CAPS(Get)
#define PMIx_Get_nb PMIX_NAME_CAPS(Get_nb)
#define PMIx_Get_version PMIX_NAME_CAPS(Get_version)
#define PMIx_Init PMIX_NAME_CAPS(Init)
#define PMIx_Initialized PMIX_NAME_CAPS(Initialized)
#define PMIx_Lookup PMIX_NAME_CAPS(Lookup)
#define PMIx_Lookup_nb PMIX_NAME_CAPS(Lookup_nb)
#define PMIx_Notify_error PMIX_NAME_CAPS(Notify_error)
#define PMIx_Publish PMIX_NAME_CAPS(Publish)
#define PMIx_Publish_nb PMIX_NAME_CAPS(Publish_nb)
#define PMIx_Put PMIX_NAME_CAPS(Put)
#define PMIx_Register_errhandler PMIX_NAME_CAPS(Register_errhandler)
#define PMIx_Resolve_nodes PMIX_NAME_CAPS(Resolve_nodes)
#define PMIx_Resolve_peers PMIX_NAME_CAPS(Resolve_peers)
#define PMIx_Spawn PMIX_NAME_CAPS(Spawn)
#define PMIx_Spawn_nb PMIX_NAME_CAPS(Spawn_nb)
#define PMIx_Store_internal PMIX_NAME_CAPS(Store_internal)
#define PMIx_Unpublish PMIX_NAME_CAPS(Unpublish)
#define PMIx_Unpublish_nb PMIX_NAME_CAPS(Unpublish_nb)
#define PMIx_generate_ppn PMIX_NAME_CAPS(generate_ppn)
#define PMIx_generate_regex PMIX_NAME_CAPS(generate_regex)
#define PMIx_server_deregister_client PMIX_NAME_CAPS(server_deregister_client)
#define PMIx_server_deregister_nspace PMIX_NAME_CAPS(server_deregister_nspace)
#define PMIx_server_dmodex_request PMIX_NAME_CAPS(server_dmodex_request)
#define PMIx_server_finalize PMIX_NAME_CAPS(server_finalize)
#define PMIx_server_init PMIX_NAME_CAPS(server_init)
#define PMIx_server_register_client PMIX_NAME_CAPS(server_register_client)
#define PMIx_server_register_nspace PMIX_NAME_CAPS(server_register_nspace)
#define PMIx_server_setup_fork PMIX_NAME_CAPS(server_setup_fork)
/* internal functions */
#define pmix_argv_append PMIX_NAME(argv_append)
#define pmix_argv_append_nosize PMIX_NAME(argv_append_nosize)
#define pmix_argv_append_unique_nosize PMIX_NAME(argv_append_unique_nosize)
#define pmix_argv_copy PMIX_NAME(argv_copy)
#define pmix_argv_count PMIX_NAME(argv_count)
#define pmix_argv_delete PMIX_NAME(argv_delete)
#define pmix_argv_free PMIX_NAME(argv_free)
#define pmix_argv_insert PMIX_NAME(argv_insert)
#define pmix_argv_insert_element PMIX_NAME(argv_insert_element)
#define pmix_argv_join PMIX_NAME(argv_join)
#define pmix_argv_join_range PMIX_NAME(argv_join_range)
#define pmix_argv_len PMIX_NAME(argv_len)
#define pmix_argv_prepend_nosize PMIX_NAME(argv_prepend_nosize)
#define pmix_argv_split PMIX_NAME(argv_split)
#define pmix_argv_split_with_empty PMIX_NAME(argv_split_with_empty)
#define pmix_asprintf PMIX_NAME(asprintf)
#define pmix_basename PMIX_NAME(basename)
#define pmix_bcopy_csum_partial PMIX_NAME(bcopy_csum_partial)
#define pmix_bcopy_uicrc_partial PMIX_NAME(bcopy_uicrc_partial)
#define pmix_bcopy_uicsum_partial PMIX_NAME(bcopy_uicsum_partial)
#define pmix_bfrop PMIX_NAME(bfrop)
#define pmix_bfrop_buffer_extend PMIX_NAME(bfrop_buffer_extend)
#define pmix_bfrop_close PMIX_NAME(bfrop_close)
#define pmix_bfrop_copy PMIX_NAME(bfrop_copy)
#define pmix_bfrop_copy_app PMIX_NAME(bfrop_copy_app)
#define pmix_bfrop_copy_array PMIX_NAME(bfrop_copy_array)
#define pmix_bfrop_copy_bo PMIX_NAME(bfrop_copy_bo)
#define pmix_bfrop_copy_buf PMIX_NAME(bfrop_copy_buf)
#define pmix_bfrop_copy_info PMIX_NAME(bfrop_copy_info)
#define pmix_bfrop_copy_kval PMIX_NAME(bfrop_copy_kval)
#define pmix_bfrop_copy_modex PMIX_NAME(bfrop_copy_modex)
#define pmix_bfrop_copy_payload PMIX_NAME(bfrop_copy_payload)
#define pmix_bfrop_copy_pdata PMIX_NAME(bfrop_copy_pdata)
#define pmix_bfrop_copy_persist PMIX_NAME(bfrop_copy_persist)
#define pmix_bfrop_copy_proc PMIX_NAME(bfrop_copy_proc)
#define pmix_bfrop_copy_string PMIX_NAME(bfrop_copy_string)
#define pmix_bfrop_copy_topo PMIX_NAME(bfrop_copy_topo)
#define pmix_bfrop_copy_value PMIX_NAME(bfrop_copy_value)
#define pmix_bfrop_get_data_type PMIX_NAME(bfrop_get_data_type)
#define pmix_bfrop_initial_size PMIX_NAME(pmix_bfrop_initial_size)
#define pmix_bfrop_initialized PMIX_NAME(bfrop_initialized)
#define pmix_bfrop_num_reg_types PMIX_NAME(pmix_bfrop_num_reg_types)
#define pmix_bfrop_open PMIX_NAME(bfrop_open)
#define pmix_bfrop_pack PMIX_NAME(bfrop_pack)
#define pmix_bfrop_pack_app PMIX_NAME(bfrop_pack_app)
#define pmix_bfrop_pack_array PMIX_NAME(bfrop_pack_array)
#define pmix_bfrop_pack_bo PMIX_NAME(bfrop_pack_bo)
#define pmix_bfrop_pack_bool PMIX_NAME(bfrop_pack_bool)
#define pmix_bfrop_pack_buf PMIX_NAME(bfrop_pack_buf)
#define pmix_bfrop_pack_buffer PMIX_NAME(bfrop_pack_buffer)
#define pmix_bfrop_pack_byte PMIX_NAME(bfrop_pack_byte)
#define pmix_bfrop_pack_datatype PMIX_NAME(bfrop_pack_datatype)
#define pmix_bfrop_pack_double PMIX_NAME(bfrop_pack_double)
#define pmix_bfrop_pack_float PMIX_NAME(bfrop_pack_float)
#define pmix_bfrop_pack_info PMIX_NAME(bfrop_pack_info)
#define pmix_bfrop_pack_int PMIX_NAME(bfrop_pack_int)
#define pmix_bfrop_pack_int16 PMIX_NAME(bfrop_pack_int16)
#define pmix_bfrop_pack_int32 PMIX_NAME(bfrop_pack_int32)
#define pmix_bfrop_pack_int64 PMIX_NAME(bfrop_pack_int64)
#define pmix_bfrop_pack_kval PMIX_NAME(bfrop_pack_kval)
#define pmix_bfrop_pack_modex PMIX_NAME(bfrop_pack_modex)
#define pmix_bfrop_pack_pdata PMIX_NAME(bfrop_pack_pdata)
#define pmix_bfrop_pack_persist PMIX_NAME(bfrop_pack_persist)
#define pmix_bfrop_pack_pid PMIX_NAME(bfrop_pack_pid)
#define pmix_bfrop_pack_proc PMIX_NAME(bfrop_pack_proc)
#define pmix_bfrop_pack_sizet PMIX_NAME(bfrop_pack_sizet)
#define pmix_bfrop_pack_string PMIX_NAME(bfrop_pack_string)
#define pmix_bfrop_pack_time PMIX_NAME(bfrop_pack_time)
#define pmix_bfrop_pack_timeval PMIX_NAME(bfrop_pack_timeval)
#define pmix_bfrop_pack_topo PMIX_NAME(bfrop_pack_topo)
#define pmix_bfrop_pack_value PMIX_NAME(bfrop_pack_value)
#define pmix_bfrop_print PMIX_NAME(bfrop_print)
#define pmix_bfrop_print_app PMIX_NAME(bfrop_print_app)
#define pmix_bfrop_print_array PMIX_NAME(bfrop_print_array)
#define pmix_bfrop_print_bo PMIX_NAME(bfrop_print_bo)
#define pmix_bfrop_print_bool PMIX_NAME(bfrop_print_bool)
#define pmix_bfrop_print_buf PMIX_NAME(bfrop_print_buf)
#define pmix_bfrop_print_byte PMIX_NAME(bfrop_print_byte)
#define pmix_bfrop_print_double PMIX_NAME(bfrop_print_double)
#define pmix_bfrop_print_float PMIX_NAME(bfrop_print_float)
#define pmix_bfrop_print_info PMIX_NAME(bfrop_print_info)
#define pmix_bfrop_print_int PMIX_NAME(bfrop_print_int)
#define pmix_bfrop_print_int16 PMIX_NAME(bfrop_print_int16)
#define pmix_bfrop_print_int32 PMIX_NAME(bfrop_print_int32)
#define pmix_bfrop_print_int64 PMIX_NAME(bfrop_print_int64)
#define pmix_bfrop_print_int8 PMIX_NAME(bfrop_print_int8)
#define pmix_bfrop_print_kval PMIX_NAME(bfrop_print_kval)
#define pmix_bfrop_print_modex PMIX_NAME(bfrop_print_modex)
#define pmix_bfrop_print_pdata PMIX_NAME(bfrop_print_pdata)
#define pmix_bfrop_print_persist PMIX_NAME(bfrop_print_persist)
#define pmix_bfrop_print_pid PMIX_NAME(bfrop_print_pid)
#define pmix_bfrop_print_proc PMIX_NAME(bfrop_print_proc)
#define pmix_bfrop_print_size PMIX_NAME(bfrop_print_size)
#define pmix_bfrop_print_string PMIX_NAME(bfrop_print_string)
#define pmix_bfrop_print_time PMIX_NAME(bfrop_print_time)
#define pmix_bfrop_print_timeval PMIX_NAME(bfrop_print_timeval)
#define pmix_bfrop_print_topo PMIX_NAME(bfrop_print_topo)
#define pmix_bfrop_print_uint PMIX_NAME(bfrop_print_uint)
#define pmix_bfrop_print_uint16 PMIX_NAME(bfrop_print_uint16)
#define pmix_bfrop_print_uint32 PMIX_NAME(bfrop_print_uint32)
#define pmix_bfrop_print_uint64 PMIX_NAME(bfrop_print_uint64)
#define pmix_bfrop_print_uint8 PMIX_NAME(bfrop_print_uint8)
#define pmix_bfrop_print_value PMIX_NAME(bfrop_print_value)
#define pmix_bfrop_std_copy PMIX_NAME(bfrop_std_copy)
#define pmix_bfrop_store_data_type PMIX_NAME(bfrop_store_data_type)
#define pmix_bfrop_threshold_size PMIX_NAME(pmix_bfrop_threshold_size)
#define pmix_bfrop_too_small PMIX_NAME(bfrop_too_small)
#define pmix_bfrop_types PMIX_NAME(bfrop_types)
#define pmix_bfrop_type_info_t_class PMIX_NAME(bfrop_type_info_t_class)
#define pmix_bfrop_unpack PMIX_NAME(bfrop_unpack)
#define pmix_bfrop_unpack_app PMIX_NAME(bfrop_unpack_app)
#define pmix_bfrop_unpack_array PMIX_NAME(bfrop_unpack_array)
#define pmix_bfrop_unpack_bo PMIX_NAME(bfrop_unpack_bo)
#define pmix_bfrop_unpack_bool PMIX_NAME(bfrop_unpack_bool)
#define pmix_bfrop_unpack_buf PMIX_NAME(bfrop_unpack_buf)
#define pmix_bfrop_unpack_buffer PMIX_NAME(bfrop_unpack_buffer)
#define pmix_bfrop_unpack_byte PMIX_NAME(bfrop_unpack_byte)
#define pmix_bfrop_unpack_datatype PMIX_NAME(bfrop_unpack_datatype)
#define pmix_bfrop_unpack_double PMIX_NAME(bfrop_unpack_double)
#define pmix_bfrop_unpack_float PMIX_NAME(bfrop_unpack_float)
#define pmix_bfrop_unpack_info PMIX_NAME(bfrop_unpack_info)
#define pmix_bfrop_unpack_int PMIX_NAME(bfrop_unpack_int)
#define pmix_bfrop_unpack_int16 PMIX_NAME(bfrop_unpack_int16)
#define pmix_bfrop_unpack_int32 PMIX_NAME(bfrop_unpack_int32)
#define pmix_bfrop_unpack_int64 PMIX_NAME(bfrop_unpack_int64)
#define pmix_bfrop_unpack_kval PMIX_NAME(bfrop_unpack_kval)
#define pmix_bfrop_unpack_modex PMIX_NAME(bfrop_unpack_modex)
#define pmix_bfrop_unpack_pdata PMIX_NAME(bfrop_unpack_pdata)
#define pmix_bfrop_unpack_persist PMIX_NAME(bfrop_unpack_persist)
#define pmix_bfrop_unpack_pid PMIX_NAME(bfrop_unpack_pid)
#define pmix_bfrop_unpack_proc PMIX_NAME(bfrop_unpack_proc)
#define pmix_bfrop_unpack_sizet PMIX_NAME(bfrop_unpack_sizet)
#define pmix_bfrop_unpack_string PMIX_NAME(bfrop_unpack_string)
#define pmix_bfrop_unpack_time PMIX_NAME(bfrop_unpack_time)
#define pmix_bfrop_unpack_timeval PMIX_NAME(bfrop_unpack_timeval)
#define pmix_bfrop_unpack_topo PMIX_NAME(bfrop_unpack_topo)
#define pmix_bfrop_unpack_value PMIX_NAME(bfrop_unpack_value)
#define pmix_buffer_t_class PMIX_NAME(buffer_t_class)
#define pmix_cb_t_class PMIX_NAME(cb_t_class)
#define pmix_class_finalize PMIX_NAME(class_finalize)
#define pmix_class_initialize PMIX_NAME(class_initialize)
#define pmix_client_globals PMIX_NAME(pmix_client_globals)
#define pmix_client_process_nspace_blob PMIX_NAME(client_process_nspace_blob)
#define pmix_csum_partial PMIX_NAME(csum_partial)
#define pmix_dirname PMIX_NAME(dirname)
#define pmix_dmdx_local_t_class PMIX_NAME(dmdx_local_t_class)
#define pmix_dmdx_remote_t_class PMIX_NAME(dmdx_remote_t_class)
#define pmix_dmdx_reply_caddy_t_class PMIX_NAME(dmdx_reply_caddy_t_class)
#define pmix_dmdx_request_t_class PMIX_NAME(dmdx_request_t_class)
#define pmix_environ_merge PMIX_NAME(environ_merge)
#define pmix_errhandler_invoke PMIX_NAME(errhandler_invoke)
#define pmix_fd_read PMIX_NAME(fd_read)
#define pmix_fd_set_cloexec PMIX_NAME(fd_set_cloexec)
#define pmix_fd_write PMIX_NAME(fd_write)
#define pmix_globals PMIX_NAME(globals)
#define pmix_globals_finalize PMIX_NAME(globals_finalize)
#define pmix_globals_init PMIX_NAME(globals_init)
#define pmix_hash_fetch PMIX_NAME(hash_fetch)
#define pmix_hash_remove_data PMIX_NAME(hash_remove_data)
#define pmix_hash_store PMIX_NAME(hash_store)
#define pmix_hash_table_get_first_key_uint32 PMIX_NAME(hash_table_get_first_key_uint32)
#define pmix_hash_table_get_first_key_uint64 PMIX_NAME(hash_table_get_first_key_uint64)
#define pmix_hash_table_get_next_key_uint32 PMIX_NAME(hash_table_get_next_key_uint32)
#define pmix_hash_table_get_next_key_uint64 PMIX_NAME(hash_table_get_next_key_uint64)
#define pmix_hash_table_get_value_ptr PMIX_NAME(hash_table_get_value_ptr)
#define pmix_hash_table_get_value_uint32 PMIX_NAME(hash_table_get_value_uint32)
#define pmix_hash_table_get_value_uint64 PMIX_NAME(hash_table_get_value_uint64)
#define pmix_hash_table_init PMIX_NAME(hash_table_init)
#define pmix_hash_table_remove_all PMIX_NAME(hash_table_remove_all)
#define pmix_hash_table_remove_value_ptr PMIX_NAME(hash_table_remove_value_ptr)
#define pmix_hash_table_remove_value_uint32 PMIX_NAME(hash_table_remove_value_uint32)
#define pmix_hash_table_remove_value_uint64 PMIX_NAME(hash_table_remove_value_uint64)
#define pmix_hash_table_set_value_ptr PMIX_NAME(hash_table_set_value_ptr)
#define pmix_hash_table_set_value_uint32 PMIX_NAME(hash_table_set_value_uint32)
#define pmix_hash_table_set_value_uint64 PMIX_NAME(hash_table_set_value_uint64)
#define pmix_hash_table_t_class PMIX_NAME(hash_table_t_class)
#define pmix_home_directory PMIX_NAME(home_directory)
#define pmix_host_server PMIX_NAME(pmix_host_server)
#define pmix_initialize_crc_table PMIX_NAME(initialize_crc_table)
#define pmix_kval_t_class PMIX_NAME(kval_t_class)
#define pmix_list_insert PMIX_NAME(list_insert)
#define pmix_list_item_t_class PMIX_NAME(list_item_t_class)
#define pmix_list_join PMIX_NAME(list_join)
#define pmix_list_sort PMIX_NAME(list_sort)
#define pmix_list_splice PMIX_NAME(list_splice)
#define pmix_list_t_class PMIX_NAME(list_t_class)
#define pmix_munge_module PMIX_NAME(munge_module)
#define pmix_native_module PMIX_NAME(native_module)
#define pmix_notify_caddy_t_class PMIX_NAME(notify_caddy_t_class)
#define pmix_nrec_t_class PMIX_NAME(nrec_t_class)
#define pmix_nspace_t_class PMIX_NAME(nspace_t_class)
#define pmix_object_t_class PMIX_NAME(object_t_class)
#define pmix_os_path PMIX_NAME(os_path)
#define pmix_output PMIX_NAME(output)
#define pmix_output_close PMIX_NAME(output_close)
#define pmix_output_finalize PMIX_NAME(output_finalize)
#define pmix_output_get_verbosity PMIX_NAME(output_get_verbosity)
#define pmix_output_init PMIX_NAME(output_init)
#define pmix_output_open PMIX_NAME(output_open)
#define pmix_output_redirected_syslog_pri PMIX_NAME(pmix_output_redirected_syslog_pri)
#define pmix_output_redirected_to_syslog PMIX_NAME(output_redirected_to_syslog)
#define pmix_output_reopen PMIX_NAME(output_reopen)
#define pmix_output_reopen_all PMIX_NAME(output_reopen_all)
#define pmix_output_set_output_file_info PMIX_NAME(output_set_output_file_info)
#define pmix_output_set_verbosity PMIX_NAME(output_set_verbosity)
#define pmix_output_stream_t_class PMIX_NAME(output_stream_t_class)
#define pmix_output_string PMIX_NAME(output_string)
#define pmix_output_switch PMIX_NAME(output_switch)
#define pmix_output_verbose PMIX_NAME(output_verbose)
#define pmix_output_vstring PMIX_NAME(output_vstring)
#define pmix_output_vverbose PMIX_NAME(output_vverbose)
#define pmix_pack_proc_map PMIX_NAME(pack_proc_map)
#define pmix_peer_t_class PMIX_NAME(peer_t_class)
#define pmix_pending_connection_t_class PMIX_NAME(pending_connection_t_class)
#define pmix_pending_nspace_requests PMIX_NAME(pending_nspace_requests)
#define pmix_pending_resolve PMIX_NAME(pending_resolve)
#define pmix_pointer_array_add PMIX_NAME(pointer_array_add)
#define pmix_pointer_array_init PMIX_NAME(pointer_array_init)
#define pmix_pointer_array_set_item PMIX_NAME(pointer_array_set_item)
#define pmix_pointer_array_set_size PMIX_NAME(pointer_array_set_size)
#define pmix_pointer_array_t_class PMIX_NAME(pointer_array_t_class)
#define pmix_pointer_array_test_and_set_item PMIX_NAME(pointer_array_test_and_set_item)
#define pmix_rank_info_t_class PMIX_NAME(rank_info_t_class)
#define pmix_regex_parse_nodes PMIX_NAME(regex_parse_nodes)
#define pmix_regex_parse_procs PMIX_NAME(regex_parse_procs)
#define pmix_regex_range_t_class PMIX_NAME(regex_range_t_class)
#define pmix_regex_value_t_class PMIX_NAME(regex_value_t_class)
#define pmix_sec PMIX_NAME(pmix_sec)
#define pmix_sec_finalize PMIX_NAME(sec_finalize)
#define pmix_sec_init PMIX_NAME(sec_init)
#define pmix_server_abort PMIX_NAME(server_abort)
#define pmix_server_caddy_t_class PMIX_NAME(server_caddy_t_class)
#define pmix_server_commit PMIX_NAME(server_commit)
#define pmix_server_connect PMIX_NAME(server_connect)
#define pmix_server_deregister_errhandler PMIX_NAME(server_deregister_errhandler)
#define pmix_server_fence PMIX_NAME(server_fence)
#define pmix_server_get PMIX_NAME(server_get)
#define pmix_server_globals PMIX_NAME(pmix_server_globals)
#define pmix_server_lookup PMIX_NAME(server_lookup)
#define pmix_server_notify_error PMIX_NAME(server_notify_error)
#define pmix_server_nspace_t_class PMIX_NAME(server_nspace_t_class)
#define pmix_server_publish PMIX_NAME(server_publish)
#define pmix_server_register_errhandler PMIX_NAME(server_register_errhandler)
#define pmix_server_spawn PMIX_NAME(server_spawn)
#define pmix_server_trkr_t_class PMIX_NAME(server_trkr_t_class)
#define pmix_server_unpublish PMIX_NAME(server_unpublish)
#define pmix_setenv PMIX_NAME(setenv)
#define pmix_setup_caddy_t_class PMIX_NAME(setup_caddy_t_class)
#define pmix_shift_caddy_t_class PMIX_NAME(shift_caddy_t_class)
#define pmix_snd_caddy_t_class PMIX_NAME(snd_caddy_t_class)
#define pmix_snprintf PMIX_NAME(snprintf)
#define pmix_start_listening PMIX_NAME(start_listening)
#define pmix_start_progress_thread PMIX_NAME(start_progress_thread)
#define pmix_stop_listening PMIX_NAME(stop_listening)
#define pmix_stop_progress_thread PMIX_NAME(stop_progress_thread)
#define pmix_timer_t_class PMIX_NAME(timer_t_class)
#define pmix_tmp_directory PMIX_NAME(tmp_directory)
#define pmix_trkr_caddy_t_class PMIX_NAME(trkr_caddy_t_class)
#define pmix_uicrc_partial PMIX_NAME(uicrc_partial)
#define pmix_uicsum_partial PMIX_NAME(uicsum_partial)
#define pmix_unsetenv PMIX_NAME(unsetenv)
#define pmix_usock_finalize PMIX_NAME(usock_finalize)
#define pmix_usock_globals PMIX_NAME(pmix_usock_globals)
#define pmix_usock_init PMIX_NAME(usock_init)
#define pmix_usock_posted_recv_t_class PMIX_NAME(usock_posted_recv_t_class)
#define pmix_usock_process_msg PMIX_NAME(usock_process_msg)
#define pmix_usock_queue_t_class PMIX_NAME(usock_queue_t_class)
#define pmix_usock_recv_blocking PMIX_NAME(usock_recv_blocking)
#define pmix_usock_recv_handler PMIX_NAME(usock_recv_handler)
#define pmix_usock_recv_t_class PMIX_NAME(usock_recv_t_class)
#define pmix_usock_send_blocking PMIX_NAME(usock_send_blocking)
#define pmix_usock_send_handler PMIX_NAME(usock_send_handler)
#define pmix_usock_send_recv PMIX_NAME(usock_send_recv)
#define pmix_usock_send_t_class PMIX_NAME(usock_send_t_class)
#define pmix_usock_set_blocking PMIX_NAME(usock_set_blocking)
#define pmix_usock_set_nonblocking PMIX_NAME(usock_set_nonblocking)
#define pmix_usock_sr_t_class PMIX_NAME(usock_sr_t_class)
#define pmix_value_load PMIX_NAME(value_load)
#define pmix_value_unload PMIX_NAME(value_unload)
#define pmix_value_xfer PMIX_NAME(value_xfer)
#define pmix_vasprintf PMIX_NAME(vasprintf)
#define pmix_vsnprintf PMIX_NAME(vsnprintf)
#endif /* PMIX_SYM_TRANSFORM */
END_C_DECLS
#endif /* PMIX_RENAME_H */

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

@ -0,0 +1,444 @@
/*
* Copyright (c) 2013-2015 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
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer listed
* in this license in the documentation and/or other materials
* provided with the distribution.
*
* - Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* The copyright holders provide no reassurances that the source code
* provided does not infringe any patent, copyright, or any other
* intellectual property rights of third parties. The copyright holders
* disclaim any liability to any recipient for claims brought against
* recipient by any third party for infringement of that parties
* intellectual property rights.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $HEADER$
*
* PMIx provides a "function-shipping" approach to support for
* implementing the server-side of the protocol. This method allows
* resource managers to implement the server without being burdened
* with PMIx internal details. Accordingly, each PMIx API is mirrored
* here in a function call to be provided by the server. When a
* request is received from the client, the corresponding server function
* will be called with the information.
*
* Any functions not supported by the RM can be indicated by a NULL for
* the function pointer. Client calls to such functions will have a
* "not supported" error returned.
*/
#ifndef PMIx_SERVER_API_H
#define PMIx_SERVER_API_H
#include <pmix/autogen/config.h>
#include <stdint.h>
#include <string.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> /* for struct timeval */
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#ifdef HAVE_NET_UIO_H
#include <net/uio.h>
#endif
/* Symbol transforms */
#include <pmix/rename.h>
/* Structure and constant definitions */
#include <pmix/pmix_common.h>
BEGIN_C_DECLS
/**** SERVER FUNCTION-SHIPPED APIs ****/
/* NOTE: for performance purposes, the host server is required to
* return as quickly as possible from all functions. Execution of
* the function is thus to be done asynchronously so as to allow
* the PMIx server support library to handle multiple client requests
* as quickly and scalably as possible.
*
* ALL data passed to the host server functions is "owned" by the
* PMIX server support library and MUST NOT be free'd. Data returned
* by the host server via callback function is owned by the host
* 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 called PMIx_Finalize - 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_finalized_fn_t)(const pmix_proc_t *proc, void* server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* A local client called PMIx_Abort - 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. The
* array of procs indicates which processes are to be terminated. A NULL
* indicates that all procs in the client's nspace are to be terminated */
typedef pmix_status_t (*pmix_server_abort_fn_t)(const pmix_proc_t *proc, void *server_object,
int status, const char msg[],
pmix_proc_t procs[], size_t nprocs,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* At least one client called either PMIx_Fence or PMIx_Fence_nb. In either case,
* the host server will be called via a non-blocking function to execute
* the specified operation once all participating local procs have
* contributed. All processes in the specified array are required to participate
* in the Fence[_nb] operation. The callback is to be executed once each daemon
* hosting at least one participant has called the host server's fencenb function.
*
* The provided data is to be collectively shared with all PMIx
* servers involved in the fence operation, and returned in the modex
* cbfunc. A _NULL_ data value indicates that the local procs had
* no data to contribute.
*
* The array of info structs is used to pass user-requested options to the server.
* This can include directives as to the algorithm to be used to execute the
* fence operation. The directives are optional _unless_ the _mandatory_ flag
* has been set - in such cases, the host RM is required to return an error
* if the directive cannot be met. */
typedef pmix_status_t (*pmix_server_fencenb_fn_t)(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
char *data, size_t ndata,
pmix_modex_cbfunc_t cbfunc, void *cbdata);
/* Used by the PMIx server to request its local host contact the
* PMIx server on the remote node that hosts the specified proc to
* obtain and return a direct modex blob for that proc.
*
* The array of info structs is used to pass user-requested options to the server.
* This can include a timeout to preclude an indefinite wait for data that
* may never become available. The directives are optional _unless_ the _mandatory_ flag
* has been set - in such cases, the host RM is required to return an error
* if the directive cannot be met. */
typedef pmix_status_t (*pmix_server_dmodex_req_fn_t)(const pmix_proc_t *proc,
const pmix_info_t info[], size_t ninfo,
pmix_modex_cbfunc_t cbfunc, void *cbdata);
/* Publish data per the PMIx API specification. The callback is to be executed
* upon completion of the operation. The default data range is expected to be
* PMIX_SESSION, and the default persistence PMIX_PERSIST_SESSION. These values
* can be modified by including the respective pmix_info_t struct in the
* provided array.
*
* Note that the host server is not required to guarantee support for any specific
* range - i.e., the server does not need to return an error if the data store
* doesn't support range-based isolation. However, the server must return an error
* (a) if the key is duplicative within the storage range, and (b) if the server
* does not allow overwriting of published info by the original publisher - it is
* left to the discretion of the host server to allow info-key-based flags to modify
* this behavior.
*
* The persistence indicates how long the server should retain the data.
*
* The identifier of the publishing process is also provided and is expected to
* be returned on any subsequent lookup request */
typedef pmix_status_t (*pmix_server_publish_fn_t)(const pmix_proc_t *proc,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Lookup published data. The host server will be passed a NULL-terminated array
* of string keys.
*
* The array of info structs is used to pass user-requested options to the server.
* This can include a wait flag to indicate that the server should wait for all
* data to become available before executing the callback function, or should
* immediately callback with whatever data is available. In addition, a timeout
* can be specified on the wait to preclude an indefinite wait for data that
* may never be published. */
typedef pmix_status_t (*pmix_server_lookup_fn_t)(const pmix_proc_t *proc, char **keys,
const pmix_info_t info[], size_t ninfo,
pmix_lookup_cbfunc_t cbfunc, void *cbdata);
/* Delete data from the data store. The host server will be passed a NULL-terminated array
* of string keys, plus potential directives such as the data range within which the
* keys should be deleted. The callback is to be executed upon completion of the delete
* procedure */
typedef pmix_status_t (*pmix_server_unpublish_fn_t)(const pmix_proc_t *proc, char **keys,
const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Spawn a set of applications/processes as per the PMIx API. Note that
* applications are not required to be MPI or any other programming model.
* Thus, the host server cannot make any assumptions as to their required
* support. The callback function is to be executed once all processes have
* been started. An error in starting any application or process in this
* request shall cause all applications and processes in the request to
* be terminated, and an error returned to the originating caller.
*
* Note that a timeout can be specified in the job_info array to indicate
* that failure to start the requested job within the given time should
* result in termination to avoid hangs */
typedef pmix_status_t (*pmix_server_spawn_fn_t)(const pmix_proc_t *proc,
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". This means that the resource
* manager should treat the failure of any process in the specified group as
* a reportable event, and take appropriate action. The callback function is
* to be called once all participating processes have called connect. Note that
* a process can only engage in *one* connect operation involving the identical
* set of procs at a time. However, a process *can* be simultaneously engaged
* in multiple connect operations, each involving a different set of procs
*
* Note also that this is a collective operation within the client library, and
* thus the client will be blocked until all procs participate. Thus, the info
* array can be used to pass user directives, including a timeout.
* The directives are optional _unless_ the _mandatory_ flag
* has been set - in such cases, the host RM is required to return an error
* if the directive cannot be met. */
typedef pmix_status_t (*pmix_server_connect_fn_t)(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 should be returned
* if the specified set of procs was not previously "connected". As above, a process
* may be involved in multiple simultaneous disconnect operations. However, a process
* is not allowed to reconnect to a set of ranges that has not fully completed
* disconnect - i.e., you have to fully disconnect before you can reconnect to the
* same group of processes.
*
* Note also that this is a collective operation within the client library, and
* thus the client will be blocked until all procs participate. Thus, the info
* array can be used to pass user directives, including a timeout.
* The directives are optional _unless_ the _mandatory_ flag
* has been set - in such cases, the host RM is required to return an error
* if the directive cannot be met. */
typedef pmix_status_t (*pmix_server_disconnect_fn_t)(const pmix_proc_t procs[], size_t nprocs,
const pmix_info_t info[], size_t ninfo,
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,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Deregister to receive notifications for the specified events that
* the client application has registered for previously. When the client
* application deregisters the err handler forevents, PMIX client passes the
* deregister request to PMIx server which in turn passes the request to the
* resource manager by calling deregister events function.*/
typedef pmix_status_t (*pmix_server_deregister_events_fn_t)(const pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Callback function for incoming connection requests from
* local clients */
typedef void (*pmix_connection_cbfunc_t)(int incoming_sd);
/* Register a socket the host server can monitor for connection
* requests, harvest them, and then call our internal callback
* function for further processing. A listener thread is essential
* to efficiently harvesting connection requests from large
* numbers of local clients such as occur when running on large
* SMPs. The host server listener is required to call accept
* on the incoming connection request, and then passing the
* resulting soct to the provided cbfunc. A NULL for this function
* 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);
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;
} pmix_server_module_t;
/**** SERVER SUPPORT INIT/FINALIZE FUNCTIONS ****/
/* Initialize the server support library, and provide a
* pointer to a pmix_server_module_t structure
* containing the caller's callback functions. The
* array of pmix_info_t structs is used to pass
* additional info that may be required by the server
* when initializing - e.g., a user/group ID to set
* on the rendezvous file for the Unix Domain Socket */
pmix_status_t PMIx_server_init(pmix_server_module_t *module,
pmix_info_t info[], size_t ninfo);
/* Finalize the server support library. If internal comm is
* in-use, the server will shut it down at this time. All
* memory usage is released */
pmix_status_t PMIx_server_finalize(void);
/* given a semicolon-separated list of input values, generate
* a regex that can be passed down to the client for parsing.
* The caller is responsible for free'ing the resulting
* string
*
* If values have leading zero's, then that is preserved. You
* have to add back any prefix/suffix for node names
* odin[009-015,017-023,076-086]
*
* "pmix:odin[009-015,017-023,076-086]"
*
* Note that the "pmix" at the beginning of each regex indicates
* that the PMIx native parser is to be used by the client for
* parsing the provided regex. Other parsers may be supported - see
* the pmix_client.h header for a list.
*/
pmix_status_t PMIx_generate_regex(const char *input, char **regex);
/* The input is expected to consist of a comma-separated list
* of ranges. Thus, an input of:
* "1-4;2-5;8,10,11,12;6,7,9"
* would generate a regex of
* "[pmix:2x(3);8,10-12;6-7,9]"
*
* Note that the "pmix" at the beginning of each regex indicates
* that the PMIx native parser is to be used by the client for
* parsing the provided regex. Other parsers may be supported - see
* the pmix_client.h header for a list.
*/
pmix_status_t PMIx_generate_ppn(const char *input, char **ppn);
/* Setup the data about a particular nspace so it can
* be passed to any child process upon startup. The PMIx
* connection procedure provides an opportunity for the
* host PMIx server to pass job-related info down to a
* child process. This might include the number of
* processes in the job, relative local ranks of the
* processes within the job, and other information of
* use to the process. The server is free to determine
* which, if any, of the supported elements it will
* provide - defined values are provided in pmix_common.h.
*
* NOTE: the server must register ALL nspaces that will
* participate in collective operations with local processes.
* This means that the server must register an nspace even
* if it will not host any local procs from within that
* nspace IF any local proc might at some point perform
* a collective operation involving one or more procs from
* that nspace. This is necessary so that the collective
* operation can know when it is locally complete.
*
* The caller must also provide the number of local procs
* that will be launched within this nspace. This is required
* for the PMIx server library to correctly handle collectives
* as a collective operation call can occur before all the
* procs have been started */
pmix_status_t PMIx_server_register_nspace(const char nspace[], int nlocalprocs,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Deregister an nspace and purge all objects relating to
* it, including any client info from that nspace. This is
* 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[]);
/* Register a client process with the PMIx server library. The
* expected user ID and group ID of the child process helps the
* server library to properly authenticate clients as they connect
* by requiring the two values to match.
*
* The host server can also, if it desires, provide an object
* it wishes to be returned when a server function is called
* that relates to a specific process. For example, the host
* server may have an object that tracks the specific client.
* Passing the object to the library allows the library to
* return that object when the client calls "finalize", thus
* allowing the host server to access the object without
* performing a lookup. */
pmix_status_t PMIx_server_register_client(const pmix_proc_t *proc,
uid_t uid, gid_t gid,
void *server_object,
pmix_op_cbfunc_t cbfunc, void *cbdata);
/* Deregister a client and purge all data relating to it. The
* 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);
/* Setup the environment of a child process to be forked
* by the host so it can correctly interact with the PMIx
* server. The PMIx client needs some setup information
* so it can properly connect back to the server. This function
* will set appropriate environmental variables for this purpose. */
pmix_status_t PMIx_server_setup_fork(const pmix_proc_t *proc, char ***env);
/* Define a callback function the PMIx server will use to return
* direct modex requests to the host server. The PMIx server
* will free the data blob upon return from the response fn */
typedef void (*pmix_dmodex_response_fn_t)(pmix_status_t status,
char *data, size_t sz,
void *cbdata);
/* Define a function by which the host server can request modex data
* from the local PMIx server. This is used to support the direct modex
* operation - i.e., where data is cached locally on each PMIx
* server for its own local clients, and is obtained on-demand
* for remote requests. Upon receiving a request from a remote
* server, the host server will call this function to pass the
* request into the PMIx server. The PMIx server will return a blob
* (once it becomes available) via the cbfunc - the host
* server shall send the blob back to the original requestor */
pmix_status_t PMIx_server_dmodex_request(const pmix_proc_t *proc,
pmix_dmodex_response_fn_t cbfunc,
void *cbdata);
END_C_DECLS
#endif

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

@ -0,0 +1,29 @@
/*
* 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) 2006 Voltaire All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_ALIGN_H
#define PMIX_ALIGN_H
#define PMIX_ALIGN(x,a,t) (((x)+((t)(a)-1)) & ~(((t)(a)-1)))
#define PMIX_ALIGN_PTR(x,a,t) ((t)PMIX_ALIGN((uintptr_t)x, a, uintptr_t))
#define PMIX_ALIGN_PAD_AMOUNT(x,s) ((~((uintptr_t)(x))+1) & ((uintptr_t)(s)-1))
#endif /* PMIX_ALIGN_H */

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

@ -0,0 +1,3 @@
This directory needs to exist in the repo so that the Autotools can
generate a file here. We have a put a token file in this directory so
that git doesn't ignore the empty directory in the repository.

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

@ -0,0 +1,69 @@
/*
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file
*
* Simple macros to quickly compute a hash value from a string.
*
*/
#ifndef PMIX_HASH_STRING_H
#define PMIX_HASH_STRING_H
/**
* Compute the hash value and the string length simultaneously
*
* @param str (IN) The string which will be parsed (char*)
* @param hash (OUT) Where the hash value will be stored (uint32_t)
* @param length (OUT) The computed length of the string (uint32_t)
*/
#define PMIX_HASH_STRLEN( str, hash, length ) \
do { \
register const char *_str = (str); \
register uint32_t _hash = 0; \
register uint32_t _len = 0; \
\
while( *_str ) { \
_len++; \
_hash += *_str++; \
_hash += (_hash << 10); \
_hash ^= (_hash >> 6); \
} \
\
_hash += (_hash << 3); \
_hash ^= (_hash >> 11); \
(hash) = (_hash + (_hash << 15)); \
(length) = _len; \
} while(0)
/**
* Compute the hash value
*
* @param str (IN) The string which will be parsed (char*)
* @param hash (OUT) Where the hash value will be stored (uint32_t)
*/
#define PMIX_HASH_STR( str, hash ) \
do { \
register const char *_str = (str); \
register uint32_t _hash = 0; \
\
while( *_str ) { \
_hash += *_str++; \
_hash += (_hash << 10); \
_hash ^= (_hash >> 6); \
} \
\
_hash += (_hash << 3); \
_hash ^= (_hash >> 11); \
(hash) = (_hash + (_hash << 15)); \
} while(0)
#endif /* PMIX_HASH_STRING_H */

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

@ -0,0 +1,26 @@
/*
* 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) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_GET_SOCKET_ERROR_H
#define PMIX_GET_SOCKET_ERROR_H
#include <errno.h>
#define pmix_socket_errno errno
#endif /* PMIX_GET_ERROR_H */

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

@ -0,0 +1,325 @@
/*
* Copyright (c) 2004-2007 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$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file includes the C99 stdint.h file if available, and otherwise
* defines fixed-width types according to the SIZEOF information
* gathered by configure.
*/
#ifndef PMIX_STDINT_H
#define PMIX_STDINT_H 1
/*
* Include what we can and define what is missing.
*/
#include <limits.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
/* 8-bit */
#if SIZEOF_CHAR == 1
#ifndef HAVE_INT8_T
typedef signed char int8_t;
#endif
#ifndef HAVE_UINT8_T
typedef unsigned char uint8_t;
#endif
#else
#error Failed to define 8-bit types
#endif
/* 16-bit */
#if SIZEOF_SHORT == 2
#ifndef HAVE_INT16_T
typedef signed short int16_t;
#endif
#ifndef HAVE_UINT16_T
typedef unsigned short uint16_t;
#endif
#else
#error Failed to define 16-bit types
#endif
/* 32-bit */
#if SIZEOF_INT == 4
#ifndef HAVE_INT32_T
typedef signed int int32_t;
#endif
#ifndef HAVE_UINT32_T
typedef unsigned int uint32_t;
#endif
#elif SIZEOF_LONG == 4
#ifndef HAVE_INT32_T
typedef signed long int32_t;
#endif
#ifndef HAVE_UINT32_T
typedef unsigned long uint32_t;
#endif
#else
#error Failed to define 32-bit types
#endif
/* 64-bit */
#if SIZEOF_INT == 8
#ifndef HAVE_INT64_T
typedef signed int int64_t;
#endif
#ifndef HAVE_UINT64_T
typedef unsigned int uint64_t;
#endif
#elif SIZEOF_LONG == 8
#ifndef HAVE_INT64_T
typedef signed long int64_t;
#endif
#ifndef HAVE_UINT64_T
typedef unsigned long uint64_t;
#endif
#elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
#ifndef HAVE_INT64_T
typedef signed long long int64_t;
#endif
#ifndef HAVE_UINT64_T
typedef unsigned long long uint64_t;
#endif
#else
#error Failed to define 64-bit types
#endif
/* Pointers */
#if SIZEOF_VOID_P == SIZEOF_INT
#ifndef HAVE_INTPTR_T
typedef signed int intptr_t;
#endif
#ifndef HAVE_UINTPTR_T
typedef unsigned int uintptr_t;
#endif
#elif SIZEOF_VOID_P == SIZEOF_LONG
#ifndef HAVE_INTPTR_T
typedef signed long intptr_t;
#endif
#ifndef HAVE_UINTPTR_T
typedef unsigned long uintptr_t;
#endif
#elif HAVE_LONG_LONG && SIZEOF_VOID_P == SIZEOF_LONG_LONG
#ifndef HAVE_INTPTR_T
typedef signed long long intptr_t;
#endif
#ifndef HAVE_UINTPTR_T
typedef unsigned long long uintptr_t;
#endif
#else
#error Failed to define pointer-sized integer types
#endif
/* fix up some constants that may be missing */
#ifndef SIZE_MAX
# if SIZEOF_VOID_P == SIZEOF_INT
# define SIZE_MAX UINT_MAX
# elif SIZEOF_VOID_P == SIZEOF_LONG
# define SIZE_MAX ULONG_MAX
# else
# error Failed to find value for SIZE_MAX
# endif
#endif /* ifndef SIZE_MAX */
/* inttypes.h printf specifiers */
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if SIZEOF_LONG == 8
# define __PRI64_PREFIX "l"
# define __PRIPTR_PREFIX "l"
# else
# define __PRI64_PREFIX "ll"
# define __PRIPTR_PREFIX
# endif
/* Decimal notation. */
# define PRId8 "d"
# define PRId16 "d"
# define PRId32 "d"
# define PRId64 __PRI64_PREFIX "d"
# define PRIdLEAST8 "d"
# define PRIdLEAST16 "d"
# define PRIdLEAST32 "d"
# define PRIdLEAST64 __PRI64_PREFIX "d"
# define PRIdFAST8 "d"
# define PRIdFAST16 __PRIPTR_PREFIX "d"
# define PRIdFAST32 __PRIPTR_PREFIX "d"
# define PRIdFAST64 __PRI64_PREFIX "d"
# define PRIi8 "i"
# define PRIi16 "i"
# define PRIi32 "i"
# define PRIi64 __PRI64_PREFIX "i"
# define PRIiLEAST8 "i"
# define PRIiLEAST16 "i"
# define PRIiLEAST32 "i"
# define PRIiLEAST64 __PRI64_PREFIX "i"
# define PRIiFAST8 "i"
# define PRIiFAST16 __PRIPTR_PREFIX "i"
# define PRIiFAST32 __PRIPTR_PREFIX "i"
# define PRIiFAST64 __PRI64_PREFIX "i"
/* Octal notation. */
# define PRIo8 "o"
# define PRIo16 "o"
# define PRIo32 "o"
# define PRIo64 __PRI64_PREFIX "o"
# define PRIoLEAST8 "o"
# define PRIoLEAST16 "o"
# define PRIoLEAST32 "o"
# define PRIoLEAST64 __PRI64_PREFIX "o"
# define PRIoFAST8 "o"
# define PRIoFAST16 __PRIPTR_PREFIX "o"
# define PRIoFAST32 __PRIPTR_PREFIX "o"
# define PRIoFAST64 __PRI64_PREFIX "o"
/* Unsigned integers. */
# define PRIu8 "u"
# define PRIu16 "u"
# define PRIu32 "u"
# define PRIu64 __PRI64_PREFIX "u"
# define PRIuLEAST8 "u"
# define PRIuLEAST16 "u"
# define PRIuLEAST32 "u"
# define PRIuLEAST64 __PRI64_PREFIX "u"
# define PRIuFAST8 "u"
# define PRIuFAST16 __PRIPTR_PREFIX "u"
# define PRIuFAST32 __PRIPTR_PREFIX "u"
# define PRIuFAST64 __PRI64_PREFIX "u"
/* lowercase hexadecimal notation. */
# define PRIx8 "x"
# define PRIx16 "x"
# define PRIx32 "x"
# define PRIx64 __PRI64_PREFIX "x"
# define PRIxLEAST8 "x"
# define PRIxLEAST16 "x"
# define PRIxLEAST32 "x"
# define PRIxLEAST64 __PRI64_PREFIX "x"
# define PRIxFAST8 "x"
# define PRIxFAST16 __PRIPTR_PREFIX "x"
# define PRIxFAST32 __PRIPTR_PREFIX "x"
# define PRIxFAST64 __PRI64_PREFIX "x"
/* UPPERCASE hexadecimal notation. */
# define PRIX8 "X"
# define PRIX16 "X"
# define PRIX32 "X"
# define PRIX64 __PRI64_PREFIX "X"
# define PRIXLEAST8 "X"
# define PRIXLEAST16 "X"
# define PRIXLEAST32 "X"
# define PRIXLEAST64 __PRI64_PREFIX "X"
# define PRIXFAST8 "X"
# define PRIXFAST16 __PRIPTR_PREFIX "X"
# define PRIXFAST32 __PRIPTR_PREFIX "X"
# define PRIXFAST64 __PRI64_PREFIX "X"
/* Macros for printing `intmax_t' and `uintmax_t'. */
# define PRIdMAX __PRI64_PREFIX "d"
# define PRIiMAX __PRI64_PREFIX "i"
# define PRIoMAX __PRI64_PREFIX "o"
# define PRIuMAX __PRI64_PREFIX "u"
# define PRIxMAX __PRI64_PREFIX "x"
# define PRIXMAX __PRI64_PREFIX "X"
/* Macros for printing `intptr_t' and `uintptr_t'. */
# define PRIdPTR __PRIPTR_PREFIX "d"
# define PRIiPTR __PRIPTR_PREFIX "i"
# define PRIoPTR __PRIPTR_PREFIX "o"
# define PRIuPTR __PRIPTR_PREFIX "u"
# define PRIxPTR __PRIPTR_PREFIX "x"
# define PRIXPTR __PRIPTR_PREFIX "X"
#endif
#ifndef PRIsize_t
# if defined(ACCEPT_C99)
# define PRIsize_t "zu"
# elif SIZEOF_SIZE_T == SIZEOF_LONG
# define PRIsize_t "lu"
# elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
# define PRIsize_t "llu"
# else
# define PRIsize_t "u"
# endif
#endif
#endif /* PMIX_STDINT_H */

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

@ -0,0 +1,37 @@
/*
* Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file
*
* Compiler-specific prefetch functions
*
* A small set of prefetch / prediction interfaces for using compiler
* directives to improve memory prefetching and branch prediction
*/
#ifndef PMIX_PREFETCH_H
#define PMIX_PREFETCH_H
#if PMIX_C_HAVE_BUILTIN_EXPECT
#define PMIX_LIKELY(expression) __builtin_expect(!!(expression), 1)
#define PMIX_UNLIKELY(expression) __builtin_expect(!!(expression), 0)
#else
#define PMIX_LIKELY(expression) (expression)
#define PMIX_UNLIKELY(expression) (expression)
#endif
#if PMIX_C_HAVE_BUILTIN_PREFETCH
#define PMIX_PREFETCH(address,rw,locality) __builtin_prefetch(address,rw,locality)
#else
#define PMIX_PREFETCH(address,rw,locality)
#endif
#endif

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

@ -0,0 +1,221 @@
/*
* 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) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_TYPES_H
#define PMIX_TYPES_H
#include <private/autogen/config.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include PMIX_EVENT_HEADER
#if PMIX_ENABLE_DEBUG
#include "src/util/output.h"
#endif
/*
* portable assignment of pointer to int
*/
typedef union {
uint64_t lval;
uint32_t ival;
void* pval;
struct {
uint32_t uval;
uint32_t lval;
} sval;
} pmix_ptr_t;
/*
* handle differences in iovec
*/
#if defined(__APPLE__) || defined(__WINDOWS__)
typedef char* pmix_iov_base_ptr_t;
#define PMIX_IOVBASE char
#else
#define PMIX_IOVBASE void
typedef void* pmix_iov_base_ptr_t;
#endif
/*
* handle differences in socklen_t
*/
#if defined(HAVE_SOCKLEN_T)
typedef socklen_t pmix_socklen_t;
#else
typedef int pmix_socklen_t;
#endif
#define pmix_htons htons
#define pmix_ntohs ntohs
/*
* Convert a 64 bit value to network byte order.
*/
static inline uint64_t pmix_hton64(uint64_t val) __pmix_attribute_const__;
static inline uint64_t pmix_hton64(uint64_t val)
{
#ifdef HAVE_UNIX_BYTESWAP
union { uint64_t ll;
uint32_t l[2];
} w, r;
/* platform already in network byte order? */
if(htonl(1) == 1L)
return val;
w.ll = val;
r.l[0] = htonl(w.l[1]);
r.l[1] = htonl(w.l[0]);
return r.ll;
#else
return val;
#endif
}
/*
* Convert a 64 bit value from network to host byte order.
*/
static inline uint64_t pmix_ntoh64(uint64_t val) __pmix_attribute_const__;
static inline uint64_t pmix_ntoh64(uint64_t val)
{
#ifdef HAVE_UNIX_BYTESWAP
union { uint64_t ll;
uint32_t l[2];
} w, r;
/* platform already in network byte order? */
if(htonl(1) == 1L)
return val;
w.ll = val;
r.l[0] = ntohl(w.l[1]);
r.l[1] = ntohl(w.l[0]);
return r.ll;
#else
return val;
#endif
}
/**
* Convert between a local representation of pointer and a 64 bits value.
*/
static inline uint64_t pmix_ptr_ptol( void* ptr ) __pmix_attribute_const__;
static inline uint64_t pmix_ptr_ptol( void* ptr )
{
return (uint64_t)(uintptr_t) ptr;
}
static inline void* pmix_ptr_ltop( uint64_t value ) __pmix_attribute_const__;
static inline void* pmix_ptr_ltop( uint64_t value )
{
#if SIZEOF_VOID_P == 4 && PMIX_ENABLE_DEBUG
if (value > ((1ULL << 32) - 1ULL)) {
pmix_output(0, "Warning: truncating value in pmix_ptr_ltop");
}
#endif
return (void*)(uintptr_t) value;
}
#if defined(WORDS_BIGENDIAN) || !defined(HAVE_UNIX_BYTESWAP)
static inline uint16_t pmix_swap_bytes2(uint16_t val) __pmix_attribute_const__;
static inline uint16_t pmix_swap_bytes2(uint16_t val)
{
union { uint16_t bigval;
uint8_t arrayval[2];
} w, r;
w.bigval = val;
r.arrayval[0] = w.arrayval[1];
r.arrayval[1] = w.arrayval[0];
return r.bigval;
}
static inline uint32_t pmix_swap_bytes4(uint32_t val) __pmix_attribute_const__;
static inline uint32_t pmix_swap_bytes4(uint32_t val)
{
union { uint32_t bigval;
uint8_t arrayval[4];
} w, r;
w.bigval = val;
r.arrayval[0] = w.arrayval[3];
r.arrayval[1] = w.arrayval[2];
r.arrayval[2] = w.arrayval[1];
r.arrayval[3] = w.arrayval[0];
return r.bigval;
}
static inline uint64_t pmix_swap_bytes8(uint64_t val) __pmix_attribute_const__;
static inline uint64_t pmix_swap_bytes8(uint64_t val)
{
union { uint64_t bigval;
uint8_t arrayval[8];
} w, r;
w.bigval = val;
r.arrayval[0] = w.arrayval[7];
r.arrayval[1] = w.arrayval[6];
r.arrayval[2] = w.arrayval[5];
r.arrayval[3] = w.arrayval[4];
r.arrayval[4] = w.arrayval[3];
r.arrayval[5] = w.arrayval[2];
r.arrayval[6] = w.arrayval[1];
r.arrayval[7] = w.arrayval[0];
return r.bigval;
}
#else
#define pmix_swap_bytes2 htons
#define pmix_swap_bytes4 htonl
#define pmix_swap_bytes8 hton64
#endif /* WORDS_BIGENDIAN || !HAVE_UNIX_BYTESWAP */
typedef struct event_base pmix_event_base_t;
typedef struct event pmix_event_t;
#endif /* PMIX_TYPES_H */

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

@ -0,0 +1,62 @@
.TH "pmix_abort" "3" "2015\-10\-25" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
PMIx_Abort \- Abort the specified processes
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <pmix.h>
pmix_status_t\ PMIx_Abort(int\ status,\ const\ char\ msg[],
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ pmix_proc_t\ procs[],\ size_t\ nprocs);
\f[]
.fi
.SH ARGUMENTS
.PP
\f[I]status\f[] : Status value to be returned.
A value of zero is permitted by PMIx, but may not be returned by some
resource managers.
.PP
\f[I]msg\f[] : A string message to be displayed
.PP
\f[I]procs\f[] : An array of pmix_proc_t structures defining the
processes to be aborted.
A \f[I]NULL\f[] for the proc array indicates that all processes in the
caller\[aq]s nspace are to be aborted.
A wildcard value for the rank in any structure indicates that all
processes in that nspace are to be aborted.
.PP
\f[I]nprocs\f[] : Number of pmix_proc_t structures in the \f[I]procs\f[]
array
.SH DESCRIPTION
.PP
Request that the provided array of procs be aborted, returning the
provided \f[I]status\f[] and printing the provided message.
A \f[I]NULL\f[] for the proc array indicates that all processes in the
caller\[aq]s nspace are to be aborted.
.PP
The response to this request is somewhat dependent on the specific
resource manager and its configuration (e.g., some resource managers
will not abort the application if the provided \f[I]status\f[] is zero
unless specifically configured to do so), and thus lies outside the
control of PMIx itself.
However, the client will inform the RM of the request that the
application be aborted, regardless of the value of the provided
\f[I]status\f[].
.PP
Passing a \f[I]NULL\f[] msg parameter is allowed.
Note that race conditions 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.
.SH RETURN VALUE
.PP
Returns PMIX_SUCCESS on success.
On error, a negative value corresponding to a PMIx errno is returned.
.SH ERRORS
.PP
PMIx errno values are defined in \f[C]pmix_common.h\f[].
.SH NOTES
.SH SEE ALSO
.SH AUTHORS
PMIx.

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

@ -0,0 +1,35 @@
.TH "pmix_commit" "3" "2015\-10\-27" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
PMIx_Commit \- Push all previously \f[I]PMIx\f[]Put_ values to the local
PMIx server.
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <pmix.h>
pmix_status_t\ PMIx_Commit(void);
\f[]
.fi
.SH ARGUMENTS
.PP
\f[I]none\f[]
.SH DESCRIPTION
.PP
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
.SH RETURN VALUE
.PP
Returns PMIX_SUCCESS on success.
On error, a negative value corresponding to a PMIx errno is returned.
.SH ERRORS
.PP
PMIx errno values are defined in \f[C]pmix_common.h\f[].
.SH NOTES
.SH SEE ALSO
.PP
\f[C]PMIx_Put\f[](3)
.SH AUTHORS
PMIx.

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

@ -0,0 +1,31 @@
.TH "pmix_finalize" "3" "2015\-10\-27" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
PMIx_Finalize \- Finalize the PMIx Client
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <pmix.h>
pmix_status_t\ PMIx_Finalize(void);
\f[]
.fi
.SH ARGUMENTS
.SH DESCRIPTION
.PP
Finalize the PMIx client, closing the connection with the local PMIx
server.
.SH RETURN VALUE
.PP
Returns PMIX_SUCCESS on success.
On error, a negative value corresponding to a PMIx errno is returned.
.SH ERRORS
.PP
PMIx errno values are defined in \f[C]pmix_common.h\f[].
.SH NOTES
.SH SEE ALSO
.PP
\f[C]PMIx_Init\f[](3)
.SH AUTHORS
PMIx.

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

@ -0,0 +1,49 @@
.TH "pmix_init" "3" "2015\-10\-25" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
PMIx_Init \- Initialize the PMIx Client
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <pmix.h>
pmix_status_t\ PMIx_Init(pmix_proc_t\ *proc);
\f[]
.fi
.SH ARGUMENTS
.PP
\f[I]proc\f[] : Pointer to a pmix_proc_t object in which the
client\[aq]s namespace and rank are to be returned.
.SH DESCRIPTION
.PP
Initialize the PMIx client, returning the process identifier assigned to
this client\[aq]s application in the provided pmix_proc_t struct.
Passing a parameter of \f[I]NULL\f[] for this parameter is allowed if
the user wishes solely to initialize the PMIx system and does not
require return of the identifier at that time.
.PP
When called, the PMIx client will check for the required connection
information of the local PMIx server and will establish the connection.
If the information is not found, or the server connection fails, then an
appropriate error constant will be returned.
.PP
If successful, the function will return PMIX_SUCCESS and will fill the
provided structure with the server\-assigned namespace and rank of the
process within the application.
.PP
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.
.SH RETURN VALUE
.PP
Returns PMIX_SUCCESS on success.
On error, a negative value corresponding to a PMIx errno is returned.
.SH ERRORS
.PP
PMIx errno values are defined in \f[C]pmix_common.h\f[].
.SH NOTES
.SH SEE ALSO
.SH AUTHORS
PMIx.

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

@ -0,0 +1,30 @@
.TH "pmix_initialized" "3" "2015\-10\-25" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
PMIx_Initialized \- Check if \f[I]PMIx\f[]Init_ has been called
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <pmix.h>
int\ PMIx_Initialized(void);
\f[]
.fi
.SH ARGUMENTS
.PP
\f[I]none\f[]
.SH DESCRIPTION
.PP
Check to see if the PMIx Client library has been intialized
.SH RETURN VALUE
.PP
Returns \f[I]true\f[] if the PMIx Client has been initialized, and
\f[I]false\f[] if not.
.SH ERRORS
.SH NOTES
.SH SEE ALSO
.PP
\f[C]PMIx_Init\f[](3)
.SH AUTHORS
PMIx.

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

@ -0,0 +1,60 @@
.TH "pmix_put" "3" "2015\-10\-25" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
PMIx_Put \- Push a value into the client\[aq]s namespace
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <pmix.h>
pmix_status_t\ PMIx_Init(pmix_scope_t\ scope,\ const\ char\ key[],\ pmix_value_t\ *val);
\f[]
.fi
.SH ARGUMENTS
.PP
\f[I]scope\f[] : Defines a scope for data "put" by PMI per the
following:
.IP
.nf
\f[C]
*\ PMI_LOCAL\ \-\ the\ data\ is\ intended\ only\ for\ other\ application
\ \ \ \ \ \ \ \ \ \ \ \ \ \ processes\ on\ the\ same\ node.\ Data\ marked\ in\ this\ way
\ \ \ \ \ \ \ \ \ \ \ \ \ \ will\ not\ be\ included\ in\ data\ packages\ sent\ to\ remote\ requestors
*\ PMI_REMOTE\ \-\ the\ data\ is\ intended\ solely\ for\ applications\ processes\ on
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ remote\ nodes.\ Data\ marked\ in\ this\ way\ will\ not\ be\ shared\ with
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ other\ processes\ on\ the\ same\ node
*\ PMI_GLOBAL\ \-\ the\ data\ is\ to\ be\ shared\ with\ all\ other\ requesting\ processes,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ regardless\ of\ location
\f[]
.fi
.PP
\f[I]key\f[] String key identifying the information.
This can be either one of the PMIx defined attributes, or a
user\-defined value
.PP
\f[I]val\f[] Pointer to a pmix_value_t structure containing the data to
be pushed along with the type of the provided data.
.SH DESCRIPTION
.PP
Push a value into the client\[aq]s namespace.
The client library will cache the information locally until
\f[I]PMIx\f[]Commit_ is called.
The provided scope value is passed to the local PMIx server, which will
distribute the data as directed.
.SH RETURN VALUE
.PP
Returns PMIX_SUCCESS on success.
On error, a negative value corresponding to a PMIx errno is returned.
.SH ERRORS
.PP
PMIx errno values are defined in \f[C]pmix_common.h\f[].
.SH NOTES
.PP
See \[aq]pmix_common.h\[aq] for definition of the pmix_value_t
structure.
.SH SEE ALSO
.PP
\f[C]PMIx_Constants\f[](7), \f[C]PMIx_Structures\f[](7)
.SH AUTHORS
PMIx.

35
opal/mca/pmix/pmix120/pmix/man/man7/pmix.7 Обычный файл
Просмотреть файл

@ -0,0 +1,35 @@
.TH "pmix" "7" "2015\-10\-29" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
Process Management Interface \- Exascale
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <pmix.h>
\f[]
.fi
.SH OVERVIEW
.PP
The Process Management Interface (PMI) has been used for quite some time
as a means of exchanging wireup information needed for interprocess
communication.
Two versions (PMI\-1 and PMI\-2) have been released as part of the MPICH
effort.
While PMI\-2 demonstrates better scaling properties than its PMI\-1
predecessor, attaining rapid launch and wireup of the roughly 1M
processes executing across 100k nodes expected for exascale operations
remains challenging.
.PP
PMI Exascale (PMIx) represents an attempt to resolve these questions by
providing an extended version of the PMI standard specifically designed
to support clusters up to and including exascale sizes.
The overall objective of the project is not to branch the existing
pseudo\-standard definitions \- in fact, PMIx fully supports both of the
existing PMI\-1 and PMI\-2 APIs \- but rather to (a) augment and extend
those APIs to eliminate some current restrictions that impact
scalability, and (b) provide a reference implementation of the
PMI\-server that demonstrates the desired level of scalability.
.SH SEE ALSO
.SH AUTHORS
PMIx.

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

@ -0,0 +1,92 @@
.TH "pmix_constants" "7" "2015\-10\-25" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
PMIx Constants
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <pmix_common.h>
\f[]
.fi
.SH OVERVIEW
.PP
PMIx relies on the following types of constants:
.PP
\f[I]Maximum Sizes\f[] : In order to minimize malloc performance
penalties, PMIx utilizes constant\-sized arrays wherever possible.
These constants provide the user with the maximum size of the various
array types.
.PP
\f[I]Attributes\f[] : .
.PP
\f[I]Errors\f[] : PMIx uses negative error constants, with 0 indicating
"success".
.SH MAXIMUM SIZES
.PP
The .
.PP
\f[I]PMIX_MAX_NSLEN\f[] : The maximum length of a namespace.
Note that any declaration of an array to hold a key string must include
one extra space for the terminating \f[I]NULL\f[].
.PP
\f[I]PMIX_MAX_KEYLEN\f[] : Maximum length of the key string used in
structures such as the \f[I]pmix\f[]info_t_.
Note that any declaration of an array to hold a key string must include
one extra space for the terminating \f[I]NULL\f[].
.SH ATTRIBUTES
.PP
Define a set of "standard" PMIx attributes that can be queried using the
PMIx_Get function.
Implementations (and users) are free to extend as desired \- thus,
functions calling PMIx_Get must be capable of handling the "not found"
condition.
Note that these are attributes of the system and the job as opposed to
values the application (or underlying programming library) might choose
to expose \- i.e., they are values provided by the resource manager as
opposed to the application.
Thus, these keys are RESERVED for use by PMIx, and users should avoid
defining any attribute starting with the keyword \f[I]PMIX\f[].
.PP
A list of the current PMIx attributes, and the type of their associated
data value, is provided here.
.PP
\f[I]PMIX_ATTR_UNDEF (NULL)\f[] : Used to initialize an attribute field,
indicating that the attribute has not yet been assigned.
.PP
\f[I]PMIX_USERID (uint32_t)\f[] : .
.PP
\f[I]PMIX_GRPID (uint32_t)\f[] : An access domain represents a single
logical connection into a fabric.
It may map to a single physical or virtual NIC or a port.
An access domain defines the boundary across which fabric resources may
be associated.
Each access domain belongs to a single fabric domain.
.PP
\f[I]PMIX_CPUSET (char*)\f[] : .
.SH ERROR CONSTANTS
.PP
\&.
.PP
\f[I]PMIX_SUCCESS\f[] : Indicates that the operation was successful.
.PP
\f[I]PMIX_ERROR\f[] : A general error code \- an error occurred, but no
specific reason can be provided.
.PP
\f[I]fi_rma \- Remote Memory Access\f[] : RMA transfers are one\-sided
operations that read or write data directly to a remote memory region.
Other than defining the appropriate memory region, RMA operations do not
require interaction at the target side for the data transfer to
complete.
.PP
\f[I]fi_atomic \- Atomic\f[] : Atomic operations can perform one of
several operations on a remote memory region.
Atomic operations include well\-known functionality, such as atomic\-add
and compare\-and\-swap, plus several other pre\-defined calls.
Unlike other data transfer interfaces, atomic operations are aware of
the data formatting at the target memory region.
.SH SEE ALSO
.PP
\f[C]pmix\f[](7)
.SH AUTHORS
PMIx.

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

@ -0,0 +1,36 @@
# -*- makefile -*-
#
# 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) 2012 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2013-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
# src/Makefile.am
headers += \
src/buffer_ops/buffer_ops.h \
src/buffer_ops/types.h \
src/buffer_ops/internal.h
sources += \
src/buffer_ops/copy.c \
src/buffer_ops/internal_functions.c \
src/buffer_ops/open_close.c \
src/buffer_ops/pack.c \
src/buffer_ops/print.c \
src/buffer_ops/unpack.c

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

@ -0,0 +1,323 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* 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) 2012 Los Alamos National Security, 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$
*/
/**
* @file
*
* Data packing subsystem.
*/
#ifndef PMIX_BFROP_H_
#define PMIX_BFROP_H_
#include <private/autogen/config.h>
#include <pmix/rename.h>
#include <private/types.h>
#include "src/include/pmix_globals.h"
#include "src/buffer_ops/types.h"
BEGIN_C_DECLS
/* internally used object for transferring data
* to/from the server and for storing in the
* hash tables */
typedef struct {
pmix_list_item_t super;
char *key;
pmix_value_t *value;
} pmix_kval_t;
PMIX_CLASS_DECLARATION(pmix_kval_t);
/* A non-API function for something that happens in a number
* of places throughout the code base - transferring a value to
* another pmix_value_t structure
*/
PMIX_DECLSPEC pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src);
PMIX_DECLSPEC void pmix_value_load(pmix_value_t *v, void *data,
pmix_data_type_t type);
PMIX_DECLSPEC pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data,
size_t *sz, pmix_data_type_t type);
PMIX_DECLSPEC bool pmix_value_cmp(pmix_value_t *p, pmix_value_t *p1);
#define PMIX_LOAD_BUFFER(b, d, s) \
do { \
(b)->base_ptr = (char*)(d); \
(b)->bytes_used = (s); \
(b)->bytes_allocated = (s); \
(b)->pack_ptr = ((char*)(b)->base_ptr) + (s); \
(b)->unpack_ptr = (b)->base_ptr; \
(d) = NULL; \
(s) = 0; \
} while(0);
#define PMIX_UNLOAD_BUFFER(b, d, s) \
do { \
(d) = (char*)(b)->unpack_ptr; \
(s) = (b)->bytes_used; \
(b)->base_ptr = NULL; \
(b)->bytes_used = 0; \
(b)->bytes_allocated = 0; \
(b)->pack_ptr = NULL; \
(b)->unpack_ptr = NULL; \
} while (0);
/**
* Top-level interface function to pack one or more values into a
* buffer.
*
* The pack function packs one or more values of a specified type into
* the specified buffer. The buffer must have already been
* initialized via an PMIX_NEW or PMIX_CONSTRUCT call - otherwise, the
* pack_value function will return an error. Providing an unsupported
* type flag will likewise be reported as an error.
*
* Note that any data to be packed that is not hard type cast (i.e.,
* not type cast to a specific size) may lose precision when unpacked
* by a non-homogeneous recipient. The BFROP will do its best to deal
* with heterogeneity issues between the packer and unpacker in such
* cases. Sending a number larger than can be handled by the recipient
* will return an error code (generated by the BFROP upon unpacking) -
* the BFROP cannot detect such errors during packing.
*
* @param *buffer A pointer to the buffer into which the value is to
* be packed.
*
* @param *src A void* pointer to the data that is to be packed. Note
* that strings are to be passed as (char **) - i.e., the caller must
* pass the address of the pointer to the string as the void*. This
* allows the BFROP to use a single interface function, but still allow
* the caller to pass multiple strings in a single call.
*
* @param num_values An int32_t indicating the number of values that are
* to be packed, beginning at the location pointed to by src. A string
* value is counted as a single value regardless of length. The values
* must be contiguous in memory. Arrays of pointers (e.g., string
* arrays) should be contiguous, although (obviously) the data pointed
* to need not be contiguous across array entries.
*
* @param type The type of the data to be packed - must be one of the
* PMIX defined data types.
*
* @retval PMIX_SUCCESS The data was packed as requested.
*
* @retval PMIX_ERROR(s) An appropriate PMIX error code indicating the
* problem encountered. This error code should be handled
* appropriately.
*
* @code
* pmix_buffer_t *buffer;
* int32_t src;
*
* status_code = pmix_bfrop.pack(buffer, &src, 1, PMIX_INT32);
* @endcode
*/
typedef pmix_status_t (*pmix_bfrop_pack_fn_t)(pmix_buffer_t *buffer, const void *src,
int32_t num_values,
pmix_data_type_t type);
/**
* Unpack values from a buffer.
*
* The unpack function unpacks the next value (or values) of a
* specified type from the specified buffer.
*
* The buffer must have already been initialized via an PMIX_NEW or
* PMIX_CONSTRUCT call (and assumedly filled with some data) -
* otherwise, the unpack_value function will return an
* error. Providing an unsupported type flag will likewise be reported
* as an error, as will specifying a data type that DOES NOT match the
* type of the next item in the buffer. An attempt to read beyond the
* end of the stored data held in the buffer will also return an
* error.
*
* NOTE: it is possible for the buffer to be corrupted and that
* the BFROP will *think* there is a proper variable type at the
* beginning of an unpack region - but that the value is bogus (e.g., just
* a byte field in a string array that so happens to have a value that
* matches the specified data type flag). Therefore, the data type error check
* is NOT completely safe. This is true for ALL unpack functions.
*
*
* Unpacking values is a "destructive" process - i.e., the values are
* removed from the buffer, thus reducing the buffer size. It is
* therefore not possible for the caller to re-unpack a value from the
* same buffer.
*
* Warning: The caller is responsible for providing adequate memory
* storage for the requested data. As noted below, the user
* must provide a parameter indicating the maximum number of values that
* can be unpacked into the allocated memory. If more values exist in the
* buffer than can fit into the memory storage, then the bfrop will unpack
* what it can fit into that location and return an error code indicating
* that the buffer was only partially unpacked.
*
* Note that any data that was not hard type cast (i.e., not type cast
* to a specific size) when packed may lose precision when unpacked by
* a non-homogeneous recipient. The BFROP will do its best to deal with
* heterogeneity issues between the packer and unpacker in such
* cases. Sending a number larger than can be handled by the recipient
* will return an error code generated by the BFROP upon unpacking - the
* BFROP cannot detect such errors during packing.
*
* @param *buffer A pointer to the buffer from which the value will be
* extracted.
*
* @param *dest A void* pointer to the memory location into which the
* data is to be stored. Note that these values will be stored
* contiguously in memory. For strings, this pointer must be to (char
* **) to provide a means of supporting multiple string
* operations. The BFROP unpack function will allocate memory for each
* string in the array - the caller must only provide adequate memory
* for the array of pointers.
*
* @param type The type of the data to be unpacked - must be one of
* the BFROP defined data types.
*
* @retval *max_num_values The number of values actually unpacked. In
* most cases, this should match the maximum number provided in the
* parameters - but in no case will it exceed the value of this
* parameter. Note that if you unpack fewer values than are actually
* available, the buffer will be in an unpackable state - the bfrop will
* return an error code to warn of this condition.
*
* @note The unpack function will return the actual number of values
* unpacked in this location.
*
* @retval PMIX_SUCCESS The next item in the buffer was successfully
* unpacked.
*
* @retval PMIX_ERROR(s) The unpack function returns an error code
* under one of several conditions: (a) the number of values in the
* item exceeds the max num provided by the caller; (b) the type of
* the next item in the buffer does not match the type specified by
* the caller; or (c) the unpack failed due to either an error in the
* buffer or an attempt to read past the end of the buffer.
*
* @code
* pmix_buffer_t *buffer;
* int32_t dest;
* char **string_array;
* int32_t num_values;
*
* num_values = 1;
* status_code = pmix_bfrop.unpack(buffer, (void*)&dest, &num_values, PMIX_INT32);
*
* num_values = 5;
* string_array = malloc(num_values*sizeof(char *));
* status_code = pmix_bfrop.unpack(buffer, (void*)(string_array), &num_values, PMIX_STRING);
*
* @endcode
*/
typedef pmix_status_t (*pmix_bfrop_unpack_fn_t)(pmix_buffer_t *buffer, void *dest,
int32_t *max_num_values,
pmix_data_type_t type);
/**
* Copy a payload from one buffer to another
* This function will append a copy of the payload in one buffer into
* another buffer. If the destination buffer is NOT empty, then the
* type of the two buffers MUST match or else an
* error will be returned. If the destination buffer IS empty, then
* its type will be set to that of the source buffer.
* NOTE: This is NOT a destructive procedure - the
* source buffer's payload will remain intact, as will any pre-existing
* payload in the destination's buffer.
*/
typedef pmix_status_t (*pmix_bfrop_copy_payload_fn_t)(pmix_buffer_t *dest,
pmix_buffer_t *src);
/**
* BFROP initialization function.
*
* In dynamic libraries, declared objects and functions don't get
* loaded until called. We need to ensure that the pmix_bfrop function
* structure gets loaded, so we provide an "open" call that is
* executed as part of the program startup.
*/
PMIX_DECLSPEC pmix_status_t pmix_bfrop_open(void);
/**
* BFROP finalize function
*/
PMIX_DECLSPEC pmix_status_t pmix_bfrop_close(void);
/**
* Copy a data value from one location to another.
*
* Since registered data types can be complex structures, the system
* needs some way to know how to copy the data from one location to
* another (e.g., for storage in the registry). This function, which
* can call other copy functions to build up complex data types, defines
* the method for making a copy of the specified data type.
*
* @param **dest The address of a pointer into which the
* address of the resulting data is to be stored.
*
* @param *src A pointer to the memory location from which the
* data is to be copied.
*
* @param type The type of the data to be copied - must be one of
* the BFROP defined data types.
*
* @retval PMIX_SUCCESS The value was successfully copied.
*
* @retval PMIX_ERROR(s) An appropriate error code.
*
*/
typedef pmix_status_t (*pmix_bfrop_copy_fn_t)(void **dest, void *src, pmix_data_type_t type);
/**
* Print a data value.
*
* Since registered data types can be complex structures, the system
* needs some way to know how to print them (i.e., convert them to a string
* representation). Provided for debug purposes.
*
* @retval PMIX_SUCCESS The value was successfully printed.
*
* @retval PMIX_ERROR(s) An appropriate error code.
*/
typedef pmix_status_t (*pmix_bfrop_print_fn_t)(char **output, char *prefix, void *src, pmix_data_type_t type);
/**
* Base structure for the BFROP
*
* Base module structure for the BFROP - presents the required function
* pointers to the calling interface.
*/
struct pmix_bfrop_t {
pmix_bfrop_pack_fn_t pack;
pmix_bfrop_unpack_fn_t unpack;
pmix_bfrop_copy_fn_t copy;
pmix_bfrop_print_fn_t print;
pmix_bfrop_copy_payload_fn_t copy_payload;
};
typedef struct pmix_bfrop_t pmix_bfrop_t;
PMIX_DECLSPEC extern pmix_bfrop_t pmix_bfrop; /* holds bfrop function pointers */
END_C_DECLS
#endif /* PMIX_BFROP_H */

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

@ -0,0 +1,485 @@
/*
* 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) 2014-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$
*/
#include <private/autogen/config.h>
#include <pmix/rename.h>
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/buffer_ops/internal.h"
int pmix_bfrop_copy(void **dest, void *src, pmix_data_type_t type)
{
pmix_bfrop_type_info_t *info;
/* check for error */
if (NULL == dest) {
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
}
if (NULL == src) {
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
}
/* Lookup the copy function for this type and call it */
if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&pmix_bfrop_types, type))) {
PMIX_ERROR_LOG(PMIX_ERR_UNKNOWN_DATA_TYPE);
return PMIX_ERR_UNKNOWN_DATA_TYPE;
}
return info->odti_copy_fn(dest, src, type);
}
int pmix_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src)
{
size_t to_copy = 0;
char *ptr;
/* deal with buffer type */
if( NULL == dest->base_ptr ){
/* destination buffer is empty - derive src buffer type */
dest->type = src->type;
} else if( dest->type != src->type ){
/* buffer types mismatch */
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return PMIX_ERR_BAD_PARAM;
}
to_copy = src->pack_ptr - src->unpack_ptr;
if( NULL == (ptr = pmix_bfrop_buffer_extend(dest, to_copy)) ){
PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE);
return PMIX_ERR_OUT_OF_RESOURCE;
}
memcpy(ptr,src->unpack_ptr, to_copy);
dest->bytes_used += to_copy;
dest->pack_ptr += to_copy;
return PMIX_SUCCESS;
}
/*
* STANDARD COPY FUNCTION - WORKS FOR EVERYTHING NON-STRUCTURED
*/
int pmix_bfrop_std_copy(void **dest, void *src, pmix_data_type_t type)
{
size_t datasize;
uint8_t *val = NULL;
switch(type) {
case PMIX_BOOL:
datasize = sizeof(bool);
break;
case PMIX_INT:
case PMIX_UINT:
datasize = sizeof(int);
break;
case PMIX_SIZE:
datasize = sizeof(size_t);
break;
case PMIX_PID:
datasize = sizeof(pid_t);
break;
case PMIX_BYTE:
case PMIX_INT8:
case PMIX_UINT8:
datasize = 1;
break;
case PMIX_INT16:
case PMIX_UINT16:
datasize = 2;
break;
case PMIX_INT32:
case PMIX_UINT32:
datasize = 4;
break;
case PMIX_INT64:
case PMIX_UINT64:
datasize = 8;
break;
case PMIX_FLOAT:
datasize = sizeof(float);
break;
case PMIX_TIMEVAL:
datasize = sizeof(struct timeval);
break;
case PMIX_TIME:
datasize = sizeof(time_t);
break;
default:
return PMIX_ERR_UNKNOWN_DATA_TYPE;
}
val = (uint8_t*)malloc(datasize);
if (NULL == val) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
memcpy(val, src, datasize);
*dest = val;
return PMIX_SUCCESS;
}
/* COPY FUNCTIONS FOR NON-STANDARD SYSTEM TYPES */
/*
* STRING
*/
int pmix_bfrop_copy_string(char **dest, char *src, pmix_data_type_t type)
{
if (NULL == src) { /* got zero-length string/NULL pointer - store NULL */
*dest = NULL;
} else {
*dest = strdup(src);
}
return PMIX_SUCCESS;
}
/* compare function for pmix_value_t*/
bool pmix_value_cmp(pmix_value_t *p, pmix_value_t *p1)
{
bool rc = false;
switch (p->type) {
case PMIX_BOOL:
rc = (p->data.flag == p1->data.flag);
break;
case PMIX_BYTE:
rc = (p->data.byte == p1->data.byte);
break;
case PMIX_SIZE:
rc = (p->data.size == p1->data.size);
break;
case PMIX_INT:
rc = (p->data.integer == p1->data.integer);
break;
case PMIX_INT8:
rc = (p->data.int8 == p1->data.int8);
break;
case PMIX_INT16:
rc = (p->data.int16 == p1->data.int16);
break;
case PMIX_INT32:
rc = (p->data.int32 == p1->data.int32);
break;
case PMIX_INT64:
rc = (p->data.int64 == p1->data.int64);
break;
case PMIX_UINT:
rc = (p->data.uint == p1->data.uint);
break;
case PMIX_UINT8:
rc = (p->data.uint8 == p1->data.int8);
break;
case PMIX_UINT16:
rc = (p->data.uint16 == p1->data.uint16);
break;
case PMIX_UINT32:
rc = (p->data.uint32 == p1->data.uint32);
break;
case PMIX_UINT64:
rc = (p->data.uint64 == p1->data.uint64);
break;
case PMIX_STRING:
rc = strcmp(p->data.string, p1->data.string);
break;
default:
pmix_output(0, "COMPARE-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)p->type);
}
return rc;
}
/* COPY FUNCTIONS FOR GENERIC PMIX TYPES */
pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
{
pmix_info_t *p1, *s1;
/* copy the right field */
p->type = src->type;
switch (src->type) {
case PMIX_BOOL:
p->data.flag = src->data.flag;
break;
case PMIX_BYTE:
p->data.byte = src->data.byte;
break;
case PMIX_STRING:
if (NULL != src->data.string) {
p->data.string = strdup(src->data.string);
} else {
p->data.string = NULL;
}
break;
case PMIX_SIZE:
p->data.size = src->data.size;
break;
case PMIX_PID:
p->data.pid = src->data.pid;
break;
case PMIX_INT:
/* to avoid alignment issues */
memcpy(&p->data.integer, &src->data.integer, sizeof(int));
break;
case PMIX_INT8:
p->data.int8 = src->data.int8;
break;
case PMIX_INT16:
/* to avoid alignment issues */
memcpy(&p->data.int16, &src->data.int16, 2);
break;
case PMIX_INT32:
/* to avoid alignment issues */
memcpy(&p->data.int32, &src->data.int32, 4);
break;
case PMIX_INT64:
/* to avoid alignment issues */
memcpy(&p->data.int64, &src->data.int64, 8);
break;
case PMIX_UINT:
/* to avoid alignment issues */
memcpy(&p->data.uint, &src->data.uint, sizeof(unsigned int));
break;
case PMIX_UINT8:
p->data.uint8 = src->data.uint8;
break;
case PMIX_UINT16:
/* to avoid alignment issues */
memcpy(&p->data.uint16, &src->data.uint16, 2);
break;
case PMIX_UINT32:
/* to avoid alignment issues */
memcpy(&p->data.uint32, &src->data.uint32, 4);
break;
case PMIX_UINT64:
/* to avoid alignment issues */
memcpy(&p->data.uint64, &src->data.uint64, 8);
break;
case PMIX_FLOAT:
p->data.fval = src->data.fval;
break;
case PMIX_DOUBLE:
p->data.dval = src->data.dval;
break;
case PMIX_TIMEVAL:
p->data.tv.tv_sec = src->data.tv.tv_sec;
p->data.tv.tv_usec = src->data.tv.tv_usec;
break;
case PMIX_INFO_ARRAY:
p->data.array.size = src->data.array.size;
if (0 < src->data.array.size) {
p->data.array.array = (struct pmix_info_t*)malloc(src->data.array.size * sizeof(pmix_info_t));
p1 = (pmix_info_t*)p->data.array.array;
s1 = (pmix_info_t*)src->data.array.array;
memcpy(p1, s1, src->data.array.size * sizeof(pmix_info_t));
}
break;
case PMIX_BYTE_OBJECT:
if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) {
p->data.bo.bytes = malloc(src->data.bo.size);
memcpy(p->data.bo.bytes, src->data.bo.bytes, src->data.bo.size);
p->data.bo.size = src->data.bo.size;
} else {
p->data.bo.bytes = NULL;
p->data.bo.size = 0;
}
break;
default:
pmix_output(0, "COPY-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)src->type);
return PMIX_ERROR;
}
return PMIX_SUCCESS;
}
/* PMIX_VALUE */
int pmix_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src,
pmix_data_type_t type)
{
pmix_value_t *p;
/* create the new object */
*dest = (pmix_value_t*)malloc(sizeof(pmix_value_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
p = *dest;
/* copy the type */
p->type = src->type;
/* copy the data */
return pmix_value_xfer(p, src);
}
int pmix_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src,
pmix_data_type_t type)
{
*dest = (pmix_info_t*)malloc(sizeof(pmix_info_t));
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
return pmix_value_xfer(&(*dest)->value, &src->value);
}
int pmix_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src,
pmix_data_type_t type)
{
*dest = PMIX_NEW(pmix_buffer_t);
pmix_bfrop.copy_payload(*dest, src);
return PMIX_SUCCESS;
}
int pmix_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
pmix_data_type_t type)
{
size_t j;
*dest = (pmix_app_t*)malloc(sizeof(pmix_app_t));
(*dest)->cmd = strdup(src->cmd);
(*dest)->argc = src->argc;
(*dest)->argv = pmix_argv_copy(src->argv);
(*dest)->env = pmix_argv_copy(src->env);
(*dest)->maxprocs = src->maxprocs;
(*dest)->ninfo = src->ninfo;
(*dest)->info = (pmix_info_t*)malloc(src->ninfo * sizeof(pmix_info_t));
for (j=0; j < src->ninfo; j++) {
(void)strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN);
pmix_value_xfer(&(*dest)->info[j].value, &src->info[j].value);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src,
pmix_data_type_t type)
{
pmix_kval_t *p;
/* create the new object */
*dest = PMIX_NEW(pmix_kval_t);
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
p = *dest;
/* copy the type */
p->value->type = src->value->type;
/* copy the data */
return pmix_value_xfer(p->value, src->value);
}
int pmix_bfrop_copy_array(pmix_info_array_t **dest,
pmix_info_array_t *src,
pmix_data_type_t type)
{
pmix_info_t *d1, *s1;
*dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
(*dest)->size = src->size;
(*dest)->array = (struct pmix_info_t*)malloc(src->size * sizeof(pmix_info_t));
d1 = (pmix_info_t*)(*dest)->array;
s1 = (pmix_info_t*)src->array;
memcpy(d1, s1, src->size * sizeof(pmix_info_t));
return PMIX_SUCCESS;
}
int pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
pmix_data_type_t type)
{
*dest = (pmix_proc_t*)malloc(sizeof(pmix_proc_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
(void)strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN);
(*dest)->rank = src->rank;
return PMIX_SUCCESS;
}
#if PMIX_HAVE_HWLOC
int pmix_bfrop_copy_topo(hwloc_topology_t *dest,
hwloc_topology_t src,
pmix_data_type_t type)
{
/* use the hwloc dup function */
return hwloc_topology_dup(dest, src);
}
#endif
int pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src,
pmix_data_type_t type)
{
*dest = (pmix_modex_data_t*)malloc(sizeof(pmix_modex_data_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
(*dest)->blob = NULL;
(*dest)->size = 0;
if (NULL != src->blob) {
(*dest)->blob = (uint8_t*)malloc(src->size * sizeof(uint8_t));
if (NULL == (*dest)->blob) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
memcpy((*dest)->blob, src->blob, src->size * sizeof(uint8_t));
(*dest)->size = src->size;
}
return PMIX_SUCCESS;
}
int pmix_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src,
pmix_data_type_t type)
{
*dest = (pmix_persistence_t*)malloc(sizeof(pmix_persistence_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
memcpy(*dest, src, sizeof(pmix_persistence_t));
return PMIX_SUCCESS;
}
int pmix_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src,
pmix_data_type_t type)
{
*dest = (pmix_byte_object_t*)malloc(sizeof(pmix_byte_object_t));
if (NULL == *dest) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
(*dest)->bytes = (char*)malloc(src->size);
memcpy((*dest)->bytes, src->bytes, src->size);
(*dest)->size = src->size;
return PMIX_SUCCESS;
}
int pmix_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src,
pmix_data_type_t type)
{
*dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t));
(void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN);
(*dest)->proc.rank = src->proc.rank;
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
return pmix_value_xfer(&(*dest)->value, &src->value);
}

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

@ -0,0 +1,473 @@
/* -*- 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$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef PMIX_BFROP_INTERNAL_H_
#define PMIX_BFROP_INTERNAL_H_
#include <private/autogen/config.h>
#include <pmix/rename.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 int pmix_bfrop_initial_size;
extern int 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
*/
int pmix_bfrop_pack(pmix_buffer_t *buffer, const void *src,
int32_t num_vals,
pmix_data_type_t type);
int pmix_bfrop_unpack(pmix_buffer_t *buffer, void *dest,
int32_t *max_num_vals,
pmix_data_type_t type);
int pmix_bfrop_copy(void **dest, void *src, pmix_data_type_t type);
int pmix_bfrop_print(char **output, char *prefix, void *src, pmix_data_type_t type);
int 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
*/
int pmix_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_string(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_int(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_float(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_double(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
int pmix_bfrop_pack_topo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
#endif
int pmix_bfrop_pack_value(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_info(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
int pmix_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
/*
* Internal unpack functions
*/
int 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);
int pmix_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int 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);
int 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);
int pmix_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
int 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);
int pmix_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
int pmix_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
/*
* Internal copy functions
*/
int pmix_bfrop_std_copy(void **dest, void *src, pmix_data_type_t type);
int pmix_bfrop_copy_string(char **dest, char *src, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
int pmix_bfrop_copy_topo(hwloc_topology_t *dest,
hwloc_topology_t src,
pmix_data_type_t type);
#endif
int pmix_bfrop_copy_value(pmix_value_t **dest, pmix_value_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_array(pmix_info_array_t **dest, pmix_info_array_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_kval(pmix_kval_t **dest, pmix_kval_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src,
pmix_data_type_t type);
int pmix_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src,
pmix_data_type_t type);
/*
* Internal print functions
*/
int pmix_bfrop_print_bool(char **output, char *prefix, bool *src, pmix_data_type_t type);
int pmix_bfrop_print_byte(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
int pmix_bfrop_print_string(char **output, char *prefix, char *src, pmix_data_type_t type);
int pmix_bfrop_print_size(char **output, char *prefix, size_t *src, pmix_data_type_t type);
int pmix_bfrop_print_pid(char **output, char *prefix, pid_t *src, pmix_data_type_t type);
int pmix_bfrop_print_int(char **output, char *prefix, int *src, pmix_data_type_t type);
int pmix_bfrop_print_int8(char **output, char *prefix, int8_t *src, pmix_data_type_t type);
int pmix_bfrop_print_int16(char **output, char *prefix, int16_t *src, pmix_data_type_t type);
int pmix_bfrop_print_int32(char **output, char *prefix, int32_t *src, pmix_data_type_t type);
int pmix_bfrop_print_int64(char **output, char *prefix, int64_t *src, pmix_data_type_t type);
int pmix_bfrop_print_uint(char **output, char *prefix, int *src, pmix_data_type_t type);
int pmix_bfrop_print_uint8(char **output, char *prefix, uint8_t *src, pmix_data_type_t type);
int pmix_bfrop_print_uint16(char **output, char *prefix, uint16_t *src, pmix_data_type_t type);
int pmix_bfrop_print_uint32(char **output, char *prefix, uint32_t *src, pmix_data_type_t type);
int pmix_bfrop_print_uint64(char **output, char *prefix, uint64_t *src, pmix_data_type_t type);
int pmix_bfrop_print_float(char **output, char *prefix, float *src, pmix_data_type_t type);
int pmix_bfrop_print_double(char **output, char *prefix, double *src, pmix_data_type_t type);
int pmix_bfrop_print_timeval(char **output, char *prefix, struct timeval *src, pmix_data_type_t type);
int pmix_bfrop_print_time(char **output, char *prefix, time_t *src, pmix_data_type_t type);
#if PMIX_HAVE_HWLOC
int pmix_bfrop_print_topo(char **output, char *prefix,
hwloc_topology_t src, pmix_data_type_t type);
#endif
int pmix_bfrop_print_value(char **output, char *prefix, pmix_value_t *src, pmix_data_type_t type);
int pmix_bfrop_print_array(char **output, char *prefix,
pmix_info_array_t *src, pmix_data_type_t type);
int pmix_bfrop_print_proc(char **output, char *prefix,
pmix_proc_t *src, pmix_data_type_t type);
int pmix_bfrop_print_app(char **output, char *prefix,
pmix_app_t *src, pmix_data_type_t type);
int pmix_bfrop_print_info(char **output, char *prefix,
pmix_info_t *src, pmix_data_type_t type);
int pmix_bfrop_print_buf(char **output, char *prefix,
pmix_buffer_t *src, pmix_data_type_t type);
int pmix_bfrop_print_kval(char **output, char *prefix,
pmix_kval_t *src, pmix_data_type_t type);
int pmix_bfrop_print_modex(char **output, char *prefix,
pmix_modex_data_t *src, pmix_data_type_t type);
int pmix_bfrop_print_persist(char **output, char *prefix,
pmix_persistence_t *src, pmix_data_type_t type);
int pmix_bfrop_print_bo(char **output, char *prefix,
pmix_byte_object_t *src, pmix_data_type_t type);
int 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);
int 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

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

@ -0,0 +1,121 @@
/*
* 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 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <private/autogen/config.h>
#include <pmix/rename.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "src/class/pmix_pointer_array.h"
#include "src/buffer_ops/internal.h"
/**
* Internal function that resizes (expands) an inuse buffer if
* necessary.
*/
char* pmix_bfrop_buffer_extend(pmix_buffer_t *buffer, size_t bytes_to_add)
{
size_t required, to_alloc;
size_t pack_offset, unpack_offset;
/* Check to see if we have enough space already */
if ((buffer->bytes_allocated - buffer->bytes_used) >= bytes_to_add) {
return buffer->pack_ptr;
}
required = buffer->bytes_used + bytes_to_add;
if(required >= (size_t)pmix_bfrop_threshold_size) {
to_alloc = ((required + pmix_bfrop_threshold_size - 1)
/ pmix_bfrop_threshold_size) * pmix_bfrop_threshold_size;
} else {
to_alloc = buffer->bytes_allocated;
if(0 == to_alloc) {
to_alloc = pmix_bfrop_initial_size;
}
while(to_alloc < required) {
to_alloc <<= 1;
}
}
if (NULL != buffer->base_ptr) {
pack_offset = ((char*) buffer->pack_ptr) - ((char*) buffer->base_ptr);
unpack_offset = ((char*) buffer->unpack_ptr) -
((char*) buffer->base_ptr);
buffer->base_ptr = (char*)realloc(buffer->base_ptr, to_alloc);
memset(buffer->base_ptr + pack_offset, 0, to_alloc - buffer->bytes_allocated);
} else {
pack_offset = 0;
unpack_offset = 0;
buffer->bytes_used = 0;
buffer->base_ptr = (char*)malloc(to_alloc);
memset(buffer->base_ptr, 0, to_alloc);
}
if (NULL == buffer->base_ptr) {
return NULL;
}
buffer->pack_ptr = ((char*) buffer->base_ptr) + pack_offset;
buffer->unpack_ptr = ((char*) buffer->base_ptr) + unpack_offset;
buffer->bytes_allocated = to_alloc;
/* All done */
return buffer->pack_ptr;
}
/*
* Internal function that checks to see if the specified number of bytes
* remain in the buffer for unpacking
*/
bool pmix_bfrop_too_small(pmix_buffer_t *buffer, size_t bytes_reqd)
{
size_t bytes_remaining_packed;
if (buffer->pack_ptr < buffer->unpack_ptr) {
return true;
}
bytes_remaining_packed = buffer->pack_ptr - buffer->unpack_ptr;
if (bytes_remaining_packed < bytes_reqd) {
/* don't error log this - it could be that someone is trying to
* simply read until the buffer is empty
*/
return true;
}
return false;
}
int pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type)
{
/* Lookup the pack function for the actual pmix_data_type type and call it */
return pmix_bfrop_pack_datatype(buffer, &type, 1, PMIX_INT);
}
int pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type)
{
int32_t n=1;
return pmix_bfrop_unpack_datatype(buffer, type, &n, PMIX_INT);
}

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

@ -0,0 +1,600 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2009 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-2013 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
*/
#include <private/autogen/config.h>
#include <pmix/rename.h>
#include <pmix/pmix_common.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "src/util/argv.h"
#include "src/buffer_ops/internal.h"
/**
* globals
*/
bool pmix_bfrop_initialized = false;
int pmix_bfrop_initial_size = 0;
int pmix_bfrop_threshold_size = 0;
pmix_pointer_array_t pmix_bfrop_types = {{0}};
pmix_data_type_t pmix_bfrop_num_reg_types = PMIX_UNDEF;
static pmix_bfrop_buffer_type_t pmix_default_buf_type = PMIX_BFROP_BUFFER_NON_DESC;
pmix_bfrop_t pmix_bfrop = {
pmix_bfrop_pack,
pmix_bfrop_unpack,
pmix_bfrop_copy,
pmix_bfrop_print,
pmix_bfrop_copy_payload,
};
/**
* Object constructors, destructors, and instantiations
*/
/** Value **/
static void pmix_buffer_construct (pmix_buffer_t* buffer)
{
/** set the default buffer type */
buffer->type = pmix_default_buf_type;
/* Make everything NULL to begin with */
buffer->base_ptr = buffer->pack_ptr = buffer->unpack_ptr = NULL;
buffer->bytes_allocated = buffer->bytes_used = 0;
}
static void pmix_buffer_destruct (pmix_buffer_t* buffer)
{
if (NULL != buffer->base_ptr) {
free (buffer->base_ptr);
}
}
PMIX_CLASS_INSTANCE(pmix_buffer_t,
pmix_object_t,
pmix_buffer_construct,
pmix_buffer_destruct);
static void pmix_bfrop_type_info_construct(pmix_bfrop_type_info_t *obj)
{
obj->odti_name = NULL;
obj->odti_pack_fn = NULL;
obj->odti_unpack_fn = NULL;
obj->odti_copy_fn = NULL;
obj->odti_print_fn = NULL;
}
static void pmix_bfrop_type_info_destruct(pmix_bfrop_type_info_t *obj)
{
if (NULL != obj->odti_name) {
free(obj->odti_name);
}
}
PMIX_CLASS_INSTANCE(pmix_bfrop_type_info_t, pmix_object_t,
pmix_bfrop_type_info_construct,
pmix_bfrop_type_info_destruct);
static void kvcon(pmix_kval_t *k)
{
k->key = NULL;
k->value = NULL;
}
static void kvdes(pmix_kval_t *k)
{
if (NULL != k->key) {
free(k->key);
}
if (NULL != k->value) {
PMIX_VALUE_RELEASE(k->value);
}
}
PMIX_CLASS_INSTANCE(pmix_kval_t,
pmix_list_item_t,
kvcon, kvdes);
static void rcon(pmix_regex_range_t *p)
{
p->start = 0;
p->cnt = 0;
}
PMIX_CLASS_INSTANCE(pmix_regex_range_t,
pmix_list_item_t,
rcon, NULL);
static void rvcon(pmix_regex_value_t *p)
{
p->prefix = NULL;
p->suffix = NULL;
p->num_digits = 0;
PMIX_CONSTRUCT(&p->ranges, pmix_list_t);
}
static void rvdes(pmix_regex_value_t *p)
{
if (NULL != p->prefix) {
free(p->prefix);
}
if (NULL != p->suffix) {
free(p->suffix);
}
PMIX_LIST_DESTRUCT(&p->ranges);
}
PMIX_CLASS_INSTANCE(pmix_regex_value_t,
pmix_list_item_t,
rvcon, rvdes);
pmix_status_t pmix_bfrop_open(void)
{
pmix_status_t rc;
if (pmix_bfrop_initialized) {
return PMIX_SUCCESS;
}
/** set the default buffer type. If we are in debug mode, then we default
* to fully described buffers. Otherwise, we default to non-described for brevity
* and performance
*/
#if PMIX_ENABLE_DEBUG
pmix_default_buf_type = PMIX_BFROP_BUFFER_FULLY_DESC;
#else
pmix_default_buf_type = PMIX_BFROP_BUFFER_NON_DESC;
#endif
/* Setup the types array */
PMIX_CONSTRUCT(&pmix_bfrop_types, pmix_pointer_array_t);
if (PMIX_SUCCESS != (rc = pmix_pointer_array_init(&pmix_bfrop_types, 64, 255, 64))) {
return rc;
}
pmix_bfrop_num_reg_types = PMIX_UNDEF;
pmix_bfrop_threshold_size = PMIX_BFROP_DEFAULT_THRESHOLD_SIZE;
pmix_bfrop_initial_size = 1;
/* Register all the supported types */
PMIX_REGISTER_TYPE("PMIX_BOOL", PMIX_BOOL,
pmix_bfrop_pack_bool,
pmix_bfrop_unpack_bool,
pmix_bfrop_std_copy,
pmix_bfrop_print_bool);
PMIX_REGISTER_TYPE("PMIX_BYTE", PMIX_BYTE,
pmix_bfrop_pack_byte,
pmix_bfrop_unpack_byte,
pmix_bfrop_std_copy,
pmix_bfrop_print_byte);
PMIX_REGISTER_TYPE("PMIX_STRING", PMIX_STRING,
pmix_bfrop_pack_string,
pmix_bfrop_unpack_string,
pmix_bfrop_copy_string,
pmix_bfrop_print_string);
PMIX_REGISTER_TYPE("PMIX_SIZE", PMIX_SIZE,
pmix_bfrop_pack_sizet,
pmix_bfrop_unpack_sizet,
pmix_bfrop_std_copy,
pmix_bfrop_print_size);
PMIX_REGISTER_TYPE("PMIX_PID", PMIX_PID,
pmix_bfrop_pack_pid,
pmix_bfrop_unpack_pid,
pmix_bfrop_std_copy,
pmix_bfrop_print_pid);
PMIX_REGISTER_TYPE("PMIX_INT", PMIX_INT,
pmix_bfrop_pack_int,
pmix_bfrop_unpack_int,
pmix_bfrop_std_copy,
pmix_bfrop_print_int);
PMIX_REGISTER_TYPE("PMIX_INT8", PMIX_INT8,
pmix_bfrop_pack_byte,
pmix_bfrop_unpack_byte,
pmix_bfrop_std_copy,
pmix_bfrop_print_int8);
PMIX_REGISTER_TYPE("PMIX_INT16", PMIX_INT16,
pmix_bfrop_pack_int16,
pmix_bfrop_unpack_int16,
pmix_bfrop_std_copy,
pmix_bfrop_print_int16);
PMIX_REGISTER_TYPE("PMIX_INT32", PMIX_INT32,
pmix_bfrop_pack_int32,
pmix_bfrop_unpack_int32,
pmix_bfrop_std_copy,
pmix_bfrop_print_int32);
PMIX_REGISTER_TYPE("PMIX_INT64", PMIX_INT64,
pmix_bfrop_pack_int64,
pmix_bfrop_unpack_int64,
pmix_bfrop_std_copy,
pmix_bfrop_print_int64);
PMIX_REGISTER_TYPE("PMIX_UINT", PMIX_UINT,
pmix_bfrop_pack_int,
pmix_bfrop_unpack_int,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint);
PMIX_REGISTER_TYPE("PMIX_UINT8", PMIX_UINT8,
pmix_bfrop_pack_byte,
pmix_bfrop_unpack_byte,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint8);
PMIX_REGISTER_TYPE("PMIX_UINT16", PMIX_UINT16,
pmix_bfrop_pack_int16,
pmix_bfrop_unpack_int16,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint16);
PMIX_REGISTER_TYPE("PMIX_UINT32", PMIX_UINT32,
pmix_bfrop_pack_int32,
pmix_bfrop_unpack_int32,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint32);
PMIX_REGISTER_TYPE("PMIX_UINT64", PMIX_UINT64,
pmix_bfrop_pack_int64,
pmix_bfrop_unpack_int64,
pmix_bfrop_std_copy,
pmix_bfrop_print_uint64);
PMIX_REGISTER_TYPE("PMIX_FLOAT", PMIX_FLOAT,
pmix_bfrop_pack_float,
pmix_bfrop_unpack_float,
pmix_bfrop_std_copy,
pmix_bfrop_print_float);
PMIX_REGISTER_TYPE("PMIX_DOUBLE", PMIX_DOUBLE,
pmix_bfrop_pack_double,
pmix_bfrop_unpack_double,
pmix_bfrop_std_copy,
pmix_bfrop_print_double);
PMIX_REGISTER_TYPE("PMIX_TIMEVAL", PMIX_TIMEVAL,
pmix_bfrop_pack_timeval,
pmix_bfrop_unpack_timeval,
pmix_bfrop_std_copy,
pmix_bfrop_print_timeval);
PMIX_REGISTER_TYPE("PMIX_TIME", PMIX_TIME,
pmix_bfrop_pack_time,
pmix_bfrop_unpack_time,
pmix_bfrop_std_copy,
pmix_bfrop_print_time);
#if PMIX_HAVE_HWLOC
PMIX_REGISTER_TYPE("PMIX_HWLOC_TOPO", PMIX_HWLOC_TOPO,
pmix_bfrop_pack_topo,
pmix_bfrop_unpack_topo,
pmix_bfrop_copy_topo,
pmix_bfrop_print_topo);
#endif
PMIX_REGISTER_TYPE("PMIX_VALUE", PMIX_VALUE,
pmix_bfrop_pack_value,
pmix_bfrop_unpack_value,
pmix_bfrop_copy_value,
pmix_bfrop_print_value);
PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY,
pmix_bfrop_pack_array,
pmix_bfrop_unpack_array,
pmix_bfrop_copy_array,
pmix_bfrop_print_array);
PMIX_REGISTER_TYPE("PMIX_PROC", PMIX_PROC,
pmix_bfrop_pack_proc,
pmix_bfrop_unpack_proc,
pmix_bfrop_copy_proc,
pmix_bfrop_print_proc);
PMIX_REGISTER_TYPE("PMIX_APP", PMIX_APP,
pmix_bfrop_pack_app,
pmix_bfrop_unpack_app,
pmix_bfrop_copy_app,
pmix_bfrop_print_app);
PMIX_REGISTER_TYPE("PMIX_INFO", PMIX_INFO,
pmix_bfrop_pack_info,
pmix_bfrop_unpack_info,
pmix_bfrop_copy_info,
pmix_bfrop_print_info);
PMIX_REGISTER_TYPE("PMIX_PDATA", PMIX_PDATA,
pmix_bfrop_pack_pdata,
pmix_bfrop_unpack_pdata,
pmix_bfrop_copy_pdata,
pmix_bfrop_print_pdata);
PMIX_REGISTER_TYPE("PMIX_BUFFER", PMIX_BUFFER,
pmix_bfrop_pack_buf,
pmix_bfrop_unpack_buf,
pmix_bfrop_copy_buf,
pmix_bfrop_print_buf);
PMIX_REGISTER_TYPE("PMIX_BYTE_OBJECT", PMIX_BYTE_OBJECT,
pmix_bfrop_pack_bo,
pmix_bfrop_unpack_bo,
pmix_bfrop_copy_bo,
pmix_bfrop_print_bo);
PMIX_REGISTER_TYPE("PMIX_KVAL", PMIX_KVAL,
pmix_bfrop_pack_kval,
pmix_bfrop_unpack_kval,
pmix_bfrop_copy_kval,
pmix_bfrop_print_kval);
PMIX_REGISTER_TYPE("PMIX_MODEX", PMIX_MODEX,
pmix_bfrop_pack_modex,
pmix_bfrop_unpack_modex,
pmix_bfrop_copy_modex,
pmix_bfrop_print_modex);
PMIX_REGISTER_TYPE("PMIX_PERSIST", PMIX_PERSIST,
pmix_bfrop_pack_persist,
pmix_bfrop_unpack_persist,
pmix_bfrop_copy_persist,
pmix_bfrop_print_persist);
/* All done */
pmix_bfrop_initialized = true;
return PMIX_SUCCESS;
}
pmix_status_t pmix_bfrop_close(void)
{
int32_t i;
if (!pmix_bfrop_initialized) {
return PMIX_SUCCESS;
}
pmix_bfrop_initialized = false;
for (i = 0 ; i < pmix_pointer_array_get_size(&pmix_bfrop_types) ; ++i) {
pmix_bfrop_type_info_t *info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&pmix_bfrop_types, i);
if (NULL != info) {
pmix_pointer_array_set_item(&pmix_bfrop_types, i, NULL);
PMIX_RELEASE(info);
}
}
PMIX_DESTRUCT(&pmix_bfrop_types);
return PMIX_SUCCESS;
}
/**** UTILITY SUPPORT ****/
void pmix_value_load(pmix_value_t *v, void *data,
pmix_data_type_t type)
{
v->type = type;
if (NULL == data) {
/* just set the fields to zero */
memset(&v->data, 0, sizeof(v->data));
} else {
switch(type) {
case PMIX_UNDEF:
break;
case PMIX_BOOL:
memcpy(&(v->data.flag), data, 1);
break;
case PMIX_BYTE:
memcpy(&(v->data.byte), data, 1);
break;
case PMIX_STRING:
v->data.string = strdup(data);
break;
case PMIX_SIZE:
memcpy(&(v->data.size), data, sizeof(size_t));
break;
case PMIX_PID:
memcpy(&(v->data.pid), data, sizeof(pid_t));
break;
case PMIX_INT:
memcpy(&(v->data.integer), data, sizeof(int));
break;
case PMIX_INT8:
memcpy(&(v->data.int8), data, 1);
break;
case PMIX_INT16:
memcpy(&(v->data.int16), data, 2);
break;
case PMIX_INT32:
memcpy(&(v->data.int32), data, 4);
break;
case PMIX_INT64:
memcpy(&(v->data.int64), data, 8);
break;
case PMIX_UINT:
memcpy(&(v->data.uint), data, sizeof(int));
break;
case PMIX_UINT8:
memcpy(&(v->data.uint8), data, 1);
break;
case PMIX_UINT16:
memcpy(&(v->data.uint16), data, 2);
break;
case PMIX_UINT32:
memcpy(&(v->data.uint32), data, 4);
break;
case PMIX_UINT64:
memcpy(&(v->data.uint64), data, 8);
break;
case PMIX_FLOAT:
memcpy(&(v->data.fval), data, sizeof(float));
break;
case PMIX_DOUBLE:
memcpy(&(v->data.dval), data, sizeof(double));
break;
case PMIX_TIMEVAL:
memcpy(&(v->data.tv), data, sizeof(struct timeval));
break;
case PMIX_BYTE_OBJECT:
v->data.bo.bytes = data;
memcpy(&(v->data.bo.size), data, sizeof(size_t));
break;
case PMIX_TIME:
case PMIX_HWLOC_TOPO:
case PMIX_VALUE:
case PMIX_INFO_ARRAY:
case PMIX_APP:
case PMIX_INFO:
case PMIX_PDATA:
case PMIX_BUFFER:
case PMIX_KVAL:
case PMIX_MODEX:
case PMIX_PERSIST:
case PMIX_PROC:
/* silence warnings */
break;
}
}
}
pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data,
size_t *sz, pmix_data_type_t type)
{
pmix_status_t rc;
rc = PMIX_SUCCESS;
if (type != kv->type) {
rc = PMIX_ERR_TYPE_MISMATCH;
} else if (NULL == data ||
(NULL == *data && PMIX_STRING != type && PMIX_BYTE_OBJECT != type)) {
rc = PMIX_ERR_BAD_PARAM;
} else {
switch(type) {
case PMIX_UNDEF:
rc = PMIX_ERR_UNKNOWN_DATA_TYPE;
break;
case PMIX_BOOL:
memcpy(*data, &(kv->data.flag), 1);
*sz = 1;
break;
case PMIX_BYTE:
memcpy(*data, &(kv->data.byte), 1);
*sz = 1;
break;
case PMIX_STRING:
if (NULL != kv->data.string) {
*data = strdup(kv->data.string);
*sz = strlen(kv->data.string);
}
break;
case PMIX_SIZE:
memcpy(*data, &(kv->data.size), sizeof(size_t));
*sz = sizeof(size_t);
break;
case PMIX_PID:
memcpy(*data, &(kv->data.pid), sizeof(pid_t));
*sz = sizeof(pid_t);
break;
case PMIX_INT:
memcpy(*data, &(kv->data.integer), sizeof(int));
*sz = sizeof(int);
break;
case PMIX_INT8:
memcpy(*data, &(kv->data.int8), 1);
*sz = 1;
break;
case PMIX_INT16:
memcpy(*data, &(kv->data.int16), 2);
*sz = 2;
break;
case PMIX_INT32:
memcpy(*data, &(kv->data.int32), 4);
*sz = 4;
break;
case PMIX_INT64:
memcpy(*data, &(kv->data.int64), 8);
*sz = 8;
break;
case PMIX_UINT:
memcpy(*data, &(kv->data.uint), sizeof(int));
*sz = sizeof(int);
break;
case PMIX_UINT8:
memcpy(*data, &(kv->data.uint8), 1);
*sz = 1;
break;
case PMIX_UINT16:
memcpy(*data, &(kv->data.uint16), 2);
*sz = 2;
break;
case PMIX_UINT32:
memcpy(*data, &(kv->data.uint32), 4);
*sz = 4;
break;
case PMIX_UINT64:
memcpy(*data, &(kv->data.uint64), 8);
*sz = 8;
break;
case PMIX_FLOAT:
memcpy(*data, &(kv->data.fval), sizeof(float));
*sz = sizeof(float);
break;
case PMIX_DOUBLE:
memcpy(*data, &(kv->data.dval), sizeof(double));
*sz = sizeof(double);
break;
case PMIX_TIMEVAL:
memcpy(*data, &(kv->data.tv), sizeof(struct timeval));
*sz = sizeof(struct timeval);
break;
case PMIX_BYTE_OBJECT:
if (NULL != kv->data.bo.bytes && 0 < kv->data.bo.size) {
*data = kv->data.bo.bytes;
*sz = kv->data.bo.size;
} else {
*data = NULL;
*sz = 0;
}
break;
case PMIX_TIME:
case PMIX_HWLOC_TOPO:
case PMIX_VALUE:
case PMIX_INFO_ARRAY:
case PMIX_APP:
case PMIX_INFO:
case PMIX_PDATA:
case PMIX_BUFFER:
case PMIX_KVAL:
case PMIX_MODEX:
case PMIX_PERSIST:
case PMIX_PROC:
/* silence warnings */
rc = PMIX_ERROR;
break;
}
}
return rc;
}

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

@ -0,0 +1,858 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 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 Cisco Systems, 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) 2015 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <private/autogen/config.h>
#include <pmix/rename.h>
#include <private/types.h>
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/buffer_ops/internal.h"
int pmix_bfrop_pack(pmix_buffer_t *buffer,
const void *src, int32_t num_vals,
pmix_data_type_t type)
{
int rc;
/* check for error */
if (NULL == buffer) {
return PMIX_ERR_BAD_PARAM;
}
/* Pack the number of values */
if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) {
if (PMIX_SUCCESS != (rc = pmix_bfrop_store_data_type(buffer, PMIX_INT32))) {
return rc;
}
}
if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_int32(buffer, &num_vals, 1, PMIX_INT32))) {
return rc;
}
/* Pack the value(s) */
return pmix_bfrop_pack_buffer(buffer, src, num_vals, type);
}
int pmix_bfrop_pack_buffer(pmix_buffer_t *buffer,
const void *src, int32_t num_vals,
pmix_data_type_t type)
{
int rc;
pmix_bfrop_type_info_t *info;
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_pack_buffer( %p, %p, %lu, %d )\n",
(void*)buffer, src, (long unsigned int)num_vals, (int)type);
/* Pack the declared data type */
if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) {
if (PMIX_SUCCESS != (rc = pmix_bfrop_store_data_type(buffer, type))) {
return rc;
}
}
/* Lookup the pack function for this type and call it */
if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&pmix_bfrop_types, type))) {
return PMIX_ERR_PACK_FAILURE;
}
return info->odti_pack_fn(buffer, src, num_vals, type);
}
/* PACK FUNCTIONS FOR GENERIC SYSTEM TYPES */
/*
* BOOL
*/
int pmix_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
uint8_t *dst;
int32_t i;
bool *s = (bool*)src;
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_pack_bool * %d\n", num_vals);
/* check to see if buffer needs extending */
if (NULL == (dst = (uint8_t*)pmix_bfrop_buffer_extend(buffer, num_vals))) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
/* store the data */
for (i=0; i < num_vals; i++) {
if (s[i]) {
dst[i] = 1;
} else {
dst[i] = 0;
}
}
/* update buffer pointers */
buffer->pack_ptr += num_vals;
buffer->bytes_used += num_vals;
return PMIX_SUCCESS;
}
/*
* INT
*/
int pmix_bfrop_pack_int(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int ret;
/* System types need to always be described so we can properly
unpack them */
if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, BFROP_TYPE_INT))) {
return ret;
}
/* Turn around and pack the real type */
return pmix_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_INT);
}
/*
* SIZE_T
*/
int pmix_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int ret;
/* System types need to always be described so we can properly
unpack them. */
if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, BFROP_TYPE_SIZE_T))) {
return ret;
}
return pmix_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_SIZE_T);
}
/*
* PID_T
*/
int pmix_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int ret;
/* System types need to always be described so we can properly
unpack them. */
if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, BFROP_TYPE_PID_T))) {
return ret;
}
/* Turn around and pack the real type */
return pmix_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_PID_T);
}
/* PACK FUNCTIONS FOR NON-GENERIC SYSTEM TYPES */
/*
* BYTE, CHAR, INT8
*/
int pmix_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
char *dst;
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_pack_byte * %d\n", num_vals);
/* check to see if buffer needs extending */
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals))) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
/* store the data */
memcpy(dst, src, num_vals);
/* update buffer pointers */
buffer->pack_ptr += num_vals;
buffer->bytes_used += num_vals;
return PMIX_SUCCESS;
}
/*
* INT16
*/
int pmix_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int32_t i;
uint16_t tmp, *srctmp = (uint16_t*) src;
char *dst;
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_pack_int16 * %d\n", num_vals);
/* check to see if buffer needs extending */
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
for (i = 0; i < num_vals; ++i) {
tmp = pmix_htons(srctmp[i]);
memcpy(dst, &tmp, sizeof(tmp));
dst += sizeof(tmp);
}
buffer->pack_ptr += num_vals * sizeof(tmp);
buffer->bytes_used += num_vals * sizeof(tmp);
return PMIX_SUCCESS;
}
/*
* INT32
*/
int pmix_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int32_t i;
uint32_t tmp, *srctmp = (uint32_t*) src;
char *dst;
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_pack_int32 * %d\n", num_vals);
/* check to see if buffer needs extending */
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals*sizeof(tmp)))) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
for (i = 0; i < num_vals; ++i) {
tmp = htonl(srctmp[i]);
memcpy(dst, &tmp, sizeof(tmp));
dst += sizeof(tmp);
}
buffer->pack_ptr += num_vals * sizeof(tmp);
buffer->bytes_used += num_vals * sizeof(tmp);
return PMIX_SUCCESS;
}
int pmix_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_int32(buffer, src, num_vals, type);
}
/*
* INT64
*/
int pmix_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int32_t i;
uint64_t tmp, tmp2;
char *dst;
size_t bytes_packed = num_vals * sizeof(tmp);
pmix_output_verbose(20, pmix_globals.debug_output, "pmix_bfrop_pack_int64 * %d\n", num_vals);
/* check to see if buffer needs extending */
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, bytes_packed))) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
for (i = 0; i < num_vals; ++i) {
memcpy(&tmp2, (char *)src+i*sizeof(uint64_t), sizeof(uint64_t));
tmp = pmix_hton64(tmp2);
memcpy(dst, &tmp, sizeof(tmp));
dst += sizeof(tmp);
}
buffer->pack_ptr += bytes_packed;
buffer->bytes_used += bytes_packed;
return PMIX_SUCCESS;
}
/*
* STRING
*/
int pmix_bfrop_pack_string(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int ret = PMIX_SUCCESS;
int32_t i, len;
char **ssrc = (char**) src;
for (i = 0; i < num_vals; ++i) {
if (NULL == ssrc[i]) { /* got zero-length string/NULL pointer - store NULL */
len = 0;
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int32(buffer, &len, 1, PMIX_INT32))) {
return ret;
}
} else {
len = (int32_t)strlen(ssrc[i]) + 1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int32(buffer, &len, 1, PMIX_INT32))) {
return ret;
}
if (PMIX_SUCCESS != (ret =
pmix_bfrop_pack_byte(buffer, ssrc[i], len, PMIX_BYTE))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
/* FLOAT */
int pmix_bfrop_pack_float(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int ret = PMIX_SUCCESS;
int32_t i;
float *ssrc = (float*)src;
char *convert;
for (i = 0; i < num_vals; ++i) {
asprintf(&convert, "%f", ssrc[i]);
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &convert, 1, PMIX_STRING))) {
free(convert);
return ret;
}
free(convert);
}
return PMIX_SUCCESS;
}
/* DOUBLE */
int pmix_bfrop_pack_double(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int ret = PMIX_SUCCESS;
int32_t i;
double *ssrc = (double*)src;
char *convert;
for (i = 0; i < num_vals; ++i) {
asprintf(&convert, "%f", ssrc[i]);
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &convert, 1, PMIX_STRING))) {
free(convert);
return ret;
}
free(convert);
}
return PMIX_SUCCESS;
}
/* TIMEVAL */
int pmix_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int64_t tmp[2];
int ret = PMIX_SUCCESS;
int32_t i;
struct timeval *ssrc = (struct timeval *)src;
for (i = 0; i < num_vals; ++i) {
tmp[0] = (int64_t)ssrc[i].tv_sec;
tmp[1] = (int64_t)ssrc[i].tv_usec;
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int64(buffer, tmp, 2, PMIX_INT64))) {
return ret;
}
}
return PMIX_SUCCESS;
}
/* TIME */
int pmix_bfrop_pack_time(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int ret = PMIX_SUCCESS;
int32_t i;
time_t *ssrc = (time_t *)src;
uint64_t ui64;
/* time_t is a system-dependent size, so cast it
* to uint64_t as a generic safe size
*/
for (i = 0; i < num_vals; ++i) {
ui64 = (uint64_t)ssrc[i];
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int64(buffer, &ui64, 1, PMIX_UINT64))) {
return ret;
}
}
return PMIX_SUCCESS;
}
/* PACK FUNCTIONS FOR GENERIC PMIX TYPES */
static int pack_val(pmix_buffer_t *buffer,
pmix_value_t *p)
{
int ret;
switch (p->type) {
case PMIX_BOOL:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.flag, 1, PMIX_BOOL))) {
return ret;
}
break;
case PMIX_BYTE:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.byte, 1, PMIX_BYTE))) {
return ret;
}
break;
case PMIX_STRING:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.string, 1, PMIX_STRING))) {
return ret;
}
break;
case PMIX_SIZE:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.size, 1, PMIX_SIZE))) {
return ret;
}
break;
case PMIX_PID:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.pid, 1, PMIX_PID))) {
return ret;
}
break;
case PMIX_INT:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.integer, 1, PMIX_INT))) {
return ret;
}
break;
case PMIX_INT8:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int8, 1, PMIX_INT8))) {
return ret;
}
break;
case PMIX_INT16:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int16, 1, PMIX_INT16))) {
return ret;
}
break;
case PMIX_INT32:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int32, 1, PMIX_INT32))) {
return ret;
}
break;
case PMIX_INT64:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.int64, 1, PMIX_INT64))) {
return ret;
}
break;
case PMIX_UINT:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint, 1, PMIX_UINT))) {
return ret;
}
break;
case PMIX_UINT8:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint8, 1, PMIX_UINT8))) {
return ret;
}
break;
case PMIX_UINT16:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint16, 1, PMIX_UINT16))) {
return ret;
}
break;
case PMIX_UINT32:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint32, 1, PMIX_UINT32))) {
return ret;
}
break;
case PMIX_UINT64:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.uint64, 1, PMIX_UINT64))) {
return ret;
}
break;
case PMIX_FLOAT:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.fval, 1, PMIX_FLOAT))) {
return ret;
}
break;
case PMIX_DOUBLE:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.dval, 1, PMIX_DOUBLE))) {
return ret;
}
break;
case PMIX_TIMEVAL:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.tv, 1, PMIX_TIMEVAL))) {
return ret;
}
break;
case PMIX_INFO_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.array, 1, PMIX_INFO_ARRAY))) {
return ret;
}
break;
case PMIX_BYTE_OBJECT:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) {
return ret;
}
break;
default:
pmix_output(0, "PACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)p->type);
return PMIX_ERROR;
}
return PMIX_SUCCESS;
}
/*
* PMIX_VALUE
*/
int pmix_bfrop_pack_value(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_value_t *ptr;
int32_t i;
int ret;
ptr = (pmix_value_t *) src;
for (i = 0; i < num_vals; ++i) {
/* pack the type */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &ptr[i].type, 1, PMIX_INT))) {
return ret;
}
/* now pack the right field */
if (PMIX_SUCCESS != (ret = pack_val(buffer, &ptr[i]))) {
return ret;
}
}
return PMIX_SUCCESS;
}
int pmix_bfrop_pack_info(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_info_t *info;
int32_t i;
int ret;
char *foo;
info = (pmix_info_t *) src;
for (i = 0; i < num_vals; ++i) {
/* pack key */
foo = info[i].key;
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &foo, 1, PMIX_STRING))) {
return ret;
}
/* pack the type */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &info[i].value.type, 1, PMIX_INT))) {
return ret;
}
/* pack value */
if (PMIX_SUCCESS != (ret = pack_val(buffer, &info[i].value))) {
return ret;
}
}
return PMIX_SUCCESS;
}
int pmix_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_pdata_t *pdata;
int32_t i;
int ret;
char *foo;
pdata = (pmix_pdata_t *) src;
for (i = 0; i < num_vals; ++i) {
/* pack the proc */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_proc(buffer, &pdata[i].proc, 1, PMIX_PROC))) {
return ret;
}
/* pack key */
foo = pdata[i].key;
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &foo, 1, PMIX_STRING))) {
return ret;
}
/* pack the type */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &pdata[i].value.type, 1, PMIX_INT))) {
return ret;
}
/* pack value */
if (PMIX_SUCCESS != (ret = pack_val(buffer, &pdata[i].value))) {
return ret;
}
}
return PMIX_SUCCESS;
}
int pmix_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_buffer_t **ptr;
int32_t i;
int ret;
ptr = (pmix_buffer_t **) src;
for (i = 0; i < num_vals; ++i) {
/* pack the number of bytes */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_sizet(buffer, &ptr[i]->bytes_used, 1, PMIX_SIZE))) {
return ret;
}
/* pack the bytes */
if (0 < ptr[i]->bytes_used) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_byte(buffer, ptr[i]->base_ptr, ptr[i]->bytes_used, PMIX_BYTE))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
int pmix_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_proc_t *proc;
int32_t i;
int ret;
proc = (pmix_proc_t *) src;
for (i = 0; i < num_vals; ++i) {
char *ptr = proc[i].nspace;
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &ptr, 1, PMIX_STRING))) {
return ret;
}
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &proc[i].rank, 1, PMIX_INT))) {
return ret;
}
}
return PMIX_SUCCESS;
}
int pmix_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_app_t *app;
int32_t i, j, nvals;
int ret;
app = (pmix_app_t *) src;
for (i = 0; i < num_vals; ++i) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &app[i].cmd, 1, PMIX_STRING))) {
return ret;
}
/* argv */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &app[i].argc, 1, PMIX_INT))) {
return ret;
}
for (j=0; j < app->argc; j++) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &app[i].argv[j], 1, PMIX_STRING))) {
return ret;
}
}
/* env */
nvals = pmix_argv_count(app[i].env);
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int32(buffer, &nvals, 1, PMIX_INT32))) {
return ret;
}
for (j=0; j < nvals; j++) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &app[i].env[j], 1, PMIX_STRING))) {
return ret;
}
}
/* maxprocs */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &app[i].maxprocs, 1, PMIX_INT))) {
return ret;
}
/* info array */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_sizet(buffer, &app[i].ninfo, 1, PMIX_SIZE))) {
return ret;
}
if (0 < app[i].ninfo) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_info(buffer, app[i].info, app[i].ninfo, PMIX_INFO))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
int pmix_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_kval_t *ptr;
int32_t i;
int ret;
ptr = (pmix_kval_t *) src;
for (i = 0; i < num_vals; ++i) {
/* pack the key */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &ptr[i].key, 1, PMIX_STRING))) {
return ret;
}
/* pack the value */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_value(buffer, ptr[i].value, 1, PMIX_INT))) {
return ret;
}
}
return PMIX_SUCCESS;
}
int pmix_bfrop_pack_array(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_info_array_t *ptr;
int32_t i;
int ret;
ptr = (pmix_info_array_t *) src;
for (i = 0; i < num_vals; ++i) {
/* pack the size */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) {
return ret;
}
if (0 < ptr[i].size) {
/* pack the values */
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
#if PMIX_HAVE_HWLOC
int pmix_bfrop_pack_topo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
/* NOTE: hwloc defines topology_t as a pointer to a struct! */
hwloc_topology_t t, *tarray = (hwloc_topology_t*)src;
int rc, i;
char *xmlbuffer=NULL;
int len;
struct hwloc_topology_support *support;
for (i=0; i < num_vals; i++) {
t = tarray[i];
/* extract an xml-buffer representation of the tree */
if (0 != hwloc_topology_export_xmlbuffer(t, &xmlbuffer, &len)) {
return PMIX_ERROR;
}
/* add to buffer */
if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_string(buffer, &xmlbuffer, 1, PMIX_STRING))) {
free(xmlbuffer);
return rc;
}
/* cleanup */
if (NULL != xmlbuffer) {
free(xmlbuffer);
}
/* get the available support - hwloc unfortunately does
* not include this info in its xml export!
*/
support = (struct hwloc_topology_support*)hwloc_topology_get_support(t);
/* pack the discovery support */
if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_byte(buffer, support->discovery,
sizeof(struct hwloc_topology_discovery_support),
PMIX_BYTE))) {
return rc;
}
/* pack the cpubind support */
if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_byte(buffer, support->cpubind,
sizeof(struct hwloc_topology_cpubind_support),
PMIX_BYTE))) {
return rc;
}
/* pack the membind support */
if (PMIX_SUCCESS != (rc = pmix_bfrop_pack_byte(buffer, support->membind,
sizeof(struct hwloc_topology_membind_support),
PMIX_BYTE))) {
return rc;
}
}
return PMIX_SUCCESS;
}
#endif
int pmix_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_modex_data_t *ptr;
int32_t i;
int ret;
ptr = (pmix_modex_data_t *) src;
for (i = 0; i < num_vals; ++i) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) {
return ret;
}
if( 0 < ptr[i].size){
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}
int pmix_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
return pmix_bfrop_pack_int(buffer, src, num_vals, PMIX_INT);
}
int pmix_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int ret;
int i;
pmix_byte_object_t *bo;
bo = (pmix_byte_object_t*)src;
for (i=0; i < num_vals; i++) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_sizet(buffer, &bo[i].size, 1, PMIX_SIZE))) {
return ret;
}
if (0 < bo[i].size) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_byte(buffer, bo[i].bytes, bo[i].size, PMIX_BYTE))) {
return ret;
}
}
}
return PMIX_SUCCESS;
}

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

@ -0,0 +1,876 @@
/*
* 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$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <private/autogen/config.h>
#include <pmix/rename.h>
#include <private/pmix_stdint.h>
#include <stdio.h>
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#include "src/buffer_ops/internal.h"
int pmix_bfrop_print(char **output, char *prefix, void *src, pmix_data_type_t type)
{
pmix_bfrop_type_info_t *info;
/* check for error */
if (NULL == output) {
return PMIX_ERR_BAD_PARAM;
}
/* Lookup the print function for this type and call it */
if(NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&pmix_bfrop_types, type))) {
return PMIX_ERR_UNKNOWN_DATA_TYPE;
}
return info->odti_print_fn(output, prefix, src, type);
}
/*
* STANDARD PRINT FUNCTIONS FOR SYSTEM TYPES
*/
int pmix_bfrop_print_bool(char **output, char *prefix, bool *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_BOOL\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_BOOL\tValue: %s", prefix,
(*src) ? "TRUE" : "FALSE");
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_byte(char **output, char *prefix, uint8_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_BYTE\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_BYTE\tValue: %x", prefix, *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_string(char **output, char *prefix, char *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_STRING\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_STRING\tValue: %s", prefx, src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_size(char **output, char *prefix, size_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_SIZE\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_SIZE\tValue: %lu", prefx, (unsigned long) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_pid(char **output, char *prefix, pid_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_PID\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_PID\tValue: %lu", prefx, (unsigned long) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_int(char **output, char *prefix, int *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_INT\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_INT\tValue: %ld", prefx, (long) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_uint(char **output, char *prefix, int *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_UINT\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_UINT\tValue: %lu", prefx, (unsigned long) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_uint8(char **output, char *prefix, uint8_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_UINT8\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_UINT8\tValue: %u", prefx, (unsigned int) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_uint16(char **output, char *prefix, uint16_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_UINT16\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_UINT16\tValue: %u", prefx, (unsigned int) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_uint32(char **output, char *prefix,
uint32_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_UINT32\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_UINT32\tValue: %u", prefx, (unsigned int) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_int8(char **output, char *prefix,
int8_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_INT8\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_INT8\tValue: %d", prefx, (int) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_int16(char **output, char *prefix,
int16_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_INT16\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_INT16\tValue: %d", prefx, (int) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_int32(char **output, char *prefix, int32_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_INT32\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_INT32\tValue: %d", prefx, (int) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_uint64(char **output, char *prefix,
uint64_t *src,
pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_UINT64\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_UINT64\tValue: %lu", prefx, (unsigned long) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_int64(char **output, char *prefix,
int64_t *src,
pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_INT64\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_INT64\tValue: %ld", prefx, (long) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_float(char **output, char *prefix,
float *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_FLOAT\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_FLOAT\tValue: %f", prefx, *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_double(char **output, char *prefix,
double *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_DOUBLE\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_DOUBLE\tValue: %f", prefx, *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_time(char **output, char *prefix,
time_t *src, pmix_data_type_t type)
{
char *prefx;
char *t;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_TIME\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
t = ctime(src);
t[strlen(t)-1] = '\0'; // remove trailing newline
asprintf(output, "%sData type: PMIX_TIME\tValue: %s", prefx, t);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_timeval(char **output, char *prefix,
struct timeval *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_TIMEVAL\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_TIMEVAL\tValue: %ld.%06ld", prefx,
(long)src->tv_sec, (long)src->tv_usec);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
/* PRINT FUNCTIONS FOR GENERIC PMIX TYPES */
/*
* PMIX_VALUE
*/
int pmix_bfrop_print_value(char **output, char *prefix,
pmix_value_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_VALUE\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
switch (src->type) {
case PMIX_BYTE:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_BYTE\tValue: %x",
prefx, src->data.byte);
break;
case PMIX_STRING:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_STRING\tValue: %s",
prefx, src->data.string);
break;
case PMIX_SIZE:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_SIZE\tValue: %lu",
prefx, (unsigned long)src->data.size);
break;
case PMIX_PID:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PID\tValue: %lu",
prefx, (unsigned long)src->data.pid);
break;
case PMIX_INT:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_INT\tValue: %d",
prefx, src->data.integer);
break;
case PMIX_INT8:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_INT8\tValue: %d",
prefx, (int)src->data.int8);
break;
case PMIX_INT16:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_INT16\tValue: %d",
prefx, (int)src->data.int16);
break;
case PMIX_INT32:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_INT32\tValue: %d",
prefx, src->data.int32);
break;
case PMIX_INT64:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_INT64\tValue: %ld",
prefx, (long)src->data.int64);
break;
case PMIX_UINT:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_UINT\tValue: %u",
prefx, src->data.uint);
break;
case PMIX_UINT8:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_UINT8\tValue: %u",
prefx, (unsigned int)src->data.uint8);
break;
case PMIX_UINT16:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_UINT16\tValue: %u",
prefx, (unsigned int)src->data.uint16);
break;
case PMIX_UINT32:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_UINT32\tValue: %u",
prefx, src->data.uint32);
break;
case PMIX_UINT64:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_UINT64\tValue: %lu",
prefx, (unsigned long)src->data.uint64);
break;
case PMIX_FLOAT:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_FLOAT\tValue: %f",
prefx, src->data.fval);
break;
case PMIX_DOUBLE:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_DOUBLE\tValue: %f",
prefx, src->data.dval);
break;
case PMIX_TIMEVAL:
asprintf(output, "%sPMIX_VALUE: Data type: PMIX_TIMEVAL\tValue: %ld.%06ld", prefx,
(long)src->data.tv.tv_sec, (long)src->data.tv.tv_usec);
break;
default:
asprintf(output, "%sPMIX_VALUE: Data type: UNKNOWN\tValue: UNPRINTABLE", prefx);
break;
}
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_info(char **output, char *prefix,
pmix_info_t *src, pmix_data_type_t type)
{
char *tmp;
pmix_bfrop_print_value(&tmp, NULL, &src->value, PMIX_VALUE);
asprintf(output, "%sKEY: %s %s", prefix, src->key,
(NULL == tmp) ? "NULL" : tmp);
if (NULL != tmp) {
free(tmp);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_pdata(char **output, char *prefix,
pmix_pdata_t *src, pmix_data_type_t type)
{
char *tmp1, *tmp2;
pmix_bfrop_print_proc(&tmp1, NULL, &src->proc, PMIX_PROC);
pmix_bfrop_print_value(&tmp2, NULL, &src->value, PMIX_VALUE);
asprintf(output, "%s %s KEY: %s %s", prefix, tmp1, src->key,
(NULL == tmp2) ? "NULL" : tmp2);
if (NULL != tmp1) {
free(tmp1);
}
if (NULL != tmp2) {
free(tmp2);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_buf(char **output, char *prefix,
pmix_buffer_t *src, pmix_data_type_t type)
{
return PMIX_SUCCESS;
}
int pmix_bfrop_print_app(char **output, char *prefix,
pmix_app_t *src, pmix_data_type_t type)
{
return PMIX_SUCCESS;
}
int pmix_bfrop_print_proc(char **output, char *prefix,
pmix_proc_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
asprintf(output, "%sPROC: %s:%d", prefx, src->nspace, src->rank);
return PMIX_SUCCESS;
}
int pmix_bfrop_print_kval(char **output, char *prefix,
pmix_kval_t *src, pmix_data_type_t type)
{
return PMIX_SUCCESS;
}
int pmix_bfrop_print_array(char **output, char *prefix,
pmix_info_array_t *src, pmix_data_type_t type)
{
size_t j;
char *tmp, *tmp2, *tmp3, *pfx;
pmix_info_t *s1;
asprintf(&tmp, "%sARRAY SIZE: %ld", prefix, (long)src->size);
asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix);
s1 = (pmix_info_t*)src->array;
for (j=0; j < src->size; j++) {
pmix_bfrop_print_info(&tmp2, pfx, &s1[j], PMIX_INFO);
asprintf(&tmp3, "%s%s", tmp, tmp2);
free(tmp);
free(tmp2);
tmp = tmp3;
}
*output = tmp;
return PMIX_SUCCESS;
}
#if PMIX_HAVE_HWLOC
#define PMIX_HWLOC_MAX_STRING 2048
static void print_hwloc_obj(char **output, char *prefix,
hwloc_topology_t topo, hwloc_obj_t obj)
{
hwloc_obj_t obj2;
char string[1024], *tmp, *tmp2, *pfx;
unsigned i;
struct hwloc_topology_support *support;
/* print the object type */
hwloc_obj_type_snprintf(string, 1024, obj, 1);
asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix);
asprintf(&tmp, "%sType: %s Number of child objects: %u%sName=%s",
(NULL == prefix) ? "" : prefix, string, obj->arity,
pfx, (NULL == obj->name) ? "NULL" : obj->name);
if (0 < hwloc_obj_attr_snprintf(string, 1024, obj, pfx, 1)) {
/* print the attributes */
asprintf(&tmp2, "%s%s%s", tmp, pfx, string);
free(tmp);
tmp = tmp2;
}
/* print the cpusets - apparently, some new HWLOC types don't
* have cpusets, so protect ourselves here
*/
if (NULL != obj->cpuset) {
hwloc_bitmap_snprintf(string, PMIX_HWLOC_MAX_STRING, obj->cpuset);
asprintf(&tmp2, "%s%sCpuset: %s", tmp, pfx, string);
free(tmp);
tmp = tmp2;
}
if (NULL != obj->online_cpuset) {
hwloc_bitmap_snprintf(string, PMIX_HWLOC_MAX_STRING, obj->online_cpuset);
asprintf(&tmp2, "%s%sOnline: %s", tmp, pfx, string);
free(tmp);
tmp = tmp2;
}
if (NULL != obj->allowed_cpuset) {
hwloc_bitmap_snprintf(string, PMIX_HWLOC_MAX_STRING, obj->allowed_cpuset);
asprintf(&tmp2, "%s%sAllowed: %s", tmp, pfx, string);
free(tmp);
tmp = tmp2;
}
if (HWLOC_OBJ_MACHINE == obj->type) {
/* root level object - add support values */
support = (struct hwloc_topology_support*)hwloc_topology_get_support(topo);
asprintf(&tmp2, "%s%sBind CPU proc: %s%sBind CPU thread: %s", tmp, pfx,
(support->cpubind->set_thisproc_cpubind) ? "TRUE" : "FALSE", pfx,
(support->cpubind->set_thisthread_cpubind) ? "TRUE" : "FALSE");
free(tmp);
tmp = tmp2;
asprintf(&tmp2, "%s%sBind MEM proc: %s%sBind MEM thread: %s", tmp, pfx,
(support->membind->set_thisproc_membind) ? "TRUE" : "FALSE", pfx,
(support->membind->set_thisthread_membind) ? "TRUE" : "FALSE");
free(tmp);
tmp = tmp2;
}
asprintf(&tmp2, "%s%s\n", (NULL == *output) ? "" : *output, tmp);
free(tmp);
free(pfx);
asprintf(&pfx, "%s\t", (NULL == prefix) ? "" : prefix);
for (i=0; i < obj->arity; i++) {
obj2 = obj->children[i];
/* print the object */
print_hwloc_obj(&tmp2, pfx, topo, obj2);
}
free(pfx);
if (NULL != *output) {
free(*output);
}
*output = tmp2;
}
int pmix_bfrop_print_topo(char **output, char *prefix,
hwloc_topology_t src, pmix_data_type_t type)
{
hwloc_obj_t obj;
char *tmp=NULL;
/* get root object */
obj = hwloc_get_root_obj(src);
/* print it */
print_hwloc_obj(&tmp, prefix, src, obj);
*output = tmp;
return PMIX_SUCCESS;
}
#endif
int pmix_bfrop_print_modex(char **output, char *prefix,
pmix_modex_data_t *src, pmix_data_type_t type)
{
return PMIX_SUCCESS;
}
int pmix_bfrop_print_persist(char **output, char *prefix, pmix_persistence_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_PERSIST\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_PERSIST\tValue: %ld", prefx, (long) *src);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
int pmix_bfrop_print_bo(char **output, char *prefix,
pmix_byte_object_t *src, pmix_data_type_t type)
{
char *prefx;
/* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " ");
else prefx = prefix;
/* if src is NULL, just print data type and return */
if (NULL == src) {
asprintf(output, "%sData type: PMIX_BYTE_OBJECT\tValue: NULL pointer", prefx);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}
asprintf(output, "%sData type: PMIX_BYTE_OBJECT\tSize: %ld", prefx, (long)src->size);
if (prefx != prefix) {
free(prefx);
}
return PMIX_SUCCESS;
}

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

@ -0,0 +1,105 @@
/* -*- C -*-
*
* 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) 2007-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Buffer management types.
*/
#ifndef PMIX_BFROP_TYPES_H_
#define PMIX_BFROP_TYPES_H_
#include <private/autogen/config.h>
#include <pmix/rename.h>
#include "src/class/pmix_object.h"
#include "src/class/pmix_pointer_array.h"
#include "src/class/pmix_list.h"
#include <pmix/pmix_common.h>
BEGIN_C_DECLS
/* define the results values for comparisons so we can change them in only one place */
#define PMIX_VALUE1_GREATER +1
#define PMIX_VALUE2_GREATER -1
#define PMIX_EQUAL 0
/**
* buffer type
*/
enum pmix_bfrop_buffer_type_t {
PMIX_BFROP_BUFFER_NON_DESC = 0x00,
PMIX_BFROP_BUFFER_FULLY_DESC = 0x01
};
typedef enum pmix_bfrop_buffer_type_t pmix_bfrop_buffer_type_t;
#define PMIX_BFROP_BUFFER_TYPE_HTON(h);
#define PMIX_BFROP_BUFFER_TYPE_NTOH(h);
/**
* Structure for holding a buffer */
typedef struct {
/** First member must be the object's parent */
pmix_object_t parent;
/** type of buffer */
pmix_bfrop_buffer_type_t type;
/** Start of my memory */
char *base_ptr;
/** Where the next data will be packed to (within the allocated
memory starting at base_ptr) */
char *pack_ptr;
/** Where the next data will be unpacked from (within the
allocated memory starting as base_ptr) */
char *unpack_ptr;
/** Number of bytes allocated (starting at base_ptr) */
size_t bytes_allocated;
/** Number of bytes used by the buffer (i.e., amount of data --
including overhead -- packed in the buffer) */
size_t bytes_used;
} pmix_buffer_t;
PMIX_DECLSPEC PMIX_CLASS_DECLARATION (pmix_buffer_t);
/* these classes are required by the regex code shared
* between the client and server implementations - it
* is put here so that both can access these objects */
typedef struct {
pmix_list_item_t super;
int start;
int cnt;
} pmix_regex_range_t;
PMIX_DECLSPEC PMIX_CLASS_DECLARATION(pmix_regex_range_t);
typedef struct {
/* list object */
pmix_list_item_t super;
char *prefix;
char *suffix;
int num_digits;
pmix_list_t ranges;
} pmix_regex_value_t;
PMIX_DECLSPEC PMIX_CLASS_DECLARATION(pmix_regex_value_t);
END_C_DECLS
#endif /* PMIX_BFROP_TYPES_H */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,35 @@
# -*- makefile -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2007 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) 2013-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
# src/Makefile.am
# Source code files
headers += \
src/class/pmix_object.h \
src/class/pmix_list.h \
src/class/pmix_pointer_array.h \
src/class/pmix_hash_table.h
sources += \
src/class/pmix_object.c \
src/class/pmix_list.c \
src/class/pmix_pointer_array.c \
src/class/pmix_hash_table.c

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

@ -0,0 +1,606 @@
/*
* 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) 2014-2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <private/autogen/config.h>
#include <string.h>
#include <stdlib.h>
#include "src/util/output.h"
#include "src/util/crc.h"
#include "src/class/pmix_list.h"
#include "src/class/pmix_hash_table.h"
#include <pmix.h>
/*
* pmix_hash_table_t
*/
static void pmix_hash_table_construct(pmix_hash_table_t* ht);
static void pmix_hash_table_destruct(pmix_hash_table_t* ht);
PMIX_CLASS_INSTANCE(
pmix_hash_table_t,
pmix_object_t,
pmix_hash_table_construct,
pmix_hash_table_destruct
);
static void pmix_hash_table_construct(pmix_hash_table_t* ht)
{
PMIX_CONSTRUCT(&ht->ht_nodes, pmix_list_t);
ht->ht_table = NULL;
ht->ht_table_size = 0;
ht->ht_size = 0;
}
static void pmix_hash_table_destruct(pmix_hash_table_t* ht)
{
size_t i;
pmix_hash_table_remove_all(ht);
for(i=0; i<ht->ht_table_size; i++) {
PMIX_DESTRUCT(ht->ht_table+i);
}
if(NULL != ht->ht_table) {
free(ht->ht_table);
}
PMIX_DESTRUCT(&ht->ht_nodes);
}
pmix_status_t pmix_hash_table_init(pmix_hash_table_t* ht, size_t table_size)
{
size_t i;
size_t power2 = pmix_next_poweroftwo (table_size);
ht->ht_mask = power2-1;
ht->ht_table = (pmix_list_t *)malloc(power2 * sizeof(pmix_list_t));
if(NULL == ht->ht_table) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
for(i=ht->ht_table_size; i<power2; i++) {
pmix_list_t* list = ht->ht_table+i;
PMIX_CONSTRUCT(list, pmix_list_t);
}
ht->ht_table_size = power2;
return PMIX_SUCCESS;
}
pmix_status_t pmix_hash_table_remove_all(pmix_hash_table_t* ht)
{
size_t i;
for(i=0; i<ht->ht_table_size; i++) {
pmix_list_t* list = ht->ht_table+i;
while(pmix_list_get_size(list)) {
pmix_list_item_t *item = pmix_list_remove_first(list);
PMIX_RELEASE(item);
}
}
while(pmix_list_get_size(&ht->ht_nodes)) {
pmix_list_item_t* item = pmix_list_remove_first(&ht->ht_nodes);
PMIX_RELEASE(item);
}
ht->ht_size = 0;
ht->ht_size -= 1;
return PMIX_SUCCESS;
}
/***************************************************************************/
/*
* pmix_uint32_hash_node_t
*/
struct pmix_uint32_hash_node_t
{
pmix_list_item_t super;
uint32_t hn_key;
void *hn_value;
};
typedef struct pmix_uint32_hash_node_t pmix_uint32_hash_node_t;
static PMIX_CLASS_INSTANCE(pmix_uint32_hash_node_t,
pmix_list_item_t,
NULL,
NULL);
pmix_status_t pmix_hash_table_get_value_uint32(pmix_hash_table_t* ht, uint32_t key,
void **ptr)
{
pmix_list_t* list = ht->ht_table + (key & ht->ht_mask);
pmix_uint32_hash_node_t *node;
#if PMIX_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
pmix_output(0, "pmix_hash_table_get_value_uint32:"
"pmix_hash_table_init() has not been called");
return PMIX_ERROR;
}
#endif
for(node = (pmix_uint32_hash_node_t*)pmix_list_get_first(list);
node != (pmix_uint32_hash_node_t*)pmix_list_get_end(list);
node = (pmix_uint32_hash_node_t*)pmix_list_get_next(node)) {
if (node->hn_key == key) {
*ptr = node->hn_value;
return PMIX_SUCCESS;
}
}
return PMIX_ERR_NOT_FOUND;
}
pmix_status_t pmix_hash_table_set_value_uint32(pmix_hash_table_t* ht,
uint32_t key, void* value)
{
pmix_list_t* list = ht->ht_table + (key & ht->ht_mask);
pmix_uint32_hash_node_t *node;
#if PMIX_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
pmix_output(0, "pmix_hash_table_set_value_uint32:"
"pmix_hash_table_init() has not been called");
return PMIX_ERR_BAD_PARAM;
}
#endif
for(node = (pmix_uint32_hash_node_t*)pmix_list_get_first(list);
node != (pmix_uint32_hash_node_t*)pmix_list_get_end(list);
node = (pmix_uint32_hash_node_t*)pmix_list_get_next(node)) {
if (node->hn_key == key) {
node->hn_value = value;
return PMIX_SUCCESS;
}
}
node = (pmix_uint32_hash_node_t*)pmix_list_remove_first(&ht->ht_nodes);
if(NULL == node) {
node = PMIX_NEW(pmix_uint32_hash_node_t);
if(NULL == node)
return PMIX_ERR_OUT_OF_RESOURCE;
}
node->hn_key = key;
node->hn_value = value;
pmix_list_append(list, (pmix_list_item_t*)node);
ht->ht_size++;
return PMIX_SUCCESS;
}
pmix_status_t pmix_hash_table_remove_value_uint32(pmix_hash_table_t* ht, uint32_t key)
{
pmix_list_t* list = ht->ht_table + (key & ht->ht_mask);
pmix_uint32_hash_node_t *node;
#if PMIX_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
pmix_output(0, "pmix_hash_table_remove_value_uint32:"
"pmix_hash_table_init() has not been called");
return PMIX_ERR_BAD_PARAM;
}
#endif
for(node = (pmix_uint32_hash_node_t*)pmix_list_get_first(list);
node != (pmix_uint32_hash_node_t*)pmix_list_get_end(list);
node = (pmix_uint32_hash_node_t*)pmix_list_get_next(node)) {
if (node->hn_key == key) {
pmix_list_remove_item(list, (pmix_list_item_t*)node);
pmix_list_append(&ht->ht_nodes, (pmix_list_item_t*)node);
ht->ht_size--;
return PMIX_SUCCESS;
}
}
return PMIX_ERR_NOT_FOUND;
}
/***************************************************************************/
/*
* pmix_uint64_hash_node_t
*/
struct pmix_uint64_hash_node_t
{
pmix_list_item_t super;
uint64_t hn_key;
void* hn_value;
};
typedef struct pmix_uint64_hash_node_t pmix_uint64_hash_node_t;
static PMIX_CLASS_INSTANCE(pmix_uint64_hash_node_t,
pmix_list_item_t,
NULL,
NULL);
pmix_status_t pmix_hash_table_get_value_uint64(pmix_hash_table_t* ht, uint64_t key,
void **ptr)
{
pmix_list_t* list = ht->ht_table + (key & ht->ht_mask);
pmix_uint64_hash_node_t *node;
#if PMIX_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
pmix_output(0, "pmix_hash_table_get_value_uint64:"
"pmix_hash_table_init() has not been called");
return PMIX_ERROR;
}
#endif
for(node = (pmix_uint64_hash_node_t*)pmix_list_get_first(list);
node != (pmix_uint64_hash_node_t*)pmix_list_get_end(list);
node = (pmix_uint64_hash_node_t*)pmix_list_get_next(node)) {
if (node->hn_key == key) {
*ptr = node->hn_value;
return PMIX_SUCCESS;
}
}
return PMIX_ERR_NOT_FOUND;
}
pmix_status_t pmix_hash_table_set_value_uint64(pmix_hash_table_t* ht,
uint64_t key, void* value)
{
pmix_list_t* list = ht->ht_table + (key & ht->ht_mask);
pmix_uint64_hash_node_t *node;
#if PMIX_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
pmix_output(0, "pmix_hash_table_set_value_uint64:"
"pmix_hash_table_init() has not been called");
return PMIX_ERR_BAD_PARAM;
}
#endif
for(node = (pmix_uint64_hash_node_t*)pmix_list_get_first(list);
node != (pmix_uint64_hash_node_t*)pmix_list_get_end(list);
node = (pmix_uint64_hash_node_t*)pmix_list_get_next(node)) {
if (node->hn_key == key) {
node->hn_value = value;
return PMIX_SUCCESS;
}
}
node = (pmix_uint64_hash_node_t*)pmix_list_remove_first(&ht->ht_nodes);
if(NULL == node) {
node = PMIX_NEW(pmix_uint64_hash_node_t);
if(NULL == node) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
}
node->hn_key = key;
node->hn_value = value;
pmix_list_append(list, (pmix_list_item_t*)node);
ht->ht_size++;
return PMIX_SUCCESS;
}
int pmix_hash_table_remove_value_uint64(pmix_hash_table_t* ht, uint64_t key)
{
pmix_list_t* list = ht->ht_table + (key & ht->ht_mask);
pmix_uint64_hash_node_t *node;
#if PMIX_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
pmix_output(0, "pmix_hash_table_remove_value_uint64:"
"pmix_hash_table_init() has not been called");
return PMIX_ERR_BAD_PARAM;
}
#endif
for(node = (pmix_uint64_hash_node_t*)pmix_list_get_first(list);
node != (pmix_uint64_hash_node_t*)pmix_list_get_end(list);
node = (pmix_uint64_hash_node_t*)pmix_list_get_next(node)) {
if (node->hn_key == key) {
pmix_list_remove_item(list, (pmix_list_item_t*)node);
pmix_list_append(&ht->ht_nodes, (pmix_list_item_t*)node);
ht->ht_size--;
return PMIX_SUCCESS;
}
}
return PMIX_ERR_NOT_FOUND;
}
/***************************************************************************/
/*
* pmix_ptr_hash_node_t
*/
struct pmix_ptr_hash_node_t
{
pmix_list_item_t super;
void* hn_key;
size_t hn_key_size;
void* hn_value;
};
typedef struct pmix_ptr_hash_node_t pmix_ptr_hash_node_t;
static void pmix_ptr_hash_node_construct(pmix_ptr_hash_node_t* hn)
{
hn->hn_key_size = 0;
hn->hn_key = NULL;
hn->hn_value = NULL;
}
static void pmix_ptr_hash_node_destruct(pmix_ptr_hash_node_t* hn)
{
if(NULL != hn->hn_key) {
free(hn->hn_key);
}
}
static PMIX_CLASS_INSTANCE(pmix_ptr_hash_node_t,
pmix_list_item_t,
pmix_ptr_hash_node_construct,
pmix_ptr_hash_node_destruct);
static inline uint32_t pmix_hash_value(size_t mask, const void *key,
size_t keysize)
{
unsigned int crc = pmix_uicrc_partial (key, keysize, 0);
return (uint32_t) (crc & mask);
}
int pmix_hash_table_get_value_ptr(pmix_hash_table_t* ht, const void* key,
size_t key_size, void **ptr)
{
pmix_list_t* list = ht->ht_table + pmix_hash_value(ht->ht_mask, key,
key_size);
pmix_ptr_hash_node_t *node;
#if PMIX_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
pmix_output(0, "pmix_hash_table_get_value_ptr:"
"pmix_hash_table_init() has not been called");
return PMIX_ERROR;
}
#endif
for(node = (pmix_ptr_hash_node_t*)pmix_list_get_first(list);
node != (pmix_ptr_hash_node_t*)pmix_list_get_end(list);
node = (pmix_ptr_hash_node_t*)pmix_list_get_next(node)) {
if (node->hn_key_size == key_size &&
memcmp(node->hn_key, key, key_size) == 0) {
*ptr = node->hn_value;
return PMIX_SUCCESS;
}
}
return PMIX_ERR_NOT_FOUND;
}
int pmix_hash_table_set_value_ptr(pmix_hash_table_t* ht, const void* key,
size_t key_size, void* value)
{
pmix_list_t* list = ht->ht_table + pmix_hash_value(ht->ht_mask, key,
key_size);
pmix_ptr_hash_node_t *node;
#if PMIX_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
pmix_output(0, "pmix_hash_table_set_value_ptr:"
"pmix_hash_table_init() has not been called");
return PMIX_ERR_BAD_PARAM;
}
#endif
for(node = (pmix_ptr_hash_node_t*)pmix_list_get_first(list);
node != (pmix_ptr_hash_node_t*)pmix_list_get_end(list);
node = (pmix_ptr_hash_node_t*)pmix_list_get_next(node)) {
if (node->hn_key_size == key_size &&
memcmp(node->hn_key, key, key_size) == 0) {
node->hn_value = value;
return PMIX_SUCCESS;
}
}
node = (pmix_ptr_hash_node_t*)pmix_list_remove_first(&ht->ht_nodes);
if(NULL == node) {
node = PMIX_NEW(pmix_ptr_hash_node_t);
if(NULL == node) {
return PMIX_ERR_OUT_OF_RESOURCE;
}
}
node->hn_key = malloc(key_size);
node->hn_key_size = key_size;
node->hn_value = value;
memcpy(node->hn_key, key, key_size);
pmix_list_append(list, (pmix_list_item_t*)node);
ht->ht_size++;
return PMIX_SUCCESS;
}
int pmix_hash_table_remove_value_ptr(pmix_hash_table_t* ht,
const void* key, size_t key_size)
{
pmix_list_t* list = ht->ht_table + pmix_hash_value(ht->ht_mask,
key, key_size);
pmix_ptr_hash_node_t *node;
#if PMIX_ENABLE_DEBUG
if(ht->ht_table_size == 0) {
pmix_output(0, "pmix_hash_table_remove_value_ptr: "
"pmix_hash_table_init() has not been called");
return PMIX_ERR_BAD_PARAM;
}
#endif
for(node = (pmix_ptr_hash_node_t*)pmix_list_get_first(list);
node != (pmix_ptr_hash_node_t*)pmix_list_get_end(list);
node = (pmix_ptr_hash_node_t*)pmix_list_get_next(node)) {
if (node->hn_key_size == key_size &&
memcmp(node->hn_key, key, key_size) == 0) {
free(node->hn_key);
node->hn_key = NULL;
node->hn_key_size = 0;
pmix_list_remove_item(list, (pmix_list_item_t*)node);
pmix_list_append(&ht->ht_nodes, (pmix_list_item_t*)node);
ht->ht_size--;
return PMIX_SUCCESS;
}
}
return PMIX_ERR_NOT_FOUND;
}
int
pmix_hash_table_get_first_key_uint32(pmix_hash_table_t *ht, uint32_t *key,
void **value, void **node)
{
size_t i;
pmix_uint32_hash_node_t *list_node;
/* Go through all the lists and return the first element off the
first non-empty list */
for (i = 0; i < ht->ht_table_size; ++i) {
if (pmix_list_get_size(ht->ht_table + i) > 0) {
list_node = (pmix_uint32_hash_node_t*)
pmix_list_get_first(ht->ht_table + i);
*node = list_node;
*key = list_node->hn_key;
*value = list_node->hn_value;
return PMIX_SUCCESS;
}
}
/* The hash table is empty */
return PMIX_ERROR;
}
int
pmix_hash_table_get_next_key_uint32(pmix_hash_table_t *ht, uint32_t *key,
void **value, void *in_node,
void **out_node)
{
size_t i;
pmix_list_t *list;
pmix_list_item_t *item;
pmix_uint32_hash_node_t *next;
/* Try to simply get the next value in the list. If there isn't
one, find the next non-empty list and take the first value */
next = (pmix_uint32_hash_node_t*) in_node;
list = ht->ht_table + (next->hn_key & ht->ht_mask);
item = pmix_list_get_next(next);
if (pmix_list_get_end(list) == item) {
item = NULL;
for (i = (list - ht->ht_table) + 1; i < ht->ht_table_size; ++i) {
if (pmix_list_get_size(ht->ht_table + i) > 0) {
item = pmix_list_get_first(ht->ht_table + i);
break;
}
}
/* If we didn't find another non-empty list after this one,
then we're at the end of the hash table */
if (NULL == item) {
return PMIX_ERROR;
}
}
/* We found it. Save the values (use "next" to avoid some
typecasting) */
*out_node = (void *) item;
next = (pmix_uint32_hash_node_t *) *out_node;
*key = next->hn_key;
*value = next->hn_value;
return PMIX_SUCCESS;
}
int
pmix_hash_table_get_first_key_uint64(pmix_hash_table_t *ht, uint64_t *key,
void **value, void **node)
{
size_t i;
pmix_uint64_hash_node_t *list_node;
/* Go through all the lists and return the first element off the
first non-empty list */
for (i = 0; i < ht->ht_table_size; ++i) {
if (pmix_list_get_size(ht->ht_table + i) > 0) {
list_node = (pmix_uint64_hash_node_t*)
pmix_list_get_first(ht->ht_table + i);
*node = list_node;
*key = list_node->hn_key;
*value = list_node->hn_value;
return PMIX_SUCCESS;
}
}
/* The hash table is empty */
return PMIX_ERROR;
}
int
pmix_hash_table_get_next_key_uint64(pmix_hash_table_t *ht, uint64_t *key,
void **value, void *in_node,
void **out_node)
{
size_t i;
pmix_list_t *list;
pmix_list_item_t *item;
pmix_uint64_hash_node_t *next;
/* Try to simply get the next value in the list. If there isn't
one, find the next non-empty list and take the first value */
next = (pmix_uint64_hash_node_t*) in_node;
list = ht->ht_table + (next->hn_key & ht->ht_mask);
item = pmix_list_get_next(next);
if (pmix_list_get_end(list) == item) {
item = NULL;
for (i = (list - ht->ht_table) + 1; i < ht->ht_table_size; ++i) {
if (pmix_list_get_size(ht->ht_table + i) > 0) {
item = pmix_list_get_first(ht->ht_table + i);
break;
}
}
/* If we didn't find another non-empty list after this one,
then we're at the end of the hash table */
if (NULL == item) {
return PMIX_ERROR;
}
}
/* We found it. Save the values (use "next" to avoid some
typecasting) */
*out_node = (void *) item;
next = (pmix_uint64_hash_node_t *) *out_node;
*key = next->hn_key;
*value = next->hn_value;
return PMIX_SUCCESS;
}

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