diff --git a/.gitignore b/.gitignore index 50cddfeacb7..d9de74cae8f 100644 --- a/.gitignore +++ b/.gitignore @@ -401,6 +401,24 @@ opal/mca/pmix/ext3x/ext3x_client.c opal/mca/pmix/ext3x/ext3x_component.c opal/mca/pmix/ext3x/ext3x_server_north.c opal/mca/pmix/ext3x/ext3x_server_south.c +opal/mca/pmix/pmix3x/pmix/config/mca_library_paths.txt +opal/mca/pmix/pmix3x/pmix/config/test-driver +opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl opal/tools/opal-checkpoint/opal-checkpoint opal/tools/opal-checkpoint/opal-checkpoint.1 diff --git a/opal/mca/pmix/pmix3x/pmix/LICENSE b/opal/mca/pmix/pmix3x/pmix/LICENSE index 3eb0a094e01..9f9a1b943ba 100644 --- a/opal/mca/pmix/pmix3x/pmix/LICENSE +++ b/opal/mca/pmix/pmix3x/pmix/LICENSE @@ -47,6 +47,8 @@ Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights reserved. Copyright (c) 2013-2019 Intel, Inc. All rights reserved. Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved. +Copyright (c) 2019 Amazon.com, Inc. or its affiliates. All Rights + reserved. $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix3x/pmix/Makefile.am b/opal/mca/pmix/pmix3x/pmix/Makefile.am index 78fdedaafce..47e21332730 100644 --- a/opal/mca/pmix/pmix3x/pmix/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/Makefile.am @@ -11,7 +11,9 @@ # All rights reserved. # Copyright (c) 2006-2016 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) 2019 Amazon.com, Inc. or its affiliates. All Rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -25,6 +27,7 @@ ACLOCAL_AMFLAGS = -I ./config SUBDIRS = config contrib include src etc +AM_DISTCHECK_CONFIGURE_FLAGS = --disable-dlopen headers = sources = diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index abc79780523..dd478a9a87e 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -1,5 +1,5 @@ Copyright (c) 2015-2019 Intel, Inc. All rights reserved. -Copyright (c) 2017 IBM Corporation. All rights reserved. +Copyright (c) 2017-2019 IBM Corporation. All rights reserved. $COPYRIGHT$ Additional copyrights may follow @@ -21,6 +21,51 @@ example, a bug might be fixed in the master, and then moved to multiple release branches. +3.1.3 -- TBD +---------------------- +- PR #1096: Restore PMIX_NUM_SLOTS for backward compatibility +- PR #1106: Automatically generate PMIX_NUMERIC_VERSION +- PR #1143: Fix tool connection handshake for tools that are registered + clients +- PR #1163: Fix a compiler warning in atomics on POWER arch +- PR #1162: Fix race condition when clients fail while in a PMIx + collective operation +- PR #1166: Fix a regression in spinlock atomics +- PR #1159: Fix missing pointer update when shared memory segment + was re-attached +- PR #1180: Remove dependency on C++ compiler for thread detection +- PR #1180: Add detection for Flex when building in non-tarball situations +- PR #1165: Add dependency on libevent-devel to rpm spec file +- PR #1188: Link libpmix.so to MCA component libraries +- PR #1194: Ensure any cached notifications arrive after registration completes +- PR #1205: Add "make check" support +- PR #1209: Update configure logic for clock_gettime +- PR #1213/#1217/#1221: Add configure option "--enable-nonglobal-dlopen" + If the MCA component libraries should link back to libpmix.so +- PR #1231: SPEC: Allow splitting PMIx in pmix and pmix-libpmi packages +- PR #1222: Fix case of multiple launcher calls in job script +- PR #1237: Avoid double-free of collective tracker +- PR #1237: Ensure all participants are notified of fence complete +- PR #1237: Ensure all participants are notified of connect and disconnect complete +- PR #1250: Fix PMIx_server_finalize hang (rare) +- PR #1271: PTL/usock doesn't support tools +- PR #1280: Fix the PTL connection establishment protocol +- PR #1280: Fix tool connection in psec/handshake mode +- PR #1289: Avoid output_verbose overhead when it won't print +- PR #1296: Allow setup_fork to proceed even if gdds and pnet don't contribute +- PR #1296: Allow servers to pass NULL module +- PR #1297: Provide internal blocking ability to the register/deregister fns +- PR #1298: Add dummy handshake component to psec framework for testing +- PR #1303: Allow jobs to not specify proc-level info +- PR #1304: Provide proc data in cases where host does not +- PR #1305: Add some more values that can be computed +- PR #1308: Add missing tool rendezvous file +- PR #1309: Fix potential integer overflow in regex +- PR #1311: Work around memory bug in older gcc compilers +- PR #1321: Provide memory op hooks in user-facing macros +- PR #1329: Add -fPIC to static builds + + 3.1.2 -- 24 Jan 2019 ---------------------- - Fix a bug in macro identifying system events diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index a81e5274f87..98c143b2677 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -15,7 +15,7 @@ major=3 minor=1 -release=2 +release=3 # greek is used for alpha or beta release tags. If it is non-empty, # it will be appended to the version number. It does not have to be @@ -23,14 +23,14 @@ release=2 # The only requirement is that it must be entirely printable ASCII # characters and have no white space. -greek= +greek=rc4 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=git0f7075f7 +repo_rev=git5e6ec324 # 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="Jan 24, 2019" +date="Jun 25, 2019" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -75,7 +75,7 @@ date="Jan 24, 2019" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=4:22:2 +libpmix_so_version=4:23:2 libpmi_so_version=1:0:0 libpmi2_so_version=1:0:0 diff --git a/opal/mca/pmix/pmix3x/pmix/autogen.pl b/opal/mca/pmix/pmix3x/pmix/autogen.pl index 40b533d2142..9d365783c8e 100755 --- a/opal/mca/pmix/pmix3x/pmix/autogen.pl +++ b/opal/mca/pmix/pmix3x/pmix/autogen.pl @@ -4,7 +4,7 @@ # Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2015 IBM Corporation. All rights reserved. @@ -37,6 +37,9 @@ # Sanity check file my $topdir_file = "include/pmix.h"; my $dnl_line = "dnl ---------------------------------------------------------------------------"; +# The text file we'll write at the end that will contain +# all the mca component directory paths +my $mca_library_paths_file = "config/mca_library_paths.txt"; # Data structures to fill up with all the stuff we find my $mca_found; @@ -137,6 +140,9 @@ sub mca_process_component { push(@{$mca_found->{$framework}->{"components"}}, $found_component); + # save the directory for later to create the paths + # to all the component libraries + push(@subdirs, $cdir); } ############################################################################## @@ -723,6 +729,15 @@ sub in_tarball { print M4 $m4; close(M4); +# Remove the old library path file and write the new one +verbose "==> Writing txt file with all the mca component paths\n"; +unlink($mca_library_paths_file); +open(M4, ">$mca_library_paths_file") || + my_die "Cannot open $mca_library_paths_file"; +my $paths = join(":", @subdirs); +print M4 $paths; +close(M4); + # Run autoreconf verbose "==> Running autoreconf\n"; my $cmd = "autoreconf -ivf --warnings=all,no-obsolete,no-override -I config"; diff --git a/opal/mca/pmix/pmix3x/pmix/config/Makefile.am b/opal/mca/pmix/pmix3x/pmix/config/Makefile.am index 3793162404c..ebc3af9d96a 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/config/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. @@ -44,7 +44,8 @@ EXTRA_DIST = \ pmix_setup_cc.m4 \ pmix_setup_zlib.m4 \ pmix_setup_libevent.m4 \ - pmix_mca_priority_sort.pl + pmix_mca_priority_sort.pl \ + mca_library_paths.txt maintainer-clean-local: diff --git a/opal/mca/pmix/pmix3x/pmix/config/distscript.sh b/opal/mca/pmix/pmix3x/pmix/config/distscript.sh index de41d2ba7b6..e5c948f15f1 100755 --- a/opal/mca/pmix/pmix3x/pmix/config/distscript.sh +++ b/opal/mca/pmix/pmix3x/pmix/config/distscript.sh @@ -11,11 +11,11 @@ # 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. +# Copyright (c) 2017-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -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 diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 index 5d1660649f5..a90e23b9795 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 @@ -18,8 +18,8 @@ dnl reserved. dnl Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved. dnl Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved. dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved. -dnl Copyright (c) 2015-2017 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2015-2019 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2016 Mellanox Technologies, Inc. dnl All rights reserved. dnl @@ -120,9 +120,11 @@ AC_DEFUN([PMIX_SETUP_CORE],[ pmixmajor=${PMIX_MAJOR_VERSION}L pmixminor=${PMIX_MINOR_VERSION}L pmixrelease=${PMIX_RELEASE_VERSION}L + pmixnumeric=$(printf 0x%4.4x%2.2x%2.2x $PMIX_MAJOR_VERSION $PMIX_MINOR_VERSION $PMIX_RELEASE_VERSION) AC_SUBST(pmixmajor) AC_SUBST(pmixminor) AC_SUBST(pmixrelease) + AC_SUBST(pmixnumeric) AC_CONFIG_FILES(pmix_config_prefix[include/pmix_version.h]) PMIX_GREEK_VERSION="`$PMIX_top_srcdir/config/pmix_get_version.sh $PMIX_top_srcdir/VERSION --greek`" @@ -645,6 +647,11 @@ AC_DEFUN([PMIX_SETUP_CORE],[ pmix_show_title "Library and Function tests" + # Darwin doesn't need -lutil, as it's something other than this -lutil. + PMIX_SEARCH_LIBS_CORE([openpty], [util]) + + PMIX_SEARCH_LIBS_CORE([gethostbyname], [nsl]) + PMIX_SEARCH_LIBS_CORE([socket], [socket]) # IRIX and CentOS have dirname in -lgen, usually in libc @@ -653,6 +660,9 @@ AC_DEFUN([PMIX_SETUP_CORE],[ # Darwin doesn't need -lm, as it's a symlink to libSystem.dylib PMIX_SEARCH_LIBS_CORE([ceil], [m]) + # -lrt might be needed for clock_gettime + PMIX_SEARCH_LIBS_CORE([clock_gettime], [rt]) + AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strsignal socketpair strncpy_s usleep statfs statvfs getpeereid getpeerucred strnlen posix_fallocate tcgetpgrp]) # On some hosts, htonl is a define, so the AC_CHECK_FUNC will get @@ -715,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" @@ -726,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 ################################## @@ -844,6 +852,32 @@ AC_DEFUN([PMIX_SETUP_CORE],[ AC_SUBST(pmixlibdir) AC_SUBST(pmixincludedir) + ############################################################################ + # setup "make check" + ############################################################################ + PMIX_BUILT_TEST_PREFIX=$PMIX_top_builddir + AC_SUBST(PMIX_BUILT_TEST_PREFIX) + # expose the mca component library paths in the build system + pathfile=$PMIX_top_srcdir/config/mca_library_paths.txt + PMIX_COMPONENT_LIBRARY_PATHS=`cat $pathfile` + AC_SUBST(PMIX_COMPONENT_LIBRARY_PATHS) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests00.pl], [chmod +x test/run_tests00.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests01.pl], [chmod +x test/run_tests01.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests02.pl], [chmod +x test/run_tests02.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests03.pl], [chmod +x test/run_tests03.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests04.pl], [chmod +x test/run_tests04.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests05.pl], [chmod +x test/run_tests05.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests06.pl], [chmod +x test/run_tests06.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests07.pl], [chmod +x test/run_tests07.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests08.pl], [chmod +x test/run_tests08.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests09.pl], [chmod +x test/run_tests09.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests10.pl], [chmod +x test/run_tests10.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests11.pl], [chmod +x test/run_tests11.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests12.pl], [chmod +x test/run_tests12.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests13.pl], [chmod +x test/run_tests13.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests14.pl], [chmod +x test/run_tests14.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests15.pl], [chmod +x test/run_tests15.pl]) + ############################################################################ # final output ############################################################################ @@ -883,6 +917,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" @@ -898,7 +936,7 @@ AC_DEFUN([PMIX_DEFINE_ARGS],[ AC_ARG_ENABLE([embedded-mode], [AC_HELP_STRING([--enable-embedded-mode], [Using --enable-embedded-mode causes PMIx to skip a few configure checks and install nothing. It should only be used when building PMIx within the scope of a larger package.])]) - AS_IF([test ! -z "$enable_embedded_mode" && test "$enable_embedded_mode" = "yes"], + AS_IF([test "$enable_embedded_mode" = "yes"], [pmix_mode=embedded pmix_install_primary_headers=no AC_MSG_RESULT([yes])], @@ -910,8 +948,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 @@ -962,7 +1008,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]) @@ -1133,6 +1178,41 @@ fi AM_CONDITIONAL([PMIX_INSTALL_BINARIES], [test $WANT_PMIX_BINARIES -eq 1]) + +# see if they want to disable non-RTLD_GLOBAL dlopen +AC_MSG_CHECKING([if want to support dlopen of non-global namespaces]) +AC_ARG_ENABLE([nonglobal-dlopen], + AC_HELP_STRING([--enable-nonglobal-dlopen], + [enable non-global dlopen (default: enabled)])) +if test "$enable_nonglobal_dlopen" == "no"; then + AC_MSG_RESULT([no]) + pmix_need_libpmix=0 +else + AC_MSG_RESULT([yes]) + pmix_need_libpmix=1 +fi + +# if someone enables embedded mode but doesn't want to install the +# devel headers, then default nonglobal-dlopen to false +AS_IF([test -z "$enable_nonglobal_dlopen" && test "x$pmix_mode" = "xembedded" && test $WANT_INSTALL_HEADERS -eq 0 && test $pmix_need_libpmix -eq 1], + [pmix_need_libpmix=0]) + +# +# psec/dummy_handshake +# + +AC_MSG_CHECKING([if want build psec/dummy_handshake]) +AC_ARG_ENABLE(dummy-handshake, + AC_HELP_STRING([--enable-dummy-handshake], + [Enables psec dummy component intended to check the PTL handshake scenario (default: disabled)])) +if test "$enable_dummy_handshake" != "yes"; then + AC_MSG_RESULT([no]) + eval "DISABLE_psec_dummy_handshake=1" +else + AC_MSG_RESULT([yes]) + eval "DISABLE_psec_dummy_handshake=0" +fi +AM_CONDITIONAL(MCA_BUILD_PSEC_DUMMY_HANDSHAKE, test "$DISABLE_psec_dummy_handshake" = "0") ])dnl # This must be a standalone routine so that it can be called both by @@ -1148,6 +1228,7 @@ AC_DEFUN([PMIX_DO_AM_CONDITIONALS],[ AM_CONDITIONAL([WANT_PRIMARY_HEADERS], [test "x$pmix_install_primary_headers" = "xyes"]) AM_CONDITIONAL(WANT_INSTALL_HEADERS, test "$WANT_INSTALL_HEADERS" = 1) AM_CONDITIONAL(WANT_PMI_BACKWARD, test "$WANT_PMI_BACKWARD" = 1) + AM_CONDITIONAL(NEED_LIBPMIX, [test "$pmix_need_libpmix" = "1"]) ]) pmix_did_am_conditionals=yes ])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 index 2e2f1fd8f97..b23f66ebb01 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 @@ -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 < conftest.c < -#include -#include -$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 diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_threads.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_threads.m4 index 541e63f726c..050f8735577 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_threads.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_threads.m4 @@ -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" diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_search_libs.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_search_libs.m4 index 9d7a8af9a74..d900c8a93b4 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_search_libs.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_search_libs.m4 @@ -1,7 +1,7 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2014 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -21,7 +21,13 @@ dnl # PMIX_SEARCH_LIBS_COMPONENT. The reason why is because this macro # calls PMIX_WRAPPER_FLAGS_ADD -- see big comment in # pmix_setup_wrappers.m4 for an explanation of why this is bad). +# NOTE: PMIx doesn't have wrapper compilers, so this is not an issue +# here - we leave the note just for downstream compatibility AC_DEFUN([PMIX_SEARCH_LIBS_CORE],[ + + PMIX_VAR_SCOPE_PUSH([LIBS_save add]) + LIBS_save=$LIBS + AC_SEARCH_LIBS([$1], [$2], [pmix_have_$1=1 $3], @@ -31,4 +37,33 @@ AC_DEFUN([PMIX_SEARCH_LIBS_CORE],[ AC_DEFINE_UNQUOTED([PMIX_HAVE_]m4_toupper($1), [$pmix_have_$1], [whether $1 is found and available]) + PMIX_VAR_SCOPE_POP +])dnl + +# PMIX SEARCH_LIBS_COMPONENT(prefix, func, list-of-libraries, +# action-if-found, action-if-not-found, +# other-libraries) +# +# Same as PMIX SEARCH_LIBS_CORE, above, except that we don't call PMIX +# WRAPPER_FLAGS_ADD. Instead, we add it to the ${prefix}_LIBS +# variable (i.e., $prefix is usually "framework_component", such as +# "fbtl_posix"). +AC_DEFUN([PMIX_SEARCH_LIBS_COMPONENT],[ + + PMIX_VAR_SCOPE_PUSH([LIBS_save add]) + LIBS_save=$LIBS + + AC_SEARCH_LIBS([$2], [$3], + [ # Found it! See if anything was added to LIBS + add=`printf '%s\n' "$LIBS" | sed -e "s/$LIBS_save$//"` + AS_IF([test -n "$add"], + [PMIX_FLAGS_APPEND_UNIQ($1_LIBS, [$add])]) + $1_have_$2=1 + $4], + [$1_have_$2=0 + $5], [$6]) + + AC_DEFINE_UNQUOTED([PMIX_HAVE_]m4_toupper($1), [$$1_have_$2], + [whether $1 is found and available]) + PMIX_VAR_SCOPE_POP ])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 index 8f6ed75176d..a17313259a2 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 @@ -17,11 +17,7 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[ [AC_HELP_STRING([--with-hwloc-header=HEADER], [The value that should be included in C files to include hwloc.h])]) - AC_ARG_ENABLE([embedded-hwloc], - [AC_HELP_STRING([--enable-embedded-hwloc], - [Enable use of locally embedded hwloc])]) - - AS_IF([test "$enable_embedded_hwloc" = "yes"], + AS_IF([test "$pmix_mode" = "embedded"], [_PMIX_HWLOC_EMBEDDED_MODE], [_PMIX_HWLOC_EXTERNAL]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 index 2348a87aacb..949af1cfd58 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 @@ -19,11 +19,7 @@ AC_DEFUN([PMIX_LIBEVENT_CONFIG],[ [AC_HELP_STRING([--with-libevent-header=HEADER], [The value that should be included in C files to include event.h])]) - AC_ARG_ENABLE([embedded-libevent], - [AC_HELP_STRING([--enable-embedded-libevent], - [Enable use of locally embedded libevent])]) - - AS_IF([test "$enable_embedded_libevent" = "yes"], + AS_IF([test "$pmix_mode" = "embedded"], [_PMIX_LIBEVENT_EMBEDDED_MODE], [_PMIX_LIBEVENT_EXTERNAL]) diff --git a/opal/mca/pmix/pmix3x/pmix/configure.ac b/opal/mca/pmix/pmix3x/pmix/configure.ac index 08f6981b8d5..53c0d64441f 100644 --- a/opal/mca/pmix/pmix3x/pmix/configure.ac +++ b/opal/mca/pmix/pmix3x/pmix/configure.ac @@ -44,13 +44,27 @@ m4_include([config/autogen_found_items.m4]) AC_INIT([pmix], [m4_normalize(esyscmd([config/pmix_get_version.sh VERSION --tarball]))], - [http://pmix.github.io/master], [pmix]) + [https://github.com/pmix/pmix/issues], [pmix]) AC_PREREQ(2.69) AC_CONFIG_AUX_DIR(./config) # Note that this directory must *exactly* match what was specified via # -I in ACLOCAL_AMFLAGS in the top-level Makefile.am. AC_CONFIG_MACRO_DIR(./config) +# autotools expects to perform tests without interference +# from user-provided CFLAGS, particularly -Werror flags. +# Search for them here and cache any we find +PMIX_CFLAGS_cache= +PMIX_CFLAGS_pass= +for val in $CFLAGS; do + if echo "$val" | grep -q -e "-W"; then + PMIX_CFLAGS_cache="$PMIX_CFLAGS_cache $val"; + else + PMIX_CFLAGS_pass="$PMIX_CFLAGS_pass $val"; + fi +done +CFLAGS=$PMIX_CFLAGS_pass + PMIX_CAPTURE_CONFIGURE_CLI([PMIX_CONFIGURE_CLI]) # Get our platform support file. This has to be done very, very early @@ -157,6 +171,9 @@ LT_PREREQ([2.2.6]) pmix_enable_shared="$enable_shared" pmix_enable_static="$enable_static" +AS_IF([test ! -z "$enable_static" && test "$enable_static" == "yes"], + [CFLAGS="$CFLAGS -fPIC"]) + AM_ENABLE_SHARED AM_DISABLE_STATIC @@ -205,7 +222,17 @@ AS_IF([test -z "$CC_FOR_BUILD"],[ AC_SUBST([CC_FOR_BUILD], [$CC]) ]) +# restore any user-provided Werror flags +AS_IF([test ! -z "$PMIX_CFLAGS_cache"], [CFLAGS="$CFLAGS $PMIX_CFLAGS_cache"]) + +# Delay setting pickyness until here so we +# don't break configure code tests +#if test "$WANT_PICKY_COMPILER" = "1"; then +# CFLAGS="$CFLAGS -Wall -Wextra -Werror" +#fi + # Cleanup duplicate flags +PMIX_FLAGS_UNIQ(CFLAGS) PMIX_FLAGS_UNIQ(CPPFLAGS) PMIX_FLAGS_UNIQ(LDFLAGS) PMIX_FLAGS_UNIQ(LIBS) @@ -232,6 +259,17 @@ AC_MSG_RESULT([$LDFLAGS]) AC_MSG_CHECKING([final LIBS]) AC_MSG_RESULT([$LIBS]) +#################################################################### +# -Werror for CI scripts +#################################################################### + +AC_ARG_ENABLE(werror, + AC_HELP_STRING([--enable-werror], + [Treat compiler warnings as errors]), +[ + CFLAGS="$CFLAGS -Werror" +]) + #################################################################### # Version information #################################################################### diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball b/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball index c9a6d19c646..f3fc22b5e49 100755 --- a/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball +++ b/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball @@ -10,8 +10,10 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2015-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2019 Amazon.com, Inc. or its affiliates. All Rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -108,14 +110,6 @@ if test "$LIBEVENT" != ""; then config_args="--with-libevent=$LIBEVENT $config_args" fi -# if config_args isn't empty, then add that to the distcheck_flags -# (because we'll assumedly need those to run configure under "make -# distcheck"). -if test "$config_args" != ""; then - echo "*** Adding to distcheck_flags: $config_args" - distcheck_flags="$distcheck_flags AM_DISTCHECK_CONFIGURE_FLAGS=\"$config_args\"" -fi - export DISTCHECK_CONFIGURE_FLAGS=$config_args # diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index ba7ec977ba5..44b3810a926 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -12,7 +12,7 @@ # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.1.2 +Version: 3.1.3rc4 Release: 1%{?dist} License: BSD Group: Development/Libraries @@ -204,6 +204,7 @@ Prefix: %{_prefix} Provides: pmix Provides: pmix = %{version} BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root +BuildRequires: libevent-devel %if %{disable_auto_requires} AutoReq: no %endif @@ -230,6 +231,22 @@ scalability. This RPM contains all the tools necessary to compile and link against PMIx. +# if build_all_in_one_rpm = 0, build split packages +%if !%{build_all_in_one_rpm} +%package libpmi +Summary: PMI-1 and PMI-2 compatibility libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Conflicts: slurm-libpmi + +%description libpmi +The %{name}-libpmi package contains libpmi and libpmi2 libraries that provide +the respective APIs and a copy of the PMIx library – each API is translated +into its PMIx equivalent. This is especially targeted at apps/libs that are +hardcoded to dlopen “libpmi” or “libpmi2”. +This package conflicts sith slurm-libpmi, which provides its own, incompatible +versions of libpmi.so and libpmi2.so. +%endif + ############################################################################# # # Prepatory Section @@ -346,6 +363,10 @@ export CFLAGS CXXFLAGS FCFLAGS # We don't need that in an RPM. find $RPM_BUILD_ROOT -name config.log -exec rm -f {} \; +# If we build separate RPMs, then move the libpmi.* and libpmi2.* compat libs +# out of the way +find $RPM_BUILD_ROOT -name 'libpmi.' | xargs rm -f + # First, the [optional] modulefile %if %{install_modulefile} @@ -490,6 +511,19 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT %endif %doc README INSTALL LICENSE +# if building separate RPMs, split the compatibility libs +%if !%{build_all_in_one_rpm} +%exclude %{_libdir}/libpmi.* +%exclude %{_libdir}/libpmi2.* +%exclude %{_includedir}/pmi.* +%exclude %{_includedir}/pmi2.* + +%files libpmi +%{_libdir}/libpmi.* +%{_libdir}/libpmi2.* +%{_includedir}/pmi.* +%{_includedir}/pmi2.* +%endif ############################################################################# # @@ -497,6 +531,11 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT # ############################################################################# %changelog +* Tue Apr 30 2019 Kilian Cavalotti +- Enable multiple RPMs build to allow backward compatibility PMI-1 and PMI-2 + libs to be built separate. "rpmbuild --define 'build_all_in_one_rpm 0' ..." + will build separate pmix and pmix-libpmi RPMs. + * Tue Oct 17 2017 Ralph Castain - Add PMIx bin directory diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in index 35aecfabbc2..a3039ff6748 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in @@ -272,6 +272,7 @@ typedef uint32_t pmix_rank_t; #define PMIX_LOCAL_SIZE "pmix.local.size" // (uint32_t) #procs in this job on this node #define PMIX_NODE_SIZE "pmix.node.size" // (uint32_t) #procs across all jobs on this node #define PMIX_MAX_PROCS "pmix.max.size" // (uint32_t) max #procs for this job +#define PMIX_NUM_SLOTS "pmix.num.slots" // (uint32_t) #slots allocated #define PMIX_NUM_NODES "pmix.num.nodes" // (uint32_t) #nodes in this nspace @@ -989,6 +990,23 @@ typedef uint16_t pmix_iof_channel_t; #define PMIX_FWD_STDDIAG_CHANNEL 0x0008 #define PMIX_FWD_ALL_CHANNELS 0x00ff +/* define some "hooks" external libraries can use to + * intercept memory allocation/release operations */ +static inline void* pmix_malloc(size_t n) +{ + return malloc(n); +} + +static inline void pmix_free(void *m) +{ + free(m); +} + +static inline void* pmix_calloc(size_t n, size_t m) +{ + return calloc(n, m); +} + /* declare a convenience macro for checking keys */ #define PMIX_CHECK_KEY(a, b) \ (0 == strncmp((a)->key, (b), PMIX_MAX_KEYLEN)) @@ -1030,7 +1048,7 @@ typedef struct pmix_byte_object { #define PMIX_BYTE_OBJECT_CREATE(m, n) \ do { \ - (m) = (pmix_byte_object_t*)malloc((n) * sizeof(pmix_byte_object_t)); \ + (m) = (pmix_byte_object_t*)pmix_malloc((n) * sizeof(pmix_byte_object_t)); \ if (NULL != (m)) { \ memset((m), 0, (n)*sizeof(pmix_byte_object_t)); \ } \ @@ -1045,7 +1063,7 @@ typedef struct pmix_byte_object { #define PMIX_BYTE_OBJECT_DESTRUCT(m) \ do { \ if (NULL != (m)->bytes) { \ - free((m)->bytes); \ + pmix_free((m)->bytes); \ } \ } while(0) @@ -1055,10 +1073,10 @@ typedef struct pmix_byte_object { if (NULL != (m)) { \ for (_bon=0; _bon < n; _bon++) { \ if (NULL != (m)[_bon].bytes) { \ - free((m)[_bon].bytes); \ + pmix_free((m)[_bon].bytes); \ } \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while(0) @@ -1089,7 +1107,7 @@ typedef struct { #define PMIX_ENVAR_CREATE(m, n) \ do { \ - (m) = (pmix_envar_t*)calloc((n) , sizeof(pmix_envar_t)); \ + (m) = (pmix_envar_t*)pmix_calloc((n) , sizeof(pmix_envar_t)); \ } while (0) #define PMIX_ENVAR_FREE(m, n) \ do { \ @@ -1098,7 +1116,7 @@ typedef struct { for (_ek=0; _ek < (n); _ek++) { \ PMIX_ENVAR_DESTRUCT(&(m)[_ek]); \ } \ - free((m)); \ + pmix_free((m)); \ } \ } while (0) #define PMIX_ENVAR_CONSTRUCT(m) \ @@ -1110,11 +1128,11 @@ typedef struct { #define PMIX_ENVAR_DESTRUCT(m) \ do { \ if (NULL != (m)->envar) { \ - free((m)->envar); \ + pmix_free((m)->envar); \ (m)->envar = NULL; \ } \ if (NULL != (m)->value) { \ - free((m)->value); \ + pmix_free((m)->value); \ (m)->value = NULL; \ } \ } while(0) @@ -1148,14 +1166,14 @@ typedef struct pmix_data_buffer { } pmix_data_buffer_t; #define PMIX_DATA_BUFFER_CREATE(m) \ do { \ - (m) = (pmix_data_buffer_t*)calloc(1, sizeof(pmix_data_buffer_t)); \ + (m) = (pmix_data_buffer_t*)pmix_calloc(1, sizeof(pmix_data_buffer_t)); \ } while (0) #define PMIX_DATA_BUFFER_RELEASE(m) \ do { \ if (NULL != (m)->base_ptr) { \ - free((m)->base_ptr); \ + pmix_free((m)->base_ptr); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) #define PMIX_DATA_BUFFER_CONSTRUCT(m) \ @@ -1163,7 +1181,7 @@ typedef struct pmix_data_buffer { #define PMIX_DATA_BUFFER_DESTRUCT(m) \ do { \ if (NULL != (m)->base_ptr) { \ - free((m)->base_ptr); \ + pmix_free((m)->base_ptr); \ (m)->base_ptr = NULL; \ } \ (m)->pack_ptr = NULL; \ @@ -1194,12 +1212,12 @@ typedef struct pmix_proc { } pmix_proc_t; #define PMIX_PROC_CREATE(m, n) \ do { \ - (m) = (pmix_proc_t*)calloc((n) , sizeof(pmix_proc_t)); \ + (m) = (pmix_proc_t*)pmix_calloc((n) , sizeof(pmix_proc_t)); \ } while (0) #define PMIX_PROC_RELEASE(m) \ do { \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1213,7 +1231,7 @@ typedef struct pmix_proc { #define PMIX_PROC_FREE(m, n) \ do { \ if (NULL != (m)) { \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1263,7 +1281,7 @@ typedef struct pmix_proc_info { } pmix_proc_info_t; #define PMIX_PROC_INFO_CREATE(m, n) \ do { \ - (m) = (pmix_proc_info_t*)calloc((n) , sizeof(pmix_proc_info_t)); \ + (m) = (pmix_proc_info_t*)pmix_calloc((n) , sizeof(pmix_proc_info_t)); \ } while (0) #define PMIX_PROC_INFO_RELEASE(m) \ @@ -1279,11 +1297,11 @@ typedef struct pmix_proc_info { #define PMIX_PROC_INFO_DESTRUCT(m) \ do { \ if (NULL != (m)->hostname) { \ - free((m)->hostname); \ + pmix_free((m)->hostname); \ (m)->hostname = NULL; \ } \ if (NULL != (m)->executable_name) { \ - free((m)->executable_name); \ + pmix_free((m)->executable_name); \ (m)->executable_name = NULL; \ } \ } while(0) @@ -1295,7 +1313,7 @@ typedef struct pmix_proc_info { for (_k=0; _k < (n); _k++) { \ PMIX_PROC_INFO_DESTRUCT(&(m)[_k]); \ } \ - free((m)); \ + pmix_free((m)); \ } \ } while (0) @@ -1362,7 +1380,7 @@ typedef struct pmix_value { do { \ int _ii; \ pmix_value_t *_v; \ - (m) = (pmix_value_t*)calloc((n), sizeof(pmix_value_t)); \ + (m) = (pmix_value_t*)pmix_calloc((n), sizeof(pmix_value_t)); \ _v = (pmix_value_t*)(m); \ if (NULL != (m)) { \ for (_ii=0; _ii < (int)(n); _ii++) { \ @@ -1375,7 +1393,7 @@ typedef struct pmix_value { #define PMIX_VALUE_RELEASE(m) \ do { \ PMIX_VALUE_DESTRUCT((m)); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1396,7 +1414,7 @@ typedef struct pmix_value { for (_vv=0; _vv < (n); _vv++) { \ PMIX_VALUE_DESTRUCT(&((m)[_vv])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1410,7 +1428,7 @@ typedef struct pmix_value { #define PMIX_VALUE_XFER(r, v, s) \ do { \ if (NULL == (v)) { \ - (v) = (pmix_value_t*)malloc(sizeof(pmix_value_t)); \ + (v) = (pmix_value_t*)pmix_malloc(sizeof(pmix_value_t)); \ if (NULL == (v)) { \ (r) = PMIX_ERR_NOMEM; \ } else { \ @@ -1488,9 +1506,11 @@ typedef struct pmix_info { #define PMIX_INFO_CREATE(m, n) \ do { \ pmix_info_t *_i; \ - (m) = (pmix_info_t*)calloc((n), sizeof(pmix_info_t)); \ - _i = (pmix_info_t*)(m); \ - _i[(n)-1].flags = PMIX_INFO_ARRAY_END; \ + (m) = (pmix_info_t*)pmix_calloc((n), sizeof(pmix_info_t)); \ + if (NULL != (m)) { \ + _i = (pmix_info_t*)(m); \ + _i[(n)-1].flags = PMIX_INFO_ARRAY_END; \ + } \ } while (0) #define PMIX_INFO_CONSTRUCT(m) \ @@ -1511,7 +1531,7 @@ typedef struct pmix_info { for (_is=0; _is < (n); _is++) { \ PMIX_INFO_DESTRUCT(&((m)[_is])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1570,13 +1590,13 @@ typedef struct pmix_pdata { /* utility macros for working with pmix_pdata_t structs */ #define PMIX_PDATA_CREATE(m, n) \ do { \ - (m) = (pmix_pdata_t*)calloc((n), sizeof(pmix_pdata_t)); \ + (m) = (pmix_pdata_t*)pmix_calloc((n), sizeof(pmix_pdata_t)); \ } while (0) #define PMIX_PDATA_RELEASE(m) \ do { \ PMIX_VALUE_DESTRUCT(&(m)->value); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1599,7 +1619,7 @@ typedef struct pmix_pdata { for (_ps=0; _ps < (n); _ps++) { \ PMIX_PDATA_DESTRUCT(&(_pdf[_ps])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1640,7 +1660,7 @@ typedef struct pmix_app { /* utility macros for working with pmix_app_t structs */ #define PMIX_APP_CREATE(m, n) \ do { \ - (m) = (pmix_app_t*)calloc((n), sizeof(pmix_app_t)); \ + (m) = (pmix_app_t*)pmix_calloc((n), sizeof(pmix_app_t)); \ } while (0) #define PMIX_APP_INFO_CREATE(m, n) \ @@ -1652,7 +1672,7 @@ typedef struct pmix_app { #define PMIX_APP_RELEASE(m) \ do { \ PMIX_APP_DESTRUCT((m)); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1665,25 +1685,25 @@ typedef struct pmix_app { do { \ size_t _aii; \ if (NULL != (m)->cmd) { \ - free((m)->cmd); \ + pmix_free((m)->cmd); \ (m)->cmd = NULL; \ } \ if (NULL != (m)->argv) { \ for (_aii=0; NULL != (m)->argv[_aii]; _aii++) { \ - free((m)->argv[_aii]); \ + pmix_free((m)->argv[_aii]); \ } \ - free((m)->argv); \ + pmix_free((m)->argv); \ (m)->argv = NULL; \ } \ if (NULL != (m)->env) { \ for (_aii=0; NULL != (m)->env[_aii]; _aii++) { \ - free((m)->env[_aii]); \ + pmix_free((m)->env[_aii]); \ } \ - free((m)->env); \ + pmix_free((m)->env); \ (m)->env = NULL; \ } \ if (NULL != (m)->cwd) { \ - free((m)->cwd); \ + pmix_free((m)->cwd); \ (m)->cwd = NULL; \ } \ if (NULL != (m)->info) { \ @@ -1700,7 +1720,7 @@ typedef struct pmix_app { for (_as=0; _as < (n); _as++) { \ PMIX_APP_DESTRUCT(&((m)[_as])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1715,7 +1735,7 @@ typedef struct pmix_query { /* utility macros for working with pmix_query_t structs */ #define PMIX_QUERY_CREATE(m, n) \ do { \ - (m) = (pmix_query_t*)calloc((n) , sizeof(pmix_query_t)); \ + (m) = (pmix_query_t*)pmix_calloc((n) , sizeof(pmix_query_t)); \ } while (0) #define PMIX_QUERY_QUALIFIERS_CREATE(m, n) \ @@ -1727,7 +1747,7 @@ typedef struct pmix_query { #define PMIX_QUERY_RELEASE(m) \ do { \ PMIX_QUERY_DESTRUCT((m)); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1741,9 +1761,9 @@ typedef struct pmix_query { size_t _qi; \ if (NULL != (m)->keys) { \ for (_qi=0; NULL != (m)->keys[_qi]; _qi++) { \ - free((m)->keys[_qi]); \ + pmix_free((m)->keys[_qi]); \ } \ - free((m)->keys); \ + pmix_free((m)->keys); \ (m)->keys = NULL; \ } \ if (NULL != (m)->qualifiers) { \ @@ -1760,7 +1780,7 @@ typedef struct pmix_query { for (_qs=0; _qs < (n); _qs++) { \ PMIX_QUERY_DESTRUCT(&((m)[_qs])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -2431,7 +2451,7 @@ PMIX_EXPORT pmix_status_t PMIx_Data_pack(const pmix_proc_t *target, * status_code = PMIx_Data_unpack(buffer, (void*)&dest, &num_values, PMIX_INT32); * * num_values = 5; - * string_array = malloc(num_values*sizeof(char *)); + * string_array = pmix_malloc(num_values*sizeof(char *)); * status_code = PMIx_Data_unpack(buffer, (void*)(string_array), &num_values, PMIX_STRING); * * @endcode @@ -2500,20 +2520,20 @@ static inline void pmix_value_destruct(pmix_value_t * m) { if (PMIX_STRING == (m)->type) { if (NULL != (m)->data.string) { - free((m)->data.string); + pmix_free((m)->data.string); (m)->data.string = NULL; } } else if ((PMIX_BYTE_OBJECT == (m)->type) || (PMIX_COMPRESSED_STRING == (m)->type)) { if (NULL != (m)->data.bo.bytes) { - free((m)->data.bo.bytes); + pmix_free((m)->data.bo.bytes); (m)->data.bo.bytes = NULL; (m)->data.bo.size = 0; } } else if (PMIX_DATA_ARRAY == (m)->type) { if (NULL != (m)->data.darray) { pmix_darray_destruct((m)->data.darray); - free((m)->data.darray); + pmix_free((m)->data.darray); (m)->data.darray = NULL; } } else if (PMIX_ENVAR == (m)->type) { @@ -2557,12 +2577,12 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) char **_s = (char**)m->array; size_t _si; for (_si=0; _si < m->size; _si++) { - free(_s[_si]); + pmix_free(_s[_si]); } - free(m->array); + pmix_free(m->array); m->array = NULL; } else { - free(m->array); + pmix_free(m->array); } } } @@ -2598,38 +2618,40 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) PMIX_BYTE == (t) || \ PMIX_INT8 == (t) || \ PMIX_UINT8 == (t)) { \ - (m)->array = calloc((n), sizeof(int8_t)); \ + (m)->array = pmix_calloc((n), sizeof(int8_t)); \ + } else if (PMIX_POINTER == (t)) { \ + (m)->array = pmix_calloc((n), sizeof(void*)); \ } else if (PMIX_STRING == (t)) { \ - (m)->array = calloc((n), sizeof(char*)); \ + (m)->array = pmix_calloc((n), sizeof(char*)); \ } else if (PMIX_SIZE == (t)) { \ - (m)->array = calloc((n), sizeof(size_t)); \ + (m)->array = pmix_calloc((n), sizeof(size_t)); \ } else if (PMIX_PID == (t)) { \ - (m)->array = calloc((n), sizeof(pid_t)); \ + (m)->array = pmix_calloc((n), sizeof(pid_t)); \ } else if (PMIX_INT == (t) || \ PMIX_UINT == (t) || \ PMIX_STATUS == (t)) { \ - (m)->array = calloc((n), sizeof(int)); \ + (m)->array = pmix_calloc((n), sizeof(int)); \ } else if (PMIX_IOF_CHANNEL == (t) || \ PMIX_DATA_TYPE == (t) || \ PMIX_INT16 == (t) || \ PMIX_UINT16 == (t)) { \ - (m)->array = calloc((n), sizeof(int16_t)); \ + (m)->array = pmix_calloc((n), sizeof(int16_t)); \ } else if (PMIX_PROC_RANK == (t) || \ PMIX_INFO_DIRECTIVES == (t) || \ PMIX_INT32 == (t) || \ PMIX_UINT32 == (t)) { \ - (m)->array = calloc((n), sizeof(int32_t)); \ + (m)->array = pmix_calloc((n), sizeof(int32_t)); \ } else if (PMIX_INT64 == (t) || \ PMIX_UINT64 == (t)) { \ - (m)->array = calloc((n), sizeof(int64_t)); \ + (m)->array = pmix_calloc((n), sizeof(int64_t)); \ } else if (PMIX_FLOAT == (t)) { \ - (m)->array = calloc((n), sizeof(float)); \ + (m)->array = pmix_calloc((n), sizeof(float)); \ } else if (PMIX_DOUBLE == (t)) { \ - (m)->array = calloc((n), sizeof(double)); \ + (m)->array = pmix_calloc((n), sizeof(double)); \ } else if (PMIX_TIMEVAL == (t)) { \ - (m)->array = calloc((n), sizeof(struct timeval)); \ + (m)->array = pmix_calloc((n), sizeof(struct timeval)); \ } else if (PMIX_TIME == (t)) { \ - (m)->array = calloc((n), sizeof(time_t)); \ + (m)->array = pmix_calloc((n), sizeof(time_t)); \ } \ } else { \ (m)->array = NULL; \ @@ -2637,7 +2659,7 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) } while(0) #define PMIX_DATA_ARRAY_CREATE(m, n, t) \ do { \ - (m) = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); \ + (m) = (pmix_data_array_t*)pmix_calloc(1, sizeof(pmix_data_array_t)); \ PMIX_DATA_ARRAY_CONSTRUCT((m), (n), (t)); \ } while(0) @@ -2647,7 +2669,7 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) do { \ if (NULL != (m)) { \ PMIX_DATA_ARRAY_DESTRUCT(m); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while(0) diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in index e5a74b5c2e3..a06bbfdfde7 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in @@ -444,6 +444,7 @@ #define pmix_output_close @PMIX_RENAME@pmix_output_close #define pmix_output_finalize @PMIX_RENAME@pmix_output_finalize #define pmix_output_get_verbosity @PMIX_RENAME@pmix_output_get_verbosity +#define pmix_output_check_verbosity @PMIX_RENAME@pmix_output_check_verbosity #define pmix_output_hexdump @PMIX_RENAME@pmix_output_hexdump #define pmix_output_init @PMIX_RENAME@pmix_output_init #define pmix_output_open @PMIX_RENAME@pmix_output_open @@ -452,7 +453,6 @@ #define pmix_output_set_output_file_info @PMIX_RENAME@pmix_output_set_output_file_info #define pmix_output_set_verbosity @PMIX_RENAME@pmix_output_set_verbosity #define pmix_output_switch @PMIX_RENAME@pmix_output_switch -#define pmix_output_verbose @PMIX_RENAME@pmix_output_verbose #define pmix_output_vverbose @PMIX_RENAME@pmix_output_vverbose #define pmix_path_access @PMIX_RENAME@pmix_path_access #define pmix_path_df @PMIX_RENAME@pmix_path_df diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in index 44987a65929..af4a00cd5df 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in @@ -3,6 +3,8 @@ * All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,5 +21,5 @@ #define PMIX_VERSION_MINOR @pmixminor@ #define PMIX_VERSION_RELEASE @pmixrelease@ -#define PMIX_NUMERIC_VERSION 0x00030100 +#define PMIX_NUMERIC_VERSION @pmixnumeric@ #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h index ee605ca8cf1..d03f83de283 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h @@ -13,7 +13,7 @@ * Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -496,7 +496,7 @@ static inline int pmix_atomic_trylock(pmix_atomic_lock_t *lock) { int32_t unlocked = PMIX_ATOMIC_LOCK_UNLOCKED; - bool ret = pmix_atomic_compare_exchange_strong_32 (&lock->u.lock, &unlocked, PMIX_ATOMIC_LOCK_LOCKED); + bool ret = pmix_atomic_compare_exchange_strong_acq_32 (&lock->u.lock, &unlocked, PMIX_ATOMIC_LOCK_LOCKED); return (ret == false) ? 1 : 0; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h index 7c4a6089090..5fc5b0a1326 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -72,7 +72,14 @@ static inline void pmix_atomic_wmb (void) static inline void pmix_atomic_rmb (void) { +#if PMIX_ASSEMBLY_ARCH == PMIX_X86_64 + /* work around a bug in older gcc versions (observed in gcc 6.x) + * where acquire seems to get treated as a no-op instead of being + * equivalent to __asm__ __volatile__("": : :"memory") on x86_64 */ + pmix_atomic_mb (); +#else atomic_thread_fence (memory_order_acquire); +#endif } #define pmix_atomic_compare_exchange_strong_32(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_relaxed, memory_order_relaxed) diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h index cfb46eb5194..17134e11c16 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h @@ -13,7 +13,7 @@ * Copyright (c) 2010-2017 IBM Corporation. All rights reserved. * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -99,27 +99,7 @@ void pmix_atomic_isync(void) ISYNC(); } -#elif PMIX_XLC_INLINE_ASSEMBLY /* end PMIX_GCC_INLINE_ASSEMBLY */ - -/* Yeah, I don't know who thought this was a reasonable syntax for - * inline assembly. Do these because they are used so often and they - * are fairly simple (aka: there is a tech pub on IBM's web site - * containing the right hex for the instructions). - */ - -#undef PMIX_HAVE_INLINE_ATOMIC_MEM_BARRIER -#define PMIX_HAVE_INLINE_ATOMIC_MEM_BARRIER 0 - -#pragma mc_func pmix_atomic_mb { "7c0004ac" } /* sync */ -#pragma reg_killed_by pmix_atomic_mb /* none */ - -#pragma mc_func pmix_atomic_rmb { "7c2004ac" } /* lwsync */ -#pragma reg_killed_by pmix_atomic_rmb /* none */ - -#pragma mc_func pmix_atomic_wmb { "7c2004ac" } /* lwsync */ -#pragma reg_killed_by pmix_atomic_wmb /* none */ - -#endif +#endif /* end PMIX_GCC_INLINE_ASSEMBLY */ /********************************************************************** * @@ -297,7 +277,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t * #define pmix_atomic_sc_64(addr, value, ret) \ do { \ pmix_atomic_int64_t *_addr = (addr); \ - int64_t _foo, _newval = (int64_t) value; \ + int64_t _newval = (int64_t) value; \ int32_t _ret; \ \ __asm__ __volatile__ (" stdcx. %2, 0, %1 \n\t" \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c index c2585ea84ae..574607ec4b0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c @@ -293,7 +293,7 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, PMIX_RELEASE(cb); goto cleanup; } - } else { + } else if (NULL != cbfunc) { cbfunc(PMIX_SUCCESS, cbdata); } @@ -977,16 +977,6 @@ static void _notify_client_event(int sd, short args, void *cbdata) if (!pmix_notify_check_range(&rngtrk, &proc)) { continue; } - if (NULL != cd->targets) { - /* track the number of targets we have left to notify */ - --cd->nleft; - /* if the event was cached and this is the last one, - * then evict this event from the cache */ - if (0 == cd->nleft) { - pmix_hotel_checkout(&pmix_globals.notifications, cd->room); - PMIX_RELEASE(cd); - } - } pmix_output_verbose(2, pmix_server_globals.event_output, "pmix_server: notifying client %s:%u on status %s", pr->peer->info->pname.nspace, pr->peer->info->pname.rank, @@ -1044,6 +1034,17 @@ static void _notify_client_event(int sd, short args, void *cbdata) if (PMIX_SUCCESS != rc) { PMIX_RELEASE(bfr); } + if (NULL != cd->targets && 0 < cd->nleft) { + /* track the number of targets we have left to notify */ + --cd->nleft; + /* if the event was cached and this is the last one, + * then evict this event from the cache */ + if (0 == cd->nleft) { + pmix_hotel_checkout(&pmix_globals.notifications, cd->room); + holdcd = false; + break; + } + } } } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c index 2607d6b101d..be2346048d8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c @@ -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); diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h index 212b5b51014..202679cc4ee 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h @@ -110,6 +110,9 @@ typedef uint8_t pmix_cmd_t; /* provide a "pretty-print" function for cmds */ const char* pmix_command_string(pmix_cmd_t cmd); +/* provide a hook to init tool data */ +PMIX_EXPORT extern pmix_status_t pmix_tool_init_info(void); + /* define a set of flags to direct collection * of data during operations */ typedef enum { @@ -280,7 +283,7 @@ typedef struct { pmix_list_item_t super; pmix_event_t ev; bool event_active; - bool lost_connection; // tracker went thru lost connection procedure + bool host_called; // tracker has been passed up to host bool local; // operation is strictly local char *id; // string identifier for the collective pmix_cmd_t type; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt b/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt index 7a96e7ace8f..3c8a67f1990 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt @@ -10,8 +10,8 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2018 Intel, Inc. All rights reserved. +# Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2018-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -60,3 +60,12 @@ all components *except* a and b", while "c,d" specifies the inclusive behavior and means "use *only* components c and d." You cannot mix inclusive and exclusive behavior. +# +[failed to add component dir] +The pmix_mca_base_component_path MCA variable was used to add paths to +search for PMIX components. At least one directory failed to add +properly: + + %s + +Check to make sure that this directory exists, is readable, etc. diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c index eb7dda21b56..062b1cb75d6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c @@ -10,12 +10,12 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,6 +43,7 @@ #include "pmix_common.h" #include "src/class/pmix_hash_table.h" #include "src/util/basename.h" +#include "src/util/show_help.h" #if PMIX_HAVE_PDL_SUPPORT @@ -220,8 +221,13 @@ int pmix_mca_base_component_repository_add (const char *path) dir = pmix_mca_base_system_default_path; } - if (0 != pmix_pdl_foreachfile(dir, process_repository_item, NULL)) { - break; + if (0 != pmix_pdl_foreachfile(dir, process_repository_item, NULL) && + !(0 == strcmp(dir, pmix_mca_base_system_default_path) || 0 == strcmp(dir, pmix_mca_base_user_default_path))) { + // It is not an error if a directory fails to add (e.g., + // if it doesn't exist). But we should warn about it as + // it is something related to "show_load_errors" + pmix_show_help("help-pmix-mca-base.txt", + "failed to add component dir", true, dir); } } while (NULL != (dir = strtok_r (NULL, sep, &ctx))); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/Makefile.am index db788f3a7c8..5855a6aeae3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_bfrops_v12_la_SOURCES = $(component_sources) mca_bfrops_v12_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_bfrops_v12_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_bfrops_v12_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/Makefile.am index ffe16123206..42eb14940aa 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_bfrops_v20_la_SOURCES = $(component_sources) mca_bfrops_v20_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_bfrops_v20_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_bfrops_v20_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/Makefile.am index d4da3258b44..1658de9d1db 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_bfrops_v21_la_SOURCES = $(component_sources) mca_bfrops_v21_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_bfrops_v21_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_bfrops_v21_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am index 14438eac7f1..d14a13258ff 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_bfrops_v3_la_SOURCES = $(component_sources) mca_bfrops_v3_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_bfrops_v3_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_bfrops_v3_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c index b9f8533c0ef..abec7a744da 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. @@ -79,7 +79,8 @@ pmix_status_t pmix_gds_base_setup_fork(const pmix_proc_t *proc, if (NULL == active->module->setup_fork) { continue; } - if (PMIX_SUCCESS != (rc = active->module->setup_fork(proc, env))) { + rc = active->module->setup_fork(proc, env); + if (PMIX_SUCCESS != rc && PMIX_ERR_NOT_AVAILABLE != rc) { return rc; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am index dc799c892f8..eae7ef34abc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am @@ -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,9 @@ 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 +if NEED_LIBPMIX +mca_gds_ds12_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_gds_ds12_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am index 215275754d7..06e1dd13a90 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am @@ -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,9 @@ 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 +if NEED_LIBPMIX +mca_gds_ds21_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_gds_ds21_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c index 5e8b7be92b0..99713f5651e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c @@ -2,7 +2,7 @@ * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. * - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -234,6 +234,7 @@ pmix_status_t pmix_gds_ds21_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const c rc = PMIX_ERR_NOT_FOUND; goto error; } + seg_hdr = (segment_hdr_t*)lock_item->seg_desc->seg_info.seg_base_addr; } lock_item->num_locks = seg_hdr->num_locks; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/Makefile.am index 7d9da0189e2..4067145ff28 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/Makefile.am @@ -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$ @@ -49,6 +49,9 @@ mcacomponent_LTLIBRARIES = $(component) mca_gds_hash_la_SOURCES = $(component_sources) mca_gds_hash_la_LIBADD = $(gds_hash_LIBS) mca_gds_hash_la_LDFLAGS = -module -avoid-version $(gds_hash_LDFLAGS) +if NEED_LIBPMIX +mca_gds_hash_la_LIBADD += $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_gds_hash_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c index 4b02d8faf21..4e092fc5a68 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -201,8 +201,16 @@ static pmix_status_t hash_assign_module(pmix_info_t *info, size_t ninfo, return PMIX_SUCCESS; } +/* Define a bitmask to track what information may not have + * been provided but is computable from other info */ +#define PMIX_HASH_PROC_DATA 0x00000001 +#define PMIX_HASH_JOB_SIZE 0x00000002 +#define PMIX_HASH_MAX_PROCS 0x00000004 +#define PMIX_HASH_NUM_NODES 0x00000008 + static pmix_status_t store_map(pmix_hash_table_t *ht, - char **nodes, char **ppn) + char **nodes, char **ppn, + uint32_t flags) { pmix_status_t rc; pmix_value_t *val; @@ -212,6 +220,8 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, bool updated; pmix_kval_t *kp2; char **procs; + uint32_t totalprocs=0; + bool localldr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:store_map", @@ -223,6 +233,22 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return PMIX_ERR_BAD_PARAM; } + /* if they didn't provide the number of nodes, then + * compute it from the list of nodes */ + if (!(PMIX_HASH_NUM_NODES & flags)) { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_NUM_NODES); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT32; + kp2->value->data.uint32 = pmix_argv_count(nodes); + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + } + for (n=0; NULL != nodes[n]; n++) { /* check and see if we already have data for this node */ val = NULL; @@ -240,18 +266,22 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, } iptr = (pmix_info_t*)val->data.darray->array; updated = false; + localldr = false; for (m=0; m < val->data.darray->size; m++) { - if (0 == strncmp(iptr[m].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(&iptr[m], PMIX_LOCAL_PEERS)) { /* we will update this entry */ if (NULL != iptr[m].value.data.string) { free(iptr[m].value.data.string); } iptr[m].value.data.string = strdup(ppn[n]); - updated = true; - break; + updated = true; // no need to add the local_peers to the array + } else if (PMIX_CHECK_KEY(&iptr[m], PMIX_LOCALLDR)) { + rank = strtoul(ppn[n], NULL, 10); + iptr[m].value.data.rank = rank; + localldr = true; // no need to add localldr to the array } } - if (!updated) { + if (!updated || !localldr) { /* append this entry to the current data */ kp2 = PMIX_NEW(pmix_kval_t); if (NULL == kp2) { @@ -270,7 +300,18 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return PMIX_ERR_NOMEM; } kp2->value->data.darray->type = PMIX_INFO; - kp2->value->data.darray->size = val->data.darray->size + 1; + /* if we didn't update the local leader, then we will + * add it here */ + m = 0; + if (!localldr) { + kp2->value->data.darray->size = val->data.darray->size + 1; + ++m; + } + /* if they didn't update the local peers, then we add it here */ + if (!updated) { + kp2->value->data.darray->size = val->data.darray->size + 1; + ++m; + } PMIX_INFO_CREATE(info, kp2->value->data.darray->size); if (NULL == info) { PMIX_RELEASE(kp2); @@ -280,7 +321,15 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, for (m=0; m < val->data.darray->size; m++) { PMIX_INFO_XFER(&info[m], &iptr[m]); } - PMIX_INFO_LOAD(&info[kp2->value->data.darray->size-1], PMIX_LOCAL_PEERS, ppn[n], PMIX_STRING); + if (!updated) { + PMIX_INFO_LOAD(&info[kp2->value->data.darray->size-m], PMIX_LOCAL_PEERS, ppn[n], PMIX_STRING); + --m; + } + if (!localldr) { + rank = strtoul(ppn[n], NULL, 10); + PMIX_INFO_LOAD(&info[kp2->value->data.darray->size-m], PMIX_LOCALLDR, &rank, PMIX_PROC_RANK); + --m; + } kp2->value->data.darray->array = info; if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { PMIX_ERROR_LOG(rc); @@ -308,14 +357,16 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return PMIX_ERR_NOMEM; } kp2->value->data.darray->type = PMIX_INFO; - PMIX_INFO_CREATE(info, 1); + PMIX_INFO_CREATE(info, 2); if (NULL == info) { PMIX_RELEASE(kp2); return PMIX_ERR_NOMEM; } PMIX_INFO_LOAD(&info[0], PMIX_LOCAL_PEERS, ppn[n], PMIX_STRING); + rank = strtoul(ppn[n], NULL, 10); + PMIX_INFO_LOAD(&info[1], PMIX_LOCALLDR, &rank, PMIX_PROC_RANK); kp2->value->data.darray->array = info; - kp2->value->data.darray->size = 1; + kp2->value->data.darray->size = 2; if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -326,6 +377,7 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, /* split the list of procs so we can store their * individual location data */ procs = pmix_argv_split(ppn[n], ','); + totalprocs += pmix_argv_count(procs); for (m=0; NULL != procs[m]; m++) { /* store the hostname for each proc */ kp2 = PMIX_NEW(pmix_kval_t); @@ -341,6 +393,48 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return rc; } PMIX_RELEASE(kp2); // maintain acctg + if (!(PMIX_HASH_PROC_DATA & flags)) { + /* add an entry for the nodeid */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_NODEID); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT32; + kp2->value->data.uint32 = n; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + pmix_argv_free(procs); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + /* add an entry for the local rank */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_LOCAL_RANK); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT16; + kp2->value->data.uint16 = m; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + pmix_argv_free(procs); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + /* add an entry for the node rank - for now, we assume + * only the one job is running */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_NODE_RANK); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT16; + kp2->value->data.uint16 = m; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + pmix_argv_free(procs); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + } } pmix_argv_free(procs); } @@ -360,6 +454,41 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, } PMIX_RELEASE(kp2); // maintain acctg + /* if they didn't provide the job size, compute it as + * being the number of provided procs (i.e., size of + * ppn list) */ + if (!(PMIX_HASH_JOB_SIZE & flags)) { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_JOB_SIZE); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT32; + kp2->value->data.uint32 = totalprocs; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + } + + /* if they didn't provide a value for max procs, just + * assume it is the same as the number of procs in the + * job and store it */ + if (!(PMIX_HASH_MAX_PROCS & flags)) { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_MAX_PROCS); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT32; + kp2->value->data.uint32 = totalprocs; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + } + + return PMIX_SUCCESS; } @@ -376,6 +505,7 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, pmix_rank_t rank; pmix_status_t rc=PMIX_SUCCESS; size_t n, j, size, len; + uint32_t flags = 0; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:cache_job_info for nspace %s", @@ -431,29 +561,14 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, PMIX_ERROR_LOG(rc); goto release; } - /* if we have already found the proc map, then parse - * and store the detailed map */ - if (NULL != procs) { - if (PMIX_SUCCESS != (rc = store_map(ht, nodes, procs))) { - PMIX_ERROR_LOG(rc); - goto release; - } - } } else if (0 == strcmp(info[n].key, PMIX_PROC_MAP)) { /* parse the regex to get the argv array containing proc ranks on each node */ if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(info[n].value.data.string, &procs))) { PMIX_ERROR_LOG(rc); goto release; } - /* if we have already recv'd the node map, then parse - * and store the detailed map */ - if (NULL != nodes) { - if (PMIX_SUCCESS != (rc = store_map(ht, nodes, procs))) { - PMIX_ERROR_LOG(rc); - goto release; - } - } } else if (0 == strcmp(info[n].key, PMIX_PROC_DATA)) { + flags |= PMIX_HASH_PROC_DATA; /* an array of data pertaining to a specific proc */ if (PMIX_DATA_ARRAY != info[n].value.type) { PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); @@ -543,9 +658,15 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, goto release; } PMIX_RELEASE(kp2); // maintain acctg - /* if this is the job size, then store it */ - if (0 == strncmp(info[n].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN)) { + /* if this is the job size, then store it in + * the nptr tracker and flag that we were given it */ + if (PMIX_CHECK_KEY(&info[n], PMIX_JOB_SIZE)) { nptr->nprocs = info[n].value.data.uint32; + flags |= PMIX_HASH_JOB_SIZE; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_NUM_NODES)) { + flags |= PMIX_HASH_NUM_NODES; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_MAX_PROCS)) { + flags |= PMIX_HASH_MAX_PROCS; } } } @@ -577,6 +698,17 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, trk->gdata_added = true; } + /* we must have the proc AND node maps */ + if (NULL == procs || NULL == nodes) { + rc = PMIX_ERR_NOT_FOUND; + goto release; + } + + if (PMIX_SUCCESS != (rc = store_map(ht, nodes, procs, flags))) { + PMIX_ERROR_LOG(rc); + goto release; + } + release: if (NULL != nodes) { pmix_argv_free(nodes); @@ -644,25 +776,24 @@ static pmix_status_t register_info(pmix_peer_t *peer, for (rank=0; rank < ns->nprocs; rank++) { val = NULL; rc = pmix_hash_fetch(ht, rank, NULL, &val); - if (PMIX_SUCCESS != rc) { + if (PMIX_SUCCESS != rc && PMIX_ERR_PROC_ENTRY_NOT_FOUND != rc) { PMIX_ERROR_LOG(rc); if (NULL != val) { PMIX_VALUE_RELEASE(val); } return rc; } - if (NULL == val) { - return PMIX_ERR_NOT_FOUND; - } PMIX_CONSTRUCT(&buf, pmix_buffer_t); PMIX_BFROPS_PACK(rc, peer, &buf, &rank, 1, PMIX_PROC_RANK); - info = (pmix_info_t*)val->data.darray->array; - ninfo = val->data.darray->size; - for (n=0; n < ninfo; n++) { - kv.key = info[n].key; - kv.value = &info[n].value; - PMIX_BFROPS_PACK(rc, peer, &buf, &kv, 1, PMIX_KVAL); + if (NULL != val) { + info = (pmix_info_t*)val->data.darray->array; + ninfo = val->data.darray->size; + for (n=0; n < ninfo; n++) { + kv.key = info[n].key; + kv.value = &info[n].value; + PMIX_BFROPS_PACK(rc, peer, &buf, &kv, 1, PMIX_KVAL); + } } kv.key = PMIX_PROC_BLOB; kv.value = &blob; @@ -1327,7 +1458,6 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, val = NULL; rc = pmix_hash_fetch(ht, PMIX_RANK_WILDCARD, NULL, &val); if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); if (NULL != val) { PMIX_VALUE_RELEASE(val); } @@ -1341,7 +1471,6 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, if (PMIX_DATA_ARRAY != val->type || NULL == val->data.darray || PMIX_INFO != val->data.darray->type) { - PMIX_ERROR_LOG(PMIX_ERR_INVALID_VAL); PMIX_VALUE_RELEASE(val); return PMIX_ERR_INVALID_VAL; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 index c5082065b23..1e749df5b2d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 @@ -1,8 +1,8 @@ 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 Intel, Inc. All rights reserved. +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.]) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/Makefile.am index aa141f9d8ff..369a06269f3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_plog_default_la_SOURCES = $(sources) mca_plog_default_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_plog_default_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_plog_default_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/Makefile.am index 497dfaaf1a7..0cdd43d60cb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_plog_stdfd_la_SOURCES = $(sources) mca_plog_stdfd_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_plog_stdfd_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_plog_stdfd_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/Makefile.am index 7a09d28fac1..ba79c07fe73 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_plog_syslog_la_SOURCES = $(sources) mca_plog_syslog_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_plog_syslog_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_plog_syslog_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c index c4869da529d..d62268dbd52 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c @@ -209,7 +209,8 @@ pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *proc, char ***env) PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { if (NULL != active->module->setup_fork) { - if (PMIX_SUCCESS != (rc = active->module->setup_fork(nptr, proc, env))) { + rc = active->module->setup_fork(nptr, proc, env); + if (PMIX_SUCCESS != rc && PMIX_ERR_NOT_AVAILABLE != rc) { return rc; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am index 1223b43eca4..fe01cde836e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am @@ -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$ @@ -49,6 +49,9 @@ mcacomponent_LTLIBRARIES = $(component) mca_pnet_opa_la_SOURCES = $(component_sources) mca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS) mca_pnet_opa_la_LDFLAGS = -module -avoid-version $(pnet_opa_LDFLAGS) +if NEED_LIBPMIX +mca_pnet_opa_la_LIBADD += $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_pnet_opa_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am index 946d81c8fba..048f34b0b63 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am @@ -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$ @@ -49,6 +49,9 @@ mcacomponent_LTLIBRARIES = $(component) mca_pnet_tcp_la_SOURCES = $(component_sources) mca_pnet_tcp_la_LIBADD = $(pnet_tcp_LIBS) mca_pnet_tcp_la_LDFLAGS = -module -avoid-version $(pnet_tcp_LDFLAGS) +if NEED_LIBPMIX +mca_pnet_tcp_la_LIBADD += $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_pnet_tcp_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am index 3faf68a32c2..b71000ef555 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_pnet_test_la_SOURCES = $(component_sources) mca_pnet_test_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_pnet_test_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_pnet_test_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/Makefile.am index fa51393622f..607dcdb0c96 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_preg_native_la_SOURCES = $(component_sources) mca_preg_native_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_preg_native_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_preg_native_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c index 0d31f96435a..0c9d6188a0d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -893,7 +893,7 @@ static pmix_status_t regex_parse_value_range(char *base, char *range, for (found = false, i = 0; i < len; ++i) { if (isdigit((int) range[i])) { if (!found) { - start = atoi(range + i); + start = strtol(range + i, NULL, 10); found = true; break; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/Makefile.am new file mode 100644 index 00000000000..1dd3853eb2d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/Makefile.am @@ -0,0 +1,59 @@ +# -*- 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-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2019 Mellanox Technologies, Inc. +# All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +if MCA_BUILD_PSEC_DUMMY_HANDSHAKE + +headers = psec_dummy_handshake.h +sources = \ + psec_dummy_handshake_component.c \ + psec_dummy_handshake.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_pmix_psec_dummy_handshake_DSO +lib = +lib_sources = +component = mca_psec_dummy_handshake.la +component_sources = $(headers) $(sources) +else +lib = libmca_psec_dummy_handshake.la +lib_sources = $(headers) $(sources) +component = +component_sources = +endif + +mcacomponentdir = $(pmixlibdir) +mcacomponent_LTLIBRARIES = $(component) +mca_psec_dummy_handshake_la_SOURCES = $(component_sources) +mca_psec_dummy_handshake_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psec_dummy_handshake_la_LIBADD = $(top_builddir)/src/libpmix.la +endif + +noinst_LTLIBRARIES = $(lib) +libmca_psec_dummy_handshake_la_SOURCES = $(lib_sources) +libmca_psec_dummy_handshake_la_LDFLAGS = -module -avoid-version + +endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c new file mode 100644 index 00000000000..ae1f9b62e59 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c @@ -0,0 +1,170 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#include + +#include "src/include/pmix_globals.h" +#include "src/util/error.h" +#include "src/util/output.h" + +#include "src/mca/psec/base/base.h" +#include "psec_dummy_handshake.h" + +#include "src/mca/ptl/base/base.h" + +#define PMIX_PSEC_DUMMY_HNDSHK_STR "PMIX_PSEC_DUMMY_HANDSHAKE_STRING" + +static pmix_status_t simple_init(void); +static void simple_finalize(void); +static pmix_status_t create_cred(struct pmix_peer_t *peer, + const pmix_info_t directives[], size_t ndirs, + pmix_info_t **info, size_t *ninfo, + pmix_byte_object_t *cred); +static pmix_status_t client_hndshk(int sd); +static pmix_status_t server_hndshk(int sd); + +pmix_psec_module_t pmix_dummy_handshake_module = { + .name = "dummy_handshake", + /** init/finalize */ + .init = simple_init, + .finalize = simple_finalize, + /** Client-side */ + .create_cred = create_cred, + .client_handshake = client_hndshk, + /** Server-side */ + .validate_cred = NULL, + .server_handshake = server_hndshk +}; + +static pmix_status_t simple_init(void) +{ + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple init"); + return PMIX_SUCCESS; +} + +static void simple_finalize(void) +{ + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple finalize"); +} + +static pmix_status_t create_cred(struct pmix_peer_t *peer, + const pmix_info_t directives[], size_t ndirs, + pmix_info_t **info, size_t *ninfo, + pmix_byte_object_t *cred) +{ + char mycred[] = "dymmy_cred"; + + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple create_cred"); + + /* ensure initialization */ + PMIX_BYTE_OBJECT_CONSTRUCT(cred); + + cred->bytes = strdup(mycred); + cred->size = strlen(mycred) + 1; + + return PMIX_SUCCESS; +} + +static pmix_status_t server_hndshk(int sd) +{ + pmix_status_t rc, status = PMIX_SUCCESS; + char *hndshk_msg = NULL; + size_t size; + + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple server_hndshk"); + + asprintf(&hndshk_msg, "%s", PMIX_PSEC_DUMMY_HNDSHK_STR); + size = strlen(hndshk_msg); + + /* send size of handshake message */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(sd, (char*)&size, + sizeof(size)))) { + goto exit; + } + /* send handshake message */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(sd, hndshk_msg, + size))) { + goto exit; + } + /* recv hadshake status from client */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_recv_blocking(sd, (char*)&status, + sizeof(status)))) { + goto exit; + } + rc = status; + pmix_output(0, "[%s:%d] psec handshake status %d recv from client", + __FILE__, __LINE__, status); + +exit: + if (NULL != hndshk_msg) { + free(hndshk_msg); + } + + return rc; +} + +static pmix_status_t client_hndshk(int sd) +{ + char *hndshk_msg = NULL; + size_t size; + pmix_status_t rc, status = PMIX_SUCCESS; + + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple client_hndshk"); + + /* recv size of handshake message */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_recv_blocking(sd, (char*)&size, + sizeof(size_t)))) { + return rc; + } + hndshk_msg = (char*)malloc(size); + /* recv handshake message */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_recv_blocking(sd, (char*)hndshk_msg, + size))) { + free(hndshk_msg); + return rc; + } + /* verifying handshake data */ + if (size != strlen(PMIX_PSEC_DUMMY_HNDSHK_STR)) { + rc = PMIX_ERR_HANDSHAKE_FAILED; + goto exit; + } + if (0 != strncmp(hndshk_msg, PMIX_PSEC_DUMMY_HNDSHK_STR, size)) { + rc = PMIX_ERR_HANDSHAKE_FAILED; + goto exit; + } + + /* send hadshake status to the server */ + status = PMIX_SUCCESS; + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(sd, (char*)&status, + sizeof(status)))) { + goto exit; + } + pmix_output(0, "[%s:%d] psec handshake status %d sent to server", + __FILE__, __LINE__, status); +exit: + if (NULL != hndshk_msg) { + free(hndshk_msg); + } + return rc; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h new file mode 100644 index 00000000000..74cc3632213 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h @@ -0,0 +1,29 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_SIMPLE_H +#define PMIX_SIMPLE_H + +#include + + +#include "src/mca/psec/psec.h" + +BEGIN_C_DECLS + +/* the component must be visible data for the linker to find it */ +PMIX_EXPORT extern pmix_psec_base_component_t mca_psec_dummy_handshake_component; +extern pmix_psec_module_t pmix_dummy_handshake_module; + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c new file mode 100644 index 00000000000..53fb13b6fed --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c @@ -0,0 +1,73 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include "pmix_common.h" + +#include "src/mca/base/pmix_mca_base_var.h" +#include "src/mca/psec/psec.h" +#include "psec_dummy_handshake.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); +static pmix_psec_module_t* assign_module(void); + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +pmix_psec_base_component_t mca_psec_dummy_handshake_component = { + .base = { + PMIX_PSEC_BASE_VERSION_1_0_0, + + /* Component name and version */ + .pmix_mca_component_name = "dummy_handshake", + 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 + }, + .assign_module = assign_module +}; + +static int component_open(void) +{ + return PMIX_SUCCESS; +} + +static int component_query(pmix_mca_base_module_t **module, int *priority) +{ + *priority = 100; + *module = (pmix_mca_base_module_t *)&pmix_dummy_handshake_module; + return PMIX_SUCCESS; +} + + +static int component_close(void) +{ + return PMIX_SUCCESS; +} + +static pmix_psec_module_t* assign_module(void) +{ + return &pmix_dummy_handshake_module; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/Makefile.am index 5f01461190c..79756320d6a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/Makefile.am @@ -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 @@ -47,6 +47,9 @@ 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) +if NEED_LIBPMIX +mca_psec_munge_la_LIBADD += $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_psec_munge_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/Makefile.am index 9381d8ad60f..b1086a2aac2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_psec_native_la_SOURCES = $(component_sources) mca_psec_native_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psec_native_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_psec_native_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c index 1af787399a5..60af0f7af1a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -25,7 +25,7 @@ #include "src/util/error.h" #include "src/util/output.h" -#include "src/mca/psec/psec.h" +#include "src/mca/psec/base/base.h" #include "psec_native.h" static pmix_status_t native_init(void); @@ -49,14 +49,14 @@ pmix_psec_module_t pmix_native_module = { static pmix_status_t native_init(void) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: native init"); return PMIX_SUCCESS; } static void native_finalize(void) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: native finalize"); } @@ -167,7 +167,7 @@ static pmix_status_t validate_cred(struct pmix_peer_t *peer, size_t n, m; uint32_t u32; - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: native validate_cred %s", (NULL == cred) ? "NULL" : "NON-NULL"); @@ -175,10 +175,10 @@ static pmix_status_t validate_cred(struct pmix_peer_t *peer, /* usock protocol - get the remote side's uid/gid */ #if defined(SO_PEERCRED) && (defined(HAVE_STRUCT_UCRED_UID) || defined(HAVE_STRUCT_UCRED_CR_UID)) /* Ignore received 'cred' and validate ucred for socket instead. */ - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec:native checking getsockopt on socket %d for peer credentials", pr->sd); if (getsockopt(pr->sd, SOL_SOCKET, SO_PEERCRED, &ucred, &crlen) < 0) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: getsockopt SO_PEERCRED failed: %s", strerror (pmix_socket_errno)); return PMIX_ERR_INVALID_CRED; @@ -192,10 +192,10 @@ static pmix_status_t validate_cred(struct pmix_peer_t *peer, #endif #elif defined(HAVE_GETPEEREID) - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec:native checking getpeereid on socket %d for peer credentials", pr->sd); if (0 != getpeereid(pr->sd, &euid, &egid)) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: getsockopt getpeereid failed: %s", strerror (pmix_socket_errno)); return PMIX_ERR_INVALID_CRED; @@ -255,14 +255,14 @@ static pmix_status_t validate_cred(struct pmix_peer_t *peer, /* check uid */ if (euid != pr->info->uid) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: socket cred contains invalid uid %u", euid); return PMIX_ERR_INVALID_CRED; } /* check gid */ if (egid != pr->info->gid) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: socket cred contains invalid gid %u", egid); return PMIX_ERR_INVALID_CRED; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/Makefile.am index 74236996375..cde03ba502f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_psec_none_la_SOURCES = $(component_sources) mca_psec_none_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psec_none_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_psec_none_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h index 4057681f6f6..10c31e9bfa3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h @@ -1,10 +1,11 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -155,23 +156,12 @@ PMIX_EXPORT pmix_psec_module_t* pmix_psec_base_assign_module(const char *options pmix_output_verbose(2, pmix_globals.debug_output, \ "credential validated"); \ } \ - /* send them the result */ \ - if (PMIX_SUCCESS != (_r = pmix_ptl_base_send_blocking((p)->sd, (char*)&(_r), sizeof(int)))) { \ - PMIX_ERROR_LOG(_r); \ - } \ (r) = _r; \ } else if (NULL != (p)->nptr->compat.psec->server_handshake) { \ - /* execute the handshake if the security mode calls for it */ \ + /* request the handshake if the security mode calls for it */ \ pmix_output_verbose(2, pmix_globals.debug_output, \ - "executing handshake"); \ + "requesting handshake"); \ _r = PMIX_ERR_READY_FOR_HANDSHAKE; \ - if (PMIX_SUCCESS != (_r = pmix_ptl_base_send_blocking((p)->sd, (char*)&(_r), sizeof(int)))) { \ - PMIX_ERROR_LOG(_r); \ - } else { \ - if (PMIX_SUCCESS != (_r = p->nptr->compat.psec->server_handshake((p)->sd))) { \ - PMIX_ERROR_LOG(_r); \ - } \ - } \ (r) = _r; \ } else { \ /* this is not allowed */ \ @@ -179,6 +169,21 @@ PMIX_EXPORT pmix_psec_module_t* pmix_psec_base_assign_module(const char *options } \ } while(0) + +#define PMIX_PSEC_SERVER_HANDSHAKE_IFNEED(r, p, d, nd, in, nin, c) \ + if(PMIX_ERR_READY_FOR_HANDSHAKE == r) { \ + int _r; \ + /* execute the handshake if the security mode calls for it */ \ + pmix_output_verbose(2, pmix_globals.debug_output, \ + "executing handshake"); \ + if (PMIX_SUCCESS != (_r = p->nptr->compat.psec->server_handshake((p)->sd))) { \ + PMIX_ERROR_LOG(_r); \ + } \ + /* Update the reply status */ \ + (r) = _r; \ + } + + /**** COMPONENT STRUCTURE DEFINITION ****/ /* define a component-level API for initializing the component */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/Makefile.am index 30dce46e38e..638fcd6a32a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_psensor_file_la_SOURCES = $(sources) mca_psensor_file_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psensor_file_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_psensor_file_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/Makefile.am index df4fe0466a7..95b978415d3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_psensor_heartbeat_la_SOURCES = $(sources) mca_psensor_heartbeat_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psensor_heartbeat_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_psensor_heartbeat_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/Makefile.am index 68ba424b719..1483ae5de01 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_pshmem_mmap_la_SOURCES = $(component_sources) mca_pshmem_mmap_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_pshmem_mmap_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_pshmem_mmap_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c index 0b465340bee..043a68e1388 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c @@ -55,13 +55,6 @@ static void _notify_complete(pmix_status_t status, void *cbdata) PMIX_RELEASE(chain); } -static void _timeout(int sd, short args, void *cbdata) -{ - pmix_server_trkr_t *trk = (pmix_server_trkr_t*)cbdata; - - PMIX_RELEASE(trk); -} - static void lcfn(pmix_status_t status, void *cbdata) { pmix_peer_t *peer = (pmix_peer_t*)cbdata; @@ -76,7 +69,6 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) pmix_ptl_posted_recv_t *rcv; pmix_buffer_t buf; pmix_ptl_hdr_t hdr; - struct timeval tv = {1200, 0}; pmix_proc_t proc; pmix_status_t rc; @@ -114,59 +106,60 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) /* remove it from the list */ pmix_list_remove_item(&trk->local_cbs, &rinfo->super); PMIX_RELEASE(rinfo); - trk->lost_connection = true; // mark that a peer's connection was lost - if (0 == pmix_list_get_size(&trk->local_cbs)) { - /* this tracker is complete, so release it - there - * is nobody waiting for a response */ - pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); - /* do NOT release the tracker here as the host may - * have a copy they will return later. However, they - * might never call back, so set a LONG timeout to - * we avoid a memory leak if they don't */ - pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, - _timeout, trk); - pmix_event_evtimer_add(&trk->ev, &tv); - trk->event_active = true; - break; + /* if the host has already been called for this tracker, + * then do nothing here - just wait for the host to return + * from the operation */ + if (trk->host_called) { + continue; } - /* if there are other participants waiting for a response, - * we need to let them know that this proc has disappeared - * as otherwise the collective will never complete */ - if (PMIX_FENCENB_CMD == trk->type) { - if (NULL != trk->modexcbfunc) { - /* do NOT release the tracker here as the host may - * have a copy they will return later. However, they - * might never call back, so set a LONG timeout to - * we avoid a memory leak if they don't */ - pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, - _timeout, trk); - pmix_event_evtimer_add(&trk->ev, &tv); - trk->event_active = true; - trk->modexcbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, NULL, 0, trk, NULL, NULL); - } - } else if (PMIX_CONNECTNB_CMD == trk->type) { - if (NULL != trk->op_cbfunc) { - /* do NOT release the tracker here as the host may - * have a copy they will return later. However, they - * might never call back, so set a LONG timeout to - * we avoid a memory leak if they don't */ - pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, - _timeout, trk); - pmix_event_evtimer_add(&trk->ev, &tv); - trk->event_active = true; - trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); - } - } else if (PMIX_DISCONNECTNB_CMD == trk->type) { - if (NULL != trk->op_cbfunc) { - /* do NOT release the tracker here as the host may - * have a copy they will return later. However, they - * might never call back, so set a LONG timeout to - * we avoid a memory leak if they don't */ - pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, - _timeout, trk); - pmix_event_evtimer_add(&trk->ev, &tv); - trk->event_active = true; - trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); + if (trk->def_complete && trk->nlocal == pmix_list_get_size(&trk->local_cbs)) { + /* if this is a local-only collective, then resolve it now */ + if (trk->local) { + /* everyone else has called in - we need to let them know + * that this proc has disappeared + * as otherwise the collective will never complete */ + if (PMIX_FENCENB_CMD == trk->type) { + if (NULL != trk->modexcbfunc) { + trk->modexcbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, NULL, 0, trk, NULL, NULL); + } + } else if (PMIX_CONNECTNB_CMD == trk->type) { + if (NULL != trk->op_cbfunc) { + trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); + } + } else if (PMIX_DISCONNECTNB_CMD == trk->type) { + if (NULL != trk->op_cbfunc) { + trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); + } + } + } else { + /* if the host has not been called, then we need to see if + * the collective is locally complete without this lost + * participant. If so, then we need to pass the call + * up to the host as otherwise the global collective will hang */ + if (PMIX_FENCENB_CMD == trk->type) { + trk->host_called = true; + rc = pmix_host_server.fence_nb(trk->pcs, trk->npcs, + trk->info, trk->ninfo, + NULL, 0, trk->modexcbfunc, trk); + if (PMIX_SUCCESS != rc) { + pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); + PMIX_RELEASE(trk); + } + } else if (PMIX_CONNECTNB_CMD == trk->type) { + trk->host_called = true; + rc = pmix_host_server.connect(trk->pcs, trk->npcs, trk->info, trk->ninfo, trk->op_cbfunc, trk); + if (PMIX_SUCCESS != rc) { + pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); + PMIX_RELEASE(trk); + } + } else if (PMIX_DISCONNECTNB_CMD == trk->type) { + trk->host_called = true; + rc = pmix_host_server.disconnect(trk->pcs, trk->npcs, trk->info, trk->ninfo, trk->op_cbfunc, trk); + if (PMIX_SUCCESS != rc) { + pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); + PMIX_RELEASE(trk); + } + } } } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/Makefile.am index 6788aba19c4..0a5b86bfdac 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_ptl_tcp_la_SOURCES = $(component_sources) mca_ptl_tcp_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_ptl_tcp_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_ptl_tcp_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c index e921cd599c7..0252eed51c2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c @@ -1411,7 +1411,18 @@ static pmix_status_t recv_connect_ack(int sd, uint8_t myflag) pmix_client_globals.myserver->info->pname.rank); /* get the returned status from the security handshake */ - pmix_ptl_base_recv_blocking(sd, (char*)&reply, sizeof(pmix_status_t)); + rc = pmix_ptl_base_recv_blocking(sd, (char*)&u32, sizeof(pmix_status_t)); + if (PMIX_SUCCESS != rc) { + if (sockopt) { + /* return the socket to normal */ + if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &save, sz)) { + return PMIX_ERR_UNREACH; + } + } + return rc; + } + + reply = ntohl(u32); if (PMIX_SUCCESS != reply) { /* see if they want us to do the handshake */ if (PMIX_ERR_READY_FOR_HANDSHAKE == reply) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h index f5373f65069..5813bc7085c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -48,6 +48,7 @@ typedef struct { struct sockaddr_storage connection; char *session_filename; char *nspace_filename; + char *pid_filename; char *system_filename; char *rendezvous_filename; int wait_to_connect; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c index 7f3138d52c6..61eb18ec305 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c @@ -15,7 +15,8 @@ * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2017-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 IBM Corporation. All rights reserved. + * Copyright (c) 2018-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -117,6 +118,7 @@ static pmix_status_t setup_fork(const pmix_proc_t *proc, char ***env); .disable_ipv6_family = true, .session_filename = NULL, .nspace_filename = NULL, + .pid_filename = NULL, .system_filename = NULL, .rendezvous_filename = NULL, .wait_to_connect = 4, @@ -297,6 +299,10 @@ pmix_status_t component_close(void) unlink(mca_ptl_tcp_component.nspace_filename); free(mca_ptl_tcp_component.nspace_filename); } + if (NULL != mca_ptl_tcp_component.pid_filename) { + unlink(mca_ptl_tcp_component.pid_filename); + free(mca_ptl_tcp_component.pid_filename); + } if (NULL != mca_ptl_tcp_component.rendezvous_filename) { unlink(mca_ptl_tcp_component.rendezvous_filename); free(mca_ptl_tcp_component.rendezvous_filename); @@ -750,10 +756,10 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, FILE *fp; pid_t mypid; - /* first output to a file based on pid */ + /* first output to a std file */ mypid = getpid(); - if (0 > asprintf(&mca_ptl_tcp_component.session_filename, "%s/pmix.%s.tool.%d", - mca_ptl_tcp_component.session_tmpdir, myhost, mypid)) { + if (0 > asprintf(&mca_ptl_tcp_component.session_filename, "%s/pmix.%s.tool", + mca_ptl_tcp_component.session_tmpdir, myhost)) { CLOSE_THE_SOCKET(lt->socket); goto sockerror; } @@ -784,6 +790,40 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, goto sockerror; } + /* now output to a file based on pid */ + mypid = getpid(); + if (0 > asprintf(&mca_ptl_tcp_component.pid_filename, "%s/pmix.%s.tool.%d", + mca_ptl_tcp_component.session_tmpdir, myhost, mypid)) { + CLOSE_THE_SOCKET(lt->socket); + goto sockerror; + } + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "WRITING TOOL FILE %s", + mca_ptl_tcp_component.pid_filename); + fp = fopen(mca_ptl_tcp_component.pid_filename, "w"); + if (NULL == fp) { + pmix_output(0, "Impossible to open the file %s in write mode\n", mca_ptl_tcp_component.pid_filename); + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + free(mca_ptl_tcp_component.pid_filename); + mca_ptl_tcp_component.pid_filename = NULL; + goto sockerror; + } + + /* output my URI */ + fprintf(fp, "%s\n", lt->uri); + /* add a flag that indicates we accept v2.1 protocols */ + fprintf(fp, "%s\n", PMIX_VERSION); + fclose(fp); + /* set the file mode */ + if (0 != chmod(mca_ptl_tcp_component.pid_filename, S_IRUSR | S_IWUSR | S_IRGRP)) { + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + free(mca_ptl_tcp_component.pid_filename); + mca_ptl_tcp_component.pid_filename = NULL; + goto sockerror; + } + /* now output it into a file based on my nspace */ if (0 > asprintf(&mca_ptl_tcp_component.nspace_filename, "%s/pmix.%s.tool.%s", @@ -957,7 +997,7 @@ static void connection_handler(int sd, short args, void *cbdata) pmix_ptl_hdr_t hdr; pmix_peer_t *peer; pmix_rank_t rank=0; - pmix_status_t rc; + pmix_status_t rc, reply; char *msg, *mg, *version; char *sec, *bfrops, *gds; pmix_bfrop_buffer_type_t bftype; @@ -1351,11 +1391,21 @@ static void connection_handler(int sd, short args, void *cbdata) } } if (NULL == nptr) { - /* we don't know this namespace, reject it */ - free(msg); - /* send an error reply to the client */ - rc = PMIX_ERR_NOT_FOUND; - goto error; + /* it is possible that this is a tool inside of + * a job-script as part of a multi-spawn operation. + * Since each tool invocation may have finalized and + * terminated, the tool will appear to "terminate", thus + * causing us to cleanup all references to it, and then + * reappear. So we don't reject this connection request. + * Instead, we create the nspace and rank objects for + * it and let the RM/host decide if this behavior + * is allowed */ + nptr = PMIX_NEW(pmix_namespace_t); + if (NULL == nptr) { + rc = PMIX_ERR_NOMEM; + goto error; + } + nptr->nspace = strdup(nspace); } /* now look for the rank */ info = NULL; @@ -1367,11 +1417,13 @@ static void connection_handler(int sd, short args, void *cbdata) } } if (!found) { - /* rank unknown, reject it */ - free(msg); - /* send an error reply to the client */ - rc = PMIX_ERR_NOT_FOUND; - goto error; + /* see above note about not finding nspace */ + info = PMIX_NEW(pmix_rank_info_t); + info->pname.nspace = strdup(nspace); + info->pname.rank = rank; + info->uid = pnd->uid; + info->gid = pnd->gid; + pmix_list_append(&nptr->ranks, &info->super); } PMIX_RETAIN(info); peer->info = info; @@ -1610,22 +1662,13 @@ static void connection_handler(int sd, short args, void *cbdata) /* validate the connection */ cred.bytes = pnd->cred; cred.size = pnd->len; - PMIX_PSEC_VALIDATE_CONNECTION(rc, peer, NULL, 0, NULL, NULL, &cred); - if (PMIX_SUCCESS != rc) { - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "validation of client connection failed"); - info->proc_cnt--; - pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL); - PMIX_RELEASE(peer); - /* send an error reply to the client */ - goto error; - } + PMIX_PSEC_VALIDATE_CONNECTION(reply, peer, NULL, 0, NULL, NULL, &cred); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "client connection validated"); + "client connection validated with status=%d", reply); /* tell the client all is good */ - u32 = htonl(PMIX_SUCCESS); + u32 = htonl(reply); if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { PMIX_ERROR_LOG(rc); info->proc_cnt--; @@ -1635,6 +1678,22 @@ static void connection_handler(int sd, short args, void *cbdata) PMIX_RELEASE(pnd); return; } + /* If needed perform the handshake. The macro will update reply */ + PMIX_PSEC_SERVER_HANDSHAKE_IFNEED(reply, peer, NULL, 0, NULL, NULL, &cred); + + /* It is possible that connection validation failed + * We need to reply to the client first and cleanup after */ + if (PMIX_SUCCESS != reply) { + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "validation of client connection failed"); + info->proc_cnt--; + pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL); + PMIX_RELEASE(peer); + /* send an error reply to the client */ + goto error; + } + + /* send the client's array index */ u32 = htonl(peer->index); if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { @@ -1697,7 +1756,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) pmix_namespace_t *nptr; pmix_rank_info_t *info; pmix_peer_t *peer; - int rc; + pmix_status_t rc, reply; uint32_t u32; pmix_info_t ginfo; pmix_byte_object_t cred; @@ -1856,8 +1915,23 @@ static void process_cbfunc(int sd, short args, void *cbdata) /* validate the connection */ cred.bytes = pnd->cred; cred.size = pnd->len; - PMIX_PSEC_VALIDATE_CONNECTION(rc, peer, NULL, 0, NULL, NULL, &cred); - if (PMIX_SUCCESS != rc) { + PMIX_PSEC_VALIDATE_CONNECTION(reply, peer, NULL, 0, NULL, NULL, &cred); + /* communicate the result to the other side */ + u32 = htonl(reply); + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(peer); + pmix_list_remove_item(&pmix_server_globals.nspaces, &nptr->super); + PMIX_RELEASE(nptr); // will release the info object + CLOSE_THE_SOCKET(pnd->sd); + goto done; + } + + /* If needed perform the handshake. The macro will update reply */ + PMIX_PSEC_SERVER_HANDSHAKE_IFNEED(reply, peer, NULL, 0, NULL, NULL, &cred); + + /* If verification wasn't successful - stop here */ + if (PMIX_SUCCESS != reply) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "validation of tool credentials failed: %s", PMIx_Error_string(rc)); @@ -1880,7 +1954,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) /* probably cannot send an error reply if we are out of memory */ return; } - info->peerid = peer->index; + peer->info->peerid = peer->index; /* start the events for this tool */ pmix_event_assign(&peer->recv_event, pmix_globals.evbase, peer->sd, @@ -1906,8 +1980,8 @@ static void cnct_cbfunc(pmix_status_t status, pmix_setup_caddy_t *cd; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "pmix:tcp:cnct_cbfunc returning %s:%d", - proc->nspace, proc->rank); + "pmix:tcp:cnct_cbfunc returning %s:%d %s", + proc->nspace, proc->rank, PMIx_Error_string(status)); /* need to thread-shift this into our context */ cd = PMIX_NEW(pmix_setup_caddy_t); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/Makefile.am index e6606e2e844..2c91ac37c8d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/Makefile.am @@ -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,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_ptl_usock_la_SOURCES = $(component_sources) mca_ptl_usock_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_ptl_usock_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_ptl_usock_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c index 7cb073db767..ef33e766f9c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c @@ -12,10 +12,11 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -150,6 +151,10 @@ pmix_status_t component_close(void) static int component_query(pmix_mca_base_module_t **module, int *priority) { + if (PMIX_PROC_IS_TOOL(pmix_globals.mypeer)) { + return PMIX_ERR_NOT_SUPPORTED; + } + *module = (pmix_mca_base_module_t*)&pmix_ptl_usock_module; return PMIX_SUCCESS; } @@ -339,7 +344,7 @@ static void connection_handler(int sd, short args, void *cbdata) { pmix_pending_connection_t *pnd = (pmix_pending_connection_t*)cbdata; char *msg, *ptr, *nspace, *version, *sec, *bfrops, *gds; - pmix_status_t rc; + pmix_status_t rc, reply; unsigned int rank; pmix_usock_hdr_t hdr; pmix_namespace_t *nptr, *tmp; @@ -354,6 +359,7 @@ static void connection_handler(int sd, short args, void *cbdata) unsigned int msglen; pmix_info_t ginfo; pmix_byte_object_t cred; + uint32_t u32; /* acquire the object */ PMIX_ACQUIRE_OBJECT(pnd); @@ -687,12 +693,34 @@ static void connection_handler(int sd, short args, void *cbdata) * record it here for future use */ nptr->compat.ptl = &pmix_ptl_usock_module; - /* validate the connection - the macro will send the status result to the client */ - PMIX_PSEC_VALIDATE_CONNECTION(rc, psave, NULL, 0, NULL, 0, &cred); /* now done with the msg */ free(msg); - if (PMIX_SUCCESS != rc) { + /* validate the connection - the macro will send the status result to the client */ + PMIX_PSEC_VALIDATE_CONNECTION(reply, psave, NULL, 0, NULL, 0, &cred); + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "client connection validated with status=%d", reply); + + /* Communicate the result of validation to the client */ + u32 = htonl(reply); + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { + PMIX_ERROR_LOG(rc); + info->proc_cnt--; + PMIX_RELEASE(info); + pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL); + PMIX_RELEASE(psave); + /* error reply was sent by the above macro */ + CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd); + return; + } + + /* If needed perform the handshake. The macro will update reply */ + PMIX_PSEC_SERVER_HANDSHAKE_IFNEED(reply, psave, NULL, 0, NULL, 0, &cred); + + /* It is possible that connection validation failed + * We need to reply to the client first and cleanup after */ + if (PMIX_SUCCESS != reply) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "validation of client credentials failed: %s", PMIx_Error_string(rc)); @@ -706,6 +734,8 @@ static void connection_handler(int sd, short args, void *cbdata) return; } + + /* send the client's array index */ if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&psave->index, sizeof(int)))) { PMIX_ERROR_LOG(rc); diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c index df0af87c280..a66e4d0a768 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c @@ -1,8 +1,10 @@ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -119,7 +121,7 @@ static void stop_progress_engine(pmix_progress_tracker_t *trk) /* break the event loop - this will cause the loop to exit upon completion of any current event */ - pmix_event_base_loopbreak(trk->ev_base); + pmix_event_base_loopexit(trk->ev_base); pmix_thread_join(&trk->engine, NULL); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c index 38b85c0175c..f827018d712 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c @@ -157,6 +157,8 @@ pmix_status_t pmix_server_initialize(void) return PMIX_SUCCESS; } +static pmix_server_module_t myhostserver = {0}; + PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, pmix_info_t info[], size_t ninfo) { @@ -185,7 +187,11 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, "pmix:server init called"); /* setup the function pointers */ - pmix_host_server = *module; + if (NULL == module) { + pmix_host_server = myhostserver; + } else { + pmix_host_server = *module; + } if (NULL != info) { for (n=0; n < ninfo; n++) { @@ -520,6 +526,13 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) return PMIX_SUCCESS; } +static void opcbfunc(pmix_status_t status, void *cbdata) +{ + pmix_lock_t *lock = (pmix_lock_t*)cbdata; + lock->status = status; + PMIX_WAKEUP_THREAD(lock); +} + static void _register_nspace(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; @@ -579,9 +592,7 @@ static void _register_nspace(int sd, short args, void *cbdata) cd->info, cd->ninfo); release: - if (NULL != cd->opcbfunc) { - cd->opcbfunc(rc, cd->cbdata); - } + cd->opcbfunc(rc, cd->cbdata); PMIX_RELEASE(cd); } @@ -591,6 +602,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const pmix_nspace_t nspace pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_setup_caddy_t *cd; + pmix_status_t rc; + pmix_lock_t mylock; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -610,6 +623,22 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const pmix_nspace_t nspace cd->info = info; } + /* if the provided callback is NULL, then substitute + * our own internal cbfunc and block here */ + if (NULL == cbfunc) { + PMIX_CONSTRUCT_LOCK(&mylock); + cd->opcbfunc = opcbfunc; + cd->cbdata = &mylock; + PMIX_THREADSHIFT(cd, _register_nspace); + PMIX_WAIT_THREAD(&mylock); + rc = mylock.status; + PMIX_DESTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS == rc) { + rc = PMIX_OPERATION_SUCCEEDED; + } + return rc; + } + /* we have to push this into our event library to avoid * potential threading issues */ PMIX_THREADSHIFT(cd, _register_nspace); @@ -747,9 +776,7 @@ static void _deregister_nspace(int sd, short args, void *cbdata) } /* release the caller */ - if (NULL != cd->opcbfunc) { - cd->opcbfunc(rc, cd->cbdata); - } + cd->opcbfunc(rc, cd->cbdata); PMIX_RELEASE(cd); } @@ -758,6 +785,7 @@ PMIX_EXPORT void PMIx_server_deregister_nspace(const pmix_nspace_t nspace, void *cbdata) { pmix_setup_caddy_t *cd; + pmix_lock_t mylock; pmix_output_verbose(2, pmix_server_globals.base_output, "pmix:server deregister nspace %s", @@ -778,6 +806,18 @@ PMIX_EXPORT void PMIx_server_deregister_nspace(const pmix_nspace_t nspace, cd->opcbfunc = cbfunc; cd->cbdata = cbdata; + /* if the provided callback is NULL, then substitute + * our own internal cbfunc and block here */ + if (NULL == cbfunc) { + PMIX_CONSTRUCT_LOCK(&mylock); + cd->opcbfunc = opcbfunc; + cd->cbdata = &mylock; + PMIX_THREADSHIFT(cd, _deregister_nspace); + PMIX_WAIT_THREAD(&mylock); + PMIX_DESTRUCT_LOCK(&mylock); + return; + } + /* we have to push this into our event library to avoid * potential threading issues */ PMIX_THREADSHIFT(cd, _deregister_nspace); @@ -1054,9 +1094,7 @@ static void _register_client(int sd, short args, void *cbdata) cleanup: /* let the caller know we are done */ - if (NULL != cd->opcbfunc) { - cd->opcbfunc(rc, cd->cbdata); - } + cd->opcbfunc(rc, cd->cbdata); PMIX_RELEASE(cd); } @@ -1065,6 +1103,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_client(const pmix_proc_t *proc, pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_setup_caddy_t *cd; + pmix_status_t rc; + pmix_lock_t mylock; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -1089,6 +1129,22 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_client(const pmix_proc_t *proc, cd->opcbfunc = cbfunc; cd->cbdata = cbdata; + /* if the provided callback is NULL, then substitute + * our own internal cbfunc and block here */ + if (NULL == cbfunc) { + PMIX_CONSTRUCT_LOCK(&mylock); + cd->opcbfunc = opcbfunc; + cd->cbdata = &mylock; + PMIX_THREADSHIFT(cd, _register_client); + PMIX_WAIT_THREAD(&mylock); + rc = mylock.status; + PMIX_DESTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS == rc) { + rc = PMIX_OPERATION_SUCCEEDED; + } + return rc; + } + /* we have to push this into our event library to avoid * potential threading issues */ PMIX_THREADSHIFT(cd, _register_client); @@ -1169,9 +1225,7 @@ static void _deregister_client(int sd, short args, void *cbdata) } cleanup: - if (NULL != cd->opcbfunc) { - cd->opcbfunc(PMIX_SUCCESS, cd->cbdata); - } + cd->opcbfunc(PMIX_SUCCESS, cd->cbdata); PMIX_RELEASE(cd); } @@ -1179,6 +1233,7 @@ PMIX_EXPORT void PMIx_server_deregister_client(const pmix_proc_t *proc, pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_setup_caddy_t *cd; + pmix_lock_t mylock; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -1206,6 +1261,18 @@ PMIX_EXPORT void PMIx_server_deregister_client(const pmix_proc_t *proc, cd->opcbfunc = cbfunc; cd->cbdata = cbdata; + /* if the provided callback is NULL, then substitute + * our own internal cbfunc and block here */ + if (NULL == cbfunc) { + PMIX_CONSTRUCT_LOCK(&mylock); + cd->opcbfunc = opcbfunc; + cd->cbdata = &mylock; + PMIX_THREADSHIFT(cd, _deregister_client); + PMIX_WAIT_THREAD(&mylock); + PMIX_DESTRUCT_LOCK(&mylock); + return; + } + /* we have to push this into our event library to avoid * potential threading issues */ PMIX_THREADSHIFT(cd, _deregister_client); @@ -2386,12 +2453,7 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) xfer.bytes_used = 0; PMIX_DESTRUCT(&xfer); - if (!tracker->lost_connection) { - /* if this tracker has gone thru the "lost_connection" procedure, - * then it has already been removed from the list - otherwise, - * remove it now */ - pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); - } + pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); PMIX_RELEASE(tracker); PMIX_LIST_DESTRUCT(&nslist); @@ -2644,12 +2706,7 @@ static void _cnct(int sd, short args, void *cbdata) if (NULL != nspaces) { pmix_argv_free(nspaces); } - if (!tracker->lost_connection) { - /* if this tracker has gone thru the "lost_connection" procedure, - * then it has already been removed from the list - otherwise, - * remove it now */ - pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); - } + pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); PMIX_RELEASE(tracker); /* we are done */ @@ -2726,12 +2783,7 @@ static void _discnct(int sd, short args, void *cbdata) cleanup: /* cleanup the tracker -- the host RM is responsible for * telling us when to remove the nspace from our data */ - if (!tracker->lost_connection) { - /* if this tracker has gone thru the "lost_connection" procedure, - * then it has already been removed from the list - otherwise, - * remove it now */ - pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); - } + pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); PMIX_RELEASE(tracker); /* we are done */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c index 5e239e0d03d..5f7ad645f86 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c @@ -375,6 +375,7 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, bool all_def; pmix_namespace_t *nptr, *ns; pmix_rank_info_t *info; + pmix_rank_t ns_local = 0; pmix_output_verbose(5, pmix_server_globals.base_output, "new_tracker called with %d procs", (int)nprocs); @@ -450,6 +451,7 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, * of the loop */ } /* is this one of my local ranks? */ + ns_local = 0; PMIX_LIST_FOREACH(info, &nptr->ranks, pmix_rank_info_t) { if (procs[i].rank == info->pname.rank || PMIX_RANK_WILDCARD == procs[i].rank) { @@ -457,12 +459,26 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, "adding local proc %s.%d to tracker", info->pname.nspace, info->pname.rank); /* track the count */ - ++trk->nlocal; + ns_local++; if (PMIX_RANK_WILDCARD != procs[i].rank) { break; } } } + + trk->nlocal += ns_local; + if (!ns_local) { + trk->local = false; + } else if (PMIX_RANK_WILDCARD == procs[i].rank) { + /* If proc is a wildcard we need to additionally check + * that all of the processes in the namespace were + * locally found. + * Otherwise this tracker is not local + */ + if (ns_local != nptr->nprocs) { + trk->local = false; + } + } } if (all_def) { trk->def_complete = true; @@ -645,6 +661,37 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { pmix_output_verbose(2, pmix_server_globals.base_output, "fence complete"); + /* if this is a purely local fence (i.e., all participants are local), + * then it is done and we notify accordingly */ + if (trk->local) { + /* the modexcbfunc thread-shifts the call prior to processing, + * so it is okay to call it directly from here. The switchyard + * will acknowledge successful acceptance of the fence request, + * but the client still requires a return from the callback in + * that scenario, so we leave this caddy on the list of local cbs */ + trk->modexcbfunc(PMIX_SUCCESS, NULL, 0, trk, NULL, NULL); + rc = PMIX_SUCCESS; + goto cleanup; + } + /* this fence involves non-local procs - check if the + * host supports it */ + if (NULL == pmix_host_server.fence_nb) { + rc = PMIX_ERR_NOT_SUPPORTED; + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the fence completion + * function doesn't need to do so */ + pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the fence completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->host_called = false; // the host will not be calling us back + trk->modexcbfunc(rc, NULL, 0, trk, NULL, NULL); + goto cleanup; + } /* if the user asked us to collect data, then we have * to provide any locally collected data to the host * server so they can circulate it - only take data @@ -719,18 +766,51 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, PMIX_BYTE_OBJECT_DESTRUCT(&bo); // releases the data if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&cb); + PMIX_DESTRUCT(&bucket); + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the fence completion + * function doesn't need to do so */ + pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the fence completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->modexcbfunc(rc, NULL, 0, trk, NULL, NULL); goto cleanup; } /* now unload the blob and pass it upstairs */ PMIX_UNLOAD_BUFFER(&bucket, data, sz); PMIX_DESTRUCT(&bucket); + trk->host_called = true; rc = pmix_host_server.fence_nb(trk->pcs, trk->npcs, trk->info, trk->ninfo, data, sz, trk->modexcbfunc, trk); - if (PMIX_SUCCESS != rc) { - pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); - PMIX_RELEASE(trk); + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the fence completion + * function doesn't need to do so */ + pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the fence completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->host_called = false; // the host will not be calling us back + trk->modexcbfunc(rc, NULL, 0, trk, NULL, NULL); + } else if (PMIX_OPERATION_SUCCEEDED == rc) { + /* the operation was atomically completed and the host will + * not be calling us back - ensure we notify all participants. + * the modexcbfunc thread-shifts the call prior to processing, + * so it is okay to call it directly from here */ + trk->host_called = false; // the host will not be calling us back + trk->modexcbfunc(PMIX_SUCCESS, NULL, 0, trk, NULL, NULL); + /* ensure that the switchyard doesn't release the caddy */ + rc = PMIX_SUCCESS; } } @@ -1377,11 +1457,31 @@ pmix_status_t pmix_server_disconnect(pmix_server_caddy_t *cd, * across all participants has been completed */ if (trk->def_complete && pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { + trk->host_called = true; rc = pmix_host_server.disconnect(trk->pcs, trk->npcs, trk->info, trk->ninfo, cbfunc, trk); - if (PMIX_SUCCESS != rc) { - /* remove this contributor from the list - they will be notified - * by the switchyard */ + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the op completion + * function doesn't need to do so */ pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the op completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->host_called = false; // the host will not be calling us back + cbfunc(rc, trk); + } else if (PMIX_OPERATION_SUCCEEDED == rc) { + /* the operation was atomically completed and the host will + * not be calling us back - ensure we notify all participants. + * the cbfunc thread-shifts the call prior to processing, + * so it is okay to call it directly from here */ + trk->host_called = false; // the host will not be calling us back + cbfunc(PMIX_SUCCESS, trk); + /* ensure that the switchyard doesn't release the caddy */ + rc = PMIX_SUCCESS; } } else { rc = PMIX_SUCCESS; @@ -1526,11 +1626,31 @@ pmix_status_t pmix_server_connect(pmix_server_caddy_t *cd, * across all participants has been completed */ if (trk->def_complete && pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { + trk->host_called = true; rc = pmix_host_server.connect(trk->pcs, trk->npcs, trk->info, trk->ninfo, cbfunc, trk); - if (PMIX_SUCCESS != rc) { - /* remove this contributor from the list - they will be notified - * by the switchyard */ + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the op completion + * function doesn't need to do so */ pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the op completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->host_called = false; // the host will not be calling us back + cbfunc(rc, trk); + } else if (PMIX_OPERATION_SUCCEEDED == rc) { + /* the operation was atomically completed and the host will + * not be calling us back - ensure we notify all participants. + * the cbfunc thread-shifts the call prior to processing, + * so it is okay to call it directly from here */ + trk->host_called = false; // the host will not be calling us back + cbfunc(PMIX_SUCCESS, trk); + /* ensure that the switchyard doesn't release the caddy */ + rc = PMIX_SUCCESS; } } else { rc = PMIX_SUCCESS; @@ -1555,29 +1675,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", @@ -1775,47 +2060,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 reg events returned rc =%d", rc); - if (NULL != scd->codes) { - free(scd->codes); - } - if (NULL != scd->info) { - PMIX_INFO_FREE(scd->info, scd->ninfo); + "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); 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: @@ -1824,144 +2130,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; } @@ -3318,7 +3492,7 @@ pmix_status_t pmix_server_iofstdin(pmix_peer_t *peer, static void tcon(pmix_server_trkr_t *t) { t->event_active = false; - t->lost_connection = false; + t->host_called = false; t->id = NULL; memset(t->pname.nspace, 0, PMIX_MAX_NSLEN+1); t->pname.rank = PMIX_RANK_UNDEF; @@ -3426,11 +3600,17 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_setup_caddy_t, static void ncon(pmix_notify_caddy_t *p) { - struct timespec tp; - PMIX_CONSTRUCT_LOCK(&p->lock); - clock_gettime(CLOCK_MONOTONIC, &tp); +#if defined(__linux__) && OPAL_HAVE_CLOCK_GETTIME + struct timespec tp; + (void) clock_gettime(CLOCK_MONOTONIC, &tp); p->ts = tp.tv_sec; +#else + /* Fall back to gettimeofday() if we have nothing else */ + struct timeval tv; + gettimeofday(&tv, NULL); + p->ts = tv.tv_sec; +#endif p->room = -1; memset(p->source.nspace, 0, PMIX_MAX_NSLEN+1); p->source.rank = PMIX_RANK_UNDEF; diff --git a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c index effa1190ff2..d2b9c9acbe5 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c @@ -260,9 +260,7 @@ static void job_data(struct pmix_peer_t *pr, PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, pmix_info_t info[], size_t ninfo) { - pmix_kval_t *kptr; pmix_status_t rc; - char hostname[PMIX_MAX_NSLEN]; char *evar, *nspace = NULL; pmix_rank_t rank = PMIX_RANK_UNDEF; bool gdsfound, do_not_connect = false; @@ -738,314 +736,39 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } + /* quick check to see if we got something back. If this + * is a launcher that is being executed multiple times + * in a job-script, then the original registration data + * will have been deleted after the first invocation. In + * such a case, we simply regenerate it locally as it is + * well-known */ + pmix_cb_t cb; + PMIX_CONSTRUCT(&cb, pmix_cb_t); + pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + wildcard.rank = PMIX_RANK_WILDCARD; + cb.proc = &wildcard; + cb.copy = true; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + PMIX_DESTRUCT(&cb); + if (PMIX_SUCCESS != rc) { + pmix_output_verbose(5, pmix_client_globals.get_output, + "pmix:tool:client data not found in internal storage"); + rc = pmix_tool_init_info(); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + } } else { /* now finish the initialization by filling our local * datastore with typical job-related info. No point * in having the server generate these as we are * obviously a singleton, and so the values are well-known */ - pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); - wildcard.rank = pmix_globals.myid.rank; - - /* the jobid is just our nspace */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_JOBID); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup(pmix_globals.myid.nspace); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* our rank */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_RANK); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_INT; - kptr->value->data.integer = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* nproc offset */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_NPROC_OFFSET); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* node size */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_NODE_SIZE); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* local peers */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_LOCAL_PEERS); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup("0"); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* local leader */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_LOCALLDR); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* universe size */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_UNIV_SIZE); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* job size - we are our very own job, so we have no peers */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_JOB_SIZE); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* local size - only us in our job */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_LOCAL_SIZE); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* max procs - since we are a self-started tool, there is no - * allocation within which we can grow ourselves */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_MAX_PROCS); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* app number */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_APPNUM); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* app leader */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_APPLDR); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* app rank */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_APP_RANK); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* global rank */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_GLOBAL_RANK); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* local rank - we are alone in our job */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_LOCAL_RANK); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT16; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* we cannot know the node rank as we don't know what - * other processes are executing on this node - so - * we'll add that info to the server-tool handshake - * and load it from there */ - - /* hostname */ - gethostname(hostname, PMIX_MAX_NSLEN); - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_HOSTNAME); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup(hostname); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* we cannot know the RM's nodeid for this host, so - * we'll add that info to the server-tool handshake - * and load it from there */ - - /* the nodemap is simply our hostname as there is no - * regex to generate */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_NODE_MAP); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup(hostname); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* likewise, the proc map is just our rank as we are - * the only proc in this job */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_PROC_MAP); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup("0"); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); + rc = pmix_tool_init_info(); if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } - PMIX_RELEASE(kptr); // maintain accounting } PMIX_RELEASE_THREAD(&pmix_global_lock); @@ -1061,6 +784,307 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, return rc; } +pmix_status_t pmix_tool_init_info(void) +{ + pmix_kval_t *kptr; + pmix_status_t rc; + pmix_proc_t wildcard; + char hostname[PMIX_MAX_NSLEN]; + + pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + wildcard.rank = pmix_globals.myid.rank; + + /* the jobid is just our nspace */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_JOBID); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup(pmix_globals.myid.nspace); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* our rank */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_INT; + kptr->value->data.integer = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* nproc offset */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_NPROC_OFFSET); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* node size */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_NODE_SIZE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* local peers */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_LOCAL_PEERS); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup("0"); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* local leader */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_LOCALLDR); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* universe size */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_UNIV_SIZE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* job size - we are our very own job, so we have no peers */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_JOB_SIZE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* local size - only us in our job */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_LOCAL_SIZE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* max procs - since we are a self-started tool, there is no + * allocation within which we can grow ourselves */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_MAX_PROCS); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* app number */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_APPNUM); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* app leader */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_APPLDR); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* app rank */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_APP_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* global rank */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_GLOBAL_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* local rank - we are alone in our job */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_LOCAL_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT16; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* we cannot know the node rank as we don't know what + * other processes are executing on this node - so + * we'll add that info to the server-tool handshake + * and load it from there */ + + /* hostname */ + if (NULL != pmix_globals.hostname) { + pmix_strncpy(hostname, pmix_globals.hostname, PMIX_MAX_NSLEN); + } else { + gethostname(hostname, PMIX_MAX_NSLEN); + } + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_HOSTNAME); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup(hostname); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* we cannot know the RM's nodeid for this host, so + * we'll add that info to the server-tool handshake + * and load it from there */ + + /* the nodemap is simply our hostname as there is no + * regex to generate */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_NODE_MAP); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup(hostname); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* likewise, the proc map is just our rank as we are + * the only proc in this job */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_PROC_MAP); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup("0"); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + return PMIX_SUCCESS; +} + + typedef struct { pmix_lock_t lock; pmix_event_t ev; diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/output.c b/opal/mca/pmix/pmix3x/pmix/src/util/output.c index 8648f1a0b72..cf73f507008 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/output.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/output.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007-2008 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) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -332,15 +332,10 @@ PMIX_EXPORT void pmix_output(int output_id, const char *format, ...) /* * Send a message to a stream if the verbose level is high enough */ - PMIX_EXPORT void pmix_output_verbose(int level, int output_id, const char *format, ...) + PMIX_EXPORT bool pmix_output_check_verbosity(int level, int output_id) { - if (output_id >= 0 && output_id < PMIX_OUTPUT_MAX_STREAMS && - info[output_id].ldi_verbose_level >= level) { - va_list arglist; - va_start(arglist, format); - output(output_id, format, arglist); - va_end(arglist); - } + return (output_id >= 0 && output_id < PMIX_OUTPUT_MAX_STREAMS && + info[output_id].ldi_verbose_level >= level); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/output.h b/opal/mca/pmix/pmix3x/pmix/src/util/output.h index c3274bab7d0..5e8fa677b5e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/output.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/output.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -414,12 +414,13 @@ PMIX_EXPORT void pmix_output(int output_id, const char *format, ...) __pmix_attr * * @see pmix_output_set_verbosity() */ -PMIX_EXPORT void pmix_output_verbose(int verbose_level, int output_id, - const char *format, ...) __pmix_attribute_format__(__printf__, 3, 4); +#define pmix_output_verbose(verbose_level, output_id, ...) \ + if (pmix_output_check_verbosity(verbose_level, output_id)) { \ + pmix_output(output_id, __VA_ARGS__); \ + } + +PMIX_EXPORT bool pmix_output_check_verbosity(int verbose_level, int output_id); -/** -* Same as pmix_output_verbose(), but takes a va_list form of varargs. -*/ PMIX_EXPORT void pmix_output_vverbose(int verbose_level, int output_id, const char *format, va_list ap) __pmix_attribute_format__(__printf__, 3, 0); diff --git a/opal/mca/pmix/pmix3x/pmix/test/Makefile.am b/opal/mca/pmix/pmix3x/pmix/test/Makefile.am index 3b4ee7214ca..c886e3b1fb3 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/test/Makefile.am @@ -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$ @@ -33,9 +33,61 @@ headers = test_common.h cli_stages.h server_callbacks.h utils.h test_fence.h \ AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/src/api -noinst_SCRIPTS = pmix_client_otheruser.sh +noinst_SCRIPTS = pmix_client_otheruser.sh \ + run_tests00.pl \ + run_tests01.pl \ + run_tests02.pl \ + run_tests03.pl \ + run_tests04.pl \ + run_tests05.pl \ + run_tests06.pl \ + run_tests07.pl \ + run_tests08.pl \ + run_tests09.pl \ + run_tests10.pl \ + run_tests11.pl \ + run_tests12.pl \ + run_tests13.pl \ + run_tests14.pl \ + run_tests15.pl + noinst_PROGRAMS = +######################### +# Support for "make check" + +check_PROGRAMS = \ + pmix_test \ + pmix_client \ + pmix_regex + +if WANT_PMI_BACKWARD +check_PROGRAMS += \ + pmi_client \ + pmi2_client +endif + +TESTS = \ + run_tests00.pl \ + run_tests01.pl \ + run_tests02.pl \ + run_tests03.pl \ + run_tests04.pl \ + run_tests05.pl \ + run_tests06.pl \ + run_tests07.pl \ + run_tests08.pl \ + run_tests09.pl \ + run_tests10.pl \ + run_tests11.pl \ + run_tests12.pl \ + run_tests13.pl \ + run_tests14.pl \ + run_tests15.pl + + +########################## + if WANT_PMI_BACKWARD noinst_PROGRAMS += pmi_client pmi2_client endif diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_common.h b/opal/mca/pmix/pmix3x/pmix/test/test_common.h index fd25f8bdf87..10b180e6598 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_common.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_common.h @@ -262,7 +262,7 @@ typedef struct { TEST_VERBOSE(("%s:%d want to get from %s:%d key %s", my_nspace, my_rank, ns, r, key)); \ if (blocking) { \ if (PMIX_SUCCESS != (rc = PMIx_Get(&foobar, key, NULL, 0, &val))) { \ - if( !( rc == PMIX_ERR_NOT_FOUND && ok_notfnd ) ){ \ + if( !( (rc == PMIX_ERR_NOT_FOUND || rc == PMIX_ERR_PROC_ENTRY_NOT_FOUND) && ok_notfnd ) ){ \ TEST_ERROR(("%s:%d: PMIx_Get failed: %d from %s:%d, key %s", my_nspace, my_rank, rc, ns, r, key)); \ } \ rc = PMIX_ERROR; \ @@ -289,7 +289,7 @@ typedef struct { } \ if (PMIX_SUCCESS == rc) { \ if( PMIX_SUCCESS != cbdata.status ){ \ - if( !( cbdata.status == PMIX_ERR_NOT_FOUND && ok_notfnd ) ){ \ + if( !( (cbdata.status == PMIX_ERR_NOT_FOUND || cbdata.status == PMIX_ERR_PROC_ENTRY_NOT_FOUND) && ok_notfnd ) ){ \ TEST_ERROR(("%s:%d: PMIx_Get_nb failed: %d from %s:%d, key=%s", \ my_nspace, my_rank, rc, my_nspace, r)); \ } \ diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_fence.c b/opal/mca/pmix/pmix3x/pmix/test/test_fence.c index 9ad4cf786df..a33d9618b71 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_fence.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_fence.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015-2017 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -384,7 +384,7 @@ int test_job_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) if( local ){ GET(int, (12340+j), my_nspace, i+params.base_rank, 100, j, 0, 0, 0); if (PMIX_SUCCESS != rc) { - TEST_ERROR(("%s:%d: PMIx_Get failed: %d", my_nspace, my_rank, rc)); + TEST_ERROR(("%s:%d: PMIx_Get failed: %s", my_nspace, my_rank, PMIx_Error_string(rc))); return PMIX_ERROR; } @@ -423,9 +423,10 @@ int test_job_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) my_nspace, my_rank)); return PMIX_ERROR; } - if (PMIX_ERR_NOT_FOUND != rc) { - TEST_ERROR(("%s:%d [ERROR]: PMIx_Get returned %d instead of not_found", - my_nspace, my_rank, rc)); + if (PMIX_ERR_NOT_FOUND != rc && PMIX_ERR_PROC_ENTRY_NOT_FOUND != rc) { + TEST_ERROR(("%s:%d [ERROR]: PMIx_Get returned %s instead of not_found", + my_nspace, my_rank, PMIx_Error_string(rc))); + return PMIX_ERROR; } if (NULL != val) { TEST_ERROR(("%s:%d [ERROR]: PMIx_Get did not return NULL value", my_nspace, my_rank)); diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_server.c b/opal/mca/pmix/pmix3x/pmix/test/test_server.c index 3627dade912..426014149ef 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_server.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 Research Organization for Information Science @@ -93,12 +93,36 @@ static void release_cb(pmix_status_t status, void *cbdata) *ptr = 0; } -static void set_namespace(int local_size, int univ_size, char *ranks, char *name) +static void fill_seq_ranks_array(size_t nprocs, int base_rank, char **ranks) +{ + uint32_t i; + int len = 0, max_ranks_len; + if (0 >= nprocs) { + return; + } + max_ranks_len = nprocs * (MAX_DIGIT_LEN+1); + *ranks = (char*) malloc(max_ranks_len); + for (i = 0; i < nprocs; i++) { + len += snprintf(*ranks + len, max_ranks_len-len-1, "%d", i+base_rank); + if (i != nprocs-1) { + len += snprintf(*ranks + len, max_ranks_len-len-1, "%c", ','); + } + } + if (len >= max_ranks_len-1) { + free(*ranks); + *ranks = NULL; + TEST_ERROR(("Not enough allocated space for global ranks array.")); + } +} + +static void set_namespace(int local_size, int univ_size, + int base_rank, char *name) { size_t ninfo; pmix_info_t *info; ninfo = 8; char *regex, *ppn; + char *ranks = NULL; PMIX_INFO_CREATE(info, ninfo); pmix_strncpy(info[0].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); @@ -113,19 +137,31 @@ static void set_namespace(int local_size, int univ_size, char *ranks, char *name info[2].value.type = PMIX_UINT32; info[2].value.data.uint32 = local_size; + /* generate the array of local peers */ + fill_seq_ranks_array(local_size, base_rank, &ranks); + if (NULL == ranks) { + return; + } pmix_strncpy(info[3].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); info[3].value.type = PMIX_STRING; info[3].value.data.string = strdup(ranks); + free(ranks); PMIx_generate_regex(NODE_NAME, ®ex); pmix_strncpy(info[4].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); info[4].value.type = PMIX_STRING; - info[4].value.data.string = regex; + info[4].value.data.string = strdup(regex); + /* generate the global proc map */ + fill_seq_ranks_array(univ_size, 0, &ranks); + if (NULL == ranks) { + return; + } PMIx_generate_ppn(ranks, &ppn); + free(ranks); pmix_strncpy(info[5].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); info[5].value.type = PMIX_STRING; - info[5].value.data.string = ppn; + info[5].value.data.string = strdup(ppn); pmix_strncpy(info[6].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); info[6].value.type = PMIX_UINT32; @@ -143,28 +179,6 @@ static void set_namespace(int local_size, int univ_size, char *ranks, char *name PMIX_INFO_FREE(info, ninfo); } -static void fill_seq_ranks_array(size_t nprocs, int base_rank, char **ranks) -{ - uint32_t i; - int len = 0, max_ranks_len; - if (0 >= nprocs) { - return; - } - max_ranks_len = nprocs * (MAX_DIGIT_LEN+1); - *ranks = (char*) malloc(max_ranks_len); - for (i = 0; i < nprocs; i++) { - len += snprintf(*ranks + len, max_ranks_len-len-1, "%d", i+base_rank); - if (i != nprocs-1) { - len += snprintf(*ranks + len, max_ranks_len-len-1, "%c", ','); - } - } - if (len >= max_ranks_len-1) { - free(*ranks); - *ranks = NULL; - TEST_ERROR(("Not enough allocated space for global ranks array.")); - } -} - static void server_unpack_procs(char *buf, size_t size) { char *ptr = buf; @@ -878,14 +892,8 @@ int server_launch_clients(int local_size, int univ_size, int base_rank, univ_size)); TEST_VERBOSE(("Setting job info")); - fill_seq_ranks_array(local_size, base_rank, &ranks); - if (NULL == ranks) { - PMIx_server_finalize(); - TEST_ERROR(("fill_seq_ranks_array failed")); - return PMIX_ERROR; - } (void)snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s-%d", TEST_NAMESPACE, num_ns); - set_namespace(local_size, univ_size, ranks, proc.nspace); + set_namespace(local_size, univ_size, base_rank, proc.nspace); if (NULL != ranks) { free(ranks); } @@ -909,17 +917,18 @@ int server_launch_clients(int local_size, int univ_size, int base_rank, /* fork/exec the test */ for (n = 0; n < local_size; n++) { proc.rank = base_rank + rank_counter; - if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, client_env))) {//n - TEST_ERROR(("Server fork setup failed with error %d", rc)); + rc = PMIx_server_register_client(&proc, myuid, mygid, NULL, NULL, NULL); + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { + TEST_ERROR(("Server register client failed with error %d", rc)); PMIx_server_finalize(); cli_kill_all(); - return rc; + return 0; } - if (PMIX_SUCCESS != (rc = PMIx_server_register_client(&proc, myuid, mygid, NULL, NULL, NULL))) {//n + if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, client_env))) {//n TEST_ERROR(("Server fork setup failed with error %d", rc)); PMIx_server_finalize(); cli_kill_all(); - return 0; + return rc; } cli_info[cli_counter].pid = fork();