1
1

pmix/pmix4x: refresh to the latest PMIx

refrest pmi4x to pmix/pmix@2531c0c3d1

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
Gilles Gouaillardet 2019-04-09 14:02:36 +09:00
родитель 163bbd4f04
Коммит 9ce8d7b568
62 изменённых файлов: 2405 добавлений и 704 удалений

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

@ -30,7 +30,7 @@ greek=a1
# command, or with the date (if "git describe" fails) in the form of
# "date<date>".
repo_rev=git20cc9c04
repo_rev=git2531c0c3
# 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="Mar 25, 2019"
date="Apr 09, 2019"
# The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library

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

@ -11,7 +11,7 @@
# All rights reserved.
# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2018 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
@ -21,7 +21,7 @@
# $HEADER$
#
helpers = setup.py client.py server.py cpmix.pxd pmix.pyx
helpers = setup.py client.py server.py pmix.pyx
if WANT_PYTHON_BINDINGS

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

@ -11,8 +11,8 @@
# 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-2019 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2015 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
@ -42,7 +42,7 @@ fi
# 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
if test -e .git ; then
repo_rev=$(config/pmix_get_version.sh VERSION --repo-rev)
fi

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

@ -725,8 +725,6 @@ AC_DEFUN([PMIX_SETUP_CORE],[
CFLAGS="$CFLAGS $THREAD_CFLAGS"
CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS"
CXXFLAGS="$CXXFLAGS $THREAD_CXXFLAGS"
CXXCPPFLAGS="$CXXCPPFLAGS $THREAD_CXXCPPFLAGS"
LDFLAGS="$LDFLAGS $THREAD_LDFLAGS"
LIBS="$LIBS $THREAD_LIBS"
@ -736,10 +734,10 @@ AC_DEFUN([PMIX_SETUP_CORE],[
AC_PROG_LN_S
# Check for some common system programs that we need
AC_PROG_GREP
AC_PROG_EGREP
##################################
# Visibility
##################################
@ -903,6 +901,10 @@ AC_DEFUN([PMIX_DEFINE_ARGS],[
[Whether build should attempt to use dlopen (or
similar) to dynamically load components.
(default: enabled)])])
AS_IF([test "$enable_dlopen" = "unknown"],
[AC_MSG_WARN([enable_dlopen variable has been overwritten by configure])
AC_MSG_WARN([This is an internal error that should be reported to PMIx developers])
AC_MSG_ERROR([Cannot continue])])
AS_IF([test "$enable_dlopen" = "no"],
[enable_mca_dso="no"
enable_mca_static="yes"
@ -930,8 +932,16 @@ AC_DEFUN([PMIX_DEFINE_ARGS],[
# Is this a developer copy?
#
if test -d .git; then
if test -e $PMIX_TOP_SRCDIR/.git; then
PMIX_DEVEL=1
# check for Flex
AC_PROG_LEX
if test "x$LEX" != xflex; then
AC_MSG_WARN([PMIx requires Flex to build from non-tarball sources,])
AC_MSG_WARN([but Flex was not found. Please install Flex into])
AC_MSG_WARN([your path and try again])
AC_MSG_ERROR([Cannot continue])
fi
else
PMIX_DEVEL=0
fi
@ -982,7 +992,6 @@ 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])

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

@ -10,7 +10,7 @@ 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 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
@ -71,104 +71,6 @@ int main(int argc, char* argv[])
# END: PMIX_INTL_PTHREAD_TRY_LINK
])dnl
AC_DEFUN([PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN], [
# BEGIN: PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN
#
# Make sure that we can run a small application in Fortran, with
# pthreads living in a C object file
# Fortran module
cat > conftestf.f <<EOF
program fpthread
call pthreadtest
end
EOF
# C module
if test -f conftest.h; then
pmix_conftest_h="#include \"conftest.h\""
else
pmix_conftest_h=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
$pmix_conftest_h
#ifdef __cplusplus
extern "C" {
#endif
int i = 3;
pthread_t me, newthread;
void cleanup_routine(void *foo);
void *thread_main(void *foo);
void pthreadtest_f(void);
void cleanup_routine(void *foo) { i = 4; }
void *thread_main(void *foo) { i = 2; return (void*) &i; }
void pthreadtest_f(void)
{
pthread_attr_t attr;
me = pthread_self();
pthread_atfork(NULL, NULL, NULL);
pthread_attr_init(&attr);
pthread_cleanup_push(cleanup_routine, 0);
pthread_create(&newthread, &attr, thread_main, 0);
pthread_join(newthread, 0);
pthread_cleanup_pop(0);
}
void pthreadtest(void)
{ pthreadtest_f(); }
void pthreadtest_(void)
{ pthreadtest_f(); }
void pthreadtest__(void)
{ pthreadtest_f(); }
void PTHREADTEST(void)
{ pthreadtest_f(); }
#ifdef __cplusplus
}
#endif
EOF
# Try the compile
PMIX_LOG_COMMAND(
[$CC $CFLAGS -I. -c conftest.c],
PMIX_LOG_COMMAND(
[$FC $FCFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
[HAPPY=1],
[HAPPY=0]),
[HAPPY=0])
if test "$HAPPY" = "1"; then
$1
else
PMIX_LOG_MSG([here is the C program:], 1)
PMIX_LOG_FILE([conftest.c])
if test -f conftest.h; then
PMIX_LOG_MSG([here is contest.h:], 1)
PMIX_LOG_FILE([conftest.h])
fi
PMIX_LOG_MSG([here is the fortran program:], 1)
PMIX_LOG_FILE([conftestf.f])
$2
fi
unset HAPPY pmix_conftest_h
rm -rf conftest*
# END: PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN
])dnl
# ********************************************************************
#
# Try to compile thread support without any special flags
@ -194,48 +96,6 @@ fi
])dnl
AC_DEFUN([PMIX_INTL_POSIX_THREADS_PLAIN_CXX], [
#
# C++ compiler
#
if test "$pmix_pthread_cxx_success" = "0"; then
AC_MSG_CHECKING([if C++ compiler and POSIX threads work as is])
AC_LANG_PUSH(C++)
PMIX_INTL_PTHREAD_TRY_LINK(pmix_pthread_cxx_success=1,
pmix_pthread_cxx_success=0)
AC_LANG_POP(C++)
if test "$pmix_pthread_cxx_success" = "1"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
])dnl
AC_DEFUN([PMIX_INTL_POSIX_THREADS_PLAIN_FC], [
#
# Fortran compiler
#
if test "$pmix_pthread_fortran_success" = "0" && \
test "$OMPI_TRY_FORTRAN_BINDINGS" -gt "$OMPI_FORTRAN_NO_BINDINGS" && \
test $ompi_fortran_happy -eq 1; then
AC_MSG_CHECKING([if Fortran compiler and POSIX threads work as is])
AC_LANG_PUSH(C)
PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN(pmix_pthread_fortran_success=1,
pmix_pthread_fortran_success=0)
AC_LANG_POP(C)
if test "$pmix_pthread_fortran_success" = "1"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
])dnl
AC_DEFUN([PMIX_INTL_POSIX_THREADS_PLAIN], [
# BEGIN: PMIX_INTL_POSIX_THREADS_PLAIN
#
@ -246,19 +106,10 @@ AC_DEFUN([PMIX_INTL_POSIX_THREADS_PLAIN], [
# why take chances?
#
# Only run C++ and Fortran if those compilers already configured
AC_PROVIDE_IFELSE([AC_PROG_CC],
[PMIX_INTL_POSIX_THREADS_PLAIN_C],
[pmix_pthread_c_success=1])
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[PMIX_INTL_POSIX_THREADS_PLAIN_CXX],
[pmix_pthread_cxx_success=1])
AC_PROVIDE_IFELSE([AC_PROG_FC],
[PMIX_INTL_POSIX_THREADS_PLAIN_FC],
[pmix_pthread_fortran_success=1])
# End: PMIX_INTL_POSIX_THREADS_PLAIN
])dnl
@ -294,60 +145,6 @@ fi
])
AC_DEFUN([PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_CXX], [
#
# C++ compiler
#
if test "$pmix_pthread_cxx_success" = "0"; then
for pf in $pflags; do
AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $pf])
CXXFLAGS="$orig_CXXFLAGS $pf"
AC_LANG_PUSH(C++)
PMIX_INTL_PTHREAD_TRY_LINK(pmix_pthread_cxx_success=1,
pmix_pthread_cxx_success=0)
AC_LANG_POP(C++)
if test "$pmix_pthread_cxx_success" = "1"; then
PTHREAD_CXXFLAGS="$pf"
AC_MSG_RESULT([yes])
break
else
PTHREAD_CXXFLAGS=
CXXFLAGS="$orig_CXXFLAGS"
AC_MSG_RESULT([no])
fi
done
fi
])
AC_DEFUN([PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_FC], [
#
# Fortran compiler
#
if test "$pmix_pthread_fortran_success" = "0" && \
test "$OMPI_TRY_FORTRAN_BINDINGS" -gt "$OMPI_FORTRAN_NO_BINDINGS" && \
test $ompi_fortran_happy -eq 1; then
for pf in $pflags; do
AC_MSG_CHECKING([if Fortran compiler and POSIX threads work with $pf])
FCFLAGS="$orig_FCFLAGS $pf"
AC_LANG_PUSH(C)
PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN(pmix_pthread_fortran_success=1,
pmix_pthread_fortran_success=0)
AC_LANG_POP(C)
if test "$pmix_pthread_fortran_success" = "1"; then
PTHREAD_FCFLAGS="$pf"
AC_MSG_RESULT([yes])
break
else
PTHREAD_FCFLAGS=
FCFLAGS="$orig_FCFLAGS"
AC_MSG_RESULT([no])
fi
done
fi
])
AC_DEFUN([PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS],[
# Begin: PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS
#
@ -374,19 +171,10 @@ case "${host_cpu}-${host_os}" in
;;
esac
# Only run C++ and Fortran if those compilers already configured
AC_PROVIDE_IFELSE([AC_PROG_CC],
[PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_C],
[pmix_pthread_c_success=1])
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_CXX],
[pmix_pthread_cxx_success=1])
AC_PROVIDE_IFELSE([AC_PROG_FC],
[PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_FC],
[pmix_pthread_fortran_success=1])
# End: PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS
])dnl
@ -435,121 +223,6 @@ if test "$pmix_pthread_c_success" = "0"; then
fi
])dnl
AC_DEFUN([PMIX_INTL_POSIX_THREADS_LIBS_CXX],[
#
# C++ compiler
#
if test "$pmix_pthread_cxx_success" = "0"; then
if test ! "$pmix_pthread_c_success" = "0" && test ! "$PTHREAD_LIBS" = "" ; then
AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $PTHREAD_LIBS])
case "${host_cpu}-${host-_os}" in
*-aix* | *-freebsd*)
if test "`echo $CXXCPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then
PTHREAD_CXXCPPFLAGS="-D_THREAD_SAFE"
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
fi
;;
*)
if test "`echo $CXXCPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then
PTHREAD_CXXCPPFLAGS="-D_REENTRANT"
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
fi
;;
esac
LIBS="$orig_LIBS $PTHREAD_LIBS"
AC_LANG_PUSH(C++)
PMIX_INTL_PTHREAD_TRY_LINK(pmix_pthread_cxx_success=1,
pmix_pthread_cxx_success=0)
AC_LANG_POP(C++)
if test "$pmix_pthread_cxx_success" = "1"; then
AC_MSG_RESULT([yes])
else
CXXCPPFLAGS="$orig_CXXCPPFLAGS"
LIBS="$orig_LIBS"
AC_MSG_RESULT([no])
AC_MSG_ERROR([Can not find working threads configuration. aborting])
fi
else
for pl in $plibs; do
AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $pl])
case "${host_cpu}-${host-_os}" in
*-aix* | *-freebsd*)
if test "`echo $CXXCPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then
PTHREAD_CXXCPPFLAGS="-D_THREAD_SAFE"
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
fi
;;
*)
if test "`echo $CXXCPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then
PTHREAD_CXXCPPFLAGS="-D_REENTRANT"
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
fi
;;
esac
LIBS="$orig_LIBS $pl"
AC_LANG_PUSH(C++)
PMIX_INTL_PTHREAD_TRY_LINK(pmix_pthread_cxx_success=1,
pmix_pthread_cxx_success=0)
AC_LANG_POP(C++)
if test "$pmix_pthread_cxx_success" = "1"; then
PTHREAD_LIBS="$pl"
AC_MSG_RESULT([yes])
else
PTHREAD_CXXCPPFLAGS=
CXXCPPFLAGS="$orig_CXXCPPFLAGS"
LIBS="$orig_LIBS"
AC_MSG_RESULT([no])
fi
done
fi
fi
])dnl
AC_DEFUN([PMIX_INTL_POSIX_THREADS_LIBS_FC],[
#
# Fortran compiler
#
if test "$pmix_pthread_fortran_success" = "0" && \
test "$OMPI_TRY_FORTRAN_BINDINGS" -gt "$OMPI_FORTRAN_NO_BINDINGS" && \
test $ompi_fortran_happy -eq 1; then
if test ! "$pmix_pthread_c_success" = "0" && test ! "$PTHREAD_LIBS" = "" ; then
AC_MSG_CHECKING([if Fortran compiler and POSIX threads work with $PTHREAD_LIBS])
LIBS="$orig_LIBS $PTHREAD_LIBS"
AC_LANG_PUSH(C)
PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN(pmix_pthread_fortran_success=1,
pmix_pthread_fortran_success=0)
AC_LANG_POP(C)
if test "$pmix_pthread_fortran_success" = "1"; then
AC_MSG_RESULT([yes])
else
LIBS="$orig_LIBS"
AC_MSG_RESULT([no])
AC_MSG_ERROR([Can not find working threads configuration. aborting])
fi
else
for pl in $plibs; do
AC_MSG_CHECKING([if Fortran compiler and POSIX threads work with $pl])
LIBS="$orig_LIBS $pl"
AC_LANG_PUSH(C)
PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN(pmix_pthread_fortran_success=1,
pmix_pthread_fortran_success=0)
AC_LANG_POP(C)
if test "$pmix_pthread_fortran_success" = "1"; then
PTHREAD_LIBS="$pl"
AC_MSG_RESULT([yes])
break
else
LIBS="$orig_LIBS"
AC_MSG_RESULT([no])
fi
done
fi
fi
])dnl
AC_DEFUN([PMIX_INTL_POSIX_THREADS_LIBS],[
# Begin: PMIX_INTL_POSIX_THREADS_LIBS
#
@ -563,19 +236,10 @@ AC_DEFUN([PMIX_INTL_POSIX_THREADS_LIBS],[
# libpthread: The usual place (like we can define usual!)
plibs="-lpthreads -llthread -lpthread"
# Only run C++ and Fortran if those compilers already configured
AC_PROVIDE_IFELSE([AC_PROG_CC],
[PMIX_INTL_POSIX_THREADS_LIBS_C],
[pmix_pthread_c_success=1])
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[PMIX_INTL_POSIX_THREADS_LIBS_CXX],
[pmix_pthread_cxx_success=1])
AC_PROVIDE_IFELSE([AC_PROG_FC],
[PMIX_INTL_POSIX_THREADS_LIBS_FC],
[pmix_pthread_fortran_success=1])
# End: PMIX_INTL_POSIX_THREADS_LIBS]
)dnl
@ -589,21 +253,14 @@ AC_DEFUN([PMIX_CONFIG_POSIX_THREADS],[
AC_REQUIRE([AC_PROG_GREP])
pmix_pthread_c_success=0
pmix_pthread_cxx_success=0
orig_CFLAGS="$CFLAGS"
orig_FCFLAGS="$FCFLAGS"
orig_CXXFLAGS="$CXXFLAGS"
orig_CPPFLAGS="$CPPFLAGS"
orig_CXXCPPFLAGS="$CXXCPPFLAGS"
orig_LDFLAGS="$LDFLAGS"
orig_LIBS="$LIBS"
PTHREAD_CFLAGS=
PTHREAD_FCFLAGS=
PTHREAD_CXXFLAGS=
PTHREAD_CPPFLAGS=
PTHREAD_CXXCPPFLAGS=
PTHREAD_LDFLAGS=
PTHREAD_LIBS=
@ -648,15 +305,11 @@ AC_DEFINE_UNQUOTED([PMIX_HAVE_PTHREAD_MUTEX_ERRORCHECK], [$defval],
[If PTHREADS implementation supports PTHREAD_MUTEX_ERRORCHECK])
CFLAGS="$orig_CFLAGS"
FCFLAGS="$orig_FCFLAGS"
CXXFLAGS="$orig_CXXFLAGS"
CPPFLAGS="$orig_CPPFLAGS"
CXXCPPFLAGS="$orig_CXXCPPFLAGS"
LDFLAGS="$orig_LDFLAGS"
LIBS="$orig_LIBS"
if test "$pmix_pthread_c_success" = "1" && \
test "$pmix_pthread_cxx_success" = "1"; then
if test "$pmix_pthread_c_success" = "1"; then
internal_useless=1
$1
else
@ -664,6 +317,6 @@ else
$2
fi
unset pmix_pthread_c_success pmix_pthread_fortran_success pmix_pthread_cxx_success
unset pmix_pthread_c_success
unset internal_useless
])dnl

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

@ -11,7 +11,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
@ -56,10 +56,7 @@ if test "$HAVE_POSIX_THREADS" = "0"; then
fi
THREAD_CFLAGS="$PTHREAD_CFLAGS"
THREAD_FCFLAGS="$PTHREAD_FCFLAGS"
THREAD_CXXFLAGS="$PTHREAD_CXXFLAGS"
THREAD_CPPFLAGS="$PTHREAD_CPPFLAGS"
THREAD_CXXCPPFLAGS="$PTHREAD_CXXCPPFLAGS"
THREAD_LDFLAGS="$PTHREAD_LDFLAGS"
THREAD_LIBS="$PTHREAD_LIBS"

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

@ -1,8 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* Copyright (c) 2016-2019 Mellanox Technologies, Inc.
* All rights reserved.
@ -326,6 +326,8 @@ typedef uint32_t pmix_rank_t;
// specified operation
#define PMIX_JOB_TERM_STATUS "pmix.job.term.status" // (pmix_status_t) status returned upon job termination
#define PMIX_PROC_STATE_STATUS "pmix.proc.state" // (pmix_proc_state_t) process state
#define PMIX_NOTIFY_LAUNCH "pmix.note.lnch" // (bool) notify the requestor upon launch of the child job and return
// its namespace in the event
/* attributes used by host server to pass data to the server convenience library - the
@ -888,6 +890,7 @@ typedef int pmix_status_t;
#define PMIX_ERR_REPEAT_ATTR_REGISTRATION -170
#define PMIX_ERR_IOF_FAILURE -171
#define PMIX_ERR_IOF_COMPLETE -172
#define PMIX_LAUNCH_COMPLETE -173 // include nspace of the launched job with notification
/* system failures */
#define PMIX_ERR_NODE_DOWN -231
@ -1977,17 +1980,16 @@ typedef struct pmix_regattr_t {
*
* @param argv Pointer to an argv array.
* @param str Pointer to the string to append.
* @param bool Whether or not to overwrite a matching value if found
*
* @retval PMIX_SUCCESS On success
* @retval PMIX_ERROR On failure
*
* This function is identical to the pmix_argv_append_nosize() function
* except that it only appends the provided argument if it does not already
* exist in the provided array, or overwrites it if it is.
* exist in the provided array.
*/
#define PMIX_ARGV_APPEND_UNIQUE(r, a, b, c) \
(r) = pmix_argv_append_unique_nosize(a, b, c)
#define PMIX_ARGV_APPEND_UNIQUE(r, a, b) \
(r) = pmix_argv_append_unique_nosize(a, b)
/* Free a NULL-terminated argv array.
*

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

@ -2,8 +2,8 @@
* Copyright (c) 2013-2018 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 (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Redistribution and use in source and binary forms, with or without
@ -91,7 +91,7 @@ pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg);
pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg);
pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite);
pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg);
void pmix_argv_free(char **argv);

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

@ -78,6 +78,8 @@ PMIX_CLASS_INSTANCE(pmix_rshift_caddy_t,
static void check_cached_events(pmix_rshift_caddy_t *cd);
/* catch the event registration response message from the
* server and process it */
static void regevents_cbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr,
pmix_buffer_t *buf, void *cbdata)
{
@ -100,7 +102,9 @@ static void regevents_cbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr,
} else {
PMIX_ERROR_LOG(ret);
}
/* remove the err handler and call the error handler reg completion callback fn.*/
/* remove the err handler and call the error handler
* reg completion callback fn so the requestor
* doesn't hang */
if (NULL == rb->list) {
if (NULL != rb->hdlr) {
PMIX_RELEASE(rb->hdlr);
@ -834,7 +838,7 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
cd->evregcbfn(rc, index, cd->cbdata);
}
/* check if any matching notifications have been cached */
/* check if any matching notifications have been locally cached */
check_cached_events(cd);
if (NULL != cd->codes) {
free(cd->codes);

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

@ -14,8 +14,8 @@
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -221,7 +221,7 @@ static char *append_filename_to_list(const char *filename)
{
int i, count;
(void) pmix_argv_append_unique_nosize(&pmix_mca_base_var_file_list, filename, false);
(void) pmix_argv_append_unique_nosize(&pmix_mca_base_var_file_list, filename);
count = pmix_argv_count(pmix_mca_base_var_file_list);

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

@ -225,7 +225,7 @@ PMIX_EXPORT extern pmix_bfrops_globals_t pmix_bfrops_globals;
#define PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, tmptype, tmpbfroptype) \
do { \
int32_t i; \
tmptype *tmpbuf = (tmptype*)malloc(sizeof(tmptype) * (*num_vals)); \
tmptype *tmpbuf = (tmptype*)calloc(*num_vals, sizeof(tmptype)); \
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, tmpbuf, num_vals, tmpbfroptype, reg_types); \
if (PMIX_ERR_UNKNOWN_DATA_TYPE != ret) { \
for (i = 0 ; i < *num_vals ; ++i) { \

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

@ -895,7 +895,7 @@ pmix_status_t pmix_bfrops_base_pack_query(pmix_pointer_array_t *regtypes,
for (i=0; i < num_vals; i++) {
/* pack the number of keys */
nkeys = pmix_argv_count(pq[i].keys);
PMIX_BFROPS_PACK_TYPE(ret, buffer, &nkeys, 1, PMIX_UINT32, regtypes);
PMIX_BFROPS_PACK_TYPE(ret, buffer, &nkeys, 1, PMIX_INT32, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
}

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

@ -146,7 +146,7 @@ PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_buffer_t);
/* Convenience macro to check for empty buffer without
* exposing the internals */
#define PMIX_BUFFER_IS_EMPTY(b) \
0 == (b)->bytes_used
(0 == (b)->bytes_used)
END_C_DECLS

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

@ -11,7 +11,7 @@
# 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-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -51,6 +51,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_bfrops_v12_la_SOURCES = $(component_sources)
mca_bfrops_v12_la_LDFLAGS = -module -avoid-version
mca_bfrops_v12_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_bfrops_v12_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -51,6 +51,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_bfrops_v20_la_SOURCES = $(component_sources)
mca_bfrops_v20_la_LDFLAGS = -module -avoid-version
mca_bfrops_v20_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_bfrops_v20_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -44,6 +44,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_bfrops_v21_la_SOURCES = $(component_sources)
mca_bfrops_v21_la_LDFLAGS = -module -avoid-version
mca_bfrops_v21_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_bfrops_v21_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -44,6 +44,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_bfrops_v3_la_SOURCES = $(component_sources)
mca_bfrops_v3_la_LDFLAGS = -module -avoid-version
mca_bfrops_v3_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_bfrops_v3_la_SOURCES = $(lib_sources)

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

@ -44,6 +44,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_bfrops_v4_la_SOURCES = $(component_sources)
mca_bfrops_v4_la_LDFLAGS = -module -avoid-version
mca_bfrops_v4_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_bfrops_v4_la_SOURCES = $(lib_sources)

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

@ -14,6 +14,7 @@
* Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -27,6 +28,10 @@
#include "src/mca/bfrops/base/base.h"
#include "bfrop_pmix4.h"
#include "src/mca/psquash/psquash.h"
#include "src/mca/psquash/base/base.h"
#include "src/util/error.h"
static pmix_status_t init(void);
static void finalize(void);
static pmix_status_t pmix4_pack(pmix_buffer_t *buffer,
@ -46,6 +51,31 @@ static pmix_status_t register_type(const char *name,
pmix_bfrop_print_fn_t print);
static const char* data_type_string(pmix_data_type_t type);
static pmix_status_t
pmix4_bfrops_base_pack_general_int(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
static pmix_status_t
pmix4_bfrops_base_pack_int(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
static pmix_status_t
pmix4_bfrops_base_pack_sizet(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type);
static pmix_status_t
pmix4_bfrops_base_unpack_general_int(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
static pmix_status_t
pmix4_bfrops_base_unpack_int(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
static pmix_status_t
pmix4_bfrops_base_unpack_sizet(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type);
pmix_bfrops_module_t pmix_bfrops_pmix4_module = {
.version = "v4",
.init = init,
@ -65,6 +95,24 @@ pmix_bfrops_module_t pmix_bfrops_pmix4_module = {
static pmix_status_t init(void)
{
pmix_status_t rc;
if( PMIX_SUCCESS != (rc = pmix_mca_base_framework_open(&pmix_psquash_base_framework, 0)) ) {
PMIX_ERROR_LOG(rc);
return rc;
}
if( PMIX_SUCCESS != (rc = pmix_psquash_base_select()) ) {
PMIX_ERROR_LOG(rc);
return rc;
}
rc = pmix_psquash.init();
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* some standard types don't require anything special */
PMIX_REGISTER_TYPE("PMIX_BOOL", PMIX_BOOL,
pmix_bfrops_base_pack_bool,
@ -89,8 +137,8 @@ static pmix_status_t init(void)
/* Register the rest of the standard generic types to point to internal functions */
PMIX_REGISTER_TYPE("PMIX_SIZE", PMIX_SIZE,
pmix_bfrops_base_pack_sizet,
pmix_bfrops_base_unpack_sizet,
pmix4_bfrops_base_pack_sizet,
pmix4_bfrops_base_unpack_sizet,
pmix_bfrops_base_std_copy,
pmix_bfrops_base_print_size,
&mca_bfrops_v4_component.types);
@ -103,8 +151,8 @@ static pmix_status_t init(void)
&mca_bfrops_v4_component.types);
PMIX_REGISTER_TYPE("PMIX_INT", PMIX_INT,
pmix_bfrops_base_pack_int,
pmix_bfrops_base_unpack_int,
pmix4_bfrops_base_pack_int,
pmix4_bfrops_base_unpack_int,
pmix_bfrops_base_std_copy,
pmix_bfrops_base_print_int,
&mca_bfrops_v4_component.types);
@ -118,29 +166,29 @@ static pmix_status_t init(void)
&mca_bfrops_v4_component.types);
PMIX_REGISTER_TYPE("PMIX_INT16", PMIX_INT16,
pmix_bfrops_base_pack_int16,
pmix_bfrops_base_unpack_int16,
pmix4_bfrops_base_pack_general_int,
pmix4_bfrops_base_unpack_general_int,
pmix_bfrops_base_std_copy,
pmix_bfrops_base_print_int16,
&mca_bfrops_v4_component.types);
PMIX_REGISTER_TYPE("PMIX_INT32", PMIX_INT32,
pmix_bfrops_base_pack_int32,
pmix_bfrops_base_unpack_int32,
pmix4_bfrops_base_pack_general_int,
pmix4_bfrops_base_unpack_general_int,
pmix_bfrops_base_std_copy,
pmix_bfrops_base_print_int32,
&mca_bfrops_v4_component.types);
PMIX_REGISTER_TYPE("PMIX_INT64", PMIX_INT64,
pmix_bfrops_base_pack_int64,
pmix_bfrops_base_unpack_int64,
pmix4_bfrops_base_pack_general_int,
pmix4_bfrops_base_unpack_general_int,
pmix_bfrops_base_std_copy,
pmix_bfrops_base_print_int64,
&mca_bfrops_v4_component.types);
PMIX_REGISTER_TYPE("PMIX_UINT", PMIX_UINT,
pmix_bfrops_base_pack_int,
pmix_bfrops_base_unpack_int,
pmix4_bfrops_base_pack_int,
pmix4_bfrops_base_unpack_int,
pmix_bfrops_base_std_copy,
pmix_bfrops_base_print_uint,
&mca_bfrops_v4_component.types);
@ -153,22 +201,22 @@ static pmix_status_t init(void)
&mca_bfrops_v4_component.types);
PMIX_REGISTER_TYPE("PMIX_UINT16", PMIX_UINT16,
pmix_bfrops_base_pack_int16,
pmix_bfrops_base_unpack_int16,
pmix4_bfrops_base_pack_general_int,
pmix4_bfrops_base_unpack_general_int,
pmix_bfrops_base_std_copy,
pmix_bfrops_base_print_uint16,
&mca_bfrops_v4_component.types);
PMIX_REGISTER_TYPE("PMIX_UINT32", PMIX_UINT32,
pmix_bfrops_base_pack_int32,
pmix_bfrops_base_unpack_int32,
pmix4_bfrops_base_pack_general_int,
pmix4_bfrops_base_unpack_general_int,
pmix_bfrops_base_std_copy,
pmix_bfrops_base_print_uint32,
&mca_bfrops_v4_component.types);
PMIX_REGISTER_TYPE("PMIX_UINT64", PMIX_UINT64,
pmix_bfrops_base_pack_int64,
pmix_bfrops_base_unpack_int64,
pmix4_bfrops_base_pack_general_int,
pmix4_bfrops_base_unpack_general_int,
pmix_bfrops_base_std_copy,
pmix_bfrops_base_print_uint64,
&mca_bfrops_v4_component.types);
@ -404,6 +452,7 @@ static void finalize(void)
{
int n;
pmix_bfrop_type_info_t *info;
pmix_status_t rc;
for (n=0; n < mca_bfrops_v4_component.types.size; n++) {
if (NULL != (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v4_component.types, n))) {
@ -411,6 +460,12 @@ static void finalize(void)
pmix_pointer_array_set_item(&mca_bfrops_v4_component.types, n, NULL);
}
}
/* close the psquash framework */
pmix_psquash.finalize();
if( PMIX_SUCCESS != (rc = pmix_mca_base_framework_close(&pmix_psquash_base_framework)) ) {
PMIX_ERROR_LOG(rc);
}
}
static pmix_status_t pmix4_pack(pmix_buffer_t *buffer,
@ -461,3 +516,225 @@ static const char* data_type_string(pmix_data_type_t type)
{
return pmix_bfrops_base_data_type_string(&mca_bfrops_v4_component.types, type);
}
/*
* INT16, INT32, INT64
*/
static pmix_status_t
pmix4_bfrops_base_pack_general_int(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_status_t rc;
int32_t i;
char *dst;
size_t val_size, max_size, pkg_size;
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
"pmix_bfrops_base_pack_integer * %d\n", num_vals);
PMIX_SQUASH_TYPE_SIZEOF(rc, type, val_size);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
rc = pmix_psquash.get_max_size(type, &max_size);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* check to see if buffer needs extending */
if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals*max_size))) {
rc = PMIX_ERR_OUT_OF_RESOURCE;
PMIX_ERROR_LOG(rc);
return rc;
}
for (i = 0; i < num_vals; ++i) {
rc = (pmix_psquash.encode_int)(type, (uint8_t*)src+i*val_size,
dst, &pkg_size);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
dst += pkg_size;
buffer->pack_ptr += pkg_size;
buffer->bytes_used += pkg_size;
}
return PMIX_SUCCESS;
}
/*
* INT
*/
static pmix_status_t
pmix4_bfrops_base_pack_int(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
pmix_status_t ret;
if (false == pmix_psquash.int_type_is_encoded) {
/* System types need to always be described so we can properly
unpack them */
if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_INT))) {
return ret;
}
}
/* Turn around and pack the real type */
PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, BFROP_TYPE_INT, regtypes);
return ret;
}
/*
* SIZE_T
*/
static pmix_status_t
pmix4_bfrops_base_pack_sizet(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, const void *src,
int32_t num_vals, pmix_data_type_t type)
{
int ret;
if (false == pmix_psquash.int_type_is_encoded) {
/* System types need to always be described so we can properly
unpack them. */
if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_SIZE_T))) {
return ret;
}
}
PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, BFROP_TYPE_SIZE_T, regtypes);
return ret;
}
/*
* INT16, INT32, INT64
*/
static pmix_status_t
pmix4_bfrops_base_unpack_general_int(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_status_t rc;
size_t val_size, avail_size, unpack_size, max_size;
int32_t i;
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
"pmix_bfrops_base_unpack_integer * %d\n", (int)*num_vals);
/* check to see if there's enough data in buffer */
if (buffer->pack_ptr == buffer->unpack_ptr) {
return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER;
}
PMIX_SQUASH_TYPE_SIZEOF(rc, type, val_size);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
rc = pmix_psquash.get_max_size(type, &max_size);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* unpack the data */
for (i = 0; i < (*num_vals); ++i) {
avail_size = buffer->pack_ptr - buffer->unpack_ptr;
rc = (pmix_psquash.decode_int)(type, buffer->unpack_ptr, avail_size,
(uint8_t*)dest+i*val_size, &unpack_size);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* sanity checks */
if (unpack_size > max_size) {
rc = PMIX_ERR_UNPACK_FAILURE;
PMIX_ERROR_LOG(rc);
return rc;
}
if (unpack_size > avail_size) {
rc = PMIX_ERR_FATAL;
PMIX_ERROR_LOG(rc);
return rc;
}
buffer->unpack_ptr += unpack_size;
}
return PMIX_SUCCESS;
}
/*
* INT
*/
static pmix_status_t
pmix4_bfrops_base_unpack_int(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_status_t ret;
pmix_data_type_t remote_type;
if (false == pmix_psquash.int_type_is_encoded) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &remote_type))) {
return ret;
}
if (remote_type == BFROP_TYPE_INT) {
/* fast path it if the sizes are the same */
/* Turn around and unpack the real type */
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_INT, regtypes);
} else {
/* slow path - types are different sizes */
PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, int, remote_type, ret);
}
} else {
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_INT, regtypes);
}
return ret;
}
/*
* SIZE_T
*/
static pmix_status_t
pmix4_bfrops_base_unpack_sizet(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_status_t ret;
pmix_data_type_t remote_type;
if (false == pmix_psquash.int_type_is_encoded) {
if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer,
&remote_type))) {
PMIX_ERROR_LOG(ret);
return ret;
}
if (remote_type == BFROP_TYPE_SIZE_T) {
/* fast path it if the sizes are the same */
/* Turn around and unpack the real type */
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_SIZE_T,
regtypes);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
}
} else {
/* slow path - types are different sizes */
PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, size_t, remote_type, ret);
}
} else {
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_SIZE_T,
regtypes);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
}
}
return ret;
}

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

@ -109,6 +109,8 @@ static inline int _my_client(const char *nspace, pmix_rank_t rank);
static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx,
pmix_proc_t *proc,
pmix_gds_modex_key_fmt_t key_fmt,
char **kmap,
pmix_buffer_t *pbkt);
static pmix_status_t _dstore_store_nolock(pmix_common_dstore_ctx_t *ds_ctx,
@ -2541,7 +2543,7 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_store_modex(pmix_common_dstore_ctx_t
return rc;
}
rc = pmix_gds_base_store_modex(nspace, buf, ds_ctx,
rc = pmix_gds_base_store_modex(nspace, buf, ds_ctx,
(pmix_gds_base_store_modex_cb_fn_t)_dstor_store_modex_cb,
cbdata);
if (PMIX_SUCCESS != rc) {
@ -2562,10 +2564,11 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_store_modex(pmix_common_dstore_ctx_t
static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx,
pmix_proc_t *proc,
pmix_gds_modex_key_fmt_t key_fmt,
char **kmap,
pmix_buffer_t *pbkt)
{
pmix_status_t rc = PMIX_SUCCESS;
int32_t cnt;
pmix_kval_t *kv;
ns_map_data_t *ns_map;
pmix_buffer_t tmp;
@ -2594,9 +2597,9 @@ static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx,
PMIX_CONSTRUCT(&tmp, pmix_buffer_t);
/* unpack the remaining values until we hit the end of the buffer */
cnt = 1;
kv = PMIX_NEW(pmix_kval_t);
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, pbkt, kv, &cnt, PMIX_KVAL);
rc = pmix_gds_base_modex_unpack_kval(key_fmt, pbkt, kmap, kv);
while (PMIX_SUCCESS == rc) {
/* store this in the hash table */
PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, proc, PMIX_REMOTE, kv);
@ -2614,8 +2617,10 @@ static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx,
/* proceed to the next element */
kv = PMIX_NEW(pmix_kval_t);
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, pbkt, kv, &cnt, PMIX_KVAL);
rc = pmix_gds_base_modex_unpack_kval(key_fmt, pbkt, kmap, kv);
if (PMIX_SUCCESS != rc) {
break;
}
}
/* Release the kv that didn't received the value

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

@ -77,11 +77,30 @@ struct pmix_gds_globals_t {
bool initialized;
char *all_mods;
};
typedef enum {
PMIX_MODEX_KEY_INVALID = -1,
PMIX_MODEX_KEY_NATIVE_FMT,
PMIX_MODEX_KEY_KEYMAP_FMT,
PMIX_MODEX_KEY_MAX
} pmix_gds_modex_key_fmt_t;
/* define a modex blob info */
typedef uint8_t pmix_gds_modex_blob_info_t;
#define PMIX_GDS_COLLECT_BIT 0x0001
#define PMIX_GDS_KEYMAP_BIT 0x0002
#define PMIX_GDS_KEYMAP_IS_SET(byte) (PMIX_GDS_KEYMAP_BIT & (byte))
#define PMIX_GDS_COLLECT_IS_SET(byte) (PMIX_GDS_COLLECT_BIT & (byte))
typedef struct pmix_gds_globals_t pmix_gds_globals_t;
typedef void * pmix_gds_base_ctx_t;
typedef pmix_status_t (*pmix_gds_base_store_modex_cb_fn_t)(pmix_gds_base_ctx_t ctx,
pmix_proc_t *proc,
pmix_gds_modex_key_fmt_t key_fmt,
char **kmap,
pmix_buffer_t *pbkt);
PMIX_EXPORT extern pmix_gds_globals_t pmix_gds_globals;
@ -112,6 +131,15 @@ PMIX_EXPORT pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nsp
pmix_gds_base_store_modex_cb_fn_t cb_fn,
void *cbdata);
PMIX_EXPORT
pmix_status_t pmix_gds_base_modex_pack_kval(pmix_gds_modex_key_fmt_t key_fmt,
pmix_buffer_t *buf, char ***kmap,
pmix_kval_t *kv);
PMIX_EXPORT
pmix_status_t pmix_gds_base_modex_unpack_kval(pmix_gds_modex_key_fmt_t key_fmt,
pmix_buffer_t *buf, char **kmap,
pmix_kval_t *kv);
END_C_DECLS
#endif

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

@ -4,7 +4,7 @@
* Copyright (c) 2016-2019 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2018 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* Copyright (c) 2018-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* $COPYRIGHT$
@ -98,28 +98,37 @@ pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace,
pmix_buffer_t bkt;
pmix_byte_object_t bo, bo2;
int32_t cnt = 1;
char byte;
pmix_collect_t ctype;
bool have_ctype = false;
pmix_server_trkr_t *trk = (pmix_server_trkr_t*)cbdata;
pmix_proc_t proc;
pmix_buffer_t pbkt;
pmix_rank_t rel_rank;
pmix_nspace_caddy_t *nm;
bool found;
char **kmap = NULL;
uint32_t kmap_size;
pmix_gds_modex_key_fmt_t kmap_type;
pmix_gds_modex_blob_info_t blob_info_byte = 0;
/* Loop over the enclosed byte object envelopes and
* store them in our GDS module */
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer,
buff, &bo, &cnt, PMIX_BYTE_OBJECT);
/* If the collect flag is set, we should have some data for unpacking */
if ((PMIX_COLLECT_YES == trk->collect_type) &&
(PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc)) {
goto exit;
}
while (PMIX_SUCCESS == rc) {
PMIX_CONSTRUCT(&bkt, pmix_buffer_t);
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt, bo.bytes, bo.size);
/* unpack the data collection flag */
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer,
&bkt, &byte, &cnt, PMIX_BYTE);
&bkt, &blob_info_byte, &cnt, PMIX_BYTE);
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) {
/* no data was returned, so we are done with this blob */
PMIX_DESTRUCT(&bkt);
@ -127,23 +136,61 @@ pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace,
}
if (PMIX_SUCCESS != rc) {
/* we have an error */
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&bkt);
goto error;
goto exit;
}
/* Check that this blob was accumulated with the same data collection
* setting */
ctype = PMIX_GDS_COLLECT_IS_SET(blob_info_byte) ?
PMIX_COLLECT_YES : PMIX_COLLECT_NO;
if (trk->collect_type != ctype) {
rc = PMIX_ERR_INVALID_ARG;
PMIX_ERROR_LOG(rc);
goto exit;
}
// Check that this blob was accumulated with the same data collection setting
if (have_ctype) {
if (ctype != (pmix_collect_t)byte) {
rc = PMIX_ERR_INVALID_ARG;
pbkt.base_ptr = NULL;
goto error;
/* determine the key-map existing flag */
kmap_type = PMIX_GDS_KEYMAP_IS_SET(blob_info_byte) ?
PMIX_MODEX_KEY_KEYMAP_FMT : PMIX_MODEX_KEY_NATIVE_FMT;
if (PMIX_MODEX_KEY_KEYMAP_FMT == kmap_type) {
/* unpack the size of uniq keys names in the map */
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer,
&bkt, &kmap_size, &cnt, PMIX_UINT32);
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) {
rc = PMIX_SUCCESS;
PMIX_DESTRUCT(&bkt);
break;
} else if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&bkt);
break;
}
/* init and unpack key names map, the position of the key name
* in the array determines the unique key index */
kmap = (char**)(calloc(kmap_size + 1, sizeof(char*)));
if (NULL == kmap) {
rc = PMIX_ERR_OUT_OF_RESOURCE;
PMIX_ERROR_LOG(rc);
goto exit;
}
cnt = kmap_size;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &bkt,
kmap, &cnt, PMIX_STRING);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&bkt);
goto exit;
}
if (pmix_argv_count(kmap) != (int)kmap_size) {
rc = PMIX_ERR_UNPACK_FAILURE;
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&bkt);
goto exit;
}
}
else {
ctype = (pmix_collect_t)byte;
have_ctype = true;
}
/* unpack the enclosed blobs from the various peers */
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer,
@ -167,8 +214,7 @@ pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace,
PMIX_ERROR_LOG(rc);
pbkt.base_ptr = NULL;
PMIX_DESTRUCT(&pbkt);
PMIX_DESTRUCT(&bkt);
goto error;
break;
}
found = false;
/* calculate proc form the relative rank */
@ -189,17 +235,18 @@ pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace,
PMIX_ERROR_LOG(rc);
pbkt.base_ptr = NULL;
PMIX_DESTRUCT(&pbkt);
PMIX_DESTRUCT(&bkt);
goto error;
break;
}
PMIX_PROC_LOAD(&proc, nm->ns->nspace, rel_rank);
rc = cb_fn(ctx, &proc, &pbkt);
/* call a specific GDS function to storing
* part of the process data */
rc = cb_fn(ctx, &proc, kmap_type, kmap, &pbkt);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
pbkt.base_ptr = NULL;
PMIX_DESTRUCT(&pbkt);
PMIX_DESTRUCT(&bkt);
goto error;
break;
}
pbkt.base_ptr = NULL;
PMIX_DESTRUCT(&pbkt);
@ -210,24 +257,133 @@ pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace,
&bkt, &bo2, &cnt, PMIX_BYTE_OBJECT);
}
PMIX_DESTRUCT(&bkt);
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) {
rc = PMIX_SUCCESS;
} else if (PMIX_SUCCESS != rc) {
goto error;
PMIX_ERROR_LOG(rc);
goto exit;
}
/* unpack and process the next blob */
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer,
buff, &bo, &cnt, PMIX_BYTE_OBJECT);
}
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) {
rc = PMIX_SUCCESS;
}
error:
if (PMIX_SUCCESS != rc) {
} else if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
}
exit:
pmix_argv_free(kmap);
return rc;
}
/*
* Pack the key-value as a tuple of key-name index and key-value.
* The key-name to store replaced by unique key-index that stored
* to the key-map. So the remote server can determine the key-name
* by the index from map that packed in modex as well.
*
* kmap - key values array by (char*), uses to store unique key
* names string and determine their indexes
*
* buf - output buffer to pack key-values
*
* kv - pmix key-value pair
*/
pmix_status_t pmix_gds_base_modex_pack_kval(pmix_gds_modex_key_fmt_t key_fmt,
pmix_buffer_t *buf, char ***kmap,
pmix_kval_t *kv)
{
uint32_t key_idx;
pmix_status_t rc = PMIX_SUCCESS;
if (PMIX_MODEX_KEY_KEYMAP_FMT == key_fmt) {
rc = pmix_argv_append_unique_idx((int*)&key_idx, kmap, kv->key);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack key-index */
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buf, &key_idx, 1, PMIX_UINT32);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack key-value */
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buf, kv->value, 1, PMIX_VALUE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
} else if (PMIX_MODEX_KEY_NATIVE_FMT == key_fmt) {
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buf, kv, 1, PMIX_KVAL);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
} else {
rc = PMIX_ERR_BAD_PARAM;
PMIX_ERROR_LOG(rc);
return rc;
}
return PMIX_SUCCESS;
}
/*
* Unpack the key-value as a tuple of key-name index and key-value.
*
* kmap - key values array by (char*), uses to store unique key
* names string and determine their indexes
*
* buf - input buffer to unpack key-values
*
* kv - unpacked pmix key-value pair
*/
pmix_status_t pmix_gds_base_modex_unpack_kval(pmix_gds_modex_key_fmt_t key_fmt,
pmix_buffer_t *buf, char **kmap,
pmix_kval_t *kv)
{
int32_t cnt;
uint32_t key_idx;
pmix_status_t rc = PMIX_SUCCESS;
if (PMIX_MODEX_KEY_KEYMAP_FMT == key_fmt) {
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buf, &key_idx, &cnt, PMIX_UINT32);
if (PMIX_SUCCESS != rc) {
return rc;
}
// sanity check
if (NULL == kmap[key_idx]) {
rc = PMIX_ERR_BAD_PARAM;
PMIX_ERROR_LOG(rc);
return rc;
}
kv->key = strdup(kmap[key_idx]);
cnt = 1;
PMIX_VALUE_CREATE(kv->value, 1);
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buf, kv->value, &cnt, PMIX_VALUE);
if (PMIX_SUCCESS != rc) {
free(kv->key);
PMIX_VALUE_RELEASE(kv->value);
PMIX_ERROR_LOG(rc);
return rc;
}
} else if (PMIX_MODEX_KEY_NATIVE_FMT == key_fmt) {
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buf, kv, &cnt, PMIX_KVAL);
if (PMIX_SUCCESS != rc) {
return rc;
}
} else {
rc = PMIX_ERR_BAD_PARAM;
PMIX_ERROR_LOG(rc);
return rc;
}
return PMIX_SUCCESS;
}

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

@ -11,7 +11,7 @@
# 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-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2017 Mellanox Technologies, Inc.
@ -64,6 +64,7 @@ mcacomponent_LTLIBRARIES = $(component)
mca_gds_ds12_la_SOURCES = $(component_sources)
mca_gds_ds12_la_LDFLAGS = -module -avoid-version \
$(PMIX_TOP_BUILDDIR)/src/mca/common/dstore/libmca_common_dstore.la
mca_gds_ds12_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_gds_ds12_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2017-2018 Mellanox Technologies, Inc.
@ -56,6 +56,7 @@ mcacomponent_LTLIBRARIES = $(component)
mca_gds_ds21_la_SOURCES = $(component_sources)
mca_gds_ds21_la_LDFLAGS = -module -avoid-version \
$(PMIX_TOP_BUILDDIR)/src/mca/common/dstore/libmca_common_dstore.la
mca_gds_ds21_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_gds_ds21_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
@ -47,7 +47,7 @@ endif
mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_gds_hash_la_SOURCES = $(component_sources)
mca_gds_hash_la_LIBADD = $(gds_hash_LIBS)
mca_gds_hash_la_LIBADD = $(gds_hash_LIBS) $(top_builddir)/src/libpmix.la
mca_gds_hash_la_LDFLAGS = -module -avoid-version $(gds_hash_LDFLAGS)
noinst_LTLIBRARIES = $(lib)

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

@ -72,6 +72,8 @@ static pmix_status_t hash_store_modex(struct pmix_namespace_t *ns,
static pmix_status_t _hash_store_modex(pmix_gds_base_ctx_t ctx,
pmix_proc_t *proc,
pmix_gds_modex_key_fmt_t key_fmt,
char **kmap,
pmix_buffer_t *pbkt);
static pmix_status_t hash_fetch(const pmix_proc_t *proc,
@ -1197,11 +1199,12 @@ static pmix_status_t hash_store_modex(struct pmix_namespace_t *nspace,
static pmix_status_t _hash_store_modex(pmix_gds_base_ctx_t ctx,
pmix_proc_t *proc,
pmix_gds_modex_key_fmt_t key_fmt,
char **kmap,
pmix_buffer_t *pbkt)
{
pmix_hash_trkr_t *trk, *t;
pmix_status_t rc = PMIX_SUCCESS;
int32_t cnt;
pmix_kval_t *kv;
pmix_output_verbose(2, pmix_gds_base_framework.framework_output,
@ -1230,15 +1233,10 @@ static pmix_status_t _hash_store_modex(pmix_gds_base_ctx_t ctx,
* the rank followed by pmix_kval_t's. The list of callbacks
* contains all local participants. */
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, pbkt, proc, &cnt, PMIX_PROC);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* unpack the remaining values until we hit the end of the buffer */
cnt = 1;
kv = PMIX_NEW(pmix_kval_t);
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, pbkt, kv, &cnt, PMIX_KVAL);
rc = pmix_gds_base_modex_unpack_kval(key_fmt, pbkt, kmap, kv);
while (PMIX_SUCCESS == rc) {
/* store this in the hash table */
if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->remote, proc->rank, kv))) {
@ -1248,8 +1246,7 @@ static pmix_status_t _hash_store_modex(pmix_gds_base_ctx_t ctx,
PMIX_RELEASE(kv); // maintain accounting as the hash increments the ref count
/* continue along */
kv = PMIX_NEW(pmix_kval_t);
cnt = 1;
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, pbkt, kv, &cnt, PMIX_KVAL);
rc = pmix_gds_base_modex_unpack_kval(key_fmt, pbkt, kmap, kv);
}
PMIX_RELEASE(kv); // maintain accounting
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) {

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

@ -34,7 +34,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_pcompress_zlib_la_SOURCES = $(sources)
mca_pcompress_zlib_la_LDFLAGS = -module -avoid-version $(pcompress_zlib_LDFLAGS)
mca_pcompress_zlib_la_LIBADD = $(pcompress_zlib_LIBS)
mca_pcompress_zlib_la_LIBADD = $(pcompress_zlib_LIBS) $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_pcompress_zlib_la_SOURCES = $(sources)

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

@ -2,7 +2,7 @@ dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
dnl Copyright (c) 2016 Research Organization for Information Science
dnl Copyright (c) 2016-2019 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
@ -27,7 +27,7 @@ AC_DEFUN([MCA_pmix_pdl_CONFIG],[
# (we still need to configure them all so that things like "make
# dist" work", but we just want the MCA system to (artificially)
# conclude that it can't build any of the components.
AS_IF([test "$enable_dlopen" = "no"],
AS_IF([test $PMIX_ENABLE_DLOPEN_SUPPORT -eq 0],
[want_pdl=0], [want_pdl=1])
MCA_CONFIGURE_FRAMEWORK([pdl], [$want_pdl])
@ -35,7 +35,7 @@ AC_DEFUN([MCA_pmix_pdl_CONFIG],[
# If we found no suitable static pdl component and dlopen support
# was not specifically disabled, this is an error.
AS_IF([test "$MCA_pmix_pdl_STATIC_COMPONENTS" = "" && \
test "$enable_dlopen" != "no"],
test $PMIX_ENABLE_DLOPEN_SUPPORT -eq 1],
[AC_MSG_WARN([Did not find a suitable static pmix pdl component])
AC_MSG_WARN([You might need to install libltld (and its headers) or])
AC_MSG_WARN([specify --disable-dlopen to configure.])

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

@ -10,7 +10,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
@ -40,6 +40,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_plog_default_la_SOURCES = $(sources)
mca_plog_default_la_LDFLAGS = -module -avoid-version
mca_plog_default_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_plog_default_la_SOURCES =$(sources)

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

@ -10,7 +10,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
@ -40,6 +40,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_plog_stdfd_la_SOURCES = $(sources)
mca_plog_stdfd_la_LDFLAGS = -module -avoid-version
mca_plog_stdfd_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_plog_stdfd_la_SOURCES =$(sources)

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

@ -10,7 +10,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
@ -40,6 +40,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_plog_syslog_la_SOURCES = $(sources)
mca_plog_syslog_la_LDFLAGS = -module -avoid-version
mca_plog_syslog_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_plog_syslog_la_SOURCES =$(sources)

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

@ -11,7 +11,7 @@
# 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-2016 Intel, Inc. All rights reserved
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
@ -47,7 +47,7 @@ endif
mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_pnet_opa_la_SOURCES = $(component_sources)
mca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS)
mca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS) $(top_builddir)/src/libpmix.la
mca_pnet_opa_la_LDFLAGS = -module -avoid-version $(pnet_opa_LDFLAGS)
noinst_LTLIBRARIES = $(lib)

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

@ -11,7 +11,7 @@
# 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-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
@ -47,7 +47,7 @@ endif
mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_pnet_tcp_la_SOURCES = $(component_sources)
mca_pnet_tcp_la_LIBADD = $(pnet_tcp_LIBS)
mca_pnet_tcp_la_LIBADD = $(pnet_tcp_LIBS) $(top_builddir)/src/libpmix.la
mca_pnet_tcp_la_LDFLAGS = -module -avoid-version $(pnet_tcp_LDFLAGS)
noinst_LTLIBRARIES = $(lib)

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

@ -11,7 +11,7 @@
# 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-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
@ -46,6 +46,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_pnet_test_la_SOURCES = $(component_sources)
mca_pnet_test_la_LDFLAGS = -module -avoid-version
mca_pnet_test_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_pnet_test_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -44,6 +44,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_preg_native_la_SOURCES = $(component_sources)
mca_preg_native_la_LDFLAGS = -module -avoid-version
mca_preg_native_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_preg_native_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2016 Intel, Inc. All rights reserved
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -46,7 +46,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_psec_munge_la_SOURCES = $(component_sources)
mca_psec_munge_la_LDFLAGS = -module -avoid-version $(psec_munge_LDFLAGS)
mca_psec_munge_la_LIBADD = $(psec_munge_LIBS)
mca_psec_munge_la_LIBADD = $(psec_munge_LIBS) $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_psec_munge_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2016 Intel, Inc. All rights reserved
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -44,6 +44,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_psec_native_la_SOURCES = $(component_sources)
mca_psec_native_la_LDFLAGS = -module -avoid-version
mca_psec_native_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_psec_native_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2016 Intel, Inc. All rights reserved
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -44,6 +44,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_psec_none_la_SOURCES = $(component_sources)
mca_psec_none_la_LDFLAGS = -module -avoid-version
mca_psec_none_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_psec_none_la_SOURCES = $(lib_sources)

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

@ -1,6 +1,6 @@
#
# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# Copyright (c) 2017-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -31,6 +31,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_psensor_file_la_SOURCES = $(sources)
mca_psensor_file_la_LDFLAGS = -module -avoid-version
mca_psensor_file_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_psensor_file_la_SOURCES =$(sources)

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

@ -1,7 +1,7 @@
#
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
#
# Copyright (c) 2017 Intel, Inc. All rights reserved.
# Copyright (c) 2017-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -32,6 +32,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_psensor_heartbeat_la_SOURCES = $(sources)
mca_psensor_heartbeat_la_LDFLAGS = -module -avoid-version
mca_psensor_heartbeat_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_psensor_heartbeat_la_SOURCES =$(sources)

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

@ -2,6 +2,7 @@
#
# Copyright (c) 2017 Mellanox Technologies, Inc.
# All rights reserved.
# Copyright (c) 2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -36,6 +37,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_pshmem_mmap_la_SOURCES = $(component_sources)
mca_pshmem_mmap_la_LDFLAGS = -module -avoid-version
mca_pshmem_mmap_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_pshmem_mmap_la_SOURCES = $(lib_sources)

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

@ -0,0 +1,45 @@
# -*- 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-2016 Intel, Inc. All rights reserved
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2019 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AM_CPPFLAGS = $(LTDLINCL)
# main library setup
noinst_LTLIBRARIES = libmca_psquash.la
libmca_psquash_la_SOURCES =
# local files
headers = psquash.h
sources =
# Conditionally install the header files
if WANT_INSTALL_HEADERS
pmixdir = $(pmixincludedir)/$(subdir)
nobase_pmix_HEADERS = $(headers)
endif
include base/Makefile.include
libmca_psquash_la_SOURCES += $(headers) $(sources)
distclean-local:
rm -f base/static-components.h

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

@ -0,0 +1,19 @@
# -*- makefile -*-
#
# Copyright (c) 2019 IBM Corporation. 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 += \
base/base.h
sources += \
base/psquash_base_frame.c \
base/psquash_base_select.c

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

@ -0,0 +1,73 @@
/* -*- C -*-
*
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* Copyright (c) 2019 Mellanox Technologies, Inc.
* All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef PMIX_PSQUASH_BASE_H_
#define PMIX_PSQUASH_BASE_H_
#include <src/include/pmix_config.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "src/class/pmix_pointer_array.h"
#include "src/mca/mca.h"
#include "src/mca/base/pmix_mca_base_framework.h"
#include "src/mca/psquash/psquash.h"
BEGIN_C_DECLS
/**
* Sizeof by PMIx type integer values.
*
* r - return status code
* t - type (pmix_data_type_t) of integer value
* s - size of type in bytes
* (see a comment to `pmix_bfrops_pack_flex` for additional details)
*/
#define PMIX_SQUASH_TYPE_SIZEOF(r, t, s) \
do { \
(r) = PMIX_SUCCESS; \
switch (t) { \
case PMIX_INT16: \
case PMIX_UINT16: \
(s) = SIZEOF_SHORT; \
break; \
case PMIX_INT: \
case PMIX_INT32: \
case PMIX_UINT: \
case PMIX_UINT32: \
(s) = SIZEOF_INT; \
break; \
case PMIX_INT64: \
case PMIX_UINT64: \
(s) = SIZEOF_LONG; \
break; \
case PMIX_SIZE: \
(s) = SIZEOF_SIZE_T; \
break; \
default: \
(r) = PMIX_ERR_BAD_PARAM; \
} \
} while (0)
PMIX_EXPORT extern pmix_mca_base_framework_t pmix_psquash_base_framework;
PMIX_EXPORT pmix_status_t pmix_psquash_base_select(void);
END_C_DECLS
#endif

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

@ -0,0 +1,75 @@
/* -*- 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-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
*/
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "src/class/pmix_list.h"
#include "src/mca/base/base.h"
#include "src/mca/psquash/base/base.h"
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* component's public mca_base_component_t struct.
*/
#include "src/mca/psquash/base/static-components.h"
static bool initialized = false;
pmix_psquash_base_module_t pmix_psquash = {0};
static pmix_status_t pmix_psquash_close(void)
{
if (!initialized) {
return PMIX_SUCCESS;
}
initialized = false;
return pmix_mca_base_framework_components_close(&pmix_psquash_base_framework, NULL);
}
static pmix_status_t pmix_psquash_open(pmix_mca_base_open_flag_t flags)
{
if (initialized) {
return PMIX_SUCCESS;
}
/* initialize globals */
initialized = true;
/* Open up all available components */
return pmix_mca_base_framework_components_open(&pmix_psquash_base_framework, flags);
}
PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, psquash, "PMIx Squash Operations",
NULL, pmix_psquash_open, pmix_psquash_close,
mca_psquash_base_static_components, 0);

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

@ -0,0 +1,104 @@
/*
* Copyright (c) 2004-2008 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) 2016-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include <pmix_common.h>
#include <string.h>
#include "src/mca/mca.h"
#include "src/mca/base/base.h"
#include "src/util/error.h"
#include "src/util/show_help.h"
#include "src/mca/psquash/base/base.h"
static bool selected = false;
/* Function for selecting a prioritized list of components
* from all those that are available. */
int pmix_psquash_base_select(void)
{
pmix_mca_base_component_list_item_t *cli;
pmix_mca_base_component_t *component;
pmix_mca_base_module_t *module;
pmix_psquash_base_module_t *nmodule;
int rc, priority, best_pri = -1;
bool inserted = false;
if (selected) {
/* ensure we don't do this twice */
return PMIX_SUCCESS;
}
selected = true;
/* Query all available components and ask if they have a module */
PMIX_LIST_FOREACH(cli, &pmix_psquash_base_framework.framework_components, pmix_mca_base_component_list_item_t) {
component = (pmix_mca_base_component_t *) cli->cli_component;
pmix_output_verbose(5, pmix_psquash_base_framework.framework_output,
"mca:psquash:select: checking available component %s", component->pmix_mca_component_name);
/* If there's no query function, skip it */
if (NULL == component->pmix_mca_query_component) {
pmix_output_verbose(5, pmix_psquash_base_framework.framework_output,
"mca:psquash:select: Skipping component [%s]. It does not implement a query function",
component->pmix_mca_component_name );
continue;
}
/* Query the component */
pmix_output_verbose(5, pmix_psquash_base_framework.framework_output,
"mca:psquash:select: Querying component [%s]",
component->pmix_mca_component_name);
rc = component->pmix_mca_query_component(&module, &priority);
/* If no module was returned, then skip component */
if (PMIX_SUCCESS != rc || NULL == module) {
pmix_output_verbose(5, pmix_psquash_base_framework.framework_output,
"mca:psquash:select: Skipping component [%s]. Query failed to return a module",
component->pmix_mca_component_name );
continue;
}
/* If we got a module, try to initialize it */
nmodule = (pmix_psquash_base_module_t*) module;
if (NULL != nmodule->init && PMIX_SUCCESS != nmodule->init()) {
continue;
}
/* keep only the highest priority module */
if (best_pri < priority) {
best_pri = priority;
/* give any prior module a chance to finalize */
if (NULL != pmix_psquash.finalize) {
pmix_psquash.finalize();
}
pmix_psquash = *nmodule;
inserted = true;
}
}
if (!inserted) {
return PMIX_ERR_NOT_FOUND;
}
return PMIX_SUCCESS;;
}

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

@ -0,0 +1,41 @@
# -*- makefile -*-
#
# Copyright (c) 2019 IBM Corporation. All rights reserved.
# Copyright (c) 2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
headers = psquash_flex128.h
sources = \
psquash_flex128_component.c \
psquash_flex128.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_pmix_psquash_flex128_DSO
lib =
lib_sources =
component = mca_psquash_flex128.la
component_sources = $(headers) $(sources)
else
lib = libmca_psquash_flex128.la
lib_sources = $(headers) $(sources)
component =
component_sources =
endif
mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_psquash_flex128_la_SOURCES = $(component_sources)
mca_psquash_flex128_la_LDFLAGS = -module -avoid-version
mca_psquash_flex128_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_psquash_flex128_la_SOURCES = $(lib_sources)
libmca_psquash_flex128_la_LDFLAGS = -module -avoid-version

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

@ -0,0 +1,383 @@
/*
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* Copyright (c) 2019 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_socket_errno.h"
#include "src/include/pmix_globals.h"
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include <unistd.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "src/mca/psquash/base/base.h"
#include "psquash_flex128.h"
/* Flexible packing constants */
#define FLEX_BASE7_MAX_BUF_SIZE (SIZEOF_SIZE_T+1)
#define FLEX_BASE7_MASK ((1<<7) - 1)
#define FLEX_BASE7_SHIFT 7
#define FLEX_BASE7_CONT_FLAG (1<<7)
/**
* Packing conversion of a signed integer value to a flexible representation.
* The main idea is to split a signed negative value onto an absolute value
* and a sign bit stored in the special location.
* This allows efficient representetion of negative values in the
* flexible form.
*
* type - type (pmix_data_type_t) of integer value
* ptr - pointer to the signed integer value
* with the type defined as (type)
* out - flexible representation of *ptr,
* extended to uint64_t if needed
* (see a comment to `pmix_bfrops_pack_flex` for additional details)
*/
#define FLEX128_PACK_CONVERT_SIGNED(type, ptr, out) \
do { \
type __tbuf = 0; \
size_t __tmp; \
int __sign = 0; \
memcpy(&__tbuf, (ptr), sizeof(type)); \
__tmp = __tbuf; \
(out) = (size_t)__tmp; \
if (__tmp & (1UL << (sizeof(__tmp)*CHAR_BIT-1))) { \
__sign = 1; \
out = ~(out); \
} \
(out) = ((out) << 1) + __sign; \
} while (0)
/**
* Packing conversion of a signed integer value to a flexible representation.
* For unsigned types it is reduced to a memcopy.
*
* type - usual integer C-type of integer value
* ptr - pointer to the signed integer value
* with the type defined as (type)
* out - flexible representation of *ptr,
* extended to uint64_t if needed
* (see a comment to `pmix_bfrops_pack_flex` for additional details)
*/
#define FLEX128_PACK_CONVERT_UNSIGNED(type, ptr, out) \
do { \
type __tbuf = 0; \
memcpy(&__tbuf, (ptr), sizeof(type)); \
out = __tbuf; \
} while (0)
/**
* Packing conversion from integer value to a flexible representation.
*
* r - return status code
* t - type (pmix_data_type_t) of integer value, it is determines
* which type of integer is converted
* s - pointer to the integer value with the type defined as (t)
* d - flexible representation output value (uin64_t)
* (see a comment to `pmix_bfrops_pack_flex` for additional details)
*/
#define FLEX128_PACK_CONVERT(r, t, s, d) \
do { \
(r) = PMIX_SUCCESS; \
switch (t) { \
case PMIX_INT16: \
FLEX128_PACK_CONVERT_SIGNED(int16_t, s, d); \
break; \
case PMIX_UINT16: \
FLEX128_PACK_CONVERT_UNSIGNED(uint16_t, s, d); \
break; \
case PMIX_INT: \
case PMIX_INT32: \
FLEX128_PACK_CONVERT_SIGNED(int32_t, s, d); \
break; \
case PMIX_UINT: \
case PMIX_UINT32: \
FLEX128_PACK_CONVERT_UNSIGNED(uint32_t, s, d); \
break; \
case PMIX_INT64: \
FLEX128_PACK_CONVERT_SIGNED(int64_t, s, d); \
break; \
case PMIX_SIZE: \
FLEX128_PACK_CONVERT_UNSIGNED(size_t, s, d); \
break; \
case PMIX_UINT64: \
FLEX128_PACK_CONVERT_UNSIGNED(uint64_t, s, d); \
break; \
default: \
(r) = PMIX_ERR_BAD_PARAM; \
} \
} while(0)
/**
* Unpacking conversion from a flexible representation to a
* signed integer value.
*
* type - C-type of a signed integer value
* val - flexible representation (uint64_t)
* ptr - pointer to a 64-bit output buffer for the upacked value
* (see a comment to `pmix_bfrops_pack_flex` for additional details)
*/
#define FLEX128_UNPACK_CONVERT_SIGNED(type, val, ptr) \
do { \
type __tbuf = 0; \
size_t __tmp = val; \
int sign = (__tmp) & 1; \
__tmp >>= 1; \
if (sign) { \
__tmp = ~__tmp; \
} \
__tbuf = (type)__tmp; \
memcpy(ptr, &__tbuf, sizeof(type)); \
} while (0)
/**
* Unpacking conversion of a flexible representation value
* to an unsigned integer.
*
* type - C-type of unsigned integer value
* val - flexible representation value (uint64_t)
* ptr - pointer to a 64-bit output buffer for the upacked value
* (see a comment to `pmix_bfrops_pack_flex` for additional details)
*/
#define FLEX128_UNPACK_CONVERT_UNSIGNED(type, val, ptr) \
do { \
type __tbuf = 0; \
__tbuf = (type)val; \
memcpy(ptr, &__tbuf, sizeof(type)); \
} while (0)
/**
* Unpacking conversion of a flexible representation value
* to an integer.
*
* r - return status code
* t - type (pmix_data_type_t) of integer value, it is determines
* which type of integer is converted
* s - flex-representation value (uin64_t)
* d - pointer to a 64-bit output buffer for the upacked value
* (see a comment to `pmix_bfrops_pack_flex` for additional details)
*/
#define FLEX128_UNPACK_CONVERT(r, t, s, d) \
do { \
(r) = PMIX_SUCCESS; \
switch (t) { \
case PMIX_INT16: \
FLEX128_UNPACK_CONVERT_SIGNED(int16_t, s, d); \
break; \
case PMIX_UINT16: \
FLEX128_UNPACK_CONVERT_UNSIGNED(uint16_t, s, d); \
break; \
case PMIX_INT: \
case PMIX_INT32: \
FLEX128_UNPACK_CONVERT_SIGNED(int32_t, s, d); \
break; \
case PMIX_UINT: \
case PMIX_UINT32: \
FLEX128_UNPACK_CONVERT_UNSIGNED(uint32_t, s, d); \
break; \
case PMIX_INT64: \
FLEX128_UNPACK_CONVERT_SIGNED(int64_t, s, d); \
break; \
case PMIX_SIZE: \
FLEX128_UNPACK_CONVERT_UNSIGNED(size_t, s, d); \
break; \
case PMIX_UINT64: \
FLEX128_UNPACK_CONVERT_UNSIGNED(uint64_t, s, d); \
break; \
default: \
(r) = PMIX_ERR_BAD_PARAM; \
} \
} while(0)
static pmix_status_t flex128_init(void);
static void flex128_finalize(void);
static pmix_status_t flex128_get_max_size(pmix_data_type_t type, size_t *size);
static pmix_status_t flex128_encode_int(pmix_data_type_t type, void *src,
void *dst, size_t *size);
static pmix_status_t flex128_decode_int(pmix_data_type_t type, void *src,
size_t src_len, void *dest,
size_t *dst_size);
static size_t flex_pack_integer(size_t val,
uint8_t out_buf[FLEX_BASE7_MAX_BUF_SIZE]);
static size_t flex_unpack_integer(const uint8_t in_buf[], size_t buf_size,
size_t *out_val, size_t *out_val_size);
pmix_psquash_base_module_t pmix_flex128_module = {
.name = "flex128",
.int_type_is_encoded = true,
.init = flex128_init,
.finalize = flex128_finalize,
.get_max_size = flex128_get_max_size,
.encode_int = flex128_encode_int,
.decode_int = flex128_decode_int
};
static pmix_status_t flex128_init(void)
{
pmix_output_verbose(2, pmix_globals.debug_output,
"psquash: flex128 init");
return PMIX_SUCCESS;
}
static void flex128_finalize(void)
{
pmix_output_verbose(2, pmix_globals.debug_output,
"psquash: flex128 finalize");
}
static pmix_status_t flex128_get_max_size(pmix_data_type_t type, size_t *size)
{
pmix_status_t rc;
PMIX_SQUASH_TYPE_SIZEOF(rc, type, *size);
/* the size of the packed value can be 1B larger
* because of continuation flags */
*size += 1;
return rc;
}
static pmix_status_t flex128_encode_int(pmix_data_type_t type, void *src,
void *dst, size_t *size)
{
pmix_status_t rc = PMIX_SUCCESS;
uint8_t tmp_buf[FLEX_BASE7_MAX_BUF_SIZE];
uint64_t tmp;
FLEX128_PACK_CONVERT(rc, type, (uint8_t*)src, tmp);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
*size = flex_pack_integer(tmp, tmp_buf);
memcpy(dst, tmp_buf, *size);
return rc;
}
static pmix_status_t flex128_decode_int(pmix_data_type_t type, void *src,
size_t src_len, void *dest, size_t *dst_size)
{
pmix_status_t rc = PMIX_SUCCESS;
size_t tmp;
size_t val_size, unpack_val_size;
PMIX_SQUASH_TYPE_SIZEOF(rc, type, val_size);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
*dst_size = flex_unpack_integer(src, src_len, &tmp, &unpack_val_size);
if( val_size < unpack_val_size ) { // sanity check
rc = PMIX_ERR_UNPACK_FAILURE;
PMIX_ERROR_LOG(rc);
return rc;
}
FLEX128_UNPACK_CONVERT(rc, type, tmp, (uint8_t*)dest);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
return rc;
}
/*
* Typical representation of a number in computer systems is:
* A[0]*B^0 + A[1]*B^1 + A[2]*B^2 + ... + A[n]*B^n
* where B called a base and B == 256 (one byte)
*
* This encoding changes the default representation by introducing an additional
* bit per each byte to store a "continuation flag". So integers are now encoded
* with the same representation, but the base B = 128 and the remaning bit is
* used to indicate whether or not the next byte contains more bits of this value.
*/
static size_t flex_pack_integer(size_t val,
uint8_t out_buf[FLEX_BASE7_MAX_BUF_SIZE])
{
size_t tmp = val;
size_t idx = 0;
do {
uint8_t val = tmp & FLEX_BASE7_MASK;
tmp >>= FLEX_BASE7_SHIFT;
if (PMIX_UNLIKELY(tmp)) {
val |= FLEX_BASE7_CONT_FLAG;
}
out_buf[idx++] = val;
} while(tmp && idx < SIZEOF_SIZE_T);
/* If we have leftover (VERY unlikely) */
if (PMIX_UNLIKELY(SIZEOF_SIZE_T == idx && tmp)) {
out_buf[idx++] = tmp;
}
return idx;
}
/*
* See a comment to `pmix_bfrops_pack_flex` for additional details.
*/
static size_t flex_unpack_integer(const uint8_t in_buf[], size_t buf_size,
size_t *out_val, size_t *out_val_size)
{
size_t value = 0, shift = 0, shift_last = 0;
size_t idx = 0;
uint8_t val = 0, val_last = 0;
uint8_t hi_bit = 0;
size_t flex_size = buf_size;
/* restrict the buf size to max flex size */
if (buf_size > FLEX_BASE7_MAX_BUF_SIZE) {
flex_size = FLEX_BASE7_MAX_BUF_SIZE;
}
do {
val = in_buf[idx++];
val_last = val;
shift_last = shift;
value = value + (((uint64_t)val & FLEX_BASE7_MASK) << shift);
shift += FLEX_BASE7_SHIFT;
} while(PMIX_UNLIKELY((val & FLEX_BASE7_CONT_FLAG) &&
(idx < (flex_size-1))));
/* If we have leftover (VERY unlikely) */
if (PMIX_UNLIKELY((flex_size-1) == idx &&
(val & FLEX_BASE7_CONT_FLAG))) {
val = in_buf[idx++];
val_last = val;
value = value + ((uint64_t)val << shift);
shift_last = shift;
}
/* compute the most significant bit of val */
while (val_last != 0) {
val_last >>= 1;
hi_bit++;
}
/* compute the real val size */
*out_val_size = (hi_bit + shift_last)/CHAR_BIT +
!!((hi_bit + shift_last) & (CHAR_BIT - 1));
*out_val = value;
return idx;
}

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

@ -0,0 +1,26 @@
/*
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_NATIVE_H
#define PMIX_NATIVE_H
#include <src/include/pmix_config.h>
#include "src/mca/psquash/psquash.h"
BEGIN_C_DECLS
/* the component must be visible data for the linker to find it */
PMIX_EXPORT extern pmix_psquash_base_component_t mca_psquash_flex128_component;
extern pmix_psquash_base_module_t pmix_flex128_module;
END_C_DECLS
#endif

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

@ -0,0 +1,66 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include "pmix_common.h"
#include "src/mca/base/pmix_mca_base_var.h"
#include "src/mca/psquash/psquash.h"
#include "psquash_flex128.h"
static pmix_status_t component_open(void);
static pmix_status_t component_close(void);
static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
pmix_psquash_base_component_t mca_psquash_flex128_component = {
.base = {
PMIX_PSQUASH_BASE_VERSION_1_0_0,
/* Component name and version */
.pmix_mca_component_name = "flex128",
PMIX_MCA_BASE_MAKE_VERSION(component,
PMIX_MAJOR_VERSION,
PMIX_MINOR_VERSION,
PMIX_RELEASE_VERSION),
/* Component open and close functions */
.pmix_mca_open_component = component_open,
.pmix_mca_close_component = component_close,
.pmix_mca_query_component = component_query,
},
.data = {
/* The component is checkpoint ready */
PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT
}
};
static int component_open(void)
{
return PMIX_SUCCESS;
}
static int component_query(pmix_mca_base_module_t **module, int *priority)
{
*priority = 20;
*module = (pmix_mca_base_module_t *)&pmix_flex128_module;
return PMIX_SUCCESS;
}
static int component_close(void)
{
return PMIX_SUCCESS;
}

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

@ -0,0 +1,44 @@
# -*- makefile -*-
#
# Copyright (c) 2019 IBM Corporation. All rights reserved.
# Copyright (c) 2019 Mellanox Technologies, Inc.
# All rights reserved.
#
# Copyright (c) 2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
headers = psquash_native.h
sources = \
psquash_native_component.c \
psquash_native.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_pmix_psquash_native_DSO
lib =
lib_sources =
component = mca_psquash_native.la
component_sources = $(headers) $(sources)
else
lib = libmca_psquash_native.la
lib_sources = $(headers) $(sources)
component =
component_sources =
endif
mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_psquash_native_la_SOURCES = $(component_sources)
mca_psquash_native_la_LDFLAGS = -module -avoid-version
mca_psquash_native_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_psquash_native_la_SOURCES = $(lib_sources)
libmca_psquash_native_la_LDFLAGS = -module -avoid-version

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

@ -0,0 +1,187 @@
/*
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* Copyright (c) 2019 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_socket_errno.h"
#include "src/include/pmix_globals.h"
#include "src/util/argv.h"
#include "src/util/error.h"
#include "src/util/output.h"
#include <unistd.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "src/mca/psquash/base/base.h"
#include "psquash_native.h"
static pmix_status_t native_init(void);
static void native_finalize(void);
static pmix_status_t native_get_max_size(pmix_data_type_t type, size_t *size);
static pmix_status_t native_encode_int(pmix_data_type_t type, void *src,
void *dst, size_t *size);
static pmix_status_t native_decode_int(pmix_data_type_t type, void *src,
size_t src_len, void *dest,
size_t *dst_size);
pmix_psquash_base_module_t pmix_psquash_native_module = {
.name = "native",
.int_type_is_encoded = false,
.init = native_init,
.finalize = native_finalize,
.get_max_size = native_get_max_size,
.encode_int = native_encode_int,
.decode_int = native_decode_int
};
#define NATIVE_PACK_CONVERT(ret, type, val) \
do { \
(ret) = PMIX_SUCCESS; \
switch(type) { \
case PMIX_INT16: \
case PMIX_UINT16:{ \
uint16_t __tmp = (uint16_t)val; \
val = pmix_htons(__tmp); \
break; \
} \
case PMIX_INT: \
case PMIX_UINT: \
case PMIX_INT32: \
case PMIX_UINT32:{ \
uint32_t __tmp = (uint32_t)val; \
val = htonl(__tmp); \
break; \
} \
case PMIX_SIZE: \
case PMIX_INT64: \
case PMIX_UINT64:{ \
uint64_t __tmp = (uint64_t)val; \
val = pmix_hton64(__tmp); \
break; \
} \
default: \
(ret) = PMIX_ERR_BAD_PARAM; \
} \
} while (0)
#define NATIVE_UNPACK_CONVERT(ret, type, val) \
do { \
(ret) = PMIX_SUCCESS; \
switch(type) { \
case PMIX_INT16: \
case PMIX_UINT16:{ \
uint16_t __tmp = (uint16_t)val; \
val = pmix_ntohs(__tmp); \
break; \
} \
case PMIX_INT: \
case PMIX_UINT: \
case PMIX_INT32: \
case PMIX_UINT32:{ \
uint32_t __tmp = (uint32_t)val; \
val = ntohl(__tmp); \
break; \
} \
case PMIX_INT64: \
case PMIX_SIZE: \
case PMIX_UINT64:{ \
uint64_t __tmp = (uint64_t)val; \
val = pmix_ntoh64(__tmp); \
break; \
} \
default: \
(ret) = PMIX_ERR_BAD_PARAM; \
} \
} while (0)
static pmix_status_t native_init(void)
{
pmix_output_verbose(2, pmix_globals.debug_output,
"psquash: native init");
return PMIX_SUCCESS;
}
static void native_finalize(void)
{
pmix_output_verbose(2, pmix_globals.debug_output,
"psquash: native finalize");
}
static pmix_status_t native_get_max_size(pmix_data_type_t type, size_t *size)
{
pmix_status_t rc;
PMIX_SQUASH_TYPE_SIZEOF(rc, type, *size);
return rc;
}
static pmix_status_t native_encode_int(pmix_data_type_t type, void *src,
void *dst, size_t *size)
{
pmix_status_t rc;
uint64_t tmp = 0;
size_t val_size;
PMIX_SQUASH_TYPE_SIZEOF(rc, type, val_size);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
memcpy(&tmp, src, val_size);
NATIVE_PACK_CONVERT(rc, type, tmp);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
memcpy(dst, &tmp, val_size);
*size = val_size;
return PMIX_SUCCESS;
}
static pmix_status_t native_decode_int(pmix_data_type_t type, void *src,
size_t src_len, void *dst,
size_t *dst_size)
{
pmix_status_t rc;
uint64_t tmp = 0;
size_t val_size;
PMIX_SQUASH_TYPE_SIZEOF(rc, type, val_size);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* sanity check */
if (src_len != val_size) {
rc = PMIX_ERR_UNPACK_FAILURE;
}
memcpy(&tmp, src, val_size);
NATIVE_UNPACK_CONVERT(rc, type, tmp);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
memcpy(dst, &tmp, val_size);
*dst_size = val_size;
return PMIX_SUCCESS;
}

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

@ -0,0 +1,29 @@
/*
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* Copyright (c) 2019 Mellanox Technologies, Inc.
* All rights reserve
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef PMIX_NATIVE_H
#define PMIX_NATIVE_H
#include <src/include/pmix_config.h>
#include "src/mca/psquash/psquash.h"
BEGIN_C_DECLS
/* the component must be visible data for the linker to find it */
PMIX_EXPORT extern pmix_psquash_base_component_t mca_psquash_native_component;
extern pmix_psquash_base_module_t pmix_psquash_native_module;
END_C_DECLS
#endif

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

@ -0,0 +1,69 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* Copyright (c) 2019 Mellanox Technologies, Inc.
* All rights reserved
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include <src/include/pmix_config.h>
#include "pmix_common.h"
#include "src/mca/base/pmix_mca_base_var.h"
#include "src/mca/psquash/psquash.h"
#include "psquash_native.h"
static pmix_status_t component_open(void);
static pmix_status_t component_close(void);
static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
pmix_psquash_base_component_t mca_psquash_native_component = {
.base = {
PMIX_PSQUASH_BASE_VERSION_1_0_0,
/* Component name and version */
.pmix_mca_component_name = "native",
PMIX_MCA_BASE_MAKE_VERSION(component,
PMIX_MAJOR_VERSION,
PMIX_MINOR_VERSION,
PMIX_RELEASE_VERSION),
/* Component open and close functions */
.pmix_mca_open_component = component_open,
.pmix_mca_close_component = component_close,
.pmix_mca_query_component = component_query,
},
.data = {
/* The component is checkpoint ready */
PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT
}
};
static int component_open(void)
{
return PMIX_SUCCESS;
}
static int component_query(pmix_mca_base_module_t **module, int *priority)
{
*priority = 5;
*module = (pmix_mca_base_module_t *)&pmix_psquash_native_module;
return PMIX_SUCCESS;
}
static int component_close(void)
{
return PMIX_SUCCESS;
}

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

@ -0,0 +1,120 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* Copyright (c) 2019 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* This interface is for the encoding/decoding of basic types and the
* compression/decompression of larger blobs of data (i.e., modex).
*
* Available plugins may be defined at runtime via the typical MCA parameter
* syntax.
*/
#ifndef PMIX_PSQUASH_H
#define PMIX_PSQUASH_H
#include <src/include/pmix_config.h>
#include "src/mca/mca.h"
#include "src/mca/base/pmix_mca_base_var.h"
#include "src/mca/base/pmix_mca_base_framework.h"
BEGIN_C_DECLS
/****** MODULE DEFINITION ******/
/**
* Initialize the module
*/
typedef pmix_status_t (*pmix_psquash_base_module_init_fn_t)(void);
/**
* Finalize the module
*/
typedef void (*pmix_psquash_base_module_finalize_fn_t)(void);
/**
* Maximum size of the type.
*
* type - Type (PMIX_SIZE, PMIX_INT to PMIX_UINT64)
* size - size of the type
*/
typedef pmix_status_t (*pmix_psquash_get_max_size_fn_t) (pmix_data_type_t type,
size_t *size);
/**
* Encode a basic integer type into a contiguous destination buffer.
*
* type - Type of the 'src' pointer (PMIX_SIZE, PMIX_INT to PMIX_UINT64)
* src - pointer to a single basic integer type
* dest - pointer to buffer to store data
* dst_len - pointer to the packed size of dest, in bytes
*/
typedef pmix_status_t (*pmix_psquash_encode_int_fn_t) (pmix_data_type_t type,
void *src, void *dest,
size_t *dst_len);
/**
* Decode a basic a contiguous destination buffer into a basic integer type.
*
* type - Type of the 'dest' pointer (PMIX_SIZE, PMIX_INT to PMIX_UINT64)
* src - pointer to buffer where data was stored
* src_len - length, in bytes, of the src buffer
* dest - pointer to a single basic integer type
* dst_len - pointer to the unpacked size of dest, in bytes
*/
typedef pmix_status_t (*pmix_psquash_decode_int_fn_t) (pmix_data_type_t type,
void *src, size_t src_len,
void *dest, size_t *dst_len);
/**
* Base structure for a PSQUASH module
*/
typedef struct {
const char *name;
/* flag indicating if the type is encoded within the value, otherwise, it is necessary to further pack the type with the value. */
bool int_type_is_encoded;
/** init/finalize */
pmix_psquash_base_module_init_fn_t init;
pmix_psquash_base_module_finalize_fn_t finalize;
pmix_psquash_get_max_size_fn_t get_max_size;
/** Integer compression */
pmix_psquash_encode_int_fn_t encode_int;
pmix_psquash_decode_int_fn_t decode_int;
} pmix_psquash_base_module_t;
/**
* Base structure for a PSQUASH component
*/
struct pmix_psquash_base_component_t {
pmix_mca_base_component_t base;
pmix_mca_base_component_data_t data;
int priority;
};
typedef struct pmix_psquash_base_component_t pmix_psquash_base_component_t;
PMIX_EXPORT extern pmix_psquash_base_module_t pmix_psquash;
/*
* Macro for use in components that are of type psquash
*/
#define PMIX_PSQUASH_BASE_VERSION_1_0_0 \
PMIX_MCA_BASE_VERSION_1_0_0("psquash", 1, 0, 0)
END_C_DECLS
#endif

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

@ -11,7 +11,7 @@
# 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-2016 Intel, Inc. All rights reserved
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -44,6 +44,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_ptl_tcp_la_SOURCES = $(component_sources)
mca_ptl_tcp_la_LDFLAGS = -module -avoid-version
mca_ptl_tcp_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_ptl_tcp_la_SOURCES = $(lib_sources)

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

@ -11,7 +11,7 @@
# 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-2016 Intel, Inc. All rights reserved
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -44,6 +44,7 @@ mcacomponentdir = $(pmixlibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_ptl_usock_la_SOURCES = $(component_sources)
mca_ptl_usock_la_LDFLAGS = -module -avoid-version
mca_ptl_usock_la_LIBADD = $(top_builddir)/src/libpmix.la
noinst_LTLIBRARIES = $(lib)
libmca_ptl_usock_la_SOURCES = $(lib_sources)

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

@ -2303,9 +2303,13 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata)
/* if we get here, then there are processes waiting
* for a response */
/* if the timer is active, clear it */
if (tracker->event_active) {
pmix_event_del(&tracker->ev);
}
/* pass the blobs being returned */
PMIX_CONSTRUCT(&xfer, pmix_buffer_t);
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &xfer, scd->data, scd->ndata);
PMIX_CONSTRUCT(&nslist, pmix_list_t);
if (PMIX_SUCCESS != scd->status) {
@ -2324,12 +2328,15 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata)
goto finish_collective;
}
// collect the pmix_namespace_t's of all local participants
/* Collect the nptr list with uniq GDS components of all local
* participants. It does not allow multiple storing to the
* same GDS if participants have mutual GDS. */
PMIX_LIST_FOREACH(cd, &tracker->local_cbs, pmix_server_caddy_t) {
// see if we already have this nspace
found = false;
PMIX_LIST_FOREACH(nptr, &nslist, pmix_nspace_caddy_t) {
if (nptr->ns == cd->peer->nptr) {
if (0 == strcmp(nptr->ns->compat.gds->name,
cd->peer->nptr->compat.gds->name)) {
found = true;
break;
}
@ -2342,8 +2349,9 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata)
pmix_list_append(&nslist, &nptr->super);
}
}
PMIX_LIST_FOREACH(nptr, &nslist, pmix_nspace_caddy_t) {
/* pass the blobs being returned */
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &xfer, scd->data, scd->ndata);
PMIX_GDS_STORE_MODEX(rc, nptr->ns, &xfer, tracker);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);

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

@ -60,9 +60,25 @@
#include "src/util/error.h"
#include "src/util/output.h"
#include "src/util/pmix_environ.h"
#include "src/mca/gds/base/base.h"
#include "pmix_server_ops.h"
/* The rank_blob_t type to collect processes blobs,
* this list afterward will form a node modex blob. */
typedef struct {
pmix_list_item_t super;
pmix_buffer_t *buf;
} rank_blob_t;
static void bufdes(rank_blob_t *p)
{
PMIX_RELEASE(p);
}
static PMIX_CLASS_INSTANCE(rank_blob_t,
pmix_list_item_t,
NULL, bufdes);
pmix_server_module_t pmix_host_server = {0};
pmix_status_t pmix_server_abort(pmix_peer_t *peer, pmix_buffer_t *buf,
@ -506,32 +522,122 @@ static void fence_timeout(int sd, short args, void *cbdata)
static pmix_status_t _collect_data(pmix_server_trkr_t *trk,
pmix_buffer_t *buf)
{
pmix_buffer_t bucket, pbkt;
pmix_buffer_t bucket, *pbkt = NULL;
pmix_cb_t cb;
pmix_kval_t *kv;
pmix_byte_object_t bo;
unsigned char tmp = (unsigned char)trk->collect_type;
pmix_server_caddy_t *scd;
pmix_proc_t pcs;
pmix_status_t rc;
pmix_status_t rc = PMIX_SUCCESS;
pmix_rank_t rel_rank;
pmix_nspace_caddy_t *nm;
bool found;
pmix_list_t rank_blobs;
rank_blob_t *blob;
uint32_t kmap_size;
/* key names map, the position of the key name
* in the array determines the unique key index */
char **kmap = NULL;
int i;
pmix_gds_modex_blob_info_t blob_info_byte = 0;
pmix_gds_modex_key_fmt_t kmap_type = PMIX_MODEX_KEY_INVALID;
PMIX_CONSTRUCT(&bucket, pmix_buffer_t);
/* mark the collection type so we can check on the
* receiving end that all participants did the same */
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket,
&tmp, 1, PMIX_BYTE);
if (PMIX_COLLECT_YES == trk->collect_type) {
pmix_output_verbose(2, pmix_server_globals.fence_output,
"fence - assembling data");
/* Evaluate key names sizes and their count to select
* a format to store key names:
* - keymap: use key-map in blob header for key-name resolve
* from idx: key names stored as indexes (avoid key duplication)
* - regular: key-names stored as is */
if (PMIX_MODEX_KEY_INVALID == kmap_type) {
size_t key_fmt_size[PMIX_MODEX_KEY_MAX] = {0};
pmix_value_array_t *key_count_array = PMIX_NEW(pmix_value_array_t);
uint32_t *key_count = NULL;
pmix_value_array_init(key_count_array, sizeof(uint32_t));
PMIX_LIST_FOREACH(scd, &trk->local_cbs, pmix_server_caddy_t) {
pmix_strncpy(pcs.nspace, scd->peer->info->pname.nspace,
PMIX_MAX_NSLEN);
pcs.rank = scd->peer->info->pname.rank;
PMIX_CONSTRUCT(&cb, pmix_cb_t);
cb.proc = &pcs;
cb.scope = PMIX_REMOTE;
cb.copy = true;
PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb);
if (PMIX_SUCCESS == rc) {
int key_idx;
PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) {
rc = pmix_argv_append_unique_idx(&key_idx, &kmap,
kv->key);
if (pmix_value_array_get_size(key_count_array) <
(size_t)(key_idx+1)) {
size_t new_size;
size_t old_size =
pmix_value_array_get_size(key_count_array);
pmix_value_array_set_size(key_count_array,
key_idx+1);
new_size =
pmix_value_array_get_size(key_count_array);
key_count =
PMIX_VALUE_ARRAY_GET_BASE(key_count_array,
uint32_t);
memset(key_count + old_size, 0, sizeof(uint32_t) *
(new_size - old_size));
}
key_count = PMIX_VALUE_ARRAY_GET_BASE(key_count_array,
uint32_t);
key_count[key_idx]++;
}
}
}
key_count = PMIX_VALUE_ARRAY_GET_BASE(key_count_array, uint32_t);
for (i = 0; i < pmix_argv_count(kmap); i++) {
pmix_buffer_t tmp;
size_t kname_size;
size_t kidx_size;
PMIX_CONSTRUCT(&tmp, pmix_buffer_t);
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &tmp, &kmap[i], 1,
PMIX_STRING);
kname_size = tmp.bytes_used;
PMIX_DESTRUCT(&tmp);
PMIX_CONSTRUCT(&tmp, pmix_buffer_t);
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &tmp, &i, 1,
PMIX_UINT32);
kidx_size = tmp.bytes_used;
PMIX_DESTRUCT(&tmp);
/* calculate the key names sizes */
key_fmt_size[PMIX_MODEX_KEY_NATIVE_FMT] =
kname_size * key_count[i];
key_fmt_size[PMIX_MODEX_KEY_KEYMAP_FMT] =
kname_size + key_count[i]*kidx_size;
}
PMIX_RELEASE(key_count_array);
/* select the most efficient key-name pack format */
kmap_type = key_fmt_size[PMIX_MODEX_KEY_NATIVE_FMT] >
key_fmt_size[PMIX_MODEX_KEY_KEYMAP_FMT] ?
PMIX_MODEX_KEY_KEYMAP_FMT : PMIX_MODEX_KEY_NATIVE_FMT;
pmix_output_verbose(5, pmix_server_globals.base_output,
"key packing type %s",
kmap_type == PMIX_MODEX_KEY_KEYMAP_FMT ?
"kmap" : "native");
}
PMIX_CONSTRUCT(&rank_blobs, pmix_list_t);
PMIX_LIST_FOREACH(scd, &trk->local_cbs, pmix_server_caddy_t) {
/* get any remote contribution - note that there
* may not be a contribution */
pmix_strncpy(pcs.nspace, scd->peer->info->pname.nspace, PMIX_MAX_NSLEN);
pmix_strncpy(pcs.nspace, scd->peer->info->pname.nspace,
PMIX_MAX_NSLEN);
pcs.rank = scd->peer->info->pname.rank;
PMIX_CONSTRUCT(&cb, pmix_cb_t);
cb.proc = &pcs;
@ -557,60 +663,115 @@ static pmix_status_t _collect_data(pmix_server_trkr_t *trk,
rc = PMIX_ERR_NOT_FOUND;
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&cb);
PMIX_DESTRUCT(&pbkt);
PMIX_DESTRUCT(&rank_blobs);
goto cleanup;
}
rel_rank += pcs.rank;
/* pack the relative rank */
PMIX_CONSTRUCT(&pbkt, pmix_buffer_t);
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt,
pbkt = PMIX_NEW(pmix_buffer_t);
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, pbkt,
&rel_rank, 1, PMIX_PROC_RANK);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&cb);
PMIX_DESTRUCT(&pbkt);
PMIX_DESTRUCT(&rank_blobs);
PMIX_RELEASE(pbkt);
goto cleanup;
}
/* pack the returned kval's */
PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) {
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, kv, 1, PMIX_KVAL);
if (PMIX_SUCCESS != rc) {
rc = pmix_gds_base_modex_pack_kval(kmap_type, pbkt, &kmap,
kv);
if (rc != PMIX_SUCCESS) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&cb);
PMIX_DESTRUCT(&pbkt);
PMIX_DESTRUCT(&rank_blobs);
PMIX_RELEASE(pbkt);
goto cleanup;
}
}
/* extract the blob */
PMIX_UNLOAD_BUFFER(&pbkt, bo.bytes, bo.size);
PMIX_DESTRUCT(&pbkt);
/* pack the returned blob */
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket,
&bo, 1, PMIX_BYTE_OBJECT);
PMIX_BYTE_OBJECT_DESTRUCT(&bo);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
PMIX_DESTRUCT(&cb);
goto cleanup;
}
/* add part of the process modex to the list */
blob = PMIX_NEW(rank_blob_t);
blob->buf = pbkt;
pmix_list_append(&rank_blobs, &blob->super);
pbkt = NULL;
}
PMIX_DESTRUCT(&cb);
}
/* mark the collection type so we can check on the
* receiving end that all participants did the same. Note
* that if the receiving end thinks that the collect flag
* is false, then store_modex will not be called on that
* node and this information (and the flag) will be ignored,
* meaning that no error is generated! */
blob_info_byte |= PMIX_GDS_COLLECT_BIT;
if (PMIX_MODEX_KEY_KEYMAP_FMT == kmap_type) {
blob_info_byte |= PMIX_GDS_KEYMAP_BIT;
}
/* pack the modex blob info byte */
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket,
&blob_info_byte, 1, PMIX_BYTE);
if (PMIX_MODEX_KEY_KEYMAP_FMT == kmap_type) {
/* pack node part of modex to `bucket` */
/* pack the key names map for the remote server can
* use it to match key names by index */
kmap_size = pmix_argv_count(kmap);
if (0 < kmap_size) {
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket,
&kmap_size, 1, PMIX_UINT32);
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket,
kmap, kmap_size, PMIX_STRING);
}
}
/* pack the collected blobs of processes */
PMIX_LIST_FOREACH(blob, &rank_blobs, rank_blob_t) {
/* extract the blob */
PMIX_UNLOAD_BUFFER(blob->buf, bo.bytes, bo.size);
/* pack the returned blob */
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket,
&bo, 1, PMIX_BYTE_OBJECT);
PMIX_BYTE_OBJECT_DESTRUCT(&bo); // releases the data
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
}
PMIX_DESTRUCT(&rank_blobs);
} else {
/* mark the collection type so we can check on the
* receiving end that all participants did the same.
* Don't do it for non-debug mode so we don't unnecessarily
* send the collection bucket. The mdxcbfunc in the
* server only calls store_modex if the local collect
* flag is set to true. In debug mode, this check will
* cause the store_modex function to see that this node
* thought the collect flag was not set, and therefore
* generate an error */
#if PMIX_ENABLE_DEBUG
/* pack the modex blob info byte */
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket,
&blob_info_byte, 1, PMIX_BYTE);
#endif
}
/* because the remote servers have to unpack things
* in chunks, we have to pack the bucket as a single
* byte object to allow remote unpack */
PMIX_UNLOAD_BUFFER(&bucket, bo.bytes, bo.size);
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buf,
&bo, 1, PMIX_BYTE_OBJECT);
PMIX_BYTE_OBJECT_DESTRUCT(&bo); // releases the data
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
if (!PMIX_BUFFER_IS_EMPTY(&bucket)) {
/* because the remote servers have to unpack things
* in chunks, we have to pack the bucket as a single
* byte object to allow remote unpack */
PMIX_UNLOAD_BUFFER(&bucket, bo.bytes, bo.size);
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buf,
&bo, 1, PMIX_BYTE_OBJECT);
PMIX_BYTE_OBJECT_DESTRUCT(&bo); // releases the data
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
}
}
cleanup:
PMIX_DESTRUCT(&bucket);
pmix_argv_free(kmap);
return rc;
}
@ -693,6 +854,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd,
}
}
}
if (0 < pmix_list_get_size(&expand)) {
PMIX_PROC_CREATE(newprocs, nmbrs);
gcd = (pmix_group_caddy_t*)pmix_list_remove_first(&expand);
@ -789,6 +951,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd,
break;
}
}
/* we only save the info structs from the first caller
* who provides them - it is a user error to provide
* different values from different participants */
@ -803,6 +966,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd,
/* add this contributor to the tracker so they get
* notified when we are done */
PMIX_RETAIN(cd);
pmix_list_append(&trk->local_cbs, &cd->super);
/* if a timeout was specified, set it */
if (0 < tv.tv_sec) {
@ -820,7 +984,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd,
* across all participants has been completed */
if (trk->def_complete &&
pmix_list_get_size(&trk->local_cbs) == trk->nlocal) {
pmix_output_verbose(2, pmix_server_globals.base_output,
pmix_output_verbose(2, pmix_server_globals.fence_output,
"fence complete");
/* if the user asked us to collect data, then we have
* to provide any locally collected data to the host
@ -845,6 +1009,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd,
if (PMIX_SUCCESS != rc) {
pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super);
PMIX_RELEASE(trk);
cd->trk = NULL;
}
}
@ -1671,29 +1836,194 @@ pmix_status_t pmix_server_connect(pmix_server_caddy_t *cd,
return rc;
}
static void _check_cached_events(int sd, short args, void *cbdata)
{
pmix_setup_caddy_t *scd = (pmix_setup_caddy_t*)cbdata;
pmix_notify_caddy_t *cd;
pmix_range_trkr_t rngtrk;
pmix_proc_t proc;
int i;
size_t k, n;
bool found, matched;
pmix_buffer_t *relay;
pmix_status_t ret = PMIX_SUCCESS;
pmix_cmd_t cmd = PMIX_NOTIFY_CMD;
/* check if any matching notifications have been cached */
rngtrk.procs = NULL;
rngtrk.nprocs = 0;
for (i=0; i < pmix_globals.max_events; i++) {
pmix_hotel_knock(&pmix_globals.notifications, i, (void**)&cd);
if (NULL == cd) {
continue;
}
found = false;
if (NULL == scd->codes) {
if (!cd->nondefault) {
/* they registered a default event handler - always matches */
found = true;
}
} else {
for (k=0; k < scd->ncodes; k++) {
if (scd->codes[k] == cd->status) {
found = true;
break;
}
}
}
if (!found) {
continue;
}
/* check if the affected procs (if given) match those they
* wanted to know about */
if (!pmix_notify_check_affected(cd->affected, cd->naffected,
scd->procs, scd->nprocs)) {
continue;
}
/* check the range */
if (NULL == cd->targets) {
rngtrk.procs = &cd->source;
rngtrk.nprocs = 1;
} else {
rngtrk.procs = cd->targets;
rngtrk.nprocs = cd->ntargets;
}
rngtrk.range = cd->range;
PMIX_LOAD_PROCID(&proc, scd->peer->info->pname.nspace, scd->peer->info->pname.rank);
if (!pmix_notify_check_range(&rngtrk, &proc)) {
continue;
}
/* if we were given specific targets, check if this is one */
found = false;
if (NULL != cd->targets) {
matched = false;
for (n=0; n < cd->ntargets; n++) {
/* if the source of the event is the same peer just registered, then ignore it
* as the event notification system will have already locally
* processed it */
if (PMIX_CHECK_PROCID(&cd->source, &scd->peer->info->pname)) {
continue;
}
if (PMIX_CHECK_PROCID(&scd->peer->info->pname, &cd->targets[n])) {
matched = true;
/* track the number of targets we have left to notify */
--cd->nleft;
/* if this is the last one, then evict this event
* from the cache */
if (0 == cd->nleft) {
pmix_hotel_checkout(&pmix_globals.notifications, cd->room);
found = true; // mark that we should release cd
}
break;
}
}
if (!matched) {
/* do not notify this one */
continue;
}
}
/* all matches - notify */
relay = PMIX_NEW(pmix_buffer_t);
if (NULL == relay) {
/* nothing we can do */
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
ret = PMIX_ERR_NOMEM;
break;
}
/* pack the info data stored in the event */
PMIX_BFROPS_PACK(ret, scd->peer, relay, &cmd, 1, PMIX_COMMAND);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
PMIX_BFROPS_PACK(ret, scd->peer, relay, &cd->status, 1, PMIX_STATUS);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
PMIX_BFROPS_PACK(ret, scd->peer, relay, &cd->source, 1, PMIX_PROC);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
PMIX_BFROPS_PACK(ret, scd->peer, relay, &cd->ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
if (0 < cd->ninfo) {
PMIX_BFROPS_PACK(ret, scd->peer, relay, cd->info, cd->ninfo, PMIX_INFO);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
}
PMIX_SERVER_QUEUE_REPLY(ret, scd->peer, 0, relay);
if (PMIX_SUCCESS != ret) {
PMIX_RELEASE(relay);
}
if (found) {
PMIX_RELEASE(cd);
}
}
/* release the caddy */
if (NULL != scd->codes) {
free(scd->codes);
}
if (NULL != scd->info) {
PMIX_INFO_FREE(scd->info, scd->ninfo);
}
if (NULL != scd->opcbfunc) {
scd->opcbfunc(ret, scd->cbdata);
}
PMIX_RELEASE(scd);
}
/* provide a callback function for the host when it finishes
* processing the registration */
static void regevopcbfunc(pmix_status_t status, void *cbdata)
{
pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata;
/* if the registration succeeded, then check local cache */
if (PMIX_SUCCESS == status) {
_check_cached_events(0, 0, cd);
return;
}
/* it didn't succeed, so cleanup and execute the callback
* so we don't hang */
if (NULL != cd->codes) {
free(cd->codes);
}
if (NULL != cd->info) {
PMIX_INFO_FREE(cd->info, cd->ninfo);
}
if (NULL != cd->opcbfunc) {
cd->opcbfunc(status, cd->cbdata);
}
PMIX_RELEASE(cd);
}
pmix_status_t pmix_server_register_events(pmix_peer_t *peer,
pmix_buffer_t *buf,
pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
int32_t cnt;
pmix_status_t rc, ret = PMIX_SUCCESS;
pmix_status_t rc;
pmix_status_t *codes = NULL;
pmix_info_t *info = NULL;
size_t ninfo=0, ncodes, n, k;
size_t ninfo=0, ncodes, n;
pmix_regevents_info_t *reginfo;
pmix_peer_events_info_t *prev = NULL;
pmix_notify_caddy_t *cd;
pmix_setup_caddy_t *scd;
int i;
bool enviro_events = false;
bool found, matched;
pmix_buffer_t *relay;
pmix_cmd_t cmd = PMIX_NOTIFY_CMD;
bool found;
pmix_proc_t *affected = NULL;
size_t naffected = 0;
pmix_range_trkr_t rngtrk;
pmix_proc_t proc;
pmix_output_verbose(2, pmix_server_globals.event_output,
"recvd register events for peer %s:%d",
@ -1891,47 +2221,68 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer,
rc = PMIX_ERR_NOMEM;
goto cleanup;
}
if (NULL != codes) {
scd->codes = (pmix_status_t*)malloc(ncodes * sizeof(pmix_status_t));
if (NULL == scd->codes) {
rc = PMIX_ERR_NOMEM;
PMIX_RELEASE(scd);
goto cleanup;
}
memcpy(scd->codes, codes, ncodes * sizeof(pmix_status_t));
scd->ncodes = ncodes;
}
if (NULL != info) {
PMIX_INFO_CREATE(scd->info, ninfo);
if (NULL == scd->info) {
rc = PMIX_ERR_NOMEM;
if (NULL != scd->codes) {
free(scd->codes);
}
PMIX_RELEASE(scd);
goto cleanup;
}
/* copy the info across */
for (n=0; n < ninfo; n++) {
PMIX_INFO_XFER(&scd->info[n], &info[n]);
}
scd->ninfo = ninfo;
}
PMIX_RETAIN(peer);
scd->peer = peer;
scd->codes = codes;
scd->ncodes = ncodes;
scd->info = info;
scd->ninfo = ninfo;
scd->opcbfunc = cbfunc;
scd->cbdata = cbdata;
if (PMIX_SUCCESS != (rc = pmix_host_server.register_events(scd->codes, scd->ncodes, scd->info, scd->ninfo, opcbfunc, scd))) {
if (PMIX_SUCCESS == (rc = pmix_host_server.register_events(scd->codes, scd->ncodes, scd->info, scd->ninfo, regevopcbfunc, scd))) {
/* the host will call us back when completed */
pmix_output_verbose(2, pmix_server_globals.event_output,
"server register events: host server processing event registration");
if (NULL != affected) {
free(affected);
}
return rc;
} else if (PMIX_OPERATION_SUCCEEDED == rc) {
/* we need to check cached notifications, but we want to ensure
* that occurs _after_ the client returns from registering the
* event handler in case the event is flagged for do_not_cache.
* Setup an event to fire after we return as that means it will
* occur after we send the registration response back to the client,
* thus guaranteeing that the client will get their registration
* callback prior to delivery of an event notification */
PMIX_RETAIN(peer);
scd->peer = peer;
scd->procs = affected;
scd->nprocs = naffected;
scd->opcbfunc = NULL;
scd->cbdata = NULL;
PMIX_THREADSHIFT(scd, _check_cached_events);
return rc;
} else {
/* host returned a genuine error and won't be calling the callback function */
pmix_output_verbose(2, pmix_server_globals.event_output,
"server register events: host server reg events returned rc =%d", rc);
if (NULL != scd->codes) {
free(scd->codes);
}
if (NULL != scd->info) {
PMIX_INFO_FREE(scd->info, scd->ninfo);
}
PMIX_RELEASE(scd);
goto cleanup;
}
} else {
rc = PMIX_OPERATION_SUCCEEDED;
/* we need to check cached notifications, but we want to ensure
* that occurs _after_ the client returns from registering the
* event handler in case the event is flagged for do_not_cache.
* Setup an event to fire after we return as that means it will
* occur after we send the registration response back to the client,
* thus guaranteeing that the client will get their registration
* callback prior to delivery of an event notification */
scd = PMIX_NEW(pmix_setup_caddy_t);
PMIX_RETAIN(peer);
scd->peer = peer;
scd->codes = codes;
scd->ncodes = ncodes;
scd->procs = affected;
scd->nprocs = naffected;
scd->opcbfunc = NULL;
scd->cbdata = NULL;
PMIX_THREADSHIFT(scd, _check_cached_events);
if (NULL != info) {
PMIX_INFO_FREE(info, ninfo);
}
return rc;
}
cleanup:
@ -1940,144 +2291,12 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer,
if (NULL != info) {
PMIX_INFO_FREE(info, ninfo);
}
if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) {
if (NULL != codes) {
free(codes);
}
if (NULL != affected) {
PMIX_PROC_FREE(affected, naffected);
}
return rc;
}
/* check if any matching notifications have been cached */
rngtrk.procs = NULL;
rngtrk.nprocs = 0;
for (i=0; i < pmix_globals.max_events; i++) {
pmix_hotel_knock(&pmix_globals.notifications, i, (void**)&cd);
if (NULL == cd) {
continue;
}
found = false;
if (NULL == codes) {
if (!cd->nondefault) {
/* they registered a default event handler - always matches */
found = true;
}
} else {
for (k=0; k < ncodes; k++) {
if (codes[k] == cd->status) {
found = true;
break;
}
}
}
if (!found) {
continue;
}
/* check if the affected procs (if given) match those they
* wanted to know about */
if (!pmix_notify_check_affected(cd->affected, cd->naffected,
affected, naffected)) {
continue;
}
/* check the range */
if (NULL == cd->targets) {
rngtrk.procs = &cd->source;
rngtrk.nprocs = 1;
} else {
rngtrk.procs = cd->targets;
rngtrk.nprocs = cd->ntargets;
}
rngtrk.range = cd->range;
PMIX_LOAD_PROCID(&proc, peer->info->pname.nspace, peer->info->pname.rank);
if (!pmix_notify_check_range(&rngtrk, &proc)) {
continue;
}
/* if we were given specific targets, check if this is one */
found = false;
if (NULL != cd->targets) {
matched = false;
for (n=0; n < cd->ntargets; n++) {
/* if the source of the event is the same peer just registered, then ignore it
* as the event notification system will have already locally
* processed it */
if (PMIX_CHECK_PROCID(&cd->source, &peer->info->pname)) {
continue;
}
if (PMIX_CHECK_PROCID(&peer->info->pname, &cd->targets[n])) {
matched = true;
/* track the number of targets we have left to notify */
--cd->nleft;
/* if this is the last one, then evict this event
* from the cache */
if (0 == cd->nleft) {
pmix_hotel_checkout(&pmix_globals.notifications, cd->room);
found = true; // mark that we should release cd
}
break;
}
}
if (!matched) {
/* do not notify this one */
continue;
}
}
/* all matches - notify */
relay = PMIX_NEW(pmix_buffer_t);
if (NULL == relay) {
/* nothing we can do */
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
ret = PMIX_ERR_NOMEM;
break;
}
/* pack the info data stored in the event */
PMIX_BFROPS_PACK(ret, peer, relay, &cmd, 1, PMIX_COMMAND);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
PMIX_BFROPS_PACK(ret, peer, relay, &cd->status, 1, PMIX_STATUS);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
PMIX_BFROPS_PACK(ret, peer, relay, &cd->source, 1, PMIX_PROC);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
PMIX_BFROPS_PACK(ret, peer, relay, &cd->ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
if (0 < cd->ninfo) {
PMIX_BFROPS_PACK(ret, peer, relay, cd->info, cd->ninfo, PMIX_INFO);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
break;
}
}
PMIX_SERVER_QUEUE_REPLY(ret, peer, 0, relay);
if (PMIX_SUCCESS != ret) {
PMIX_RELEASE(relay);
}
if (found) {
PMIX_RELEASE(cd);
}
}
if (NULL != codes) {
free(codes);
}
if (NULL != affected) {
PMIX_PROC_FREE(affected, naffected);
}
if (PMIX_SUCCESS != ret) {
rc = ret;
}
return rc;
}
@ -3539,14 +3758,16 @@ static void _grpcbfunc(int sd, short argc, void *cbdata)
* store it for us before releasing the group members */
if (NULL != bo) {
PMIX_CONSTRUCT(&xfer, pmix_buffer_t);
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &xfer, bo->bytes, bo->size);
PMIX_CONSTRUCT(&nslist, pmix_list_t);
// collect the pmix_namespace_t's of all local participants
/* Collect the nptr list with uniq GDS components of all local
* participants. It does not allow multiple storing to the
* same GDS if participants have mutual GDS. */
PMIX_LIST_FOREACH(cd, &trk->local_cbs, pmix_server_caddy_t) {
// see if we already have this nspace
found = false;
PMIX_LIST_FOREACH(nptr, &nslist, pmix_nspace_caddy_t) {
if (nptr->ns == cd->peer->nptr) {
if (0 == strcmp(nptr->ns->compat.gds->name,
cd->peer->nptr->compat.gds->name)) {
found = true;
break;
}
@ -3561,6 +3782,7 @@ static void _grpcbfunc(int sd, short argc, void *cbdata)
}
PMIX_LIST_FOREACH(nptr, &nslist, pmix_nspace_caddy_t) {
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &xfer, bo->bytes, bo->size);
PMIX_GDS_STORE_MODEX(ret, nptr->ns, &xfer, trk);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);

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

@ -128,7 +128,35 @@ pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg)
return PMIX_SUCCESS;
}
pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite)
pmix_status_t pmix_argv_append_unique_idx(int *idx, char ***argv, const char *arg)
{
int i;
pmix_status_t rc;
/* if the provided array is NULL, then the arg cannot be present,
* so just go ahead and append
*/
if (NULL == *argv) {
goto add;
}
/* see if this arg is already present in the array */
for (i=0; NULL != (*argv)[i]; i++) {
if (0 == strcmp(arg, (*argv)[i])) {
/* already exists */
*idx = i;
return PMIX_SUCCESS;
}
}
add:
if (PMIX_SUCCESS != (rc = pmix_argv_append_nosize(argv, arg))) {
return rc;
}
*idx = pmix_argv_count(*argv)-1;
return PMIX_SUCCESS;
}
pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg)
{
int i;
@ -142,11 +170,7 @@ pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool
/* see if this arg is already present in the array */
for (i=0; NULL != (*argv)[i]; i++) {
if (0 == strcmp(arg, (*argv)[i])) {
/* already exists - are we authorized to overwrite? */
if (overwrite) {
free((*argv)[i]);
(*argv)[i] = strdup(arg);
}
/* already exists */
return PMIX_SUCCESS;
}
}

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

@ -15,8 +15,8 @@
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved.
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
*
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -110,16 +110,32 @@ PMIX_EXPORT pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg
*
* @param argv Pointer to an argv array.
* @param str Pointer to the string to append.
* @param bool Whether or not to overwrite a matching value if found
*
* @retval PMIX_SUCCESS On success
* @retval PMIX_ERROR On failure
*
* This function is identical to the pmix_argv_append_nosize() function
* except that it only appends the provided argument if it does not already
* exist in the provided array, or overwrites it if it is.
* exist in the provided array.
*/
PMIX_EXPORT pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite);
PMIX_EXPORT pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg);
/**
* Append to an argv-style array, but only if the provided argument
* doesn't already exist somewhere in the array. Ignore the size of the array.
* Defines the index of the found/added item in the array.
*
* @param idx Index the found/added item in the array.
* @param argv Pointer to an argv array.
* @param str Pointer to the string to append.
*
* @retval PMIX_SUCCESS On success
* @retval PMIX_ERROR On failure
*
* This function is identical to the pmix_argv_append_unique_nosize() function
* but it has an extra argument defining the index of the item in the array.
*/
PMIX_EXPORT pmix_status_t pmix_argv_append_unique_idx(int *idx, char ***argv, const char *arg);
/**
* Free a NULL-terminated argv array.

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

@ -273,6 +273,8 @@ PMIX_EXPORT const char* PMIx_Error_string(pmix_status_t errnum)
case PMIX_ERR_TEMP_UNAVAILABLE:
return "PMIX TEMPORARILY UNAVAILABLE";
case PMIX_LAUNCH_COMPLETE:
return "PMIX LAUNCH COMPLETE";
case PMIX_MAX_ERR_CONSTANT:
return "PMIX_ERR_WILDCARD";