1
1

Roll in the latest PMIx version - includes shared memory datastore and reduced memory footprint

Этот коммит содержится в:
Ralph Castain 2016-08-20 07:52:25 -07:00
родитель c9dc286f25
Коммит 61ffba668b
31 изменённых файлов: 2650 добавлений и 246 удалений

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

@ -38,7 +38,7 @@ AC_DEFUN([MCA_opal_pmix_pmix2x_CONFIG],[
opal_pmix_pmix2x_save_LDFLAGS=$LDFLAGS
opal_pmix_pmix2x_save_LIBS=$LIBS
opal_pmix_pmix2x_args="--without-tests-examples --with-pmix-symbol-prefix=opal_pmix_pmix2x_ --disable-visibility --enable-embedded-libevent --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --enable-embedded-hwloc --with-hwloc-header=\\\"$opal_hwloc_base_include\\\""
opal_pmix_pmix2x_args="--without-tests-examples --disable-visibility --enable-embedded-libevent --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --enable-embedded-hwloc --with-hwloc-header=\\\"$opal_hwloc_base_include\\\""
AS_IF([test "$enable_debug" = "yes"],
[opal_pmix_pmix2x_args="--enable-debug $opal_pmix_pmix2x_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"],

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

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

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

@ -818,7 +818,25 @@ AC_DEFINE_UNQUOTED([PMIX_WANT_PRETTY_PRINT_STACKTRACE],
[$WANT_PRETTY_PRINT_STACKTRACE],
[if want pretty-print stack trace feature])
# Do we want the shared memory datastore usage?
#
AC_MSG_CHECKING([if want shared memory datastore])
AC_ARG_ENABLE([dstore],
[AC_HELP_STRING([--disable-dstore],
[Using shared memory datastore (default: enabled)])])
if test "$enable_dstore" != "no" ; then
AC_MSG_RESULT([yes])
WANT_DSTORE=1
else
AC_MSG_RESULT([no])
WANT_DSTORE=0
fi
AC_DEFINE_UNQUOTED([PMIX_ENABLE_DSTORE],
[$WANT_DSTORE],
[if want shared memory dstore feature])
#
# Ident string
#
AC_MSG_CHECKING([if want ident string])
@ -887,6 +905,7 @@ AC_DEFUN([PMIX_DO_AM_CONDITIONALS],[
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"])
AM_CONDITIONAL([WANT_DSTORE],[test "x$enable_dstore" != "xno"])
])
pmix_did_am_conditionals=yes
])dnl

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

@ -55,15 +55,10 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#ifdef HAVE_SYS_TIME_H
#include <time.h>
#include <sys/time.h> /* for struct timeval */
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* for uid_t and gid_t */
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> /* for uid_t and gid_t */
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
@ -182,7 +177,9 @@ typedef uint32_t pmix_rank_t;
/* 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_TIMEOUT "pmix.timeout" // (int) time in sec before specified operation should time out (0 => infinite)
#define PMIX_IMMEDIATE "pmix.immediate" // (bool) specified operation should immediately return an error if requested
// data cannot be found - do not request it from the host RM
#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
@ -606,17 +603,17 @@ typedef struct pmix_value {
time_t time;
pmix_status_t status;
pmix_rank_t rank;
pmix_proc_t proc;
pmix_proc_t *proc;
pmix_byte_object_t bo;
pmix_persistence_t persist;
pmix_scope_t scope;
pmix_data_range_t range;
pmix_proc_state_t state;
pmix_proc_info_t pinfo;
pmix_data_array_t darray;
pmix_proc_info_t *pinfo;
pmix_data_array_t *darray;
void *ptr;
/**** DEPRECATED ****/
pmix_info_array_t array;
pmix_info_array_t *array;
/********************/
} data;
} pmix_value_t;
@ -661,41 +658,23 @@ typedef struct pmix_value {
free((m)->data.bo.bytes); \
} \
} else if (PMIX_DATA_ARRAY == (m)->type) { \
if (PMIX_STRING == (m)->data.darray.type) { \
char **_str = (char**)(m)->data.darray.array; \
for (_n=0; _n < (m)->data.darray.size; _n++) { \
if (PMIX_STRING == (m)->data.darray->type) { \
char **_str = (char**)(m)->data.darray->array; \
for (_n=0; _n < (m)->data.darray->size; _n++) { \
if (NULL != _str[_n]) { \
free(_str[_n]); \
} \
} \
} else if (PMIX_PROC_INFO == (m)->data.darray.type) { \
} else if (PMIX_PROC_INFO == (m)->data.darray->type) { \
pmix_proc_info_t *_info = \
(pmix_proc_info_t*)(m)->data.darray.array; \
for (_n=0; _n < (m)->data.darray.size; _n++) { \
(pmix_proc_info_t*)(m)->data.darray->array; \
for (_n=0; _n < (m)->data.darray->size; _n++) { \
PMIX_PROC_INFO_DESTRUCT(&_info[_n]); \
} \
/**** DEPRECATED ****/ \
} else if (PMIX_INFO_ARRAY == (m)->type) { \
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); \
} \
} else if (PMIX_PROC_INFO == _p[_n].value.type) { \
PMIX_PROC_INFO_DESTRUCT(&_p[_n].value.data.pinfo); \
} \
} \
free(_p); \
/********************/ \
} else if (PMIX_INFO == (m)->data.darray.type) { \
} else if (PMIX_INFO == (m)->data.darray->type) { \
pmix_info_t *_info = \
(pmix_info_t*)(m)->data.darray.array; \
for (_n=0; _n < (m)->data.darray.size; _n++) { \
(pmix_info_t*)(m)->data.darray->array; \
for (_n=0; _n < (m)->data.darray->size; _n++) { \
/* cannot use info destruct as that loops back */ \
if (PMIX_STRING == _info[_n].value.type) { \
if (NULL != _info[_n].value.data.string) { \
@ -706,21 +685,39 @@ typedef struct pmix_value {
free(_info[_n].value.data.bo.bytes); \
} \
} else if (PMIX_PROC_INFO == _info[_n].value.type) { \
PMIX_PROC_INFO_DESTRUCT(&_info[_n].value.data.pinfo); \
PMIX_PROC_INFO_DESTRUCT(_info[_n].value.data.pinfo); \
} \
} \
} else if (PMIX_BYTE_OBJECT == (m)->data.darray.type) { \
} else if (PMIX_BYTE_OBJECT == (m)->data.darray->type) { \
pmix_byte_object_t *_obj = \
(pmix_byte_object_t*)(m)->data.darray.array; \
for (_n=0; _n < (m)->data.darray.size; _n++) { \
(pmix_byte_object_t*)(m)->data.darray->array; \
for (_n=0; _n < (m)->data.darray->size; _n++) { \
if (NULL != _obj[_n].bytes) { \
free(_obj[_n].bytes); \
} \
} \
} \
if (NULL != (m)->data.darray.array) { \
free((m)->data.darray.array); \
if (NULL != (m)->data.darray->array) { \
free((m)->data.darray->array); \
} \
/**** DEPRECATED ****/ \
} else if (PMIX_INFO_ARRAY == (m)->type) { \
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); \
} \
} else if (PMIX_PROC_INFO == _p[_n].value.type) { \
PMIX_PROC_INFO_DESTRUCT(_p[_n].value.data.pinfo); \
} \
} \
free(_p); \
/********************/ \
} \
} while (0)

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

@ -74,6 +74,10 @@ include common/Makefile.include
include buffer_ops/Makefile.am
include usock/Makefile.am
include sec/Makefile.am
if WANT_DSTORE
include sm/Makefile.include
include dstore/Makefile.include
endif
MAINTAINERCLEANFILES = Makefile.in config.h config.h.in
DISTCLEANFILES = Makefile

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

@ -393,23 +393,24 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
memcpy(&p->data.state, &src->data.state, sizeof(pmix_proc_state_t));
break;
case PMIX_PROC_INFO:
PMIX_PROC_INFO_CONSTRUCT(&p->data.pinfo);
if (NULL != src->data.pinfo.hostname) {
p->data.pinfo.hostname = strdup(src->data.pinfo.hostname);
PMIX_PROC_INFO_CREATE(p->data.pinfo, 1);
if (NULL != src->data.pinfo->hostname) {
p->data.pinfo->hostname = strdup(src->data.pinfo->hostname);
}
if (NULL != src->data.pinfo.executable_name) {
p->data.pinfo.executable_name = strdup(src->data.pinfo.executable_name);
if (NULL != src->data.pinfo->executable_name) {
p->data.pinfo->executable_name = strdup(src->data.pinfo->executable_name);
}
memcpy(&p->data.pinfo.pid, &src->data.pinfo.pid, sizeof(pid_t));
memcpy(&p->data.pinfo.exit_code, &src->data.pinfo.exit_code, sizeof(int));
memcpy(&p->data.pinfo.state, &src->data.pinfo.state, sizeof(pmix_proc_state_t));
memcpy(&p->data.pinfo->pid, &src->data.pinfo->pid, sizeof(pid_t));
memcpy(&p->data.pinfo->exit_code, &src->data.pinfo->exit_code, sizeof(int));
memcpy(&p->data.pinfo->state, &src->data.pinfo->state, sizeof(pmix_proc_state_t));
break;
case PMIX_DATA_ARRAY:
p->data.darray.type = src->data.darray.type;
p->data.darray.size = src->data.darray.size;
if (0 == p->data.darray.size || NULL == src->data.darray.array) {
p->data.darray.array = NULL;
p->data.darray.size = 0;
p->data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t));
p->data.darray->type = src->data.darray->type;
p->data.darray->size = src->data.darray->size;
if (0 == p->data.darray->size || NULL == src->data.darray->array) {
p->data.darray->array = NULL;
p->data.darray->size = 0;
break;
}
/* allocate space and do the copy */
@ -417,65 +418,65 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
case PMIX_UINT8:
case PMIX_INT8:
case PMIX_BYTE:
p->data.darray.array = (char*)malloc(src->data.darray.size);
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size);
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size);
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size);
break;
case PMIX_UINT16:
case PMIX_INT16:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(uint16_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(uint16_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(uint16_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(uint16_t));
break;
case PMIX_UINT32:
case PMIX_INT32:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(uint32_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(uint32_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(uint32_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(uint32_t));
break;
case PMIX_UINT64:
case PMIX_INT64:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(uint64_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(uint64_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(uint64_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(uint64_t));
break;
case PMIX_BOOL:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(bool));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(bool));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(bool));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(bool));
break;
case PMIX_SIZE:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(size_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(size_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(size_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(size_t));
break;
case PMIX_PID:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(pid_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(pid_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pid_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pid_t));
break;
case PMIX_STRING:
p->data.darray.array = (char**)malloc(src->data.darray.size * sizeof(char*));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char**)malloc(src->data.darray->size * sizeof(char*));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
prarray = (char**)p->data.darray.array;
strarray = (char**)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
prarray = (char**)p->data.darray->array;
strarray = (char**)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
if (NULL != strarray[n]) {
prarray[n] = strdup(strarray[n]);
}
@ -483,76 +484,76 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
break;
case PMIX_INT:
case PMIX_UINT:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(int));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(int));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(int));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(int));
break;
case PMIX_FLOAT:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(float));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(float));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(float));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(float));
break;
case PMIX_DOUBLE:
p->data.darray.array = (char*)malloc(src->data.darray.size * sizeof(double));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(double));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(double));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(double));
break;
case PMIX_TIMEVAL:
p->data.darray.array = (struct timeval*)malloc(src->data.darray.size * sizeof(struct timeval));
if (NULL == p->data.darray.array) {
p->data.darray->array = (struct timeval*)malloc(src->data.darray->size * sizeof(struct timeval));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(struct timeval));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(struct timeval));
break;
case PMIX_TIME:
p->data.darray.array = (time_t*)malloc(src->data.darray.size * sizeof(time_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (time_t*)malloc(src->data.darray->size * sizeof(time_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(time_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(time_t));
break;
case PMIX_STATUS:
p->data.darray.array = (pmix_status_t*)malloc(src->data.darray.size * sizeof(pmix_status_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (pmix_status_t*)malloc(src->data.darray->size * sizeof(pmix_status_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_status_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_status_t));
break;
case PMIX_VALUE:
PMIX_VALUE_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
PMIX_VALUE_CREATE(p->data.darray->array, src->data.darray->size);
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
pv = (pmix_value_t*)p->data.darray.array;
sv = (pmix_value_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
pv = (pmix_value_t*)p->data.darray->array;
sv = (pmix_value_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
if (PMIX_SUCCESS != (rc = pmix_value_xfer(&pv[n], &sv[n]))) {
PMIX_VALUE_FREE(pv, src->data.darray.size);
PMIX_VALUE_FREE(pv, src->data.darray->size);
return rc;
}
}
break;
case PMIX_PROC:
PMIX_PROC_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
PMIX_PROC_CREATE(p->data.darray->array, src->data.darray->size);
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_proc_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_proc_t));
break;
case PMIX_APP:
PMIX_APP_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
PMIX_APP_CREATE(p->data.darray->array, src->data.darray->size);
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
pa = (pmix_app_t*)p->data.darray.array;
sa = (pmix_app_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
pa = (pmix_app_t*)p->data.darray->array;
sa = (pmix_app_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
if (NULL != sa[n].cmd) {
pa[n].cmd = strdup(sa[n].cmd);
}
@ -567,7 +568,7 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
if (0 < sa[n].ninfo && NULL != sa[n].info) {
PMIX_INFO_CREATE(pa[n].info, sa[n].ninfo);
if (NULL == pa[n].info) {
PMIX_APP_FREE(pa, src->data.darray.size);
PMIX_APP_FREE(pa, src->data.darray->size);
return PMIX_ERR_NOMEM;
}
pa[n].ninfo = sa[n].ninfo;
@ -578,44 +579,44 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
}
break;
case PMIX_INFO:
PMIX_INFO_CREATE(p->data.darray.array, src->data.darray.size);
p1 = (pmix_info_t*)p->data.darray.array;
s1 = (pmix_info_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
PMIX_INFO_CREATE(p->data.darray->array, src->data.darray->size);
p1 = (pmix_info_t*)p->data.darray->array;
s1 = (pmix_info_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type);
}
break;
case PMIX_PDATA:
PMIX_PDATA_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
PMIX_PDATA_CREATE(p->data.darray->array, src->data.darray->size);
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
pd = (pmix_pdata_t*)p->data.darray.array;
sd = (pmix_pdata_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
pd = (pmix_pdata_t*)p->data.darray->array;
sd = (pmix_pdata_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value.data.flag, sd[n].value.type);
}
break;
case PMIX_BUFFER:
p->data.darray.array = (pmix_buffer_t*)malloc(src->data.darray.size * sizeof(pmix_buffer_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (pmix_buffer_t*)malloc(src->data.darray->size * sizeof(pmix_buffer_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
pb = (pmix_buffer_t*)p->data.darray.array;
sb = (pmix_buffer_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
pb = (pmix_buffer_t*)p->data.darray->array;
sb = (pmix_buffer_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
PMIX_CONSTRUCT(&pb[n], pmix_buffer_t);
pmix_bfrop.copy_payload(&pb[n], &sb[n]);
}
break;
case PMIX_BYTE_OBJECT:
p->data.darray.array = (pmix_byte_object_t*)malloc(src->data.darray.size * sizeof(pmix_byte_object_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (pmix_byte_object_t*)malloc(src->data.darray->size * sizeof(pmix_byte_object_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
pbo = (pmix_byte_object_t*)p->data.darray.array;
sbo = (pmix_byte_object_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
pbo = (pmix_byte_object_t*)p->data.darray->array;
sbo = (pmix_byte_object_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
if (NULL != sbo[n].bytes && 0 < sbo[n].size) {
pbo[n].size = sbo[n].size;
pbo[n].bytes = (char*)malloc(pbo[n].size);
@ -627,20 +628,20 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
}
break;
case PMIX_KVAL:
p->data.darray.array = (pmix_kval_t*)calloc(src->data.darray.size , sizeof(pmix_kval_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (pmix_kval_t*)calloc(src->data.darray->size , sizeof(pmix_kval_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
pk = (pmix_kval_t*)p->data.darray.array;
sk = (pmix_kval_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
pk = (pmix_kval_t*)p->data.darray->array;
sk = (pmix_kval_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
if (NULL != sk[n].key) {
pk[n].key = strdup(sk[n].key);
}
if (NULL != sk[n].value) {
PMIX_VALUE_CREATE(pk[n].value, 1);
if (NULL == pk[n].value) {
free(p->data.darray.array);
free(p->data.darray->array);
return PMIX_ERR_NOMEM;
}
if (PMIX_SUCCESS != (rc = pmix_value_xfer(pk[n].value, sk[n].value))) {
@ -650,13 +651,13 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
}
break;
case PMIX_MODEX:
PMIX_MODEX_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
PMIX_MODEX_CREATE(p->data.darray->array, src->data.darray->size);
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
pm = (pmix_modex_data_t*)p->data.darray.array;
sm = (pmix_modex_data_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
pm = (pmix_modex_data_t*)p->data.darray->array;
sm = (pmix_modex_data_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
memcpy(&pm[n], &sm[n], sizeof(pmix_modex_data_t));
if (NULL != sm[n].blob && 0 < sm[n].size) {
pm[n].blob = (uint8_t*)malloc(sm[n].size);
@ -672,59 +673,59 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
}
break;
case PMIX_PERSIST:
p->data.darray.array = (pmix_persistence_t*)malloc(src->data.darray.size * sizeof(pmix_persistence_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (pmix_persistence_t*)malloc(src->data.darray->size * sizeof(pmix_persistence_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_persistence_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_persistence_t));
break;
case PMIX_POINTER:
p->data.darray.array = (char**)malloc(src->data.darray.size * sizeof(char*));
if (NULL == p->data.darray.array) {
p->data.darray->array = (char**)malloc(src->data.darray->size * sizeof(char*));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
prarray = (char**)p->data.darray.array;
strarray = (char**)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
prarray = (char**)p->data.darray->array;
strarray = (char**)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
prarray[n] = strarray[n];
}
break;
case PMIX_SCOPE:
p->data.darray.array = (pmix_scope_t*)malloc(src->data.darray.size * sizeof(pmix_scope_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (pmix_scope_t*)malloc(src->data.darray->size * sizeof(pmix_scope_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_scope_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_scope_t));
break;
case PMIX_DATA_RANGE:
p->data.darray.array = (pmix_data_range_t*)malloc(src->data.darray.size * sizeof(pmix_data_range_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (pmix_data_range_t*)malloc(src->data.darray->size * sizeof(pmix_data_range_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_data_range_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_data_range_t));
break;
case PMIX_COMMAND:
p->data.darray.array = (pmix_cmd_t*)malloc(src->data.darray.size * sizeof(pmix_cmd_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (pmix_cmd_t*)malloc(src->data.darray->size * sizeof(pmix_cmd_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_cmd_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_cmd_t));
break;
case PMIX_INFO_DIRECTIVES:
p->data.darray.array = (pmix_info_directives_t*)malloc(src->data.darray.size * sizeof(pmix_info_directives_t));
if (NULL == p->data.darray.array) {
p->data.darray->array = (pmix_info_directives_t*)malloc(src->data.darray->size * sizeof(pmix_info_directives_t));
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
memcpy(p->data.darray.array, src->data.darray.array, src->data.darray.size * sizeof(pmix_info_directives_t));
memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_info_directives_t));
break;
case PMIX_PROC_INFO:
PMIX_PROC_INFO_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
PMIX_PROC_INFO_CREATE(p->data.darray->array, src->data.darray->size);
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
pi = (pmix_proc_info_t*)p->data.darray.array;
si = (pmix_proc_info_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
pi = (pmix_proc_info_t*)p->data.darray->array;
si = (pmix_proc_info_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
memcpy(&pi[n].proc, &si[n].proc, sizeof(pmix_proc_t));
if (NULL != si[n].hostname) {
pi[n].hostname = strdup(si[n].hostname);
@ -744,20 +745,20 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
case PMIX_DATA_ARRAY:
return PMIX_ERR_NOT_SUPPORTED; // don't support iterative arrays
case PMIX_QUERY:
PMIX_QUERY_CREATE(p->data.darray.array, src->data.darray.size);
if (NULL == p->data.darray.array) {
PMIX_QUERY_CREATE(p->data.darray->array, src->data.darray->size);
if (NULL == p->data.darray->array) {
return PMIX_ERR_NOMEM;
}
pq = (pmix_query_t*)p->data.darray.array;
sq = (pmix_query_t*)src->data.darray.array;
for (n=0; n < src->data.darray.size; n++) {
pq = (pmix_query_t*)p->data.darray->array;
sq = (pmix_query_t*)src->data.darray->array;
for (n=0; n < src->data.darray->size; n++) {
if (NULL != sq[n].keys) {
pq[n].keys = pmix_argv_copy(sq[n].keys);
}
if (NULL != sq[n].qualifiers && 0 < sq[n].nqual) {
PMIX_INFO_CREATE(pq[n].qualifiers, sq[n].nqual);
if (NULL == pq[n].qualifiers) {
PMIX_QUERY_FREE(pq, src->data.darray.size);
PMIX_QUERY_FREE(pq, src->data.darray->size);
return PMIX_ERR_NOMEM;
}
for (m=0; m < sq[n].nqual; m++) {
@ -779,15 +780,15 @@ pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
break;
/**** DEPRECATED ****/
case PMIX_INFO_ARRAY:
p->data.array.size = src->data.array.size;
if (0 < src->data.array.size) {
p->data.array.array = (pmix_info_t*)malloc(src->data.array.size * sizeof(pmix_info_t));
if (NULL == p->data.array.array) {
p->data.array->size = src->data.array->size;
if (0 < src->data.array->size) {
p->data.array->array = (pmix_info_t*)malloc(src->data.array->size * sizeof(pmix_info_t));
if (NULL == p->data.array->array) {
return PMIX_ERR_NOMEM;
}
p1 = (pmix_info_t*)p->data.array.array;
s1 = (pmix_info_t*)src->data.array.array;
for (n=0; n < src->data.darray.size; n++) {
p1 = (pmix_info_t*)p->data.array->array;
s1 = (pmix_info_t*)src->data.array->array;
for (n=0; n < src->data.darray->size; n++) {
PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type);
}
}

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

@ -540,7 +540,7 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer,
}
break;
case PMIX_PROC:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.proc, 1, PMIX_PROC))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, p->data.proc, 1, PMIX_PROC))) {
return ret;
}
break;
@ -575,23 +575,23 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer,
}
break;
case PMIX_PROC_INFO:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.pinfo, 1, PMIX_PROC_INFO))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, p->data.pinfo, 1, PMIX_PROC_INFO))) {
return ret;
}
break;
case PMIX_DATA_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.darray, 1, PMIX_DATA_ARRAY))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, p->data.darray, 1, PMIX_DATA_ARRAY))) {
return ret;
}
break;
case PMIX_QUERY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.darray, 1, PMIX_QUERY))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, p->data.darray, 1, PMIX_QUERY))) {
return ret;
}
break;
/**** DEPRECATED ****/
case PMIX_INFO_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, &p->data.array, 1, PMIX_INFO_ARRAY))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_buffer(buffer, p->data.array, 1, PMIX_INFO_ARRAY))) {
return ret;
}
break;

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

@ -865,26 +865,44 @@ pmix_status_t pmix_bfrop_print_status(char **output, char *prefix,
PMIx_Error_string(src->data.status));
break;
case PMIX_PROC:
if (NULL == src->data.proc) {
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PROC\tNULL", prefx);
} else {
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PROC\t%s:%lu",
prefx, src->data.proc->nspace, (unsigned long)src->data.proc->rank);
}
break;
case PMIX_BYTE_OBJECT:
rc = asprintf(output, "%sPMIX_VALUE: Data type: BYTE_OBJECT\tSIZE: %ld",
prefx, (long)src->data.bo.size);
break;
case PMIX_PERSIST:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PERSIST\tValue: %d",
prefx, (int)src->data.persist);
break;
case PMIX_SCOPE:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PERSIST\tValue: %d",
prefx, (int)src->data.persist);
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_SCOPE\tValue: %d",
prefx, (int)src->data.scope);
break;
case PMIX_DATA_RANGE:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PERSIST\tValue: %d",
prefx, (int)src->data.persist);
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_DATA_RANGE\tValue: %d",
prefx, (int)src->data.range);
break;
case PMIX_PROC_STATE:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_STATE\tValue: %d",
prefx, (int)src->data.state);
break;
case PMIX_PROC_INFO:
rc = asprintf(output, "%sPMIX_VALUE: Data type: PMIX_PROC_INFO\tValue: %s:%lu",
prefx, src->data.proc->nspace, (unsigned long)src->data.proc->rank);
break;
case PMIX_DATA_ARRAY:
rc = asprintf(output, "%sPMIX_VALUE: Data type: DATA_ARRAY\tARRAY SIZE: %ld",
prefx, (long)src->data.darray->size);
/**** DEPRECATED ****/
case PMIX_INFO_ARRAY:
rc = asprintf(output, "%sPMIX_VALUE: Data type: INFO_ARRAY\tARRAY SIZE: %ld",
prefx, (long)src->data.array.size);
prefx, (long)src->data.array->size);
break;
/********************/
default:

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

@ -631,7 +631,7 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
}
break;
case PMIX_PROC:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.proc, &m, PMIX_PROC))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, val->data.proc, &m, PMIX_PROC))) {
return ret;
}
break;
@ -666,23 +666,23 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest,
}
break;
case PMIX_PROC_INFO:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.pinfo, &m, PMIX_PROC_INFO))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, val->data.pinfo, &m, PMIX_PROC_INFO))) {
return ret;
}
break;
case PMIX_DATA_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.darray, &m, PMIX_DATA_ARRAY))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, val->data.darray, &m, PMIX_DATA_ARRAY))) {
return ret;
}
break;
case PMIX_QUERY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.darray, &m, PMIX_QUERY))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, val->data.darray, &m, PMIX_QUERY))) {
return ret;
}
break;
/**** DEPRECATED ****/
case PMIX_INFO_ARRAY:
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, &val->data.array, &m, PMIX_INFO_ARRAY))) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, val->data.array, &m, PMIX_INFO_ARRAY))) {
return ret;
}
break;

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

@ -187,7 +187,11 @@ static void expand_array(void)
int i;
max_classes += increment;
classes = (void**)realloc(classes, sizeof(void *) * max_classes);
if (NULL == classes) {
classes = (void**)calloc(max_classes, sizeof(void*));
} else {
classes = (void**)realloc(classes, sizeof(void *) * max_classes);
}
if (NULL == classes) {
perror("class malloc failed");
exit(-1);

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

@ -45,6 +45,7 @@
#include <sys/types.h>
#endif
#include PMIX_EVENT_HEADER
#include PMIX_EVENT2_THREAD_HEADER
#if PMIX_CC_USE_PRAGMA_IDENT
#pragma ident PMIX_VERSION
@ -388,6 +389,9 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
pmix_sec_init();
if (!pmix_globals.external_evbase) {
/* tell the event library we need thread support */
pmix_event_use_threads();
/* create an event base and progress thread for us */
if (NULL == (pmix_globals.evbase = pmix_progress_thread_init(NULL))) {
pmix_sec_finalize();

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

@ -242,7 +242,9 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
int32_t cnt;
pmix_nspace_t *ns, *nptr;
pmix_rank_t rank;
#if (PMIX_ENABLE_DSTORE != 1)
pmix_rank_t cur_rank;
#endif
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: get_nb callback recvd");
@ -254,7 +256,6 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
}
/* cache the rank */
rank = cb->rank;
cur_rank = rank;
/* unpack the status */
cnt = 1;
@ -282,12 +283,13 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
goto done;
}
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
#if (PMIX_ENABLE_DSTORE == 1)
rc = pmix_dstore_fetch(nptr->nspace, cb->rank, cb->key, &val);
#else
/* we received the entire blob for this process, so
* unpack and store it in the modex - this could consist
* of buffers from multiple scopes */
cur_rank = rank;
cnt = 1;
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(buf, &cur_rank, &cnt, PMIX_PROC_RANK))) {
pmix_kval_t *cur_kval;
@ -411,11 +413,11 @@ static pmix_status_t process_val(pmix_value_t *val,
}
/* save the results */
if (PMIX_DATA_ARRAY == val->type) {
info = (pmix_info_t*)val->data.darray.array;
nsize = val->data.darray.size;
info = (pmix_info_t*)val->data.darray->array;
nsize = val->data.darray->size;
} else {
info = (pmix_info_t*)val->data.array.array;
nsize = val->data.array.size;
info = (pmix_info_t*)val->data.array->array;
nsize = val->data.array->size;
}
nvals = 0;
for (n=0; n < nsize; n++) {
@ -425,11 +427,11 @@ static pmix_status_t process_val(pmix_value_t *val,
++nvals;
}
if (PMIX_DATA_ARRAY == val->type) {
val->data.darray.array = NULL; // protect the data
val->data.darray.size = 0;
val->data.darray->array = NULL; // protect the data
val->data.darray->size = 0;
} else {
val->data.array.array = NULL;
val->data.array.size = 0;
val->data.array->array = NULL;
val->data.array->size = 0;
}
/* increment the number of values */
(*num_vals) += nvals;
@ -528,10 +530,10 @@ static void _getnbfn(int fd, short flags, void *cbdata)
/* now let's package up the results */
PMIX_VALUE_CREATE(val, 1);
val->type = PMIX_DATA_ARRAY;
val->data.darray.type = PMIX_INFO;
val->data.darray.size = nvals;
val->data.darray->type = PMIX_INFO;
val->data.darray->size = nvals;
PMIX_INFO_CREATE(iptr, nvals);
val->data.darray.array = (void*)iptr;
val->data.darray->array = (void*)iptr;
for (n=0; n < (size_t)results.size && n < nvals; n++) {
if (NULL != (info = (pmix_info_t*)pmix_pointer_array_get_item(&results, n))) {
(void)strncpy(iptr[n].key, info->key, PMIX_MAX_KEYLEN);

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

@ -0,0 +1,16 @@
# Copyright (c) 2015-2016 Mellanox Technologies, Inc.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
headers += \
dstore/pmix_dstore.h \
dstore/pmix_esh.h
sources += \
dstore/pmix_dstore.c \
dstore/pmix_esh.c

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

@ -0,0 +1,92 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#include "src/include/pmix_globals.h"
#include "pmix_dstore.h"
#include "pmix_esh.h"
/*
* Array of all possible DSTOREs
*/
/**** ENSURE THE FOLLOWING VALUE IS AT LEAST AS
**** LARGE AS THE TOTAL NUMBER OF SUPPORTED SPCs
**** IN THE ARRAY BELOW
*/
static pmix_dstore_base_module_t *all[] = {
&pmix_dstore_esh_module,
/* Always end the array with a NULL */
NULL
};
pmix_dstore_base_module_t pmix_dstore = {0};
int pmix_dstore_init(pmix_info_t info[], size_t ninfo)
{
pmix_dstore = *all[0];
if (!pmix_dstore.init) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.init(info, ninfo);
}
void pmix_dstore_finalize(void)
{
if (!pmix_dstore.finalize) {
return ;
}
pmix_dstore.finalize();
return ;
}
int pmix_dstore_store(const char *nspace, pmix_rank_t rank, pmix_kval_t *kv)
{
if (!pmix_dstore.store) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.store(nspace, rank, kv);
}
int pmix_dstore_fetch(const char *nspace, pmix_rank_t rank,
const char *key, pmix_value_t **kvs)
{
if (!pmix_dstore.fetch) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.fetch(nspace, rank, key, kvs);
}
int pmix_dstore_patch_env(char ***env)
{
if (!pmix_dstore.patch_env) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.patch_env(env);
}
int pmix_dstore_nspace_add(const char *nspace)
{
if (!pmix_dstore.nspace) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_dstore.nspace(nspace);
}

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

@ -0,0 +1,113 @@
/*
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_DSTORE_H
#define PMIX_DSTORE_H
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#include "src/buffer_ops/buffer_ops.h"
BEGIN_C_DECLS
int pmix_dstore_init(pmix_info_t info[], size_t ninfo);
void pmix_dstore_finalize(void);
int pmix_dstore_store(const char *nspace, pmix_rank_t rank, pmix_kval_t *kv);
int pmix_dstore_fetch(const char *nspace, pmix_rank_t rank,
const char *key, pmix_value_t **kvs);
int pmix_dstore_patch_env(char ***env);
int pmix_dstore_nspace_add(const char *nspace);
/**
* Initialize the module. Returns an error if the module cannot
* run, success if it can and wants to be used.
*/
typedef int (*pmix_dstore_base_module_init_fn_t)(pmix_info_t info[], size_t ninfo);
/**
* Finalize the module. Tear down any allocated storage, disconnect
* from any system support.
*/
typedef int (*pmix_dstore_base_module_fini_fn_t)(void);
/**
* store key/value pair in datastore.
*
* @param nspace namespace string
*
* @param rank rank.
*
* @param kv key/value pair.
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_store_fn_t)(const char *nspace,
pmix_rank_t rank,
pmix_kval_t *kv);
/**
* fetch value in datastore.
*
* @param nspace namespace string
*
* @param rank rank.
*
* @param key key.
*
* @return kvs(key/value pair) and PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_fetch_fn_t)(const char *nspace,
pmix_rank_t rank,
const char *key,
pmix_value_t **kvs);
/**
* get base dstore path.
*
* @param nspace namespace string
*
* @param rank rank.
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_proc_patch_env_fn_t)(char ***env);
/**
* get base dstore path.
*
* @param nspace namespace string
*
* @param rank rank.
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_dstore_base_module_add_nspace_fn_t)(const char *nspace);
/**
* structure for dstore modules
*/
typedef struct {
const char *name;
pmix_dstore_base_module_init_fn_t init;
pmix_dstore_base_module_fini_fn_t finalize;
pmix_dstore_base_module_store_fn_t store;
pmix_dstore_base_module_fetch_fn_t fetch;
pmix_dstore_base_module_proc_patch_env_fn_t patch_env;
pmix_dstore_base_module_add_nspace_fn_t nspace;
} pmix_dstore_base_module_t;
END_C_DECLS
#endif /* PMIX_DSTORE_H */

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

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

@ -0,0 +1,85 @@
/*
* Copyright (c) 2015-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_DSTORE_ESH_H
#define PMIX_DSTORE_ESH_H
#include <src/include/pmix_config.h>
#include "pmix_dstore.h"
#include "src/sm/pmix_sm.h"
BEGIN_C_DECLS
#define INITIAL_SEG_SIZE 4096
#define NS_META_SEG_SIZE (1<<22)
#define NS_DATA_SEG_SIZE (1<<22)
#define PMIX_DSTORE_ESH_BASE_PATH "PMIX_DSTORE_ESH_BASE_PATH"
typedef enum {
INITIAL_SEGMENT,
NS_META_SEGMENT,
NS_DATA_SEGMENT
} segment_type;
/* initial segment format:
* size_t num_elems;
* int full; //indicate to client that it needs to attach to the next segment
* ns_seg_info_t ns_seg_info[max_ns_num];
*/
typedef struct {
char ns_name[PMIX_MAX_NSLEN+1];
size_t num_meta_seg;/* read by clients to attach to this number of segments. */
size_t num_data_seg;
} ns_seg_info_t;
/* meta segment format:
* size_t num_elems;
* rank_meta_info meta_info[max_meta_elems];
*/
typedef struct {
size_t rank;
size_t offset;
size_t count;
} rank_meta_info;
/* this structs are used to store information about
* shared segments addresses locally at each process,
* so they are common for different types of segments
* and don't have a specific content (namespace's info,
* rank's meta info, ranks's data). */
typedef struct seg_desc_t seg_desc_t;
struct seg_desc_t {
segment_type type;
pmix_sm_seg_t seg_info;
uint32_t id;
seg_desc_t *next;
};
typedef struct {
pmix_list_item_t super;
char ns_name[PMIX_MAX_NSLEN+1];
size_t num_meta_seg;
size_t num_data_seg;
seg_desc_t *meta_seg;
seg_desc_t *data_seg;
} ns_track_elem_t;
PMIX_CLASS_DECLARATION(ns_track_elem_t);
extern pmix_dstore_base_module_t pmix_dstore_esh_module;
END_C_DECLS
#endif /* PMIX_DSTORE_ESH_H */

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

@ -12,8 +12,6 @@
# All rights reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
# Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -45,6 +43,6 @@ headers += \
endif ! PMIX_EMBEDDED_MODE
if WANT_INSTALL_HEADERS
nodist_headers += \
headers += \
include/pmix_config.h
endif

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

@ -145,6 +145,7 @@ static void* progress_engine(pmix_object_t *obj)
pmix_progress_tracker_t *trk = (pmix_progress_tracker_t*)t->t_arg;
while (trk->ev_active) {
pmix_event_loop(trk->ev_base, PMIX_EVLOOP_ONCE);
}

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

@ -47,6 +47,7 @@
#include <ctype.h>
#include <sys/stat.h>
#include PMIX_EVENT_HEADER
#include PMIX_EVENT2_THREAD_HEADER
#include "src/util/argv.h"
#include "src/util/error.h"
@ -300,6 +301,9 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
/* and the usock system */
pmix_usock_init(NULL);
/* tell the event library we need thread support */
pmix_event_use_threads();
/* create an event base and progress thread for us */
if (NULL == (pmix_globals.evbase = pmix_progress_thread_init(NULL))) {
return PMIX_ERR_INIT;
@ -376,8 +380,12 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
free(pmix_pid);
return PMIX_ERR_INVALID_LENGTH;
}
pmix_output_verbose(2, pmix_globals.debug_output,
"%s:%d dropping system tool at %s",
pmix_globals.myid.nspace,
pmix_globals.myid.rank, pmix_pid);
/* create the listener for this point */
pmix_listener_t *tl = PMIX_NEW(pmix_listener_t);
tl = PMIX_NEW(pmix_listener_t);
tl -> address.sun_family = AF_UNIX;
tl->protocol = PMIX_PROTOCOL_TOOL;
snprintf(tl->address.sun_path, sizeof(tl->address.sun_path) - 1, "%s", pmix_pid);
@ -405,6 +413,10 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
free(pmix_pid);
return PMIX_ERR_INVALID_LENGTH;
}
pmix_output_verbose(2, pmix_globals.debug_output,
"%s:%d dropping session tool at %s",
pmix_globals.myid.nspace,
pmix_globals.myid.rank, pmix_pid);
/* create the listener for this point */
tl = PMIX_NEW(pmix_listener_t);
tl -> address.sun_family = AF_UNIX;
@ -646,12 +658,12 @@ static void _register_nspace(int sd, short args, void *cbdata)
} else if (0 == strcmp(cd->info[i].key, PMIX_PROC_DATA)) {
/* an array of data pertaining to a specific proc */
if (PMIX_DATA_ARRAY != cd->info[i].value.type ||
PMIX_INFO != cd->info[i].value.data.darray.type) {
PMIX_INFO != cd->info[i].value.data.darray->type) {
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
goto release;
}
size = cd->info[i].value.data.darray.size;
iptr = (pmix_info_t*)cd->info[i].value.data.darray.array;
size = cd->info[i].value.data.darray->size;
iptr = (pmix_info_t*)cd->info[i].value.data.darray->array;
PMIX_CONSTRUCT(&buf2, pmix_buffer_t);
/* first element of the array must be the rank */
if (0 != strcmp(iptr[0].key, PMIX_RANK)) {

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

@ -165,8 +165,8 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
/* search for directives we can deal with here */
for (n=0; n < ninfo; n++) {
if (0 == strcmp(info[n].key, PMIX_TIMEOUT)) {
if (0 == info[n].value.data.integer) {
if (0 == strcmp(info[n].key, PMIX_IMMEDIATE)) {
if (PMIX_UNDEF == info[n].value.type || info[n].value.data.flag) {
/* just check our own data - don't wait
* or request it from someone else */
localonly = true;

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

@ -0,0 +1,17 @@
#
# Copyright (c) 2016 Mellanox Technologies, Inc.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
headers += \
sm/pmix_sm.h \
sm/pmix_mmap.h
sources += \
sm/pmix_sm.c \
sm/pmix_mmap.c

161
opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c Обычный файл
Просмотреть файл

@ -0,0 +1,161 @@
/*
* Copyright (c) 2015-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <unistd.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#include "src/include/pmix_globals.h"
#include "pmix_sm.h"
#include "pmix_mmap.h"
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
# define MAP_ANONYMOUS MAP_ANON
#endif /* MAP_ANONYMOUS and MAP_ANON */
static int _mmap_segment_create(pmix_sm_seg_t *sm_seg, const char *file_name, size_t size);
static int _mmap_segment_attach(pmix_sm_seg_t *sm_seg, pmix_sm_access_mode_t sm_mode);
static int _mmap_segment_detach(pmix_sm_seg_t *sm_seg);
static int _mmap_segment_unlink(pmix_sm_seg_t *sm_seg);
pmix_sm_base_module_t pmix_sm_mmap_module = {
"mmap",
_mmap_segment_create,
_mmap_segment_attach,
_mmap_segment_detach,
_mmap_segment_unlink
};
int _mmap_segment_create(pmix_sm_seg_t *sm_seg, const char *file_name, size_t size)
{
int rc = PMIX_SUCCESS;
void *seg_addr = MAP_FAILED;
pid_t my_pid = getpid();
_segment_ds_reset(sm_seg);
/* enough space is available, so create the segment */
if (-1 == (sm_seg->seg_id = open(file_name, O_CREAT | O_RDWR, 0600))) {
pmix_output_verbose(2, pmix_globals.debug_output,
"sys call open(2) fail\n");
rc = PMIX_ERROR;
goto out;
}
/* size backing file - note the use of real_size here */
if (0 != ftruncate(sm_seg->seg_id, size)) {
pmix_output_verbose(2, pmix_globals.debug_output,
"sys call ftruncate(2) fail\n");
rc = PMIX_ERROR;
goto out;
}
if (MAP_FAILED == (seg_addr = mmap(NULL, size,
PROT_READ | PROT_WRITE, MAP_SHARED,
sm_seg->seg_id, 0))) {
pmix_output_verbose(2, pmix_globals.debug_output,
"sys call mmap(2) fail\n");
rc = PMIX_ERROR;
goto out;
}
sm_seg->seg_cpid = my_pid;
sm_seg->seg_size = size;
sm_seg->seg_base_addr = (unsigned char *)seg_addr;
(void)strncpy(sm_seg->seg_name, file_name, PMIX_PATH_MAX - 1);
out:
if (-1 != sm_seg->seg_id) {
if (0 != close(sm_seg->seg_id)) {
pmix_output_verbose(2, pmix_globals.debug_output,
"sys call close(2) fail\n");
rc = PMIX_ERROR;
}
}
/* an error occured, so invalidate the shmem object and munmap if needed */
if (PMIX_SUCCESS != rc) {
if (MAP_FAILED != seg_addr) {
munmap((void *)seg_addr, size);
}
_segment_ds_reset(sm_seg);
}
return rc;
}
int _mmap_segment_attach(pmix_sm_seg_t *sm_seg, pmix_sm_access_mode_t sm_mode)
{
mode_t mode = O_RDWR;
int mmap_prot = PROT_READ | PROT_WRITE;
if (sm_mode == PMIX_SM_RONLY) {
mode = O_RDONLY;
mmap_prot = PROT_READ;
}
if (-1 == (sm_seg->seg_id = open(sm_seg->seg_name, mode))) {
return PMIX_ERROR;
}
if (MAP_FAILED == (sm_seg->seg_base_addr = (unsigned char *)
mmap(NULL, sm_seg->seg_size,
mmap_prot, MAP_SHARED,
sm_seg->seg_id, 0))) {
/* mmap failed, so close the file and return NULL - no error check
* here because we are already in an error path...
*/
pmix_output_verbose(2, pmix_globals.debug_output,
"sys call mmap(2) fail\n");
close(sm_seg->seg_id);
return PMIX_ERROR;
}
/* all is well */
/* if close fails here, that's okay. just let the user know and
* continue. if we got this far, open and mmap were successful...
*/
if (0 != close(sm_seg->seg_id)) {
pmix_output_verbose(2, pmix_globals.debug_output,
"sys call close(2) fail\n");
}
sm_seg->seg_cpid = 0;/* FIXME */
return PMIX_SUCCESS;
}
int _mmap_segment_detach(pmix_sm_seg_t *sm_seg)
{
int rc = PMIX_SUCCESS;
if (0 != munmap((void *)sm_seg->seg_base_addr, sm_seg->seg_size)) {
pmix_output_verbose(2, pmix_globals.debug_output,
"sys call munmap(2) fail\n");
rc = PMIX_ERROR;
}
/* reset the contents of the pmix_sm_seg_t associated with this
* shared memory segment.
*/
_segment_ds_reset(sm_seg);
return rc;
}
int _mmap_segment_unlink(pmix_sm_seg_t *sm_seg)
{
if (-1 == unlink(sm_seg->seg_name)) {
pmix_output_verbose(2, pmix_globals.debug_output,
"sys call unlink(2) fail\n");
return PMIX_ERROR;
}
sm_seg->seg_id = PMIX_SHMEM_DS_ID_INVALID;
return PMIX_SUCCESS;
}

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

@ -0,0 +1,25 @@
/*
* Copyright (c) 2015-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_SM_MMAP_H
#define PMIX_SM_MMAP_H
#include <src/include/pmix_config.h>
#include "pmix_sm.h"
BEGIN_C_DECLS
extern pmix_sm_base_module_t pmix_sm_mmap_module;
END_C_DECLS
#endif /* PMIX_SM_MMAP_H */

82
opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.c Обычный файл
Просмотреть файл

@ -0,0 +1,82 @@
/*
* Copyright (c) 2015-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#include "src/include/pmix_globals.h"
#include "pmix_sm.h"
#include "pmix_mmap.h"
/*
* Array of all possible SMs
*/
/**** ENSURE THE FOLLOWING VALUE IS AT LEAST AS
**** LARGE AS THE TOTAL NUMBER OF SUPPORTED SPCs
**** IN THE ARRAY BELOW
*/
static pmix_sm_base_module_t *all[] = {
&pmix_sm_mmap_module,
/* Always end the array with a NULL */
NULL
};
pmix_sm_base_module_t pmix_sm = {0};
int pmix_sm_init(void)
{
pmix_sm = *all[0];
return PMIX_SUCCESS;
}
void pmix_sm_finalize(void)
{
return ;
}
int pmix_sm_segment_create(pmix_sm_seg_t *sm_seg, const char *file_name, size_t size)
{
if (!pmix_sm.segment_create) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_sm.segment_create(sm_seg, file_name, size);
}
int pmix_sm_segment_attach(pmix_sm_seg_t *sm_seg, pmix_sm_access_mode_t sm_mode)
{
if (!pmix_sm.segment_attach) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_sm.segment_attach(sm_seg, sm_mode);
}
int pmix_sm_segment_detach(pmix_sm_seg_t *sm_seg)
{
if (!pmix_sm.segment_detach) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_sm.segment_detach(sm_seg);
}
int pmix_sm_segment_unlink(pmix_sm_seg_t *sm_seg)
{
if (!pmix_sm.segment_unlink) {
return PMIX_ERR_NOT_SUPPORTED;
}
return pmix_sm.segment_unlink(sm_seg);
}

121
opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.h Обычный файл
Просмотреть файл

@ -0,0 +1,121 @@
/*
* Copyright (c) 2015-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_SM_H
#define PMIX_SM_H
#include <src/include/pmix_config.h>
BEGIN_C_DECLS
#if !defined(MAP_FAILED)
# define MAP_FAILED ((char*)-1)
#endif /* MAP_FAILED */
#define PMIX_SHMEM_DS_ID_INVALID -1
typedef enum {
PMIX_SM_RONLY,
PMIX_SM_RW
} pmix_sm_access_mode_t;
typedef struct pmix_sm_seg_t {
/* pid of the shared memory segment creator */
pid_t seg_cpid;
/* ds id */
int seg_id;
/* size of shared memory segment */
size_t seg_size;
/* base address of shared memory segment */
unsigned char *seg_base_addr;
char seg_name[PMIX_PATH_MAX];
} pmix_sm_seg_t;
int pmix_sm_init(void);
void pmix_sm_finalize(void);
int pmix_sm_segment_create(pmix_sm_seg_t *sm_seg, const char *file_name, size_t size);
int pmix_sm_segment_attach(pmix_sm_seg_t *sm_seg, pmix_sm_access_mode_t sm_mode);
int pmix_sm_segment_detach(pmix_sm_seg_t *sm_seg);
int pmix_sm_segment_unlink(pmix_sm_seg_t *sm_seg);
static inline void _segment_ds_reset(pmix_sm_seg_t *sm_seg)
{
sm_seg->seg_cpid = 0;
sm_seg->seg_id = PMIX_SHMEM_DS_ID_INVALID;
sm_seg->seg_size = 0;
memset(sm_seg->seg_name, '\0', PMIX_PATH_MAX);
sm_seg->seg_base_addr = (unsigned char *)MAP_FAILED;
}
/**
* create a new shared memory segment and initialize members in structure
* pointed to by sm_seg.
*
* @param sm_seg pointer to pmix_sm_seg_t structure
*
* @param file_name unique string identifier that must be a valid,
* writable path (IN).
*
* @param size size of the shared memory segment.
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_sm_base_module_segment_create_fn_t)(pmix_sm_seg_t *sm_seg, const char *file_name, size_t size);
/**
* attach to an existing shared memory segment initialized by segment_create.
*
* @param sm_seg pointer to initialized pmix_sm_seg_t typedef'd
* structure (IN/OUT).
*
* @return base address of shared memory segment on success. returns
* NULL otherwise.
*/
typedef int (*pmix_sm_base_module_segment_attach_fn_t)(pmix_sm_seg_t *sm_seg, pmix_sm_access_mode_t sm_mode);
/**
* detach from an existing shared memory segment.
*
* @param sm_seg pointer to initialized pmix_sm_seg_t typedef'd structure
* (IN/OUT).
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_sm_base_module_segment_detach_fn_t)(pmix_sm_seg_t *sm_seg);
/**
* unlink an existing shared memory segment.
*
* @param sm_seg pointer to initialized pmix_sm_seg_t typedef'd structure
* (IN/OUT).
*
* @return PMIX_SUCCESS on success.
*/
typedef int (*pmix_sm_base_module_unlink_fn_t)(pmix_sm_seg_t *sm_seg);
/**
* structure for sm modules
*/
typedef struct {
const char *name;
pmix_sm_base_module_segment_create_fn_t segment_create;
pmix_sm_base_module_segment_attach_fn_t segment_attach;
pmix_sm_base_module_segment_detach_fn_t segment_detach;
pmix_sm_base_module_unlink_fn_t segment_unlink;
} pmix_sm_base_module_t;
END_C_DECLS
#endif /* PMIX_SM_H */

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

@ -49,6 +49,7 @@
#endif /* HAVE_DIRENT_H */
#include PMIX_EVENT_HEADER
#include PMIX_EVENT2_THREAD_HEADER
#if PMIX_CC_USE_PRAGMA_IDENT
#pragma ident PMIX_VERSION
@ -299,6 +300,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc,
}
/* otherwise, this isn't a fatal error - reset the addr */
memset(&address, 0, sizeof(struct sockaddr_un));
address.sun_family = AF_UNIX;
connection_defined = false;
} else {
/* connect to this server */
@ -371,6 +373,10 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc,
pmix_usock_init(pmix_tool_notify_recv);
pmix_sec_init();
/* tell the event library we need thread support */
pmix_event_use_threads();
if (!pmix_globals.external_evbase) {
/* create an event base and progress thread for us */
if (NULL == (pmix_globals.evbase = pmix_progress_thread_init(NULL))) {
@ -836,7 +842,8 @@ static pmix_status_t usock_connect(struct sockaddr_un *addr, int *fd)
int retries = 0;
pmix_output_verbose(2, pmix_globals.debug_output,
"usock_peer_try_connect: attempting to connect to server");
"usock_peer_try_connect: attempting to connect to server at %s",
addr->sun_path);
addrlen = sizeof(struct sockaddr_un);
while (retries < PMIX_MAX_RETRIES) {

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

@ -94,11 +94,22 @@ int main(int argc, char **argv)
/* init us */
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Init failed: %d", myproc.nspace, myproc.rank, rc);
pmix_output(0, "Client ns %s rank %d: PMIx_Init failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
exit(rc);
}
pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank);
/* test something */
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Get failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
exit(rc);
}
PMIX_VALUE_RELEASE(val);
/* register our errhandler */
active = true;
PMIx_Register_event_handler(NULL, 0, NULL, 0,
@ -111,7 +122,8 @@ int main(int argc, char **argv)
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %d", myproc.nspace, myproc.rank, rc);
pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
nprocs = val->data.uint32;
@ -123,7 +135,8 @@ int main(int argc, char **argv)
value.type = PMIX_UINT32;
value.data.uint32 = 1234;
if (PMIX_SUCCESS != (rc = PMIx_Store_internal(&myproc, tmp, &value))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Store_internal failed: %d", myproc.nspace, myproc.rank, rc);
pmix_output(0, "Client ns %s rank %d: PMIx_Store_internal failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
@ -132,7 +145,8 @@ int main(int argc, char **argv)
value.type = PMIX_UINT64;
value.data.uint64 = 1234;
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, tmp, &value))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Put internal failed: %d", myproc.nspace, myproc.rank, rc);
pmix_output(0, "Client ns %s rank %d: PMIx_Put internal failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
@ -140,12 +154,14 @@ int main(int argc, char **argv)
value.type = PMIX_STRING;
value.data.string = "1234";
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) {
pmix_output(0, "Client ns %s rank %d: PMIx_Put internal failed: %d", myproc.nspace, myproc.rank, rc);
pmix_output(0, "Client ns %s rank %d: PMIx_Put internal failed: %s",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
goto done;
}
if (PMIX_SUCCESS != (rc = PMIx_Commit())) {
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Commit failed: %d", myproc.nspace, myproc.rank, cnt, rc);
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Commit failed: %s",
myproc.nspace, myproc.rank, cnt, PMIx_Error_string(rc));
goto done;
}
@ -154,7 +170,8 @@ int main(int argc, char **argv)
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
proc.rank = PMIX_RANK_WILDCARD;
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) {
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Fence failed: %d", myproc.nspace, myproc.rank, cnt, rc);
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Fence failed: %s",
myproc.nspace, myproc.rank, cnt, PMIx_Error_string(rc));
goto done;
}
@ -165,7 +182,8 @@ int main(int argc, char **argv)
proc.rank = n;
(void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, n, j);
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %d", myproc.nspace, myproc.rank, j, tmp, rc);
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %s",
myproc.nspace, myproc.rank, j, tmp, PMIx_Error_string(rc));
continue;
}
if (PMIX_UINT64 != val->type) {
@ -186,7 +204,8 @@ int main(int argc, char **argv)
(void)asprintf(&tmp, "%s-%d-remote-%d", proc.nspace, n, j);
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) {
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %d", myproc.nspace, myproc.rank, j, tmp, rc);
pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %s",
myproc.nspace, myproc.rank, j, tmp, PMIx_Error_string(rc));
continue;
}
if (PMIX_STRING != val->type) {
@ -235,7 +254,8 @@ int main(int argc, char **argv)
/* finalize us */
pmix_output(0, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank);
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %s\n",
myproc.nspace, myproc.rank, PMIx_Error_string(rc));
} else {
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);
}

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

@ -356,7 +356,7 @@ static void set_namespace(int nprocs, char *ranks, char *nspace,
char hostname[PMIX_MAXHOSTNAMELEN];
gethostname(hostname, sizeof(hostname));
x->ninfo = 6;
x->ninfo = 7;
PMIX_INFO_CREATE(x->info, x->ninfo);
(void)strncpy(x->info[0].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN);
@ -385,6 +385,10 @@ static void set_namespace(int nprocs, char *ranks, char *nspace,
x->info[5].value.type = PMIX_STRING;
x->info[5].value.data.string = ppn;
(void)strncpy(x->info[6].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN);
x->info[6].value.type = PMIX_UINT32;
x->info[6].value.data.uint32 = nprocs;
PMIx_server_register_nspace(nspace, nprocs, x->info, x->ninfo,
cbfunc, x);
}

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

@ -5,7 +5,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -789,8 +789,9 @@ void pmix2x_value_load(pmix_value_t *v,
case OPAL_NAME:
v->type = PMIX_PROC;
/* have to stringify the jobid */
(void)opal_snprintf_jobid(v->data.proc.nspace, PMIX_MAX_NSLEN, kv->data.name.vpid);
v->data.proc.rank = pmix2x_convert_opalrank(kv->data.name.vpid);
PMIX_PROC_CREATE(v->data.proc, 1);
(void)opal_snprintf_jobid(v->data.proc->nspace, PMIX_MAX_NSLEN, kv->data.name.vpid);
v->data.proc->rank = pmix2x_convert_opalrank(kv->data.name.vpid);
break;
case OPAL_BYTE_OBJECT:
v->type = PMIX_BYTE_OBJECT;
@ -929,10 +930,10 @@ int pmix2x_value_unload(opal_value_t *kv,
break;
case PMIX_PROC:
kv->type = OPAL_NAME;
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&kv->data.name.jobid, v->data.proc.nspace))) {
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&kv->data.name.jobid, v->data.proc->nspace))) {
return pmix2x_convert_opalrc(rc);
}
kv->data.name.vpid = pmix2x_convert_rank(v->data.proc.rank);
kv->data.name.vpid = pmix2x_convert_rank(v->data.proc->rank);
break;
case PMIX_BYTE_OBJECT:
kv->type = OPAL_BYTE_OBJECT;

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

@ -6,7 +6,7 @@
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -216,9 +216,10 @@ static void _reg_nspace(int sd, short args, void *cbdata)
pmapinfo = (opal_list_t*)kv->data.ptr;
szmap = opal_list_get_size(pmapinfo);
PMIX_INFO_CREATE(pmap, szmap);
pinfo[n].value.data.darray.type = PMIX_INFO;
pinfo[n].value.data.darray.array = (struct pmix_info_t*)pmap;
pinfo[n].value.data.darray.size = szmap;
pinfo[n].value.data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t));
pinfo[n].value.data.darray->type = PMIX_INFO;
pinfo[n].value.data.darray->array = (struct pmix_info_t*)pmap;
pinfo[n].value.data.darray->size = szmap;
m = 0;
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);