From eba14f3ad2dbb22b4680794e67b27cf217714ab6 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Wed, 28 Mar 2018 19:54:15 -0500 Subject: [PATCH] Update to PMIx 2.0.3 Signed-off-by: Joshua Hursey --- opal/mca/pmix/pmix2x/pmix/NEWS | 48 +- opal/mca/pmix/pmix2x/pmix/README | 28 +- opal/mca/pmix/pmix2x/pmix/VERSION | 12 +- .../mca/pmix/pmix2x/pmix/config/distscript.sh | 11 + opal/mca/pmix/pmix2x/pmix/config/pmix.m4 | 38 +- .../pmix2x/pmix/config/pmix_check_package.m4 | 2 +- .../pmix2x/pmix/config/pmix_config_asm.m4 | 16 +- .../pmix/pmix2x/pmix/config/pmix_functions.m4 | 2 +- .../pmix/pmix2x/pmix/config/pmix_setup_cc.m4 | 2 +- opal/mca/pmix/pmix2x/pmix/configure.ac | 2 + opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec | 116 ++-- .../mca/pmix/pmix2x/pmix/examples/Makefile.am | 6 +- opal/mca/pmix/pmix2x/pmix/examples/client.c | 129 ++-- opal/mca/pmix/pmix2x/pmix/examples/client2.c | 223 +++++++ .../pmix/pmix2x/pmix/include/pmix_common.h | 32 +- .../pmix/pmix2x/pmix/include/pmix_rename.h.in | 2 +- opal/mca/pmix/pmix2x/pmix/src/Makefile.am | 20 +- .../pmix/src/atomics/sys/Makefile.include | 2 - .../pmix2x/pmix/src/atomics/sys/arm/timer.h | 1 - .../pmix2x/pmix/src/atomics/sys/arm64/timer.h | 1 - .../pmix2x/pmix/src/atomics/sys/atomic_impl.h | 1 - .../pmix2x/pmix/src/atomics/sys/ia32/timer.h | 1 - .../src/atomics/sys/ia64/Makefile.include | 24 - .../pmix2x/pmix/src/atomics/sys/ia64/atomic.h | 146 ---- .../pmix2x/pmix/src/atomics/sys/ia64/timer.h | 49 -- .../src/atomics/sys/mips/Makefile.include | 24 - .../pmix2x/pmix/src/atomics/sys/mips/atomic.h | 199 ------ .../pmix2x/pmix/src/atomics/sys/mips/timer.h | 34 - .../pmix/src/atomics/sys/powerpc/atomic.h | 4 +- .../pmix/src/atomics/sys/powerpc/timer.h | 1 - .../pmix/src/atomics/sys/sparcv9/timer.h | 1 - .../pmix2x/pmix/src/buffer_ops/buffer_ops.h | 7 +- .../pmix/pmix2x/pmix/src/buffer_ops/unpack.c | 7 + .../pmix2x/pmix/src/client/Makefile.include | 5 +- opal/mca/pmix/pmix2x/pmix/src/client/pmi1.c | 92 ++- opal/mca/pmix/pmix2x/pmix/src/client/pmi2.c | 95 ++- .../pmix/pmix2x/pmix/src/client/pmix_client.c | 21 +- .../pmix/src/client/pmix_client_connect.c | 15 +- .../pmix/src/client/pmix_client_fence.c | 10 +- .../pmix2x/pmix/src/client/pmix_client_get.c | 24 +- .../pmix2x/pmix/src/client/pmix_client_pub.c | 34 +- .../pmix/src/client/pmix_client_spawn.c | 55 +- .../pmix2x/pmix/src/common/pmix_control.c | 13 +- .../pmix/pmix2x/pmix/src/common/pmix_data.c | 8 +- .../pmix2x/pmix/src/common/pmix_jobdata.c | 26 +- .../pmix/src/event/pmix_event_notification.c | 6 +- .../pmix/src/event/pmix_event_registration.c | 25 +- .../pmix/src/mca/base/pmix_mca_base_open.c | 6 +- .../pmix/src/mca/base/pmix_mca_base_var.c | 16 +- .../pmix/src/mca/base/pmix_mca_base_var.h | 70 +- .../pmix/src/mca/psec/base/psec_base_select.c | 13 +- .../pmix/src/mca/psec/munge/Makefile.am | 8 +- .../pmix/src/mca/psec/munge/psec_munge.c | 38 +- .../pmix2x/pmix/src/mca/psec/none/psec_none.c | 16 +- .../pmix/pmix2x/pmix/src/mca/ptl/base/base.h | 6 +- .../pmix/src/mca/ptl/base/ptl_base_frame.c | 15 +- .../pmix/src/mca/ptl/base/ptl_base_sendrecv.c | 24 +- .../pmix/pmix2x/pmix/src/mca/ptl/ptl_types.h | 6 +- .../pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp.c | 57 +- .../pmix/src/mca/ptl/tcp/ptl_tcp_component.c | 28 +- .../pmix2x/pmix/src/mca/ptl/usock/Makefile.am | 50 -- .../pmix2x/pmix/src/mca/ptl/usock/ptl_usock.c | 358 ---------- .../pmix2x/pmix/src/mca/ptl/usock/ptl_usock.h | 47 -- .../src/mca/ptl/usock/ptl_usock_component.c | 630 ------------------ .../pmix2x/pmix/src/runtime/Makefile.include | 4 +- .../pmix/src/runtime/help-pmix-runtime.txt | 12 +- .../pmix/pmix2x/pmix/src/server/pmix_server.c | 24 +- .../pmix2x/pmix/src/server/pmix_server_get.c | 5 +- .../pmix2x/pmix/src/server/pmix_server_ops.c | 80 ++- .../pmix2x/pmix/src/server/pmix_server_ops.h | 5 +- opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c | 1 - .../pmix2x/pmix/src/threads/Makefile.include | 2 +- .../mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c | 56 +- opal/mca/pmix/pmix2x/pmix/src/util/compress.h | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/output.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/Makefile.am | 4 +- .../pmix/pmix2x/pmix/test/server_callbacks.c | 4 +- opal/mca/pmix/pmix2x/pmix/test/test_common.c | 3 +- opal/mca/pmix/pmix2x/pmix/test/test_common.h | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_fence.c | 3 +- 80 files changed, 1245 insertions(+), 1972 deletions(-) create mode 100644 opal/mca/pmix/pmix2x/pmix/examples/client2.c mode change 100755 => 100644 opal/mca/pmix/pmix2x/pmix/include/pmix_rename.h.in delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/Makefile.include delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/atomic.h delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/timer.h delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/Makefile.include delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/atomic.h delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/timer.h delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/Makefile.am delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock.c delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock.h delete mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock_component.c diff --git a/opal/mca/pmix/pmix2x/pmix/NEWS b/opal/mca/pmix/pmix2x/pmix/NEWS index 1caf0b7271d..590e3faf2ed 100644 --- a/opal/mca/pmix/pmix2x/pmix/NEWS +++ b/opal/mca/pmix/pmix2x/pmix/NEWS @@ -1,4 +1,4 @@ -Copyright (c) 2015-2017 Intel, Inc. All rights reserved. +Copyright (c) 2015-2018 Intel, Inc. All rights reserved. Copyright (c) 2017 IBM Corporation. All rights reserved. $COPYRIGHT$ @@ -20,6 +20,43 @@ other, a single NEWS-worthy item might apply to different series. For example, a bug might be fixed in the master, and then moved to the current release as well as the "stable" bug fix release branch. +2.0.3 -- 23 Feb 2018 +---------------------- +**** NOTE: PMIx_Get in PMIx v2.x will fail when requesting information +**** on any process whose nspace has not yet been registered with the +**** PMIx server +- Fix event notification so all sides of multi-library get notified + of other library's existence +- Update syslog protection to support Mac High Sierra OS +- Remove usock component - unable to support v1.x clients due + to datatype differences +- Cleanup security handshake +- Cleanup separation of PMI-1/2 libraries and PMIx symbols +- Protect against overly-large messages +- Update data buffer APIs to support cross-version operations +- Protect receive callbacks from NULL and/or empty buffers as this + can occur when the peer on a connection disappears. +- Fix tool connection search so it properly descends into the directory + tree while searching for the server's contact file. +- Fix store_local so it doesn't reject a new nspace as that can happen + when working with tools +- Ensure we always complete PMIx_Finalize - don't return if something + goes wrong in the middle of the procedure +- Fix several tool connection issues +- Fix a mismatch in data type on an MCA param + + +2.0.2 -- 19 Oct 2017 +---------------------- +- Update RPM spec file (rpmbuild -ta, and --rebuild fixes) (PR #523) +- Support singletons in PMI-1/PMI-2 (PR #537) +- Provide missing implementation support for arrays of pmix_value_t's (PR #531) +- Remove unsupported assembly code for MIPS and ARM processors + prior to v6 (PR #547) +- Fix path separator for PMIx configuration files (PR #547) +- Add configure option to enable/disable the default value for the + show-load-errors MCA param (PR #547) + 2.0.1 -- 24 Aug. 2017 ---------------------- @@ -90,6 +127,15 @@ current release as well as the "stable" bug fix release branch. and to themselves +1.2.4 -- 13 Oct. 2017 +---------------------- +- Silence some unnecessary warning messages (PR #487) +- Coverity fix - TOCTOU (PR #465) +- automake 1.13 configure fix (PR #486) +- Update RPM spec file (rpmbuild -ta, and --rebuild fixes) (PR #523) +- Support singletons in PMI-1/PMI-2 (PR #537) + + 1.2.3 -- 24 Aug. 2017 ---------------------- - Resolve visibility issues for public APIs (PR #451) diff --git a/opal/mca/pmix/pmix2x/pmix/README b/opal/mca/pmix/pmix2x/pmix/README index 55b7c61f5e3..386aed4de63 100644 --- a/opal/mca/pmix/pmix2x/pmix/README +++ b/opal/mca/pmix/pmix2x/pmix/README @@ -15,7 +15,7 @@ Copyright (c) 2007 Myricom, Inc. All rights reserved. Copyright (c) 2008 IBM Corporation. All rights reserved. Copyright (c) 2010 Oak Ridge National Labs. All rights reserved. Copyright (c) 2011 University of Houston. All rights reserved. -Copyright (c) 2013-2015 Intel, Inc. All rights reserved +Copyright (c) 2013-2017 Intel, Inc. All rights reserved. $COPYRIGHT$ Additional copyrights may follow @@ -128,6 +128,32 @@ INSTALLATION OPTIONS --disable-shared; enabling static libraries and disabling shared libraries are two independent options. + --disable-show-load-errors-by-default + Set the default value of the mca_base_component_show_load_errors MCA + variable: the --enable form of this option sets the MCA variable to + true, the --disable form sets the MCA variable to false. The MCA + mca_base_component_show_load_errors variable can still be overridden + at run time via the usual MCA-variable-setting mechanisms; this + configure option simply sets the default value. + + The --disable form of this option is intended for PMIx packagers + who tend to enable support for many different types of networks and + systems in their packages. For example, consider a packager who + includes support for both the FOO and BAR networks in their PMIx + package, both of which require support libraries (libFOO.so and + libBAR.so). If an end user only has BAR hardware, they likely only + have libBAR.so available on their systems -- not libFOO.so. + Disabling load errors by default will prevent the user from seeing + potentially confusing warnings about the FOO components failing to + load because libFOO.so is not available on their systems. + + Conversely, system administrators tend to build a PMIx that is + targeted at their specific environment, and contains few (if any) + components that are not needed. In such cases, they might want + their users to be warned that the FOO network components failed to + load (e.g., if libFOO.so was mistakenly unavailable), and thus + some PMIx calls might unexpectedly return "not supported". + --with-platform=FILE Load configure options for the build from FILE. Options on the command line that are not in FILE are also used. Options on the diff --git a/opal/mca/pmix/pmix2x/pmix/VERSION b/opal/mca/pmix/pmix2x/pmix/VERSION index f4b42c4d40a..3c56c372795 100644 --- a/opal/mca/pmix/pmix2x/pmix/VERSION +++ b/opal/mca/pmix/pmix2x/pmix/VERSION @@ -15,7 +15,7 @@ major=2 minor=0 -release=1 +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=1 # The only requirement is that it must be entirely printable ASCII # characters and have no white space. -greek=rc1 +greek= # 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=gitda9b50e +repo_rev=gitf2bdb4a # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -44,7 +44,7 @@ tarball_version= # The date when this release was created -date="Aug 14, 2017" +date="Mar 05, 2018" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -75,4 +75,6 @@ date="Aug 14, 2017" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=3:1:1 +libpmix_so_version=3:3:1 +libpmi_so_version=1:0:0 +libpmi2_so_version=1:0:0 diff --git a/opal/mca/pmix/pmix2x/pmix/config/distscript.sh b/opal/mca/pmix/pmix2x/pmix/config/distscript.sh index fbb37a78716..a91aec2e3fe 100755 --- a/opal/mca/pmix/pmix2x/pmix/config/distscript.sh +++ b/opal/mca/pmix/pmix2x/pmix/config/distscript.sh @@ -54,3 +54,14 @@ touch -r "${srcdir}/VERSION" "${distdir}/VERSION" echo "*** Updated VERSION file with repo rev: $repo_rev" echo "*** (via dist-hook / config/distscript.sh)" + +# +# Update pmix.spec:%{version} with the main version +# +PMIX_SPEC=contrib/pmix.spec +perl -pi -e 's/^Version:.*/Version: '$PMIX_REPO_REV'/' -- "${distdir}/$PMIX_SPEC" +touch -r "${srcdir}/$PMIX_VERSION" "${distdir}/$PMIX_VERSION" + +echo "*** Updated $PMIX_SPEC file with repo rev: $PMIX_REPO_REV" +echo "*** (via dist-hook / config/distscript.sh)" + diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 index ccce0aa97f3..6ffa3cfc1c4 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 @@ -156,18 +156,6 @@ AC_DEFUN([PMIX_SETUP_CORE],[ AC_SUBST(PMIX_RENAME) AC_CONFIG_FILES(pmix_config_prefix[include/pmix_rename.h]) - # Add any extra lib? - AC_ARG_WITH([pmix-extra-lib], - AC_HELP_STRING([--with-pmix-extra-lib=LIB], - [Link the output PMIx library to this extra lib (used in embedded mode)])) - AC_MSG_CHECKING([for extra lib]) - AS_IF([test ! -z "$with_pmix_extra_lib"], - [AC_MSG_RESULT([$with_pmix_extra_lib]) - PMIX_EXTRA_LIB=$with_pmix_extra_lib], - [AC_MSG_RESULT([no]) - PMIX_EXTRA_LIB=]) - AC_SUBST(PMIX_EXTRA_LIB) - # GCC specifics. if test "x$GCC" = "xyes"; then PMIX_GCC_CFLAGS="-Wall -Wmissing-prototypes -Wundef" @@ -698,6 +686,32 @@ AC_DEFUN([PMIX_SETUP_CORE],[ pmix_show_title "Modular Component Architecture (MCA) setup" + # + # Do we want to show component load error messages by default? + # + + AC_MSG_CHECKING([for default value of mca_base_component_show_load_errors]) + AC_ARG_ENABLE([show-load-errors-by-default], + [AC_HELP_STRING([--enable-show-load-errors-by-default], + [Set the default value for the MCA parameter + mca_base_component_show_load_errors (but can be + overridden at run time by the usual + MCA-variable-setting mechansism). This MCA variable + controls whether warnings are displayed when an MCA + component fails to load at run time due to an error. + (default: enabled, meaning that + mca_base_component_show_load_errors is enabled + by default])]) + if test "$enable_show_load_errors_by_default" = "no" ; then + PMIX_SHOW_LOAD_ERRORS_DEFAULT=0 + AC_MSG_RESULT([disabled by default]) + else + PMIX_SHOW_LOAD_ERRORS_DEFAULT=1 + AC_MSG_RESULT([enabled by default]) + fi + AC_DEFINE_UNQUOTED(PMIX_SHOW_LOAD_ERRORS_DEFAULT, $PMIX_SHOW_LOAD_ERRORS_DEFAULT, + [Default value for mca_base_component_show_load_errors MCA variable]) + AC_MSG_CHECKING([for subdir args]) PMIX_CONFIG_SUBDIR_ARGS([pmix_subdir_args]) AC_MSG_RESULT([$pmix_subdir_args]) diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_package.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_package.m4 index 283c59bd6a6..babb542cde1 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_package.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_package.m4 @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2014 Intel, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_config_asm.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_config_asm.m4 index 91f24ad1f12..062440499a6 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_config_asm.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_config_asm.m4 @@ -959,8 +959,8 @@ AC_DEFUN([PMIX_CONFIG_ASM],[ ia64-*) pmix_cv_asm_arch="IA64" - PMIX_ASM_SUPPORT_64BIT=1 - PMIX_GCC_INLINE_ASSIGN='"mov %0=r0\n;;\n" : "=&r"(ret)' + PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], + [AC_MSG_ERROR([No atomic primitives available for $host])]) ;; aarch64*) pmix_cv_asm_arch="ARM64" @@ -993,20 +993,16 @@ AC_DEFUN([PMIX_CONFIG_ASM],[ armv5*linux*|armv4*linux*|arm-*-linux-gnueabi) # uses Linux kernel helpers for some atomic operations pmix_cv_asm_arch="ARM" - PMIX_ASM_SUPPORT_64BIT=0 - PMIX_ASM_ARM_VERSION=5 - CCASFLAGS="$CCASFLAGS -march=armv7-a" - AC_DEFINE_UNQUOTED([PMIX_ASM_ARM_VERSION], [$PMIX_ASM_ARM_VERSION], - [What ARM assembly version to use]) - PMIX_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)' + PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], + [AC_MSG_ERROR([No atomic primitives available for $host])]) ;; mips-*|mips64*) # Should really find some way to make sure that we are on # a MIPS III machine (r4000 and later) pmix_cv_asm_arch="MIPS" - PMIX_ASM_SUPPORT_64BIT=1 - PMIX_GCC_INLINE_ASSIGN='"or %0,[$]0,[$]0" : "=&r"(ret)' + PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], + [AC_MSG_ERROR([No atomic primitives available for $host])]) ;; powerpc-*|powerpc64-*|powerpcle-*|powerpc64le-*|rs6000-*|ppc-*) diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_functions.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_functions.m4 index ce83b3b207b..e0f3a93cb68 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_functions.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_functions.m4 @@ -13,7 +13,7 @@ dnl All rights reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. dnl Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +dnl Copyright (c) 2013-2016 Intel, Inc. All rights reserved. dnl Copyright (c) 2017 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_setup_cc.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_setup_cc.m4 index 3029ffa5266..bc45f5bf165 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_setup_cc.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_setup_cc.m4 @@ -16,7 +16,7 @@ dnl Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. -dnl Copyright (c) 2015-2017 Intel, Inc. All rights reserved. +dnl Copyright (c) 2015-2016 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/configure.ac b/opal/mca/pmix/pmix2x/pmix/configure.ac index f8abb60d55b..f9257e0ba7b 100644 --- a/opal/mca/pmix/pmix2x/pmix/configure.ac +++ b/opal/mca/pmix/pmix2x/pmix/configure.ac @@ -224,6 +224,8 @@ AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION']) . $srcdir/VERSION AC_SUBST([libpmix_so_version]) +AC_SUBST([libpmi_so_version]) +AC_SUBST([libpmi2_so_version]) AC_CONFIG_FILES(pmix_config_prefix[contrib/Makefile] pmix_config_prefix[examples/Makefile] diff --git a/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec index 236986114b6..68f1425f897 100644 --- a/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec @@ -9,10 +9,12 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2015 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -61,7 +63,7 @@ # type: string (root path to install shell scripts) %{!?shell_scripts_path: %define shell_scripts_path %{_bindir}} # type: string (base name of the shell scripts) -%{!?shell_scripts_basename: %define shell_scripts_basename mpivars} +%{!?shell_scripts_basename: %define shell_scripts_basename pmixvars} # Define this to 1 if you want this RPM to install a modulefile. # type: bool (0/1) @@ -78,17 +80,6 @@ # type: string (name of modules RPM) %{!?modules_rpm_name: %define modules_rpm_name environment-modules} -# Should we use the mpi-selector functionality? -# type: bool (0/1) -%{!?use_mpi_selector: %define use_mpi_selector 0} -# The name of the mpi-selector RPM. Can vary from system to system. -# type: string (name of mpi-selector RPM) -%{!?mpi_selector_rpm_name: %define mpi_selector_rpm_name mpi-selector} -# The location of the mpi-selector executable (can be a relative path -# name if "mpi-selector" can be found in the path) -# type: string (path to mpi-selector exectuable) -%{!?mpi_selector: %define mpi_selector mpi-selector} - # Should we build a debuginfo RPM or not? # type: bool (0/1) %{!?build_debuginfo_rpm: %define build_debuginfo_rpm 0} @@ -100,7 +91,7 @@ # Should we use the default "check_files" RPM step (i.e., check for # unpackaged files)? It is discouraged to disable this, but some # installers need it (e.g., older versions of OFED, because they -# installed lots of other stuff in the BUILD_ROOT before PMIx/SHMEM). +# installed lots of other stuff in the BUILD_ROOT before PMIx). # type: bool (0/1) %{!?use_check_files: %define use_check_files 1} @@ -125,7 +116,7 @@ # type: bool (0/1) %{!?disable_auto_requires: %define disable_auto_requires 0} -# On some platforms, PMIx/SHMEM just flat-out doesn't work with +# On some platforms, PMIx just flat-out doesn't work with # -D_FORTIFY_SOURCE (e.g., some users have reported that there are # problems on ioa64 platforms). In this case, just turn it off # (meaning: this specfile will strip out that flag from the @@ -152,7 +143,7 @@ %define _includedir /opt/%{name}/%{version}/include %define _mandir /opt/%{name}/%{version}/man # Note that the name "pmix" is hard-coded in -# opal/mca/installdirs/config for pkgdatadir; there is currently no +# src/mca/installdirs/config for pkgdatadir; there is currently no # easy way to have PMIx change this directory name internally. So we # just hard-code that name here as well (regardless of the value of # %{name} or %{_name}). @@ -162,6 +153,8 @@ # bets are off. So feel free to install it anywhere in your tree. He # suggests $prefix/doc. %define _defaultdocdir /opt/%{name}/%{version}/doc +# Also put the modulefile in /opt. +%define modulefile_path /opt/%{name}/%{version}/share/pmixmodulefiles %endif %if !%{build_debuginfo_rpm} @@ -191,10 +184,6 @@ %define optflags "" %endif -%if %{use_mpi_selector} -%define install_shell_scripts 1 -%endif - ############################################################################# # # Preamble Section @@ -203,16 +192,16 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: $VERSION +Version: 2.0.3 Release: 1%{?dist} License: BSD Group: Development/Libraries -Source: pmix-%{version}.tar.$EXTENSION +Source0: https://github.com/pmix/pmix/releases/download/v%{version}/pmix-%{version}.tar.bz2 Packager: %{?_packager:%{_packager}}%{!?_packager:%{_vendor}} Vendor: %{?_vendorinfo:%{_vendorinfo}}%{!?_vendorinfo:%{_vendor}} Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}} Prefix: %{_prefix} -Provides: mpi +Provides: pmix Provides: pmix = %{version} BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root %if %{disable_auto_requires} @@ -221,9 +210,6 @@ AutoReq: no %if %{install_modulefile} Requires: %{modules_rpm_name} %endif -%if %{use_mpi_selector} -Requires: %{mpi_selector_rpm_name} -%endif %description The Process Management Interface (PMI) has been used for quite some time as a @@ -340,9 +326,8 @@ fi CFLAGS="%{?cflags:%{cflags}}%{!?cflags:$RPM_OPT_FLAGS}" CXXFLAGS="%{?cxxflags:%{cxxflags}}%{!?cxxflags:$RPM_OPT_FLAGS}" -FFLAGS="%{?f77flags:%{f77flags}}%{!?f7flags:$RPM_OPT_FLAGS}" FCFLAGS="%{?fcflags:%{fcflags}}%{!?fcflags:$RPM_OPT_FLAGS}" -export CFLAGS CXXFLAGS F77FLAGS FCFLAGS +export CFLAGS CXXFLAGS FCFLAGS %configure %{configure_options} %{__make} %{?mflags} @@ -369,14 +354,14 @@ cat <$RPM_BUILD_ROOT/%{modulefile_path}/%{modulefile_subdir}/%{modulefile_ #%Module # NOTE: This is an automatically-generated file! (generated by the -# PMIx/SHMEM RPM). Any changes made here will be lost a) if the RPM is +# PMIx RPM). Any changes made here will be lost a) if the RPM is # uninstalled, or b) if the RPM is upgraded or uninstalled. proc ModulesHelp { } { - puts stderr "This module adds PMIx/SHMEM v%{version} to various paths" + puts stderr "This module adds PMIx v%{version} to various paths" } -module-whatis "Sets up PMIx/SHMEM v%{version} in your enviornment" +module-whatis "Sets up PMIx v%{version} in your enviornment" prepend-path PATH "%{_prefix}/bin/" prepend-path LD_LIBRARY_PATH %{_libdir} @@ -391,7 +376,7 @@ EOF %{__mkdir_p} $RPM_BUILD_ROOT/%{shell_scripts_path} cat < $RPM_BUILD_ROOT/%{shell_scripts_path}/%{shell_scripts_basename}.sh # NOTE: This is an automatically-generated file! (generated by the -# PMIx/SHMEM RPM). Any changes made here will be lost if the RPM is +# PMIx RPM). Any changes made here will be lost if the RPM is # uninstalled or upgraded. # PATH @@ -412,13 +397,10 @@ if test -z "\`echo \$MANPATH | grep %{_mandir}\`"; then export MANPATH fi -# MPI_ROOT -MPI_ROOT=%{_prefix} -export MPI_ROOT EOF cat < $RPM_BUILD_ROOT/%{shell_scripts_path}/%{shell_scripts_basename}.csh # NOTE: This is an automatically-generated file! (generated by the -# PMIx/SHMEM RPM). Any changes made here will be lost if the RPM is +# PMIx RPM). Any changes made here will be lost if the RPM is # uninstalled or upgraded. # path @@ -444,8 +426,6 @@ else setenv MANPATH %{_mandir}: endif -# MPI_ROOT -setenv MPI_ROOT %{_prefix} EOF %endif # End of shell_scripts if @@ -465,30 +445,6 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version} test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT -############################################################################# -# -# Post Install Section -# -############################################################################# -%if %{use_mpi_selector} -%post -%{mpi_selector} \ - --register %{name}-%{version} \ - --source-dir %{shell_scripts_path} \ - --yes -%endif - -############################################################################# -# -# Pre Uninstall Section -# -############################################################################# -%if %{use_mpi_selector} -%preun -%{mpi_selector} --unregister %{name}-%{version} --yes || \ - /bin/true > /dev/null 2> /dev/null -%endif - ############################################################################# # # Files Section @@ -504,13 +460,20 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT %files %defattr(-, root, root, -) +%if %(test "%{_prefix}" = "/usr" && echo 1 || echo 0) +#%{_bindir}/* +%{_includedir}/* +%{_libdir}/* +%{_datadir} +%else %{_prefix} -# If the sysconfdir is not under the prefix, then list it explicitly. -%if !%{sysconfdir_in_prefix} -%{_sysconfdir} %endif -# If %{install_in_opt}, then we're installing PMIx to -# /opt/pmix/. But be sure to also explicitly mention +# If the sysconfdir is not under the prefix, then list it explicitly. +#%if !%{sysconfdir_in_prefix} +#%{_sysconfdir}/* +#%endif +# If %{install_in_opt}, then we're instaling PMIx to +# /opt/pmix. But be sure to also explicitly mention # /opt/pmix so that it can be removed by RPM when everything under # there is also removed. %if %{install_in_opt} @@ -527,14 +490,22 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT %endif %doc README INSTALL LICENSE + ############################################################################# # # Changelog # ############################################################################# %changelog -* Fri Jun 19 2015 Ralph H. Castain -- Port to PMIx +* Tue Sep 12 2017 Ralph Castain +- Port to pmix + +* Tue Mar 28 2017 Jeff Squyres +- Reverting a decision from a prior changelog entry: if + install_in_opt==1, then even put the modulefile under /opt. + +* Thu Nov 12 2015 Gilles Gouaillardet +- Revamp packaging when prefix is /usr * Tue Jan 20 2015 Bert Wesarg - Remove VampirTrace wrapper from package. @@ -545,7 +516,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT fields in case %{name} is overridden. * Mon Jun 24 2013 Igor Ivanov -- Add Open SHMEM parallel programming library as part of Open MPI +- Add Open parallel programming library as part of PMIx * Tue Dec 11 2012 Jeff Squyres - Re-release 1.6.0-1.6.3 SRPMs (with new SRPM Release numbers) with @@ -593,7 +564,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT leave_build_root kludge nastyness. W00t! * Fri Jan 18 2008 Jeff Squyres -- Remove the hard-coded "pmix" name from two Requires statements +- Remove the hard-coded "openmpi" name from two Requires statements and use %{name} instead (FWIW, %{_name} caused rpmbuild to barf). * Wed Jan 2 2008 Jeff Squyres @@ -683,4 +654,3 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT * Wed Mar 23 2005 Mezzanine - Specfile auto-generated by Mezzanine - diff --git a/opal/mca/pmix/pmix2x/pmix/examples/Makefile.am b/opal/mca/pmix/pmix2x/pmix/examples/Makefile.am index 07ae0061570..d2e9597a9cd 100644 --- a/opal/mca/pmix/pmix2x/pmix/examples/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/examples/Makefile.am @@ -21,7 +21,7 @@ AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/include -I$(top_builddir)/include/pmix -noinst_PROGRAMS = client dmodex dynamic fault pub tool debugger debuggerd alloc jctrl +noinst_PROGRAMS = client client2 dmodex dynamic fault pub tool debugger debuggerd alloc jctrl if !WANT_HIDDEN # these examples use internal symbols # use --disable-visibility @@ -32,6 +32,10 @@ client_SOURCES = client.c client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) client_LDADD = $(top_builddir)/src/libpmix.la +client2_SOURCES = client2.c +client2_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) +client2_LDADD = $(top_builddir)/src/libpmix.la + debugger_SOURCES = debugger.c debugger_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) debugger_LDADD = $(top_builddir)/src/libpmix.la diff --git a/opal/mca/pmix/pmix2x/pmix/examples/client.c b/opal/mca/pmix/pmix2x/pmix/examples/client.c index 3f304fd50d4..6fccc430786 100644 --- a/opal/mca/pmix/pmix2x/pmix/examples/client.c +++ b/opal/mca/pmix/pmix2x/pmix/examples/client.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -97,11 +97,11 @@ int main(int argc, char **argv) int rc; pmix_value_t value; pmix_value_t *val = &value; - char *tmp; + char *tmp, *ptr, *p; pmix_proc_t proc; - uint32_t nprocs, n; + uint32_t nprocs, m, n, local_cnt, *localpeers; pmix_info_t *info; - bool flag; + bool flag, local; volatile int active; pmix_status_t dbg = PMIX_ERR_DEBUGGER_RELEASE; @@ -189,7 +189,7 @@ int main(int argc, char **argv) value.type = PMIX_UINT64; value.data.uint64 = 1234; if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, tmp, &value))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc); + fprintf(stderr, "Client ns %s rank %d: PMIx_Put local failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } free(tmp); @@ -200,7 +200,7 @@ int main(int argc, char **argv) value.type = PMIX_STRING; value.data.string = "1234"; if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc); + fprintf(stderr, "Client ns %s rank %d: PMIx_Put remote failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } free(tmp); @@ -223,53 +223,96 @@ int main(int argc, char **argv) } PMIX_INFO_FREE(info, 1); + /* get the number of local peers */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_SIZE, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_SIZE failed: %d", myproc.nspace, myproc.rank, rc); + goto done; + } + local_cnt = val->data.uint32; + PMIX_VALUE_RELEASE(val); + + /* create an array for the peers */ + localpeers = (uint32_t*)malloc(local_cnt * sizeof(int)); + + /* get the list of local peers */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_PEERS failed: %d", myproc.nspace, myproc.rank, rc); + goto done; + } + ptr = strdup(val->data.string); + PMIX_VALUE_RELEASE(val); + + /* populate the peers array */ + p = strtok(ptr, ","); + localpeers[0] = strtoul(p, NULL, 10); + for (n=1; n < local_cnt; n++) { + p = strtok(NULL, ","); + localpeers[n] = strtoul(p, NULL, 10); + } + free(ptr); + /* check the returned data */ for (n=0; n < nprocs; n++) { - if (0 > asprintf(&tmp, "%s-%d-local", myproc.nspace, myproc.rank)) { - exit(1); + if (n == myproc.rank) { + continue; } - if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); - goto done; - } - if (PMIX_UINT64 != val->type) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); - PMIX_VALUE_RELEASE(val); - free(tmp); - goto done; + proc.rank = n; + local = false; + for (m=0; m < local_cnt; m++) { + if (localpeers[m] == proc.rank) { + local = true; + break; + } } - if (1234 != val->data.uint64) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %d\n", myproc.nspace, myproc.rank, tmp, (int)val->data.uint64); + if (local) { + if (0 > asprintf(&tmp, "%s-%d-local", proc.nspace, proc.rank)) { + exit(1); + } + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); + goto done; + } + if (PMIX_UINT64 != val->type) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); + PMIX_VALUE_RELEASE(val); + free(tmp); + goto done; + } + if (1234 != val->data.uint64) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %d\n", myproc.nspace, myproc.rank, tmp, (int)val->data.uint64); + PMIX_VALUE_RELEASE(val); + free(tmp); + goto done; + } + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp); PMIX_VALUE_RELEASE(val); free(tmp); - goto done; - } - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp); - PMIX_VALUE_RELEASE(val); - free(tmp); - if (0 > asprintf(&tmp, "%s-%d-remote", myproc.nspace, myproc.rank)) { - exit(1); - } - if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); - goto done; - } - if (PMIX_STRING != val->type) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); - PMIX_VALUE_RELEASE(val); - free(tmp); - goto done; - } - if (0 != strcmp(val->data.string, "1234")) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %s\n", myproc.nspace, myproc.rank, tmp, val->data.string); + } else { + if (0 > asprintf(&tmp, "%s-%d-remote", proc.nspace, proc.rank)) { + exit(1); + } + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); + goto done; + } + if (PMIX_STRING != val->type) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); + PMIX_VALUE_RELEASE(val); + free(tmp); + goto done; + } + if (0 != strcmp(val->data.string, "1234")) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %s\n", myproc.nspace, myproc.rank, tmp, val->data.string); + PMIX_VALUE_RELEASE(val); + free(tmp); + goto done; + } + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp); PMIX_VALUE_RELEASE(val); free(tmp); - goto done; } - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp); - PMIX_VALUE_RELEASE(val); - free(tmp); } + free(localpeers); done: /* finalize us */ diff --git a/opal/mca/pmix/pmix2x/pmix/examples/client2.c b/opal/mca/pmix/pmix2x/pmix/examples/client2.c new file mode 100644 index 00000000000..9b7f7e6c0fe --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/examples/client2.c @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2006-2013 Los Alamos National Security, LLC. + * All rights reserved. + * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +#include + +static pmix_proc_t myproc; + +/* this is the event notification function we pass down below + * when registering for general events - i.e.,, the default + * handler. We don't technically need to register one, but it + * is usually good practice to catch any events that occur */ +static void notification_fn(size_t evhdlr_registration_id, + pmix_status_t status, + const pmix_proc_t *source, + pmix_info_t info[], size_t ninfo, + pmix_info_t results[], size_t nresults, + pmix_event_notification_cbfunc_fn_t cbfunc, + void *cbdata) +{ + if (NULL != cbfunc) { + cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata); + } +} + +/* event handler registration is done asynchronously because it + * may involve the PMIx server registering with the host RM for + * external events. So we provide a callback function that returns + * the status of the request (success or an error), plus a numerical index + * to the registered event. The index is used later on to deregister + * an event handler - if we don't explicitly deregister it, then the + * PMIx server will do so when it see us exit */ +static void evhandler_reg_callbk(pmix_status_t status, + size_t evhandler_ref, + void *cbdata) +{ + volatile int *active = (volatile int*)cbdata; + + if (PMIX_SUCCESS != status) { + fprintf(stderr, "Client %s:%d EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n", + myproc.nspace, myproc.rank, status, (unsigned long)evhandler_ref); + } + *active = status; +} + +int main(int argc, char **argv) +{ + int rc; + pmix_value_t value; + pmix_value_t *val, *vptr; + pmix_proc_t proc; + uint32_t nprocs, n, k; + pmix_info_t *info; + bool flag; + volatile int active; + pmix_data_array_t da, *dptr; + + /* init us - note that the call to "init" includes the return of + * any job-related info provided by the RM. This includes any + * debugger flag instructing us to stop-in-init. If such a directive + * is included, then the process will be stopped in this call until + * the "debugger release" notification arrives */ + if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc); + exit(0); + } + fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank); + + + /* register our default event handler - again, this isn't strictly + * required, but is generally good practice */ + active = -1; + PMIx_Register_event_handler(NULL, 0, NULL, 0, + notification_fn, evhandler_reg_callbk, (void*)&active); + while (-1 == active) { + sleep(1); + } + if (0 != active) { + fprintf(stderr, "[%s:%d] Default handler registration failed\n", myproc.nspace, myproc.rank); + exit(active); + } + + /* job-related info is found in our nspace, assigned to the + * wildcard rank as it doesn't relate to a specific rank. Setup + * a name to retrieve such values */ + PMIX_PROC_CONSTRUCT(&proc); + (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); + proc.rank = PMIX_RANK_WILDCARD; + + /* get our job size */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + nprocs = val->data.uint32; + PMIX_VALUE_RELEASE(val); + fprintf(stderr, "Client %s:%d job size %d\n", myproc.nspace, myproc.rank, nprocs); + + /* put a data array of pmix_value's */ + val = (pmix_value_t*)malloc(32 * sizeof(pmix_value_t)); + for (n=0; n < 32; n++) { + val[n].type = PMIX_UINT64; + val[n].data.uint64 = 2*n; + } + da.type = PMIX_VALUE; + da.size = 32; + da.array = val; + value.type = PMIX_DATA_ARRAY; + value.data.darray = &da; + rc = PMIx_Put(PMIX_GLOBAL, "test-key", &value); + if (PMIX_SUCCESS != rc) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Put failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + free(val); + + /* push the data to our PMIx server */ + if (PMIX_SUCCESS != (rc = PMIx_Commit())) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Commit failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + + /* call fence to synchronize with our peers - instruct + * the fence operation to collect and return all "put" + * data from our peers */ + PMIX_INFO_CREATE(info, 1); + flag = true; + PMIX_INFO_LOAD(info, PMIX_COLLECT_DATA, &flag, PMIX_BOOL); + if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, info, 1))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + PMIX_INFO_FREE(info, 1); + + /* check the returned data */ + for (n=0; n < nprocs; n++) { + proc.rank = n; + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, "test-key", NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get on rank %u failed: %d\n", + myproc.nspace, myproc.rank, proc.rank, rc); + goto done; + } + if (PMIX_DATA_ARRAY != val->type) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get on rank %u returned wrong type: %d\n", + myproc.nspace, myproc.rank, proc.rank, val->type); + PMIX_VALUE_RELEASE(val); + goto done; + } + dptr = val->data.darray; + if (NULL == dptr) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned NULL array\n", + myproc.nspace, myproc.rank, proc.rank); + PMIX_VALUE_RELEASE(val); + goto done; + } + if (PMIX_VALUE != dptr->type) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned wrong array value type %d\n", + myproc.nspace, myproc.rank, proc.rank, dptr->type); + PMIX_VALUE_RELEASE(val); + goto done; + } + if (32 != dptr->size) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned wrong array value size %d\n", + myproc.nspace, myproc.rank, proc.rank, (int)dptr->size); + PMIX_VALUE_RELEASE(val); + goto done; + } + vptr = (pmix_value_t*)dptr->array; + for (k=0; k < 32; k++) { + if (PMIX_UINT64 != vptr[k].type) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned wrong type: %d\n", + myproc.nspace, myproc.rank, proc.rank, vptr[k].type); + PMIX_VALUE_RELEASE(val); + goto done; + } + if (2*k != vptr[k].data.uint64) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned wrong value: %lu\n", + myproc.nspace, myproc.rank, proc.rank, (unsigned long)vptr[k].data.uint64); + PMIX_VALUE_RELEASE(val); + goto done; + } + } + } + + done: + /* finalize us */ + fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank); + if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) { + fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc); + } else { + fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank); + } + fflush(stderr); + return(0); +} diff --git a/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h b/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h index df03dcba136..12cd102700b 100644 --- a/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h +++ b/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2016-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -149,6 +149,8 @@ typedef uint32_t pmix_rank_t; #define PMIX_MODEL_LIBRARY_NAME "pmix.mdl.name" // (char*) programming model implementation ID (e.g., "OpenMPI" or "MPICH") #define PMIX_MODEL_LIBRARY_VERSION "pmix.mld.vrs" // (char*) programming model version string (e.g., "2.1.1") #define PMIX_THREADING_MODEL "pmix.threads" // (char*) threading model used (e.g., "pthreads") +#define PMIX_REQUESTOR_IS_TOOL "pmix.req.tool" // (bool) requesting process is a tool +#define PMIX_REQUESTOR_IS_CLIENT "pmix.req.client" // (bool) requesting process is a client process /* attributes for the USOCK rendezvous socket */ @@ -1568,6 +1570,17 @@ PMIX_EXPORT pmix_status_t PMIx_Store_internal(const pmix_proc_t *proc, * will return an error code (generated upon unpacking) - * the error cannot be detected during packing. * + * The identity of the intended recipient of the packed buffer (i.e., the + * process that will be unpacking it) is used solely to resolve any data type + * differences between PMIx versions. The recipient must, therefore, be + * known to the user prior to calling the pack function so that the + * PMIx library is aware of the version the recipient is using. + * + * @param *target Pointer to a pmix_proc_t structure containing the + * nspace/rank of the process that will be unpacking the final buffer. + * A NULL value may be used to indicate that the target is based on + * the same PMIx version as the caller. + * * @param *buffer A pointer to the buffer into which the value is to * be packed. * @@ -1601,7 +1614,8 @@ PMIX_EXPORT pmix_status_t PMIx_Store_internal(const pmix_proc_t *proc, * status_code = PMIx_Data_pack(buffer, &src, 1, PMIX_INT32); * @endcode */ -PMIX_EXPORT pmix_status_t PMIx_Data_pack(pmix_data_buffer_t *buffer, +PMIX_EXPORT pmix_status_t PMIx_Data_pack(const pmix_proc_t *target, + pmix_data_buffer_t *buffer, void *src, int32_t num_vals, pmix_data_type_t type); @@ -1648,6 +1662,17 @@ PMIX_EXPORT pmix_status_t PMIx_Data_pack(pmix_data_buffer_t *buffer, * will return an error code generated upon unpacking - these errors * cannot be detected during packing. * + * The identity of the source of the packed buffer (i.e., the + * process that packed it) is used solely to resolve any data type + * differences between PMIx versions. The source must, therefore, be + * known to the user prior to calling the unpack function so that the + * PMIx library is aware of the version the source used. + * + * @param *source Pointer to a pmix_proc_t structure containing the + * nspace/rank of the process that packed the provided buffer. + * A NULL value may be used to indicate that the source is based on + * the same PMIx version as the caller. + * * @param *buffer A pointer to the buffer from which the value will be * extracted. * @@ -1697,7 +1722,8 @@ PMIX_EXPORT pmix_status_t PMIx_Data_pack(pmix_data_buffer_t *buffer, * * @endcode */ -PMIX_EXPORT pmix_status_t PMIx_Data_unpack(pmix_data_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t PMIx_Data_unpack(const pmix_proc_t *source, + pmix_data_buffer_t *buffer, void *dest, int32_t *max_num_values, pmix_data_type_t type); diff --git a/opal/mca/pmix/pmix2x/pmix/include/pmix_rename.h.in b/opal/mca/pmix/pmix2x/pmix/include/pmix_rename.h.in old mode 100755 new mode 100644 index f58edd298cf..3f52f02d1af --- a/opal/mca/pmix/pmix2x/pmix/include/pmix_rename.h.in +++ b/opal/mca/pmix/pmix2x/pmix/include/pmix_rename.h.in @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/src/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/Makefile.am index ff27a293b54..387e785cf5e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/Makefile.am @@ -43,10 +43,13 @@ nodist_headers = EXTRA_DIST = dist_pmixdata_DATA = +# place to capture sources for backward compatibility libs +pmi1_sources = +pmi2_sources = + libpmix_la_LIBADD = \ mca/base/libpmix_mca_base.la \ - $(MCA_pmix_FRAMEWORK_LIBS) \ - $(PMIX_EXTRA_LIB) + $(MCA_pmix_FRAMEWORK_LIBS) libpmix_la_DEPENDENCIES = $(libpmix_la_LIBADD) if PMIX_EMBEDDED_MODE @@ -71,6 +74,19 @@ lib_LTLIBRARIES = libpmix.la libpmix_la_SOURCES = $(headers) $(sources) libpmix_la_LDFLAGS = -version-info $(libpmix_so_version) +if WANT_PMI_BACKWARD +lib_LTLIBRARIES += libpmi.la libpmi2.la +libpmi_la_SOURCES = $(headers) $(sources) $(pmi1_sources) +libpmi_la_LDFLAGS = -version-info $(libpmi_so_version) +libpmi_la_LIBADD = $(libpmix_la_LIBADD) +libpmi_la_DEPENDENCIES = $(libpmi_la_LIBADD) + +libpmi2_la_SOURCES = $(headers) $(sources) $(pmi2_sources) +libpmi2_la_LDFLAGS = -version-info $(libpmi2_so_version) +libpmi2_la_LIBADD = $(libpmix_la_LIBADD) +libpmi2_la_DEPENDENCIES = $(libpmi2_la_LIBADD) +endif + endif !PMIX_EMBEDDED_MODE include atomics/sys/Makefile.include diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/Makefile.include index 9f677e5e44c..dbd384e3e5a 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/Makefile.include +++ b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/Makefile.include @@ -36,8 +36,6 @@ include atomics/sys/x86_64/Makefile.include include atomics/sys/arm/Makefile.include include atomics/sys/arm64/Makefile.include include atomics/sys/ia32/Makefile.include -include atomics/sys/ia64/Makefile.include -include atomics/sys/mips/Makefile.include include atomics/sys/powerpc/Makefile.include include atomics/sys/sparcv9/Makefile.include include atomics/sys/sync_builtin/Makefile.include diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/arm/timer.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/arm/timer.h index 65532ac8a77..fd280cc2215 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/arm/timer.h +++ b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/arm/timer.h @@ -2,7 +2,6 @@ * Copyright (c) 2008 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/arm64/timer.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/arm64/timer.h index bacc4b919eb..b6bfe2abd68 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/arm64/timer.h +++ b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/arm64/timer.h @@ -6,7 +6,6 @@ * Copyright (c) 2016 Broadcom Limited. All rights reserved. * Copyright (c) 2016 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/atomic_impl.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/atomic_impl.h index 62213e3a508..e1fb810f781 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/atomic_impl.h +++ b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/atomic_impl.h @@ -13,7 +13,6 @@ * Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia32/timer.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia32/timer.h index 5be92d4902d..9f9a80d684d 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia32/timer.h +++ b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia32/timer.h @@ -9,7 +9,6 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/Makefile.include deleted file mode 100644 index d1f4e5e4b62..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/Makefile.include +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This makefile.am does not stand on its own - it is included from pmix/include/Makefile.am - -headers += \ - atomics/sys/ia64/atomic.h \ - atomics/sys/ia64/timer.h diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/atomic.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/atomic.h deleted file mode 100644 index ca8ce8dfdde..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/atomic.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_SYS_ARCH_ATOMIC_H -#define PMIX_SYS_ARCH_ATOMIC_H 1 - -/* - * On ia64, we use cmpxchg, which supports acquire/release semantics natively. - */ - - -#define PMIXMB() __asm__ __volatile__("mf": : :"memory") - - -/********************************************************************** - * - * Define constants for IA64 - * - *********************************************************************/ -#define PMIX_HAVE_ATOMIC_MEM_BARRIER 1 - -#define PMIX_HAVE_ATOMIC_CMPSET_32 1 -#define PMIX_HAVE_ATOMIC_CMPSET_64 1 - -/********************************************************************** - * - * Memory Barriers - * - *********************************************************************/ -#if PMIX_GCC_INLINE_ASSEMBLY - -static inline void pmix_atomic_mb(void) -{ - PMIXMB(); -} - - -static inline void pmix_atomic_rmb(void) -{ - PMIXMB(); -} - - -static inline void pmix_atomic_wmb(void) -{ - PMIXMB(); -} - -static inline void pmix_atomic_isync(void) -{ -} - -#endif /* PMIX_GCC_INLINE_ASSEMBLY */ - - -/********************************************************************** - * - * Atomic math operations - * - *********************************************************************/ -#if PMIX_GCC_INLINE_ASSEMBLY - -#define ia64_cmpxchg4_acq(ptr, new, old) \ -({ \ - __u64 ia64_intri_res; \ - ia64_intri_res; \ -}) - -static inline int pmix_atomic_cmpset_acq_32( volatile int32_t *addr, - int32_t oldval, int32_t newval) -{ - int64_t ret; - - __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(oldval)); - __asm__ __volatile__ ("cmpxchg4.acq %0=[%1],%2,ar.ccv": - "=r"(ret) : "r"(addr), "r"(newval) : "memory"); - - return ((int32_t)ret == oldval); -} - - -static inline int pmix_atomic_cmpset_rel_32( volatile int32_t *addr, - int32_t oldval, int32_t newval) -{ - int64_t ret; - - __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(oldval)); - __asm__ __volatile__ ("cmpxchg4.rel %0=[%1],%2,ar.ccv": - "=r"(ret) : "r"(addr), "r"(newval) : "memory"); - - return ((int32_t)ret == oldval); -} - -#endif /* PMIX_GCC_INLINE_ASSEMBLY */ - - -#define pmix_atomic_cmpset_32 pmix_atomic_cmpset_acq_32 - -#if PMIX_GCC_INLINE_ASSEMBLY - -static inline int pmix_atomic_cmpset_acq_64( volatile int64_t *addr, - int64_t oldval, int64_t newval) -{ - int64_t ret; - - __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(oldval)); - __asm__ __volatile__ ("cmpxchg8.acq %0=[%1],%2,ar.ccv": - "=r"(ret) : "r"(addr), "r"(newval) : "memory"); - - return (ret == oldval); -} - - -static inline int pmix_atomic_cmpset_rel_64( volatile int64_t *addr, - int64_t oldval, int64_t newval) -{ - int64_t ret; - - __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(oldval)); - __asm__ __volatile__ ("cmpxchg8.rel %0=[%1],%2,ar.ccv": - "=r"(ret) : "r"(addr), "r"(newval) : "memory"); - - return (ret == oldval); -} - -#endif /* PMIX_GCC_INLINE_ASSEMBLY */ - -#define pmix_atomic_cmpset_64 pmix_atomic_cmpset_acq_64 - -#endif /* ! PMIX_SYS_ARCH_ATOMIC_H */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/timer.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/timer.h deleted file mode 100644 index 5a33236592d..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/ia64/timer.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_SYS_ARCH_TIMER_H -#define PMIX_SYS_ARCH_TIMER_H 1 - - -typedef uint64_t pmix_timer_t; - - -#if PMIX_GCC_INLINE_ASSEMBLY - -static inline pmix_timer_t -pmix_sys_timer_get_cycles(void) -{ - pmix_timer_t ret; - - __asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret)); - - return ret; -} - -#define PMIX_HAVE_SYS_TIMER_GET_CYCLES 1 - -#else - -pmix_timer_t pmix_sys_timer_get_cycles(void); - -#define PMIX_HAVE_SYS_TIMER_GET_CYCLES 1 - -#endif /* PMIX_GCC_INLINE_ASSEMBLY */ - -#endif /* ! PMIX_SYS_ARCH_TIMER_H */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/Makefile.include deleted file mode 100644 index f3916e581da..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/Makefile.include +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2008 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) 2017 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This makefile.am does not stand on its own - it is included from pmix/include/Makefile.am - -headers += \ - atomics/sys/mips/atomic.h \ - atomics/sys/mips/timer.h diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/atomic.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/atomic.h deleted file mode 100644 index 2e0765d9e2f..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/atomic.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_SYS_ARCH_ATOMIC_H -#define PMIX_SYS_ARCH_ATOMIC_H 1 - - -/* BWB - FIX ME! */ -#ifdef __linux__ -#define PMIXMB() __asm__ __volatile__(".set mips2; sync; .set mips0": : :"memory") -#define PMIXRMB() __asm__ __volatile__(".set mips2; sync; .set mips0": : :"memory") -#define PMIXWMB() __asm__ __volatile__(".set mips2; sync; .set mips0": : :"memory") -#define PMIXSMP_SYNC ".set mips2; sync; .set mips0" -#else -#define PMIXMB() __asm__ __volatile__("sync": : :"memory") -#define PMIXRMB() __asm__ __volatile__("sync": : :"memory") -#define PMIXWMB() __asm__ __volatile__("sync": : :"memory") -#define PMIXSMP_SYNC "sync" -#endif - - -/********************************************************************** - * - * Define constants for MIPS - * - *********************************************************************/ -#define PMIX_HAVE_ATOMIC_MEM_BARRIER 1 - -#define PMIX_HAVE_ATOMIC_CMPSET_32 1 - -#ifdef __mips64 -#define PMIX_HAVE_ATOMIC_CMPSET_64 1 -#endif - -/********************************************************************** - * - * Memory Barriers - * - *********************************************************************/ -#if PMIX_GCC_INLINE_ASSEMBLY - -static inline -void pmix_atomic_mb(void) -{ - PMIXMB(); -} - - -static inline -void pmix_atomic_rmb(void) -{ - PMIXRMB(); -} - - -static inline -void pmix_atomic_wmb(void) -{ - PMIXWMB(); -} - -static inline -void pmix_atomic_isync(void) -{ -} - -#endif - -/********************************************************************** - * - * Atomic math operations - * - *********************************************************************/ -#if PMIX_GCC_INLINE_ASSEMBLY - -static inline int pmix_atomic_cmpset_32(volatile int32_t *addr, - int32_t oldval, int32_t newval) -{ - int32_t ret; - - __asm__ __volatile__ (".set noreorder \n" - ".set noat \n" - "1: \n" -#ifdef __linux__ - ".set mips2 \n\t" -#endif - "ll %0, %2 \n" /* load *addr into ret */ - "bne %0, %z3, 2f \n" /* done if oldval != ret */ - "or $1, %z4, 0 \n" /* tmp = newval (delay slot) */ - "sc $1, %2 \n" /* store tmp in *addr */ -#ifdef __linux__ - ".set mips0 \n\t" -#endif - /* note: ret will be 0 if failed, 1 if succeeded */ - "beqz $1, 1b \n" /* if 0 jump back to 1b */ - "nop \n" /* fill delay slots */ - "2: \n" - ".set reorder \n" - : "=&r"(ret), "=m"(*addr) - : "m"(*addr), "r"(oldval), "r"(newval) - : "cc", "memory"); - return (ret == oldval); -} - - -/* these two functions aren't inlined in the non-gcc case because then - there would be two function calls (since neither cmpset_32 nor - atomic_?mb can be inlined). Instead, we "inline" them by hand in - the assembly, meaning there is one function call overhead instead - of two */ -static inline int pmix_atomic_cmpset_acq_32(volatile int32_t *addr, - int32_t oldval, int32_t newval) -{ - int rc; - - rc = pmix_atomic_cmpset_32(addr, oldval, newval); - pmix_atomic_rmb(); - - return rc; -} - - -static inline int pmix_atomic_cmpset_rel_32(volatile int32_t *addr, - int32_t oldval, int32_t newval) -{ - pmix_atomic_wmb(); - return pmix_atomic_cmpset_32(addr, oldval, newval); -} - -#ifdef PMIX_HAVE_ATOMIC_CMPSET_64 -static inline int pmix_atomic_cmpset_64(volatile int64_t *addr, - int64_t oldval, int64_t newval) -{ - int64_t ret; - - __asm__ __volatile__ (".set noreorder \n" - ".set noat \n" - "1: \n\t" - "lld %0, %2 \n\t" /* load *addr into ret */ - "bne %0, %z3, 2f \n\t" /* done if oldval != ret */ - "or $1, %4, 0 \n\t" /* tmp = newval (delay slot) */ - "scd $1, %2 \n\t" /* store tmp in *addr */ - /* note: ret will be 0 if failed, 1 if succeeded */ - "beqz $1, 1b \n\t" /* if 0 jump back to 1b */ - "nop \n\t" /* fill delay slot */ - "2: \n\t" - ".set reorder \n" - : "=&r" (ret), "=m" (*addr) - : "m" (*addr), "r" (oldval), "r" (newval) - : "cc", "memory"); - - return (ret == oldval); -} - - -/* these two functions aren't inlined in the non-gcc case because then - there would be two function calls (since neither cmpset_64 nor - atomic_?mb can be inlined). Instead, we "inline" them by hand in - the assembly, meaning there is one function call overhead instead - of two */ -static inline int pmix_atomic_cmpset_acq_64(volatile int64_t *addr, - int64_t oldval, int64_t newval) -{ - int rc; - - rc = pmix_atomic_cmpset_64(addr, oldval, newval); - pmix_atomic_rmb(); - - return rc; -} - - -static inline int pmix_atomic_cmpset_rel_64(volatile int64_t *addr, - int64_t oldval, int64_t newval) -{ - pmix_atomic_wmb(); - return pmix_atomic_cmpset_64(addr, oldval, newval); -} -#endif /* PMIX_HAVE_ATOMIC_CMPSET_64 */ - -#endif /* PMIX_GCC_INLINE_ASSEMBLY */ - -#endif /* ! PMIX_SYS_ARCH_ATOMIC_H */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/timer.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/timer.h deleted file mode 100644 index 65532ac8a77..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/mips/timer.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2008 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_SYS_ARCH_TIMER_H -#define PMIX_SYS_ARCH_TIMER_H 1 - -#include - -typedef uint64_t pmix_timer_t; - -static inline pmix_timer_t -pmix_sys_timer_get_cycles(void) -{ - pmix_timer_t ret; - struct tms accurate_clock; - - times(&accurate_clock); - ret = accurate_clock.tms_utime + accurate_clock.tms_stime; - - return ret; -} - -#define PMIX_HAVE_SYS_TIMER_GET_CYCLES 1 - -#endif /* ! PMIX_SYS_ARCH_TIMER_H */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/powerpc/atomic.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/powerpc/atomic.h index 9682b9e62af..4e39a43ee33 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/powerpc/atomic.h +++ b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/powerpc/atomic.h @@ -84,7 +84,7 @@ void pmix_atomic_rmb(void) static inline void pmix_atomic_wmb(void) { - PMIXRMB(); + PMIXWMB(); } static inline @@ -110,7 +110,7 @@ void pmix_atomic_isync(void) #pragma mc_func pmix_atomic_rmb { "7c2004ac" } /* lwsync */ #pragma reg_killed_by pmix_atomic_rmb /* none */ -#pragma mc_func pmix_atomic_wmb { "7c0006ac" } /* eieio */ +#pragma mc_func pmix_atomic_wmb { "7c2004ac" } /* lwsync */ #pragma reg_killed_by pmix_atomic_wmb /* none */ #endif diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/powerpc/timer.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/powerpc/timer.h index dd8c3ffe1b6..0d557e875e1 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/powerpc/timer.h +++ b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/powerpc/timer.h @@ -9,7 +9,6 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/sparcv9/timer.h b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/sparcv9/timer.h index 395ea986014..354babad46e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/sparcv9/timer.h +++ b/opal/mca/pmix/pmix2x/pmix/src/atomics/sys/sparcv9/timer.h @@ -9,7 +9,6 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/buffer_ops.h b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/buffer_ops.h index a02bfa77a5a..29b057a9fe9 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/buffer_ops.h +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/buffer_ops.h @@ -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-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -74,6 +74,11 @@ bool pmix_value_cmp(pmix_value_t *p, pmix_value_t *p1); (b)->unpack_ptr = NULL; \ } while (0) +/* Convenience macro to check for empty buffer without + * exposing the internals */ +#define PMIX_BUFFER_IS_EMPTY(b) \ + 0 == (b)->bytes_used + /** * Top-level interface function to pack one or more values into a diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c index 8296f8f7cef..66c8b1ddb69 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c @@ -693,6 +693,7 @@ pmix_status_t pmix_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, return PMIX_ERR_NOMEM; } if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_buffer(buffer, val->data.darray, &m, PMIX_DATA_ARRAY))) { + PMIX_ERROR_LOG(ret); return ret; } break; @@ -734,10 +735,12 @@ pmix_status_t pmix_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, for (i = 0; i < n; ++i) { /* unpack the type */ if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &ptr[i].type))) { + PMIX_ERROR_LOG(ret); return ret; } /* unpack value */ if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i])) ) { + PMIX_ERROR_LOG(ret); return ret; } } @@ -1304,6 +1307,10 @@ pmix_status_t pmix_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest, break; case PMIX_QUERY: nbytes = sizeof(pmix_query_t); + break; + case PMIX_VALUE: + nbytes = sizeof(pmix_value_t); + break; default: return PMIX_ERR_NOT_SUPPORTED; } diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/client/Makefile.include index 0bf6efed743..80801cc4aaf 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/Makefile.include +++ b/opal/mca/pmix/pmix2x/pmix/src/client/Makefile.include @@ -23,7 +23,8 @@ sources += \ client/pmix_client_connect.c if WANT_PMI_BACKWARD -sources += \ - client/pmi1.c \ +pmi1_sources += \ + client/pmi1.c +pmi2_sources += \ client/pmi2.c endif diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmi1.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmi1.c index 9a4e1acd0a5..5b89533fdd3 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmi1.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmi1.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -45,11 +45,11 @@ #define PMI_MAX_VAL_LEN 4096 /* Maximum size of a PMI value */ -#define PMI_CHECK() \ - do { \ - if (!pmi_init) { \ - return PMI_FAIL; \ - } \ +#define PMI_CHECK() \ + do { \ + if (!pmi_init) { \ + return PMI_FAIL; \ + } \ } while (0) /* local functions */ @@ -57,6 +57,7 @@ static pmix_status_t convert_int(int *value, pmix_value_t *kv); static int convert_err(pmix_status_t rc); static pmix_proc_t myproc; static int pmi_init = 0; +static bool pmi_singleton = false; PMIX_EXPORT int PMI_Init(int *spawned) { @@ -66,7 +67,19 @@ PMIX_EXPORT int PMI_Init(int *spawned) pmix_info_t info[1]; bool val_optinal = 1; - if (PMIX_SUCCESS != PMIx_Init(&myproc, NULL, 0)) { + if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) { + /* if we didn't see a PMIx server (e.g., missing envar), + * then allow us to run as a singleton */ + if (PMIX_ERR_INVALID_NAMESPACE == rc) { + if (NULL != spawned) { + *spawned = 0; + } + pmi_singleton = true; + (void)strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN); + myproc.rank = 0; + pmi_init = 1; + return PMI_SUCCESS; + } return PMI_ERR_INIT; } @@ -109,7 +122,11 @@ PMIX_EXPORT int PMI_Initialized(PMI_BOOL *initialized) return PMI_ERR_INVALID_ARG; } - *initialized = (PMIx_Initialized() ? PMI_TRUE : PMI_FALSE); + if (pmi_singleton) { + *initialized = PMI_TRUE; + } else { + *initialized = (PMIx_Initialized() ? PMI_TRUE : PMI_FALSE); + } return PMI_SUCCESS; } @@ -120,6 +137,10 @@ PMIX_EXPORT int PMI_Finalize(void) PMI_CHECK(); + if (pmi_singleton) { + return PMI_SUCCESS; + } + pmi_init = 0; rc = PMIx_Finalize(NULL, 0); return convert_err(rc); @@ -131,6 +152,10 @@ PMIX_EXPORT int PMI_Abort(int flag, const char msg[]) PMI_CHECK(); + if (pmi_singleton) { + return PMI_SUCCESS; + } + rc = PMIx_Abort(flag, msg, NULL, 0); return convert_err(rc); } @@ -153,6 +178,9 @@ PMIX_EXPORT int PMI_KVS_Put(const char kvsname[], const char key[], const char v if ((value == NULL) || (strlen(value) > PMI_MAX_VAL_LEN)) { return PMI_ERR_INVALID_VAL; } + if (pmi_singleton) { + return PMI_SUCCESS; + } pmix_output_verbose(2, pmix_globals.debug_output, "PMI_KVS_Put: KVS=%s, key=%s value=%s", kvsname, key, value); @@ -173,6 +201,9 @@ PMIX_EXPORT int PMI_KVS_Commit(const char kvsname[]) if ((kvsname == NULL) || (strlen(kvsname) > PMI_MAX_KVSNAME_LEN)) { return PMI_ERR_INVALID_KVS; } + if (pmi_singleton) { + return PMI_SUCCESS; + } pmix_output_verbose(2, pmix_globals.debug_output, "PMI_KVS_Commit: KVS=%s", kvsname); @@ -256,6 +287,10 @@ PMIX_EXPORT int PMI_Barrier(void) PMI_CHECK(); + if (pmi_singleton) { + return PMI_SUCCESS; + } + info = &buf; PMIX_INFO_CONSTRUCT(info); PMIX_INFO_LOAD(info, PMIX_COLLECT_DATA, &val, PMIX_BOOL); @@ -282,6 +317,11 @@ PMIX_EXPORT int PMI_Get_size(int *size) return PMI_ERR_INVALID_ARG; } + if (pmi_singleton) { + *size = 1; + return PMI_SUCCESS; + } + /* set controlling parameters * PMIX_OPTIONAL - expect that these keys should be available on startup */ @@ -326,6 +366,11 @@ PMIX_EXPORT int PMI_Get_universe_size(int *size) return PMI_ERR_INVALID_ARG; } + if (pmi_singleton) { + *size = 1; + return PMI_SUCCESS; + } + /* set controlling parameters * PMIX_OPTIONAL - expect that these keys should be available on startup */ @@ -358,6 +403,11 @@ PMIX_EXPORT int PMI_Get_appnum(int *appnum) return PMI_ERR_INVALID_ARG; } + if (pmi_singleton) { + *appnum = 0; + return PMI_SUCCESS; + } + /* set controlling parameters * PMIX_OPTIONAL - expect that these keys should be available on startup */ @@ -390,6 +440,10 @@ PMIX_EXPORT int PMI_Publish_name(const char service_name[], const char port[]) return PMI_ERR_INVALID_ARG; } + if (pmi_singleton) { + return PMI_FAIL; + } + /* pass the service/port */ (void) strncpy(info.key, service_name, PMIX_MAX_KEYLEN); info.value.type = PMIX_STRING; @@ -413,6 +467,10 @@ PMIX_EXPORT int PMI_Unpublish_name(const char service_name[]) return PMI_ERR_INVALID_ARG; } + if (pmi_singleton) { + return PMI_FAIL; + } + /* pass the service */ keys[0] = (char*) service_name; keys[1] = NULL; @@ -432,6 +490,10 @@ PMIX_EXPORT int PMI_Lookup_name(const char service_name[], char port[]) return PMI_ERR_INVALID_ARG; } + if (pmi_singleton) { + return PMI_FAIL; + } + PMIX_PDATA_CONSTRUCT(&pdata); /* pass the service */ @@ -512,6 +574,11 @@ PMIX_EXPORT int PMI_Get_clique_size(int *size) return PMI_ERR_INVALID_ARG; } + if (pmi_singleton) { + *size = 1; + return PMI_SUCCESS; + } + /* set controlling parameters * PMIX_OPTIONAL - expect that these keys should be available on startup */ @@ -544,6 +611,11 @@ PMIX_EXPORT int PMI_Get_clique_ranks(int ranks[], int length) return PMI_ERR_INVALID_ARGS; } + if (pmi_singleton) { + ranks[0] = 0; + return PMI_SUCCESS; + } + rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val); if (PMIX_SUCCESS == rc) { /* kv will contain a string of comma-separated @@ -655,6 +727,10 @@ PMIX_EXPORT int PMI_Spawn_multiple(int count, return PMI_ERR_INVALID_ARG; } + if (pmi_singleton) { + return PMI_FAIL; + } + /* setup the apps */ PMIX_APP_CREATE(apps, count); for (i = 0; i < count; i++) { diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmi2.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmi2.c index 97d1939c0ff..77d1bc38041 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmi2.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmi2.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -38,11 +38,11 @@ #define ANL_MAPPING "PMI_process_mapping" -#define PMI2_CHECK() \ - do { \ - if (!pmi2_init) { \ - return PMI2_FAIL; \ - } \ +#define PMI2_CHECK() \ + do { \ + if (!pmi2_init) { \ + return PMI2_FAIL; \ + } \ } while (0) /* local functions */ @@ -51,6 +51,7 @@ static int convert_err(pmix_status_t rc); static pmix_proc_t myproc; static int pmi2_init = 0; static bool commit_reqd = false; +static bool pmi2_singleton = false; PMIX_EXPORT int PMI2_Init(int *spawned, int *size, int *rank, int *appnum) { @@ -62,6 +63,27 @@ PMIX_EXPORT int PMI2_Init(int *spawned, int *size, int *rank, int *appnum) proc.rank = PMIX_RANK_WILDCARD; if (PMIX_SUCCESS != PMIx_Init(&myproc, NULL, 0)) { + /* if we didn't see a PMIx server (e.g., missing envar), + * then allow us to run as a singleton */ + if (PMIX_ERR_INVALID_NAMESPACE == rc) { + if (NULL != spawned) { + *spawned = 0; + } + if (NULL != size) { + *size = 1; + } + if (NULL != rank) { + *rank = 0; + } + if (NULL != appnum) { + *appnum = 0; + } + pmi2_singleton = true; + (void)strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN); + myproc.rank = 0; + pmi2_init = 1; + return PMI2_SUCCESS; + } return PMI2_ERR_INIT; } @@ -132,6 +154,10 @@ PMIX_EXPORT int PMI2_Init(int *spawned, int *size, int *rank, int *appnum) PMIX_EXPORT int PMI2_Initialized(void) { int initialized; + if (pmi2_singleton) { + return 1; + } + initialized = (int)PMIx_Initialized(); return initialized; } @@ -143,6 +169,10 @@ PMIX_EXPORT int PMI2_Finalize(void) PMI2_CHECK(); pmi2_init = 0; + if (pmi2_singleton) { + return PMI2_SUCCESS; + } + rc = PMIx_Finalize(NULL, 0); return convert_err(rc); } @@ -153,6 +183,10 @@ PMIX_EXPORT int PMI2_Abort(int flag, const char msg[]) PMI2_CHECK(); + if (pmi2_singleton) { + return PMI2_SUCCESS; + } + rc = PMIx_Abort(flag, msg, NULL, 0); return convert_err(rc); } @@ -179,6 +213,10 @@ PMIX_EXPORT int PMI2_Job_Spawn(int count, const char * cmds[], return PMI2_ERR_INVALID_ARGS; } + if (pmi2_singleton) { + return PMI2_FAIL; + } + /* setup the apps */ PMIX_APP_CREATE(apps, count); for (i=0; i < count; i++) { @@ -264,6 +302,11 @@ PMIX_EXPORT int PMI2_Info_GetSize(int *size) return PMI2_ERR_INVALID_ARGS; } + if (pmi2_singleton) { + *size = 1; + return PMI2_SUCCESS; + } + /* set controlling parameters * PMIX_OPTIONAL - expect that these keys should be available on startup */ @@ -291,6 +334,10 @@ PMIX_EXPORT int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn) return PMI2_ERR_INVALID_ARGS; } + if (pmi2_singleton) { + return PMI2_FAIL; + } + memset(proc.nspace, 0, sizeof(proc.nspace)); (void)strncpy(proc.nspace, (jobid ? jobid : proc.nspace), sizeof(proc.nspace)-1); proc.rank = PMIX_RANK_WILDCARD; @@ -305,6 +352,10 @@ PMIX_EXPORT int PMI2_Job_Disconnect(const char jobid[]) PMI2_CHECK(); + if (pmi2_singleton) { + return PMI2_SUCCESS; + } + memset(proc.nspace, 0, sizeof(proc.nspace)); (void)strncpy(proc.nspace, (jobid ? jobid : proc.nspace), sizeof(proc.nspace)-1); proc.rank = PMIX_RANK_WILDCARD; @@ -324,6 +375,10 @@ PMIX_EXPORT int PMI2_KVS_Put(const char key[], const char value[]) return PMI2_ERR_INVALID_ARG; } + if (pmi2_singleton) { + return PMI2_SUCCESS; + } + pmix_output_verbose(3, pmix_globals.debug_output, "PMI2_KVS_Put: key=%s value=%s", key, value); @@ -344,6 +399,10 @@ PMIX_EXPORT int PMI2_KVS_Fence(void) pmix_output_verbose(3, pmix_globals.debug_output, "PMI2_KVS_Fence"); + if (pmi2_singleton) { + return PMI2_SUCCESS; + } + if (PMIX_SUCCESS != (rc = PMIx_Commit())) { return convert_err(rc); } @@ -435,6 +494,10 @@ PMIX_EXPORT int PMI2_Info_GetNodeAttr(const char name[], return PMI2_ERR_INVALID_ARG; } + if (pmi2_singleton) { + return PMI2_FAIL; + } + /* set controlling parameters * PMIX_OPTIONAL - expect that these keys should be available on startup */ @@ -479,6 +542,10 @@ PMIX_EXPORT int PMI2_Info_PutNodeAttr(const char name[], const char value[]) return PMI2_ERR_INVALID_ARG; } + if (pmi2_singleton) { + return PMI2_SUCCESS; + } + val.type = PMIX_STRING; val.data.string = (char*)value; rc = PMIx_Put(PMIX_LOCAL, name, &val); @@ -500,6 +567,10 @@ PMIX_EXPORT int PMI2_Info_GetJobAttr(const char name[], char value[], int valuel return PMI2_ERR_INVALID_ARG; } + if (pmi2_singleton) { + return PMI2_FAIL; + } + /* set controlling parameters * PMIX_OPTIONAL - expect that these keys should be available on startup */ @@ -572,6 +643,10 @@ PMIX_EXPORT int PMI2_Nameserv_publish(const char service_name[], return PMI2_ERR_INVALID_ARG; } + if (pmi2_singleton) { + return PMI2_FAIL; + } + /* pass the service/port */ (void)strncpy(info[0].key, service_name, PMIX_MAX_KEYLEN); info[0].value.type = PMIX_STRING; @@ -606,6 +681,10 @@ PMIX_EXPORT int PMI2_Nameserv_lookup(const char service_name[], return PMI2_ERR_INVALID_ARG; } + if (pmi2_singleton) { + return PMI2_FAIL; + } + PMIX_PDATA_CONSTRUCT(&pdata[0]); PMIX_PDATA_CONSTRUCT(&pdata[1]); @@ -659,6 +738,10 @@ PMIX_EXPORT int PMI2_Nameserv_unpublish(const char service_name[], return PMI2_ERR_INVALID_ARG; } + if (pmi2_singleton) { + return PMI2_FAIL; + } + /* pass the service */ keys[0] = (char*)service_name; keys[1] = NULL; diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c index 3bf71848cd4..cda0d4e15ab 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -105,6 +105,12 @@ static void pmix_client_notify_recv(struct pmix_peer_t *peer, pmix_output_verbose(2, pmix_globals.debug_output, "pmix:client_notify_recv - processing event"); + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + return; + } + /* start the local notification chain */ chain = PMIX_NEW(pmix_event_chain_t); chain->final_cbfunc = _notify_complete; @@ -578,9 +584,7 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo) msg = PMIX_NEW(pmix_buffer_t); /* pack the cmd */ if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - return rc; + goto complete; } @@ -599,7 +603,8 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo) /* send to the server */ if (PMIX_SUCCESS != (rc = pmix_ptl.send_recv(pmix_client_globals.myserver, msg, finwait_cbfunc, (void*)&tev))){ - return rc; + pmix_event_del(&tev.ev); + goto complete; } /* wait for the ack to return */ @@ -614,6 +619,7 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo) pmix_globals.myid.nspace, pmix_globals.myid.rank); } + complete: if (!pmix_globals.external_evbase) { /* stop the progress thread, but leave the event base * still constructed. This will allow us to safely @@ -623,10 +629,7 @@ PMIX_EXPORT pmix_status_t PMIx_Finalize(const pmix_info_t info[], size_t ninfo) } #if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) - if (0 > (rc = pmix_dstore_nspace_del(pmix_globals.myid.nspace))) { - PMIX_ERROR_LOG(rc); - return rc; - } + pmix_dstore_nspace_del(pmix_globals.myid.nspace); #endif PMIX_LIST_DESTRUCT(&pmix_client_globals.pending_requests); diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_connect.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_connect.c index 50864d7fbc5..3acaa1f2a7c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_connect.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_connect.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -323,6 +323,18 @@ static void wait_cbfunc(struct pmix_peer_t *pr, "pmix:client recv callback activated with %d bytes", (NULL == buf) ? -1 : (int)buf->bytes_used); + if (NULL == buf) { + ret = PMIX_ERR_BAD_PARAM; + goto report; + } + + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + ret = PMIX_ERR_UNREACH; + goto report; + } + /* unpack the returned status */ cnt = 1; if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) { @@ -352,6 +364,7 @@ static void wait_cbfunc(struct pmix_peer_t *pr, ret = rc; } + report: if (NULL != cb->op_cbfunc) { cb->op_cbfunc(ret, cb->cbdata); } diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_fence.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_fence.c index acabf342cac..eada6e8e1a1 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_fence.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_fence.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -247,7 +247,13 @@ static void wait_cbfunc(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr, PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); return; } - rc = unpack_return(buf); + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + rc = PMIX_ERR_UNREACH; + } else { + rc = unpack_return(buf); + } /* if a callback was provided, execute it */ if (NULL != cb->op_cbfunc) { diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c index 928eb721f51..4beadba360c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -260,7 +260,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_value_t *val = NULL; int32_t cnt; pmix_nspace_t *ns, *nptr; - pmix_rank_t rank; + pmix_proc_t proc; #if (PMIX_ENABLE_DSTORE != 1) pmix_rank_t cur_rank; #endif @@ -274,8 +274,16 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); return; } - /* cache the rank */ - rank = cb->rank; + /* cache the proc id */ + (void)strncpy(proc.nspace, cb->nspace, PMIX_MAX_NSLEN); + proc.rank = cb->rank; + + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + ret = PMIX_ERR_UNREACH; + goto done; + } /* unpack the status */ cnt = 1; @@ -313,7 +321,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, /* we received the entire blob for this process, so * unpack and store it in the modex - this could consist * of buffers from multiple scopes */ - cur_rank = rank; + cur_rank = cb->rank; cnt = 1; while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(buf, &cur_rank, &cnt, PMIX_PROC_RANK))) { pmix_kval_t *cur_kval; @@ -413,13 +421,13 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, /* now search any pending requests to see if they can be met */ PMIX_LIST_FOREACH_SAFE(cb, cb2, &pmix_client_globals.pending_requests, pmix_cb_t) { - if (0 == strncmp(nptr->nspace, cb->nspace, PMIX_MAX_NSLEN) && cb->rank == rank) { + if (0 == strncmp(nptr->nspace, cb->nspace, PMIX_MAX_NSLEN) && cb->rank == proc.rank) { /* we have the data - see if we can find the key */ val = NULL; #if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) - rc = pmix_dstore_fetch(nptr->nspace, rank, cb->key, &val); + rc = pmix_dstore_fetch(nptr->nspace, proc.rank, cb->key, &val); #else - rc = pmix_hash_fetch(&nptr->modex, rank, cb->key, &val); + rc = pmix_hash_fetch(&nptr->modex, proc.rank, cb->key, &val); #endif /* PMIX_ENABLE_DSTORE */ cb->value_cbfunc(rc, val, cb->cbdata); if (NULL != val) { diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c index 6981c96e1e5..8634491a0de 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -478,11 +478,24 @@ static void wait_cbfunc(struct pmix_peer_t *pr, "pmix:client recv callback activated with %d bytes", (NULL == buf) ? -1 : (int)buf->bytes_used); + if (NULL == buf) { + rc = PMIX_ERR_BAD_PARAM; + goto report; + } + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + rc = PMIX_ERR_UNREACH; + goto report; + } + /* unpack the returned status */ cnt = 1; if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) { PMIX_ERROR_LOG(rc); } + + report: if (NULL != cb->op_cbfunc) { cb->op_cbfunc(rc, cb->cbdata); } @@ -514,15 +527,25 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr, "pmix:client recv callback activated with %d bytes", (NULL == buf) ? -1 : (int)buf->bytes_used); + /* set the defaults */ + pdata = NULL; + ndata = 0; + if (NULL == cb->lookup_cbfunc) { /* nothing we can do with this */ PMIX_RELEASE(cb); return; } - - /* set the defaults */ - pdata = NULL; - ndata = 0; + if (NULL == buf) { + rc = PMIX_ERR_BAD_PARAM; + goto report; + } + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + rc = PMIX_ERR_UNREACH; + goto report; + } /* unpack the returned status */ cnt = 1; @@ -556,6 +579,7 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr, } } + report: if (NULL != cb->lookup_cbfunc) { cb->lookup_cbfunc(rc, pdata, ndata, cb->cbdata); } diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_spawn.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_spawn.c index a7842c5ffb4..41e01b61573 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_spawn.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_spawn.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -119,6 +119,8 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin pmix_cmd_t cmd = PMIX_SPAWNNB_CMD; pmix_status_t rc; pmix_cb_t *cb; + pmix_info_t *spinfo; + size_t spninfo, n; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -145,19 +147,40 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin return rc; } + /* always add one directive that indicates whether the requestor + * is a tool or client */ + spninfo = ninfo + 1; + PMIX_INFO_CREATE(spinfo, spninfo); + if (NULL == spinfo) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return PMIX_ERR_NOMEM; + } + /* copy the info across */ + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&spinfo[n], (pmix_info_t*)&job_info[n]); + } + /* add the directive to the end */ + if (PMIX_PROC_IS_TOOL) { + PMIX_INFO_LOAD(&spinfo[ninfo], PMIX_REQUESTOR_IS_TOOL, NULL, PMIX_BOOL); + } else { + PMIX_INFO_LOAD(&spinfo[ninfo], PMIX_REQUESTOR_IS_CLIENT, NULL, PMIX_BOOL); + } + /* pack the job-level directives */ - if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &ninfo, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &spninfo, 1, PMIX_SIZE))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); + PMIX_INFO_FREE(spinfo, spninfo); return rc; } - if (0 < ninfo) { - if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, job_info, ninfo, PMIX_INFO))) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - return rc; - } + if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, spinfo, spninfo, PMIX_INFO))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + PMIX_INFO_FREE(spinfo, spninfo); + return rc; } + PMIX_INFO_FREE(spinfo, spninfo); /* pack the apps */ if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &napps, 1, PMIX_SIZE))) { @@ -203,12 +226,23 @@ static void wait_cbfunc(struct pmix_peer_t *pr, PMIX_ACQUIRE_OBJECT(cb); pmix_output_verbose(2, pmix_globals.debug_output, - "pmix:client recv callback activated with %d bytes", + "pmix:client spawn callback activated with %d bytes", (NULL == buf) ? -1 : (int)buf->bytes_used); /* init */ memset(nspace, 0, PMIX_MAX_NSLEN+1); + if (NULL == buf) { + ret = PMIX_ERR_BAD_PARAM; + goto report; + } + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + ret = PMIX_ERR_UNREACH; + goto report; + } + /* unpack the returned status */ cnt = 1; if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_STATUS))) { @@ -223,7 +257,7 @@ static void wait_cbfunc(struct pmix_peer_t *pr, ret = rc; } pmix_output_verbose(1, pmix_globals.debug_output, - "pmix:client recv '%s'", n2); + "pmix:client spawned %s", n2); if (NULL != n2) { (void)strncpy(nspace, n2, PMIX_MAX_NSLEN); @@ -235,6 +269,7 @@ static void wait_cbfunc(struct pmix_peer_t *pr, } } + report: if (NULL != cb->spawn_cbfunc) { cb->spawn_cbfunc(ret, nspace, cb->cbdata); } diff --git a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_control.c b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_control.c index cf2f546f777..e77c0f72bf9 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_control.c +++ b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_control.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -56,6 +56,17 @@ static void query_cbfunc(struct pmix_peer_t *peer, pmix_output_verbose(2, pmix_globals.debug_output, "pmix:query cback from server"); + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + /* release the caller */ + if (NULL != cd->cbfunc) { + cd->cbfunc(PMIX_ERR_COMM_FAILURE, NULL, 0, cd->cbdata, NULL, NULL); + } + PMIX_RELEASE(cd); + return; + } + results = PMIX_NEW(pmix_shift_caddy_t); /* unpack the status */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_data.c b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_data.c index a10f4057cc2..9b031915d6e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_data.c +++ b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_data.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2012 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -64,7 +64,8 @@ (b)->bytes_used = 0; \ } while (0) -PMIX_EXPORT pmix_status_t PMIx_Data_pack(pmix_data_buffer_t *buffer, +PMIX_EXPORT pmix_status_t PMIx_Data_pack(const pmix_proc_t *target, + pmix_data_buffer_t *buffer, void *src, int32_t num_vals, pmix_data_type_t type) { @@ -88,7 +89,8 @@ PMIX_EXPORT pmix_status_t PMIx_Data_pack(pmix_data_buffer_t *buffer, } -PMIX_EXPORT pmix_status_t PMIx_Data_unpack(pmix_data_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t PMIx_Data_unpack(const pmix_proc_t *source, + pmix_data_buffer_t *buffer, void *dest, int32_t *max_num_values, pmix_data_type_t type) { diff --git a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_jobdata.c b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_jobdata.c index 4ca58d6acf7..d55c43f9ccf 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_jobdata.c +++ b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_jobdata.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2016-2017 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -151,7 +151,7 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) pmix_job_data_caddy_t *cb = (pmix_job_data_caddy_t*)(cbdata); pmix_status_t rc = PMIX_SUCCESS; pmix_nspace_t *nsptr = NULL, *nsptr2 = NULL; - pmix_kval_t *kptr, *kp2, kv; + pmix_kval_t *kptr, *kp2, *kv; int32_t cnt; size_t nnodes, len; uint32_t i; @@ -278,11 +278,11 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) /* unpack the list of procs on each node */ for (i=0; i < nnodes; i++) { cnt = 1; - PMIX_CONSTRUCT(&kv, pmix_kval_t); - if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(&buf2, &kv, &cnt, PMIX_KVAL))) { + kv = PMIX_NEW(pmix_kval_t); + if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(&buf2, kv, &cnt, PMIX_KVAL))) { PMIX_ERROR_LOG(rc); PMIX_DESTRUCT(&buf2); - PMIX_DESTRUCT(&kv); + PMIX_RELEASE(kv); goto exit; } /* the name of the node is in the key, and the value is @@ -290,7 +290,7 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) * have this node */ nrec = NULL; PMIX_LIST_FOREACH(nr2, &nsptr->nodes, pmix_nrec_t) { - if (0 == strcmp(nr2->name, kv.key)) { + if (0 == strcmp(nr2->name, kv->key)) { nrec = nr2; break; } @@ -301,10 +301,10 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) if (NULL == nrec) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); PMIX_DESTRUCT(&buf2); - PMIX_DESTRUCT(&kv); + PMIX_RELEASE(kv); goto exit; } - nrec->name = strdup(kv.key); + nrec->name = strdup(kv->key); pmix_list_append(&nsptr->nodes, &nrec->super); } else { /* refresh the list */ @@ -312,13 +312,13 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) free(nrec->procs); } } - nrec->procs = strdup(kv.value->data.string); + nrec->procs = strdup(kv->value->data.string); /* split the list of procs so we can store their * individual location data */ #if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) - if (PMIX_SUCCESS != (rc = _add_key_for_rank(PMIX_RANK_WILDCARD, &kv, cb))) { + if (PMIX_SUCCESS != (rc = _add_key_for_rank(PMIX_RANK_WILDCARD, kv, cb))) { PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&kv); + PMIX_RELEASE(kv); PMIX_DESTRUCT(&buf2); pmix_argv_free(procs); goto exit; @@ -338,7 +338,7 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) if (PMIX_SUCCESS != (rc = _add_key_for_rank(rank, kp2, cb))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); - PMIX_DESTRUCT(&kv); + PMIX_RELEASE(kv); PMIX_DESTRUCT(&buf2); pmix_argv_free(procs); goto exit; @@ -347,7 +347,7 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) } pmix_argv_free(procs); #endif - PMIX_DESTRUCT(&kv); + PMIX_RELEASE(kv); // maintain accounting } /* cleanup */ PMIX_DESTRUCT(&buf2); diff --git a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c index 78a37c34ce8..27b1ed78260 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c +++ b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c @@ -788,10 +788,8 @@ static void _notify_client_event(int sd, short args, void *cbdata) PMIX_ACQUIRE_OBJECT(cd); pmix_output_verbose(2, pmix_globals.debug_output, - "pmix_server: _notify_client_event notifying clients of event %s range %s type %s", - PMIx_Error_string(cd->status), - PMIx_Data_range_string(cd->range), - cd->nondefault ? "NONDEFAULT" : "OPEN"); + "pmix_server: _notify_error notifying clients of error %s", + PMIx_Error_string(cd->status)); /* we cannot know if everyone who wants this notice has had a chance * to register for it - the notice may be coming too early. So cache diff --git a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_registration.c b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_registration.c index 21fcc381301..5ec3f1ce39b 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_registration.c +++ b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_registration.c @@ -749,13 +749,17 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) ack: /* acknowledge the registration so the caller can release - * their data */ + * their data AND record the event handler index */ if (NULL != cd->evregcbfn) { cd->evregcbfn(rc, index, cd->cbdata); } /* check if any matching notifications have been cached */ check_cached_events(cd); + if (NULL != cd->codes) { + free(cd->codes); + cd->codes = NULL; + } /* all done */ PMIX_RELEASE(cd); @@ -768,6 +772,7 @@ PMIX_EXPORT void PMIx_Register_event_handler(pmix_status_t codes[], size_t ncode void *cbdata) { pmix_rshift_caddy_t *cd; + size_t n; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -783,7 +788,23 @@ PMIX_EXPORT void PMIx_Register_event_handler(pmix_status_t codes[], size_t ncode /* need to thread shift this request so we can access * our global data to register this *local* event handler */ cd = PMIX_NEW(pmix_rshift_caddy_t); - cd->codes = codes; + /* we have to save the codes as we will check them against existing + * registrations AFTER we have executed the callback which allows + * the caller to release their storage */ + if (0 < ncodes) { + cd->codes = (pmix_status_t*)malloc(ncodes * sizeof(pmix_status_t)); + if (NULL == cd->codes) { + /* immediately return error */ + PMIX_RELEASE(cd); + if (NULL != cbfunc) { + cbfunc(PMIX_ERR_NOMEM, SIZE_MAX, cbdata); + } + return; + } + for (n=0; n < ncodes; n++) { + cd->codes[n] = codes[n]; + } + } cd->ncodes = ncodes; cd->info = info; cd->ninfo = ninfo; diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_open.c b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_open.c index 34562680806..5d0ab142ead 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_open.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_open.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2008 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -48,7 +48,7 @@ char *pmix_mca_base_component_path = NULL; int pmix_mca_base_opened = 0; char *pmix_mca_base_system_default_path = NULL; char *pmix_mca_base_user_default_path = NULL; -bool pmix_mca_base_component_show_load_errors = true; +bool pmix_mca_base_component_show_load_errors = (bool) PMIX_SHOW_LOAD_ERRORS_DEFAULT; bool pmix_mca_base_component_disable_dlopen = false; static char *pmix_mca_base_verbose = NULL; @@ -101,7 +101,7 @@ int pmix_mca_base_open(void) PMIX_MCA_BASE_VAR_SYN_FLAG_DEPRECATED); free(value); - pmix_mca_base_component_show_load_errors = true; + pmix_mca_base_component_show_load_errors = (bool) PMIX_SHOW_LOAD_ERRORS_DEFAULT;; var_id = pmix_mca_base_var_register("pmix", "mca", "base", "component_show_load_errors", "Whether to show errors for components that failed to load or not", PMIX_MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var.c b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var.c index 858ca1a91a4..1a16d0bf5e5 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var.c @@ -428,12 +428,18 @@ int pmix_mca_base_var_cache_files(bool rel_path_search) } #if PMIX_WANT_HOME_CONFIG_FILES - asprintf(&pmix_mca_base_var_files, "%s"PMIX_PATH_SEP".pmix" PMIX_PATH_SEP - "mca-params.conf%c%s" PMIX_PATH_SEP "pmix-mca-params.conf", - home, PMIX_ENV_SEP, pmix_pinstall_dirs.sysconfdir); + ret = asprintf(&pmix_mca_base_var_files, "%s"PMIX_PATH_SEP".pmix" PMIX_PATH_SEP + "mca-params.conf%c%s" PMIX_PATH_SEP "pmix-mca-params.conf", + home, ',', pmix_pinstall_dirs.sysconfdir); + if (PMIX_SUCCESS != ret) { + return ret; + } #else - asprintf(&pmix_mca_base_var_files, "%s" PMIX_PATH_SEP "pmix-mca-params.conf", - pmix_pinstall_dirs.sysconfdir); + ret = asprintf(&pmix_mca_base_var_files, "%s" PMIX_PATH_SEP "pmix-mca-params.conf", + pmix_pinstall_dirs.sysconfdir); + if (PMIX_SUCCESS != ret) { + return ret; + } #endif /* Initialize a parameter that says where MCA param files can be found. diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var.h b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var.h index 328cdb1f520..c23a7b757e3 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var.h +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var.h @@ -95,7 +95,7 @@ typedef enum { PMIX_MCA_BASE_VAR_TYPE_MAX } pmix_mca_base_var_type_t; -extern const char *pmix_var_type_names[]; +PMIX_EXPORT extern const char *pmix_var_type_names[]; /** * Source of an MCA variable's value @@ -298,7 +298,7 @@ BEGIN_C_DECLS /** * Object declarayion for pmix_mca_base_var_t */ -PMIX_CLASS_DECLARATION(pmix_mca_base_var_t); +PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_mca_base_var_t); /** * Initialize the MCA variable system. @@ -309,7 +309,7 @@ PMIX_CLASS_DECLARATION(pmix_mca_base_var_t); * invoked internally (by pmix_mca_base_open()) and is only documented * here for completeness. */ -int pmix_mca_base_var_init(void); +PMIX_EXPORT int pmix_mca_base_var_init(void); /** * Register an MCA variable @@ -489,7 +489,7 @@ PMIX_EXPORT int pmix_mca_base_var_register_synonym (int synonym_for, const char * * If an enumerator is associated with this variable it will be dereferenced. */ -int pmix_mca_base_var_deregister(int vari); +PMIX_EXPORT int pmix_mca_base_var_deregister(int vari); /** @@ -512,9 +512,9 @@ int pmix_mca_base_var_deregister(int vari); * Note: The value can be changed by the registering code without using * the pmix_mca_base_var_* interface so the source may be incorrect. */ -int pmix_mca_base_var_get_value (int vari, void *value, - pmix_mca_base_var_source_t *source, - const char **source_file); +PMIX_EXPORT int pmix_mca_base_var_get_value (int vari, void *value, + pmix_mca_base_var_source_t *source, + const char **source_file); /** * Sets an "override" value for an integer MCA variable. @@ -537,9 +537,9 @@ int pmix_mca_base_var_get_value (int vari, void *value, * a synonym the variable the synonym represents) if the value is * settable. */ -int pmix_mca_base_var_set_value (int vari, const void *value, size_t size, - pmix_mca_base_var_source_t source, - const char *source_file); +PMIX_EXPORT int pmix_mca_base_var_set_value (int vari, const void *value, size_t size, + pmix_mca_base_var_source_t source, + const char *source_file); /** * Get the string name corresponding to the MCA variable @@ -554,8 +554,8 @@ int pmix_mca_base_var_set_value (int vari, const void *value, size_t size, * The string that is returned is owned by the caller; if * appropriate, it must be eventually freed by the caller. */ -int pmix_mca_base_var_env_name(const char *param_name, - char **env_name); +PMIX_EXPORT int pmix_mca_base_var_env_name(const char *param_name, + char **env_name); /** * Find the index for an MCA variable based on its names. @@ -574,10 +574,10 @@ int pmix_mca_base_var_env_name(const char *param_name, * of any registered variable. The returned index can be used with * pmix_mca_base_var_get() and pmix_mca_base_var_get_value(). */ -int pmix_mca_base_var_find (const char *project_name, - const char *type_name, - const char *component_name, - const char *param_name); +PMIX_EXPORT int pmix_mca_base_var_find (const char *project_name, + const char *type_name, + const char *component_name, + const char *param_name); /** * Find the index for a variable based on its full name @@ -587,7 +587,7 @@ int pmix_mca_base_var_find (const char *project_name, * * See pmix_mca_base_var_find(). */ -int pmix_mca_base_var_find_by_name (const char *full_name, int *vari); +PMIX_EXPORT int pmix_mca_base_var_find_by_name (const char *full_name, int *vari); /** * Check that two MCA variables were not both set to non-default @@ -617,13 +617,13 @@ int pmix_mca_base_var_find_by_name (const char *full_name, int *vari); * are not MCA_BASE_VAR_SOURCE_DEFAULT. * @returns PMIX_SUCCESS otherwise. */ -int pmix_mca_base_var_check_exclusive (const char *project, - const char *type_a, - const char *component_a, - const char *param_a, - const char *type_b, - const char *component_b, - const char *param_b); +PMIX_EXPORT int pmix_mca_base_var_check_exclusive (const char *project, + const char *type_a, + const char *component_a, + const char *param_a, + const char *type_b, + const char *component_b, + const char *param_b); /** * Set or unset a flag on a variable. @@ -636,8 +636,8 @@ int pmix_mca_base_var_check_exclusive (const char *project, * @returns PMIX_ERR_BAD_PARAM If the variable is not registered. * @returns PMIX_ERROR Otherwise */ -int pmix_mca_base_var_set_flag(int vari, pmix_mca_base_var_flag_t flag, - bool set); +PMIX_EXPORT int pmix_mca_base_var_set_flag(int vari, pmix_mca_base_var_flag_t flag, + bool set); /** * Obtain basic info on a single variable (name, help message, etc) @@ -651,7 +651,7 @@ int pmix_mca_base_var_set_flag(int vari, pmix_mca_base_var_flag_t flag, * The returned pointer belongs to the MCA variable system. Do not * modify/free/retain the pointer. */ -int pmix_mca_base_var_get (int vari, const pmix_mca_base_var_t **var); +PMIX_EXPORT int pmix_mca_base_var_get (int vari, const pmix_mca_base_var_t **var); /** * Obtain the number of variables that have been registered. @@ -664,7 +664,7 @@ int pmix_mca_base_var_get (int vari, const pmix_mca_base_var_t **var); * returned is equal to the number of calls to pmix_mca_base_var_register with * unique names. ie. two calls with the same name will not affect the count. */ -int pmix_mca_base_var_get_count (void); +PMIX_EXPORT int pmix_mca_base_var_get_count (void); /** * Obtain a list of enironment variables describing the all @@ -683,8 +683,8 @@ int pmix_mca_base_var_get_count (void); * its output is in terms of an argv-style array of key=value * strings, suitable for using in an environment. */ -int pmix_mca_base_var_build_env(char ***env, int *num_env, - bool internal); +PMIX_EXPORT int pmix_mca_base_var_build_env(char ***env, int *num_env, + bool internal); /** * Shut down the MCA variable system (normally only invoked by the @@ -700,7 +700,7 @@ int pmix_mca_base_var_build_env(char ***env, int *num_env, * when the process is shutting down (e.g., during MPI_FINALIZE). It * is only documented here for completeness. */ -int pmix_mca_base_var_finalize(void); +PMIX_EXPORT int pmix_mca_base_var_finalize(void); typedef enum { /* Dump human-readable strings */ @@ -721,19 +721,19 @@ typedef enum { * This function returns an array of strings describing the variable. All strings * and the array must be freed by the caller. */ -int pmix_mca_base_var_dump(int vari, char ***out, pmix_mca_base_var_dump_type_t output_type); +PMIX_EXPORT int pmix_mca_base_var_dump(int vari, char ***out, pmix_mca_base_var_dump_type_t output_type); #define MCA_COMPILETIME_VER "print_compiletime_version" #define MCA_RUNTIME_VER "print_runtime_version" -int pmix_mca_base_var_cache_files (bool rel_path_search); +PMIX_EXPORT int pmix_mca_base_var_cache_files (bool rel_path_search); /* * Parse a provided list of envars and add their local value, or * their assigned value, to the provided argv */ -int pmix_mca_base_var_process_env_list(char ***argv); -int pmix_mca_base_var_process_env_list_from_file(char ***argv); +PMIX_EXPORT int pmix_mca_base_var_process_env_list(char ***argv); +PMIX_EXPORT int pmix_mca_base_var_process_env_list_from_file(char ***argv); END_C_DECLS diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/base/psec_base_select.c b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/base/psec_base_select.c index 73dbeb9095c..c6ec77cc02b 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/base/psec_base_select.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/base/psec_base_select.c @@ -72,12 +72,21 @@ int pmix_psec_base_select(void) if (PMIX_SUCCESS != rc || NULL == module) { pmix_output_verbose(5, pmix_psec_base_framework.framework_output, "mca:psec:select: Skipping component [%s]. Query failed to return a module", - component->pmix_mca_component_name ); + component->pmix_mca_component_name); + continue; + } + nmodule = (pmix_psec_module_t*) module; + + /* give the module a chance to init */ + if (NULL != nmodule->init && PMIX_SUCCESS != nmodule->init()) { + /* failed to init, so skip it */ + pmix_output_verbose(5, pmix_psec_base_framework.framework_output, + "mca:psec:select: Skipping component [%s]. Failed to init", + component->pmix_mca_component_name); continue; } /* If we got a module, keep it */ - nmodule = (pmix_psec_module_t*) module; /* add to the list of selected modules */ newmodule = PMIX_NEW(pmix_psec_base_active_module_t); newmodule->pri = priority; diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/munge/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/munge/Makefile.am index a756c8b19de..5f01461190c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/munge/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/munge/Makefile.am @@ -19,6 +19,8 @@ # $HEADER$ # +AM_CPPFLAGS = $(psec_munge_CPPFLAGS) + headers = psec_munge.h sources = \ psec_munge_component.c \ @@ -43,8 +45,10 @@ endif mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_psec_munge_la_SOURCES = $(component_sources) -mca_psec_munge_la_LDFLAGS = -module -avoid-version +mca_psec_munge_la_LDFLAGS = -module -avoid-version $(psec_munge_LDFLAGS) +mca_psec_munge_la_LIBADD = $(psec_munge_LIBS) noinst_LTLIBRARIES = $(lib) libmca_psec_munge_la_SOURCES = $(lib_sources) -libmca_psec_munge_la_LDFLAGS = -module -avoid-version +libmca_psec_munge_la_LDFLAGS = -module -avoid-version $(psec_munge_LDFLAGS) +libmca_psec_munge_la_LIBADD = $(psec_munge_LIBS) diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/munge/psec_munge.c b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/munge/psec_munge.c index fcf7834aab2..eceda9be460 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/munge/psec_munge.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/munge/psec_munge.c @@ -25,6 +25,7 @@ #endif #include +#include "src/threads/threads.h" #include "src/mca/psec/psec.h" #include "psec_munge.h" @@ -32,19 +33,19 @@ static pmix_status_t munge_init(void); static void munge_finalize(void); static pmix_status_t create_cred(pmix_listener_protocol_t protocol, char **cred, size_t *len); -static pmix_status_t validate_cred(pmix_listener_protocol_t protocol, - pmix_peer_t *peer, char *cred, size_t len); +static pmix_status_t validate_cred(pmix_peer_t *peer, + pmix_listener_protocol_t protocol, + char *cred, size_t len); pmix_psec_module_t pmix_munge_module = { - "munge", - munge_init, - munge_finalize, - create_cred, - NULL, - validate_cred, - NULL + .name = "munge", + .init = munge_init, + .finalize = munge_finalize, + .create_cred = create_cred, + .validate_cred = validate_cred }; +static pmix_lock_t lock; static char *mycred = NULL; static bool initialized = false; static bool refresh = false; @@ -56,6 +57,9 @@ static pmix_status_t munge_init(void) pmix_output_verbose(2, pmix_globals.debug_output, "psec: munge init"); + PMIX_CONSTRUCT_LOCK(&lock); + lock.active = false; + /* attempt to get a credential as a way of checking that * the munge server is available - cache the credential * for later use */ @@ -66,6 +70,7 @@ static pmix_status_t munge_init(void) munge_strerror(rc)); return PMIX_ERR_SERVER_NOT_AVAIL; } + initialized = true; return PMIX_SUCCESS; @@ -73,6 +78,8 @@ static pmix_status_t munge_init(void) static void munge_finalize(void) { + PMIX_ACQUIRE_THREAD(&lock); + pmix_output_verbose(2, pmix_globals.debug_output, "psec: munge finalize"); if (initialized) { @@ -81,6 +88,8 @@ static void munge_finalize(void) mycred = NULL; } } + PMIX_RELEASE_THREAD(&lock); + PMIX_DESTRUCT_LOCK(&lock); } static pmix_status_t create_cred(pmix_listener_protocol_t protocol, @@ -88,6 +97,8 @@ static pmix_status_t create_cred(pmix_listener_protocol_t protocol, { int rc; + PMIX_ACQUIRE_THREAD(&lock); + pmix_output_verbose(2, pmix_globals.debug_output, "psec: munge create_cred"); @@ -106,17 +117,20 @@ static pmix_status_t create_cred(pmix_listener_protocol_t protocol, pmix_output_verbose(2, pmix_globals.debug_output, "psec: munge failed to create credential: %s", munge_strerror(rc)); - return NULL; + PMIX_RELEASE_THREAD(&lock); + return PMIX_ERR_NOT_SUPPORTED; } *cred = strdup(mycred); *len = strlen(mycred) + 1; } } + PMIX_RELEASE_THREAD(&lock); return PMIX_SUCCESS; } -static pmix_status_t validate_cred(pmix_listener_protocol_t protocol, - pmix_peer_t *peer, char *cred, size_t len) +static pmix_status_t validate_cred(pmix_peer_t *peer, + pmix_listener_protocol_t protocol, + char *cred, size_t len) { uid_t uid; gid_t gid; diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/none/psec_none.c b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/none/psec_none.c index 5fc22cec042..e3d58392578 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/none/psec_none.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/none/psec_none.c @@ -1,6 +1,8 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 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. * * $COPYRIGHT$ * @@ -29,6 +31,8 @@ static pmix_status_t none_init(void); static void none_finalize(void); +static pmix_status_t create_cred(pmix_listener_protocol_t protocol, + char **cred, size_t *len); static pmix_status_t validate_cred(pmix_peer_t *peer, pmix_listener_protocol_t protocol, char *cred, size_t len); @@ -37,6 +41,7 @@ pmix_psec_module_t pmix_none_module = { .name = "none", .init = none_init, .finalize = none_finalize, + .create_cred = create_cred, .validate_cred = validate_cred }; @@ -53,6 +58,15 @@ static void none_finalize(void) "psec: none finalize"); } +static pmix_status_t create_cred(pmix_listener_protocol_t protocol, + char **cred, size_t *len) +{ + *cred = NULL; + *len = 0; + + return PMIX_SUCCESS; +} + static pmix_status_t validate_cred(pmix_peer_t *peer, pmix_listener_protocol_t protocol, char *cred, size_t len) diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/base.h b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/base.h index ac92ed9dc97..2aa562f2512 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/base.h +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/base.h @@ -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) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -37,6 +37,7 @@ #include "src/class/pmix_pointer_array.h" #include "src/mca/mca.h" #include "src/mca/base/pmix_mca_base_framework.h" +#include "src/include/pmix_globals.h" #include "src/mca/ptl/ptl.h" @@ -77,6 +78,8 @@ struct pmix_ptl_globals_t { int stop_thread[2]; bool listen_thread_active; pmix_list_t listeners; + pmix_ptl_tag_t current_tag; + size_t max_msg_size; }; typedef struct pmix_ptl_globals_t pmix_ptl_globals_t; @@ -119,6 +122,7 @@ PMIX_EXPORT pmix_status_t pmix_ptl_base_connect(struct sockaddr_storage *addr, PMIX_EXPORT void pmix_ptl_base_connection_handler(int sd, short args, void *cbdata); PMIX_EXPORT pmix_status_t pmix_ptl_base_send_connect_ack(int sd); PMIX_EXPORT pmix_status_t pmix_ptl_base_recv_connect_ack(int sd); +PMIX_EXPORT void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err); END_C_DECLS diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_frame.c b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_frame.c index fbcf19cb022..4b5c29c3e59 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_frame.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_frame.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -53,6 +53,8 @@ #include "src/mca/ptl/base/static-components.h" +#define PMIX_MAX_MSG_SIZE 16 + /* Instantiate the global vars */ pmix_ptl_globals_t pmix_ptl_globals = {{{0}}}; pmix_ptl_API_t pmix_ptl = { @@ -67,8 +69,18 @@ pmix_ptl_API_t pmix_ptl = { .stop_listening = pmix_ptl_base_stop_listening }; +static size_t max_msg_size = PMIX_MAX_MSG_SIZE; + static int pmix_ptl_register(pmix_mca_base_register_flag_t flags) { + (void) pmix_mca_base_var_register("pmix", "ptl", "base", "max_msg_size", + "Maximum allowed message size (in MBytes)", + PMIX_MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, + PMIX_INFO_LVL_2, + PMIX_MCA_BASE_VAR_SCOPE_READONLY, + &max_msg_size); + pmix_ptl_globals.max_msg_size = max_msg_size * 1024 * 1024; + return PMIX_SUCCESS; } @@ -107,6 +119,7 @@ static pmix_status_t pmix_ptl_open(pmix_mca_base_open_flag_t flags) PMIX_CONSTRUCT(&pmix_ptl_globals.unexpected_msgs, pmix_list_t); pmix_ptl_globals.listen_thread_active = false; PMIX_CONSTRUCT(&pmix_ptl_globals.listeners, pmix_list_t); + pmix_ptl_globals.current_tag = PMIX_PTL_TAG_DYNAMIC; /* Open up all available components */ return pmix_mca_base_framework_components_open(&pmix_ptl_base_framework, flags); diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c index 350c4d81bda..213857629b9 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science @@ -44,18 +44,17 @@ #include "src/client/pmix_client_ops.h" #include "src/server/pmix_server_ops.h" #include "src/util/error.h" +#include "src/util/show_help.h" #include "src/mca/ptl/base/base.h" -static uint32_t current_tag = PMIX_PTL_TAG_DYNAMIC; - static void _notify_complete(pmix_status_t status, void *cbdata) { pmix_event_chain_t *chain = (pmix_event_chain_t*)cbdata; PMIX_RELEASE(chain); } -static void lost_connection(pmix_peer_t *peer, pmix_status_t err) +void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) { pmix_server_trkr_t *trk; pmix_rank_info_t *rinfo, *rnext; @@ -351,7 +350,7 @@ void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata) peer->send_ev_active = false; PMIX_RELEASE(msg); peer->send_msg = NULL; - lost_connection(peer, rc); + pmix_ptl_base_lost_connection(peer, rc); /* ensure we post the modified peer object before another thread * picks it back up */ PMIX_POST_OBJECT(peer); @@ -434,6 +433,11 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata) peer->recv_msg->hdr.pindex = ntohl(hdr.pindex); peer->recv_msg->hdr.tag = ntohl(hdr.tag); peer->recv_msg->hdr.nbytes = ntohl(hdr.nbytes); + if (pmix_ptl_globals.max_msg_size < peer->recv_msg->hdr.nbytes) { + pmix_show_help("help-pmix-runtime.txt", "ptl:message-too-large", true, + peer->recv_msg->hdr.nbytes, pmix_ptl_globals.max_msg_size); + goto err_close; + } pmix_output_verbose(2, pmix_globals.debug_output, "RECVD MSG FOR TAG %d SIZE %d", (int)peer->recv_msg->hdr.tag, @@ -533,7 +537,7 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata) PMIX_RELEASE(peer->recv_msg); peer->recv_msg = NULL; } - lost_connection(peer, PMIX_ERR_UNREACH); + pmix_ptl_base_lost_connection(peer, PMIX_ERR_UNREACH); /* ensure we post the modified peer object before another thread * picks it back up */ PMIX_POST_OBJECT(peer); @@ -609,11 +613,11 @@ void pmix_ptl_base_send_recv(int fd, short args, void *cbdata) } /* take the next tag in the sequence */ - current_tag++; - if (UINT32_MAX == current_tag ) { - current_tag = PMIX_PTL_TAG_DYNAMIC; + pmix_ptl_globals.current_tag++; + if (UINT32_MAX == pmix_ptl_globals.current_tag ) { + pmix_ptl_globals.current_tag = PMIX_PTL_TAG_DYNAMIC; } - tag = current_tag; + tag = pmix_ptl_globals.current_tag; if (NULL != ms->cbfunc) { /* if a callback msg is expected, setup a recv for it */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/ptl_types.h b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/ptl_types.h index 55e617690aa..05326516fb4 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/ptl_types.h +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/ptl_types.h @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -227,6 +227,7 @@ PMIX_CLASS_DECLARATION(pmix_listener_t); #define PMIX_SERVER_QUEUE_REPLY(p, t, b) \ do { \ pmix_ptl_send_t *snd; \ + uint32_t nbytes; \ pmix_output_verbose(5, pmix_globals.debug_output, \ "[%s:%d] queue callback called: reply to %s:%d on tag %d size %d", \ __FILE__, __LINE__, \ @@ -235,7 +236,8 @@ PMIX_CLASS_DECLARATION(pmix_listener_t); snd = PMIX_NEW(pmix_ptl_send_t); \ snd->hdr.pindex = htonl(pmix_globals.pindex); \ snd->hdr.tag = htonl(t); \ - snd->hdr.nbytes = htonl((b)->bytes_used); \ + nbytes = (b)->bytes_used; \ + snd->hdr.nbytes = htonl(nbytes); \ snd->data = (b); \ /* always start with the header */ \ snd->sdptr = (char*)&snd->hdr; \ diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp.c b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp.c index 47c047a7da7..cf1aa23274e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp.c @@ -13,7 +13,8 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -116,8 +117,8 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_info_t *info, size_t ninfo) { char *evar, **uri, *suri; - char *filename, *nspace; - pmix_rank_t rank; + char *filename, *nspace=NULL; + pmix_rank_t rank = PMIX_RANK_WILDCARD; char *p, *p2; int sd, rc; size_t n; @@ -176,6 +177,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, /* go ahead and try to connect */ if (PMIX_SUCCESS != (rc = try_connect(&sd))) { + free(nspace); return rc; } goto complete; @@ -210,6 +212,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp:tool getting connection info from %s", mca_ptl_tcp_component.super.uri); + nspace = NULL; rc = parse_uri_file(&mca_ptl_tcp_component.super.uri[6], &suri, &nspace, &rank); if (PMIX_SUCCESS != rc) { return PMIX_ERR_UNREACH; @@ -222,6 +225,9 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, mca_ptl_tcp_component.super.uri); /* go ahead and try to connect */ if (PMIX_SUCCESS != (rc = try_connect(&sd))) { + if (NULL != nspace) { + free(nspace); + } return rc; } goto complete; @@ -248,6 +254,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (PMIX_SUCCESS == try_connect(&sd)) { goto complete; } + free(nspace); } } @@ -270,12 +277,16 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp:tool searching for given session server %s", filename); + nspace = NULL; rc = df_search(mca_ptl_tcp_component.system_tmpdir, filename, &sd, &nspace, &rank); free(filename); if (PMIX_SUCCESS == rc) { goto complete; } + if (NULL != nspace) { + free(nspace); + } /* since they gave us a specific pid and we couldn't * connect to it, return an error */ return PMIX_ERR_UNREACH; @@ -292,10 +303,14 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp:tool searching for session server %s", filename); + nspace = NULL; rc = df_search(mca_ptl_tcp_component.system_tmpdir, filename, &sd, &nspace, &rank); free(filename); if (PMIX_SUCCESS != rc) { + if (NULL != nspace){ + free(nspace); + } return PMIX_ERR_UNREACH; } @@ -303,6 +318,11 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_output_verbose(2, pmix_globals.debug_output, "sock_peer_try_connect: Connection across to server succeeded"); + /* do a final bozo check */ + if (NULL == nspace || PMIX_RANK_WILDCARD == rank) { + CLOSE_THE_SOCKET(sd); + return PMIX_ERR_UNREACH; + } /* mark the connection as made */ pmix_globals.connected = true; pmix_client_globals.myserver->sd = sd; @@ -315,6 +335,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_client_globals.myserver->info->nptr = PMIX_NEW(pmix_nspace_t); } (void)strncpy(pmix_client_globals.myserver->info->nptr->nspace, nspace, PMIX_MAX_NSLEN); + free(nspace); pmix_client_globals.myserver->info->rank = rank; pmix_ptl_base_set_nonblocking(sd); @@ -515,7 +536,9 @@ static pmix_status_t try_connect(int *sd) /* establish the connection */ if (PMIX_SUCCESS != (rc = pmix_ptl_base_connect(&mca_ptl_tcp_component.connection, len, sd))) { - PMIX_ERROR_LOG(rc); + /* Do not be noisy about this. It is normal to try and fail different + connection methods until we find the right one */ +// PMIX_ERROR_LOG(rc); return rc; } @@ -578,7 +601,7 @@ static pmix_status_t send_connect_ack(int sd) if (PMIX_PROC_IS_CLIENT) { flag = 0; /* reserve space for our nspace and rank info */ - sdsize += strlen(pmix_globals.myid.nspace) + 1 + sizeof(uint32_t); + sdsize += strlen(pmix_globals.myid.nspace) + 1 + sizeof(int); } else { flag = 1; /* add space for our uid/gid for ACL purposes */ @@ -619,7 +642,7 @@ static pmix_status_t send_connect_ack(int sd) memcpy(msg+csize, &u32, sizeof(uint32_t)); csize += sizeof(uint32_t); /* load the credential */ - if (0 < len) { + if (0 < u32) { memcpy(msg+csize, cred, len); csize += len; } @@ -796,8 +819,9 @@ static pmix_status_t df_search(char *dirname, char *prefix, char *suri, *nsp, *newdir; pmix_rank_t rk; pmix_status_t rc; + struct stat buf; DIR *cur_dirp; - struct dirent * dir_entry; + struct dirent *dir_entry; if (NULL == (cur_dirp = opendir(dirname))) { return PMIX_ERR_NOT_FOUND; @@ -813,9 +837,13 @@ static pmix_status_t df_search(char *dirname, char *prefix, 0 == strcmp(dir_entry->d_name, "..")) { continue; } + newdir = pmix_os_path(false, dirname, dir_entry->d_name, NULL); + if (-1 == stat(newdir, &buf)) { + free(newdir); + continue; + } /* if it is a directory, down search */ - if (DT_DIR == dir_entry->d_type) { - newdir = pmix_os_path(false, dirname, dir_entry->d_name, NULL); + if (S_ISDIR(buf.st_mode)) { rc = df_search(newdir, prefix, sd, nspace, rank); free(newdir); if (PMIX_SUCCESS == rc) { @@ -824,22 +852,14 @@ static pmix_status_t df_search(char *dirname, char *prefix, } continue; } - /* if it isn't a regular file, ignore it */ - if (DT_REG != dir_entry->d_type) { - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "pmix:tcp: ignoring %s", dir_entry->d_name); - continue; - } pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "pmix:tcp: checking %s vs %s", dir_entry->d_name, prefix); /* see if it starts with our prefix */ if (0 == strncmp(dir_entry->d_name, prefix, strlen(prefix))) { /* try to read this file */ - newdir = pmix_os_path(false, dirname, dir_entry->d_name, NULL); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "pmix:tcp: reading file %s", newdir); rc = parse_uri_file(newdir, &suri, &nsp, &rk); - free(newdir); if (PMIX_SUCCESS == rc) { if (NULL != mca_ptl_tcp_component.super.uri) { free(mca_ptl_tcp_component.super.uri); @@ -852,10 +872,13 @@ static pmix_status_t df_search(char *dirname, char *prefix, (*nspace) = nsp; *rank = rk; closedir(cur_dirp); + free(newdir); return PMIX_SUCCESS; } + free(nsp); } } + free(newdir); } closedir(cur_dirp); return PMIX_ERR_NOT_FOUND; diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c index 7b18e21c52c..5b93cdc3437 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c @@ -13,6 +13,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -549,8 +550,8 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, } else if (AF_INET6 == mca_ptl_tcp_component.connection.ss_family) { prefix = "tcp6://"; myport = ntohs(((struct sockaddr_in6*) &mca_ptl_tcp_component.connection)->sin6_port); - inet_ntop(AF_INET6, &((struct sockaddr_in6*) &mca_ptl_tcp_component.connection)->sin6_addr, - myconnhost, PMIX_MAXHOSTNAMELEN); + inet_ntop(AF_INET6, &((struct sockaddr_in6*) &mca_ptl_tcp_component.connection)->sin6_addr, + myconnhost, PMIX_MAXHOSTNAMELEN); } else { goto sockerror; } @@ -586,7 +587,13 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, fprintf(fp, "%s.%d:%s\n", pmix_globals.myid.nspace, pmix_globals.myid.rank, lt->uri); fclose(fp); /* set the file mode */ - chmod(mca_ptl_tcp_component.system_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + if (0 != chmod(mca_ptl_tcp_component.system_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) { + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + free(mca_ptl_tcp_component.system_filename); + mca_ptl_tcp_component.system_filename = NULL; + goto sockerror; + } } if (session_tool) { FILE *fp; @@ -612,7 +619,13 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, fprintf(fp, "%s.%d:%s\n", pmix_globals.myid.nspace, pmix_globals.myid.rank, lt->uri); fclose(fp); /* set the file mode */ - chmod(mca_ptl_tcp_component.session_filename, S_IRUSR | S_IWUSR | S_IRGRP); + if (0 != chmod(mca_ptl_tcp_component.session_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.system_filename); + mca_ptl_tcp_component.system_filename = NULL; + goto sockerror; + } } /* we need listener thread support */ @@ -1014,6 +1027,7 @@ static void connection_handler(int sd, short args, void *cbdata) /* send an error reply to the client */ goto error; } + free(msg); /* the choice of PTL module is obviously us */ peer->compat.ptl = &pmix_ptl_tcp_module; @@ -1158,12 +1172,14 @@ static void process_cbfunc(int sd, short args, void *cbdata) /* add this tool rank to the nspace */ info = PMIX_NEW(pmix_rank_info_t); - (void)strncpy(info->nptr->nspace, cd->proc.nspace, PMIX_MAX_NSLEN); - info->rank = 0; /* add this nspace to our pool */ nptr = PMIX_NEW(pmix_nspace_t); info->nptr = nptr; + (void)strncpy(info->nptr->nspace, cd->proc.nspace, PMIX_MAX_NSLEN); + info->rank = 0; (void)strncpy(nptr->nspace, cd->proc.nspace, PMIX_MAX_NSLEN); + nptr->server = PMIX_NEW(pmix_server_nspace_t); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); /* need to include the uid/gid for validation */ info->uid = pnd->uid; diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/Makefile.am deleted file mode 100644 index e6606e2e844..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -# -*- makefile -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -headers = ptl_usock.h -sources = \ - ptl_usock_component.c \ - ptl_usock.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_ptl_usock_DSO -lib = -lib_sources = -component = mca_ptl_usock.la -component_sources = $(headers) $(sources) -else -lib = libmca_ptl_usock.la -lib_sources = $(headers) $(sources) -component = -component_sources = -endif - -mcacomponentdir = $(pmixlibdir) -mcacomponent_LTLIBRARIES = $(component) -mca_ptl_usock_la_SOURCES = $(component_sources) -mca_ptl_usock_la_LDFLAGS = -module -avoid-version - -noinst_LTLIBRARIES = $(lib) -libmca_ptl_usock_la_SOURCES = $(lib_sources) -libmca_ptl_usock_la_LDFLAGS = -module -avoid-version diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock.c b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock.c deleted file mode 100644 index 0a090bb51de..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - */ - -#include -#include "pmix_common.h" - -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_SYS_UN_H -#include -#endif -#ifdef HAVE_SYS_UIO_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif - -#include "src/util/argv.h" -#include "src/util/error.h" -#include "src/client/pmix_client_ops.h" -#include "src/include/pmix_globals.h" -#include "src/include/pmix_socket_errno.h" -#include "src/mca/psec/psec.h" - -#include "src/mca/ptl/base/base.h" -#include "ptl_usock.h" - -static pmix_status_t init(void); -static void finalize(void); -static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, - pmix_info_t *info, size_t ninfo); -static pmix_status_t send_recv(struct pmix_peer_t *peer, - pmix_buffer_t *bfr, - pmix_ptl_cbfunc_t cbfunc, - void *cbdata); -static pmix_status_t send_oneway(struct pmix_peer_t *peer, - pmix_buffer_t *bfr, - pmix_ptl_tag_t tag); - -pmix_ptl_module_t pmix_ptl_usock_module = { - .init = init, - .finalize = finalize, - .send_recv = send_recv, - .send = send_oneway, - .connect_to_peer = connect_to_peer -}; - -static pmix_status_t recv_connect_ack(int sd); -static pmix_status_t send_connect_ack(int sd); - -static pmix_status_t init(void) -{ - return PMIX_SUCCESS; -} - -static void finalize(void) -{ -} - -static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, - pmix_info_t *info, size_t ninfo) -{ - struct sockaddr_un *address; - char *evar, **uri; - pmix_status_t rc; - int sd; - pmix_socklen_t len; - - /* if we are not a client, there is nothing we can do */ - if (!PMIX_PROC_IS_CLIENT) { - return PMIX_ERR_NOT_SUPPORTED; - } - - /* if we don't have a path to the daemon rendezvous point, - * then we need to return an error */ - if (NULL == (evar = getenv("PMIX_SERVER_URI"))) { - /* let the caller know that the server isn't available */ - return PMIX_ERR_SERVER_NOT_AVAIL; - } - uri = pmix_argv_split(evar, ':'); - if (3 != pmix_argv_count(uri)) { - pmix_argv_free(uri); - return PMIX_ERROR; - } - - /* set the server nspace */ - pmix_client_globals.myserver->info = PMIX_NEW(pmix_rank_info_t); - pmix_client_globals.myserver->info->nptr = PMIX_NEW(pmix_nspace_t); - (void)strncpy(pmix_client_globals.myserver->info->nptr->nspace, uri[0], PMIX_MAX_NSLEN); - - /* set the server rank */ - pmix_client_globals.myserver->info->rank = strtoull(uri[1], NULL, 10); - - /* setup the path to the daemon rendezvous point */ - memset(&mca_ptl_usock_component.connection, 0, sizeof(struct sockaddr_storage)); - address = (struct sockaddr_un*)&mca_ptl_usock_component.connection; - address->sun_family = AF_UNIX; - snprintf(address->sun_path, sizeof(address->sun_path)-1, "%s", uri[2]); - /* if the rendezvous file doesn't exist, that's an error */ - if (0 != access(uri[2], R_OK)) { - pmix_argv_free(uri); - return PMIX_ERR_NOT_FOUND; - } - pmix_argv_free(uri); - - /* establish the connection */ - len = sizeof(struct sockaddr_un); - if (PMIX_SUCCESS != (rc = pmix_ptl_base_connect(&mca_ptl_usock_component.connection, len, &sd))) { - PMIX_ERROR_LOG(rc); - return rc; - } - pmix_client_globals.myserver->sd = sd; - - /* send our identity and any authentication credentials to the server */ - if (PMIX_SUCCESS != (rc = send_connect_ack(sd))) { - CLOSE_THE_SOCKET(sd); - return rc; - } - - /* do whatever handshake is required */ - if (PMIX_SUCCESS != (rc = recv_connect_ack(sd))) { - CLOSE_THE_SOCKET(sd); - return rc; - } - - pmix_output_verbose(2, pmix_globals.debug_output, - "sock_peer_try_connect: Connection across to server succeeded"); - - /* mark the connection as made */ - pmix_globals.connected = true; - - pmix_ptl_base_set_nonblocking(sd); - - /* setup recv event */ - pmix_event_assign(&pmix_client_globals.myserver->recv_event, - pmix_globals.evbase, - pmix_client_globals.myserver->sd, - EV_READ | EV_PERSIST, - pmix_ptl_base_recv_handler, &pmix_client_globals.myserver); - pmix_event_add(&pmix_client_globals.myserver->recv_event, 0); - pmix_client_globals.myserver->recv_ev_active = true; - - /* setup send event */ - pmix_event_assign(&pmix_client_globals.myserver->send_event, - pmix_globals.evbase, - pmix_client_globals.myserver->sd, - EV_WRITE|EV_PERSIST, - pmix_ptl_base_send_handler, &pmix_client_globals.myserver); - pmix_client_globals.myserver->send_ev_active = false; - - return PMIX_SUCCESS; -} - -static pmix_status_t send_recv(struct pmix_peer_t *peer, - pmix_buffer_t *bfr, - pmix_ptl_cbfunc_t cbfunc, - void *cbdata) -{ - pmix_ptl_sr_t *ms; - - pmix_output_verbose(5, pmix_globals.debug_output, - "[%s:%d] post send to server", - __FILE__, __LINE__); - - ms = PMIX_NEW(pmix_ptl_sr_t); - ms->peer = peer; - ms->bfr = bfr; - ms->cbfunc = cbfunc; - ms->cbdata = cbdata; - PMIX_THREADSHIFT(ms, pmix_ptl_base_send_recv); - return PMIX_SUCCESS; -} - -static pmix_status_t send_oneway(struct pmix_peer_t *peer, - pmix_buffer_t *bfr, - pmix_ptl_tag_t tag) -{ - pmix_ptl_queue_t *q; - pmix_peer_t *pr = (pmix_peer_t*)peer; - - /* we have to transfer this to an event for thread - * safety as we need to post this message on the - * peer's send queue */ - q = PMIX_NEW(pmix_ptl_queue_t); - PMIX_RETAIN(pr); - q->peer = peer; - q->buf = bfr; - q->tag = tag; - PMIX_THREADSHIFT(q, pmix_ptl_base_send); - - return PMIX_SUCCESS; -} - -static pmix_status_t send_connect_ack(int sd) -{ - char *msg; - pmix_usock_hdr_t hdr; - size_t sdsize=0, csize=0, len; - char *cred = NULL; - pmix_status_t rc; - - pmix_output_verbose(2, pmix_globals.debug_output, - "pmix: SEND CONNECT ACK"); - - /* setup the header */ - memset(&hdr, 0, sizeof(pmix_usock_hdr_t)); - hdr.pindex = -1; - hdr.tag = UINT32_MAX; - - /* reserve space for the nspace and rank info */ - sdsize = strlen(pmix_globals.myid.nspace) + 1 + sizeof(int); - - /* get a credential, if the security system provides one. Not - * every SPC will do so, thus we must first check */ - if (PMIX_SUCCESS != (rc = pmix_psec.create_cred(pmix_client_globals.myserver, - PMIX_PROTOCOL_V1, &cred, &len))) { - return rc; - } - - /* set the number of bytes to be read beyond the header */ - hdr.nbytes = sdsize + strlen(PMIX_VERSION) + 1 + len; // must NULL terminate the VERSION string! - - /* create a space for our message */ - sdsize = (sizeof(hdr) + hdr.nbytes); - if (NULL == (msg = (char*)malloc(sdsize))) { - if (NULL != cred) { - free(cred); - } - return PMIX_ERR_OUT_OF_RESOURCE; - } - memset(msg, 0, sdsize); - - /* load the message */ - csize=0; - memcpy(msg, &hdr, sizeof(pmix_usock_hdr_t)); - csize += sizeof(pmix_usock_hdr_t); - memcpy(msg+csize, pmix_globals.myid.nspace, strlen(pmix_globals.myid.nspace)); - csize += strlen(pmix_globals.myid.nspace)+1; - memcpy(msg+csize, &pmix_globals.myid.rank, sizeof(int)); - csize += sizeof(int); - memcpy(msg+csize, PMIX_VERSION, strlen(PMIX_VERSION)); - csize += strlen(PMIX_VERSION)+1; - if (NULL != cred) { - memcpy(msg+csize, cred, strlen(cred)); // leaves last position in msg set to NULL - } - - if (PMIX_SUCCESS != pmix_ptl_base_send_blocking(sd, msg, sdsize)) { - free(msg); - if (NULL != cred) { - free(cred); - } - return PMIX_ERR_UNREACH; - } - free(msg); - if (NULL != cred) { - free(cred); - } - return PMIX_SUCCESS; -} - -/* we receive a connection acknowledgement from the server, - * consisting of nothing more than a status report. If success, - * then we initiate authentication method */ -static pmix_status_t recv_connect_ack(int sd) -{ - pmix_status_t reply; - pmix_status_t rc; - struct timeval tv, save; - pmix_socklen_t sz; - bool sockopt = true; - pmix_output_verbose(2, pmix_globals.debug_output, - "pmix: RECV CONNECT ACK FROM SERVER"); - - /* get the current timeout value so we can reset to it */ - sz = sizeof(save); - if (0 != getsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (void*)&save, &sz)) { - if (ENOPROTOOPT == errno) { - sockopt = false; - } else { - return PMIX_ERR_UNREACH; - } - } else { - /* set a timeout on the blocking recv so we don't hang */ - tv.tv_sec = 2; - tv.tv_usec = 0; - if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv))) { - pmix_output_verbose(2, pmix_globals.debug_output, - "pmix: recv_connect_ack could not setsockopt SO_RCVTIMEO"); - return PMIX_ERR_UNREACH; - } - } - - /* receive the status reply */ - rc = pmix_ptl_base_recv_blocking(sd, (char*)&reply, sizeof(int)); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - return rc; - } - - /* see if they want us to do the handshake */ - if (PMIX_ERR_READY_FOR_HANDSHAKE == reply) { - if (PMIX_SUCCESS != (rc = pmix_psec.client_handshake(pmix_client_globals.myserver, sd))) { - return rc; - } - } else if (PMIX_SUCCESS != reply) { - return reply; - } - - pmix_output_verbose(2, pmix_globals.debug_output, - "pmix: RECV CONNECT CONFIRMATION"); - - /* receive our index into the server's client array */ - rc = pmix_ptl_base_recv_blocking(sd, (char*)&pmix_globals.pindex, sizeof(int)); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - return rc; - } - if (sockopt) { - /* return the socket to normal */ - if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &save, sz)) { - return PMIX_ERR_UNREACH; - } - } - - return PMIX_SUCCESS; -} diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock.h b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock.h deleted file mode 100644 index 358b23ab37f..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_PTL_USOCK_H -#define PMIX_PTL_USOCK_H - -#include "src/mca/ptl/ptl.h" - -BEGIN_C_DECLS - -typedef struct { - pmix_ptl_base_component_t super; - char *tmpdir; - struct sockaddr_storage connection; - char *filename; -} pmix_ptl_usock_component_t; - -/* header for messages */ -typedef struct { - int pindex; - uint32_t tag; - size_t nbytes; -} pmix_usock_hdr_t; - -extern pmix_ptl_usock_component_t mca_ptl_usock_component; - -extern pmix_ptl_module_t pmix_ptl_usock_module; - -END_C_DECLS - -#endif /* PMIX_PTL_USOCK_H */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock_component.c b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock_component.c deleted file mode 100644 index 8f363be4272..00000000000 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/usock/ptl_usock_component.c +++ /dev/null @@ -1,630 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennptlee and The University - * of Tennptlee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - * These symbols are in a file by themselves to provide nice linker - * semantics. Since linkers generally pull in symbols by object - * files, keeping these symbols as the only symbols in this file - * prevents utility programs such as "ompi_info" from having to import - * entire components just to query their version and parameters. - */ - -#include -#include - -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_SYS_UN_H -#include -#endif -#ifdef HAVE_SYS_UIO_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#include - -#include "src/util/argv.h" -#include "src/util/error.h" -#include "src/util/fd.h" -#include "src/util/show_help.h" -#include "src/util/strnlen.h" -#include "src/mca/psec/psec.h" -#include "src/server/pmix_server_ops.h" - -#include "src/mca/ptl/base/base.h" -#include "src/mca/ptl/usock/ptl_usock.h" - -static pmix_status_t component_open(void); -static pmix_status_t component_close(void); -static int component_query(pmix_mca_base_module_t **module, int *priority); -static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, - bool *need_listener); - -/* - * Instantiate the public struct with all of our public information - * and pointers to our public functions in it - */ -PMIX_EXPORT pmix_ptl_usock_component_t mca_ptl_usock_component = { - .super = { - .base = { - PMIX_PTL_BASE_VERSION_1_0_0, - - /* Component name and version */ - .pmix_mca_component_name = "usock", - 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 - }, - .priority = 15, - .uri = NULL, - .setup_listener = setup_listener - }, - .tmpdir = NULL, - .filename = NULL -}; - -static void connection_handler(int sd, short args, void *cbdata); -static void listener_cb(int incoming_sd, void *cbdata); -static char *sec_mode = NULL; - -pmix_status_t component_open(void) -{ - char *tdir; - - memset(&mca_ptl_usock_component.connection, 0, sizeof(mca_ptl_usock_component.connection)); - - /* check for environ-based directives - * on system tmpdir to use */ - if (NULL == (tdir = getenv("PMIX_SYSTEM_TMPDIR"))) { - if (NULL == (tdir = getenv("TMPDIR"))) { - if (NULL == (tdir = getenv("TEMP"))) { - if (NULL == (tdir = getenv("TMP"))) { - tdir = "/tmp"; - } - } - } - } - if (NULL != tdir) { - mca_ptl_usock_component.tmpdir = strdup(tdir); - } - - return PMIX_SUCCESS; -} - - -pmix_status_t component_close(void) -{ - if (NULL != sec_mode) { - free(sec_mode); - } - if (NULL != mca_ptl_usock_component.tmpdir) { - free(mca_ptl_usock_component.tmpdir); - } - if (NULL != mca_ptl_usock_component.super.uri) { - free(mca_ptl_usock_component.super.uri); - } - if (NULL != mca_ptl_usock_component.filename) { - /* remove the file */ - unlink(mca_ptl_usock_component.filename); - free(mca_ptl_usock_component.filename); - } - - return PMIX_SUCCESS; -} - -static int component_query(pmix_mca_base_module_t **module, int *priority) -{ - *module = (pmix_mca_base_module_t*)&pmix_ptl_usock_module; - return PMIX_SUCCESS; -} - -/* if we are the server, then we need to setup a usock rendezvous - * point for legacy releases, but only do so if requested as some - * systems may not wish to support older releases. The system can, - * of course, simply use the MCA param method to disable this - * component (PMIX_MCA_ptl=^usock), or can tell us to disqualify - * ourselves using an info key to this API. - * - * NOTE: we accept MCA parameters, but info keys override them - */ -static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, - bool *need_listener) -{ - int flags; - size_t n; - pmix_listener_t *lt; - pmix_status_t rc; - socklen_t addrlen; - struct sockaddr_un *address; - bool disabled = false; - char *secmods, **options, *pmix_pid; - pid_t mypid; - - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:usock setup_listener"); - - /* if we are not a server, then we shouldn't be doing this */ - if (PMIX_PROC_SERVER != pmix_globals.proc_type) { - return PMIX_ERR_NOT_SUPPORTED; - } - - /* scan the info keys and process any override instructions */ - if (NULL != info) { - for (n=0; n < ninfo; n++) { - if (0 == strcmp(info[n].key, PMIX_USOCK_DISABLE)) { - if (PMIX_UNDEF == info[n].value.type) { - disabled = true;; - } else { - disabled = info[n].value.data.flag; - } - break; - } - } - } - - /* see if we have been disabled */ - if (disabled) { - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:usock not available"); - return PMIX_ERR_NOT_AVAILABLE; - } - - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:usock setting up listener"); - - addrlen = sizeof(struct sockaddr_un); - address = (struct sockaddr_un*)&mca_ptl_usock_component.connection; - address->sun_family = AF_UNIX; - - /* any client we hear from will be using v1.x protocols. This - * means that they cannot tell us what security module they - * are using as this wasn't included in their handshake. So - * the best we can assume is that they are using the highest - * priority default we have */ - secmods = pmix_psec.get_available_modules(); - options = pmix_argv_split(secmods, ','); - sec_mode = strdup(options[0]); - pmix_argv_free(options); - free(secmods); - - /* define the listener */ - lt = PMIX_NEW(pmix_listener_t); - - /* for now, just setup the v1.1 series rendezvous point - * we use the pid to reduce collisions */ - mypid = getpid(); - if (0 > asprintf(&pmix_pid, "%s/pmix-%d", mca_ptl_usock_component.tmpdir, mypid)) { - PMIX_RELEASE(lt); - return PMIX_ERR_NOMEM; - } - if ((strlen(pmix_pid) + 1) > sizeof(address->sun_path)-1) { - pmix_show_help("help-pmix-server.txt", "rnd-path-too-long", true, - mca_ptl_usock_component.tmpdir, pmix_pid); - free(pmix_pid); - PMIX_RELEASE(lt); - return PMIX_ERR_INVALID_LENGTH; - } - snprintf(address->sun_path, sizeof(address->sun_path)-1, "%s", pmix_pid); - free(pmix_pid); - /* set the URI */ - lt->varname = strdup("PMIX_SERVER_URI"); - if (0 > asprintf(<->uri, "%s:%lu:%s", pmix_globals.myid.nspace, - (unsigned long)pmix_globals.myid.rank, address->sun_path)) { - PMIX_RELEASE(lt); - return PMIX_ERR_NOMEM; - } - /* save the rendezvous filename for later removal */ - mca_ptl_usock_component.filename = strdup(address->sun_path); - - lt->protocol = PMIX_PROTOCOL_V1; - lt->ptl = (struct pmix_ptl_module_t*)&pmix_ptl_usock_module; - lt->cbfunc = connection_handler; - pmix_list_append(&pmix_ptl_globals.listeners, <->super); - - /* create a listen socket for incoming connection attempts */ - lt->socket = socket(PF_UNIX, SOCK_STREAM, 0); - if (lt->socket < 0) { - printf("%s:%d socket() failed\n", __FILE__, __LINE__); - goto sockerror; - } - /* Set the socket to close-on-exec so that no children inherit - * this FD */ - if (pmix_fd_set_cloexec(lt->socket) != PMIX_SUCCESS) { - CLOSE_THE_SOCKET(lt->socket); - goto sockerror; - } - - if (bind(lt->socket, (struct sockaddr*)address, addrlen) < 0) { - printf("%s:%d bind() failed\n", __FILE__, __LINE__); - CLOSE_THE_SOCKET(lt->socket); - goto sockerror; - } - /* chown as required */ - if (lt->owner_given) { - if (0 != chown(address->sun_path, lt->owner, -1)) { - pmix_output(0, "CANNOT CHOWN socket %s: %s", address->sun_path, strerror (errno)); - CLOSE_THE_SOCKET(lt->socket); - goto sockerror; - } - } - if (lt->group_given) { - if (0 != chown(address->sun_path, -1, lt->group)) { - pmix_output(0, "CANNOT CHOWN socket %s: %s", address->sun_path, strerror (errno)); - CLOSE_THE_SOCKET(lt->socket); - goto sockerror; - } - } - /* set the mode as required */ - if (0 != chmod(address->sun_path, lt->mode)) { - pmix_output(0, "CANNOT CHMOD socket %s: %s", address->sun_path, strerror (errno)); - CLOSE_THE_SOCKET(lt->socket); - goto sockerror; - } - - /* setup listen backlog to maximum allowed by kernel */ - if (listen(lt->socket, SOMAXCONN) < 0) { - printf("%s:%d listen() failed\n", __FILE__, __LINE__); - CLOSE_THE_SOCKET(lt->socket); - goto sockerror; - } - - /* set socket up to be non-blocking, otherwise accept could block */ - if ((flags = fcntl(lt->socket, F_GETFL, 0)) < 0) { - printf("%s:%d fcntl(F_GETFL) failed\n", __FILE__, __LINE__); - CLOSE_THE_SOCKET(lt->socket); - goto sockerror; - } - flags |= O_NONBLOCK; - if (fcntl(lt->socket, F_SETFL, flags) < 0) { - printf("%s:%d fcntl(F_SETFL) failed\n", __FILE__, __LINE__); - CLOSE_THE_SOCKET(lt->socket); - goto sockerror; - } - - /* if the server will listen for us, then ask it to do so now */ - rc = PMIX_ERR_NOT_SUPPORTED; - if (NULL != pmix_host_server.listener) { - rc = pmix_host_server.listener(lt->socket, listener_cb, (void*)lt); - } - - if (PMIX_SUCCESS != rc) { - *need_listener = true; - } - - return PMIX_SUCCESS; - - sockerror: - pmix_list_remove_item(&pmix_ptl_globals.listeners, <->super); - PMIX_RELEASE(lt); - return PMIX_ERROR; -} - -static void listener_cb(int incoming_sd, void *cbdata) -{ - pmix_pending_connection_t *pending_connection; - - /* throw it into our event library for processing */ - pmix_output_verbose(8, pmix_ptl_base_framework.framework_output, - "listen_cb: pushing new connection %d into evbase", - incoming_sd); - pending_connection = PMIX_NEW(pmix_pending_connection_t); - pending_connection->sd = incoming_sd; - pmix_event_assign(&pending_connection->ev, pmix_globals.evbase, -1, - EV_WRITE, connection_handler, pending_connection); - pmix_event_active(&pending_connection->ev, EV_WRITE, 1); -} - -/* Parse init-ack message: - * NSPACE<0>VERSION<0>[CRED<0>] - */ -static pmix_status_t parse_connect_ack (char *msg, unsigned int len, - char **nspace, unsigned int *rank, - char **version, char **cred) -{ - unsigned int msglen; - - PMIX_STRNLEN(msglen, msg, len); - if (msglen < len) { - *nspace = msg; - msg += strlen(*nspace) + 1; - len -= strlen(*nspace) + 1; - } else { - return PMIX_ERR_BAD_PARAM; - } - - PMIX_STRNLEN(msglen, msg, len); - if (msglen <= len) { - memcpy(rank, msg, sizeof(int)); - msg += sizeof(int); - len -= sizeof(int); - } else { - return PMIX_ERR_BAD_PARAM; - } - - PMIX_STRNLEN(msglen, msg, len); - if (msglen < len) { - *version = msg; - msg += strlen(*version) + 1; - len -= strlen(*version) + 1; - } else { - return PMIX_ERR_BAD_PARAM; - } - - PMIX_STRNLEN(msglen, msg, len); - if (msglen < len) - *cred = msg; - else { - *cred = NULL; - } - - return PMIX_SUCCESS; -} - - -static void connection_handler(int sd, short args, void *cbdata) -{ - pmix_pending_connection_t *pnd = (pmix_pending_connection_t*)cbdata; - char *msg, *nspace, *version, *cred; - pmix_status_t rc; - unsigned int rank; - pmix_usock_hdr_t hdr; - pmix_nspace_t *nptr, *tmp; - pmix_rank_info_t *info; - pmix_peer_t *psave = NULL; - bool found; - pmix_proc_t proc; - size_t len; - - /* acquire the object */ - PMIX_ACQUIRE_OBJECT(pnd); - - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "USOCK CONNECTION FROM PEER ON SOCKET %d", pnd->sd); - - /* ensure all is zero'd */ - memset(&hdr, 0, sizeof(pmix_usock_hdr_t)); - - /* get the header */ - if (PMIX_SUCCESS != (rc = pmix_ptl_base_recv_blocking(pnd->sd, (char*)&hdr, sizeof(pmix_usock_hdr_t)))) { - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - return; - } - - /* get the id, authentication and version payload (and possibly - * security credential) - to guard against potential attacks, - * we'll set an arbitrary limit per a define */ - if (PMIX_MAX_CRED_SIZE < hdr.nbytes) { - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - return; - } - if (NULL == (msg = (char*)malloc(hdr.nbytes))) { - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - return; - } - if (PMIX_SUCCESS != pmix_ptl_base_recv_blocking(pnd->sd, msg, hdr.nbytes)) { - /* unable to complete the recv */ - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "unable to complete recv of connect-ack with client ON SOCKET %d", pnd->sd); - free(msg); - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - return; - } - - if (PMIX_SUCCESS != (rc = parse_connect_ack (msg, hdr.nbytes, &nspace, - &rank, &version, &cred))) { - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "error parsing connect-ack from client ON SOCKET %d", pnd->sd); - free(msg); - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - return; - } - - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "connect-ack recvd from peer %s:%d:%s on socket %d", - nspace, rank, version, pnd->sd); - - /* do not check the version - we only retain it at this - * time in case we need to check it at some future date. - * For now, our intent is to retain backward compatibility - * and so we will assume that all versions are compatible. */ - - /* see if we know this nspace */ - nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_globals.nspaces, pmix_nspace_t) { - if (0 == strcmp(tmp->nspace, nspace)) { - nptr = tmp; - break; - } - } - 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; - } - - /* see if we have this peer in our list */ - info = NULL; - found = false; - PMIX_LIST_FOREACH(info, &nptr->server->ranks, pmix_rank_info_t) { - if (info->rank == rank) { - found = true; - break; - } - } - if (!found) { - /* rank unknown, reject it */ - free(msg); - /* send an error reply to the client */ - rc = PMIX_ERR_NOT_FOUND; - goto error; - } - /* a peer can connect on multiple sockets since it can fork/exec - * a child that also calls PMIx_Init, so add it here if necessary. - * Create the tracker for this peer */ - psave = PMIX_NEW(pmix_peer_t); - if (NULL == psave) { - free(msg); - rc = PMIX_ERR_NOMEM; - goto error; - } - PMIX_RETAIN(info); - psave->info = info; - info->proc_cnt++; /* increase number of processes on this rank */ - psave->sd = pnd->sd; - if (0 > (psave->index = pmix_pointer_array_add(&pmix_server_globals.clients, psave))) { - free(msg); - info->proc_cnt--; - PMIX_RELEASE(info); - PMIX_RELEASE(psave); - /* probably cannot send an error reply if we are out of memory */ - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - return; - } - - /* get the appropriate compatibility modules */ - if (PMIX_SUCCESS != pmix_psec.assign_module((struct pmix_peer_t*)psave, sec_mode)) { - free(msg); - info->proc_cnt--; - PMIX_RELEASE(info); - PMIX_RELEASE(psave); - pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL); - /* send an error reply to the client */ - goto error; - } - /* the choice of PTL module was obviously made by the connecting - * tool as we received this request via that channel, so simply - * record it here for future use */ - psave->compat.ptl = &pmix_ptl_usock_module; - - /* validate the connection */ - if (NULL == cred) { - len = 0; - } else { - len = strlen(cred); - } - if (PMIX_SUCCESS != (rc = pmix_psec.validate_connection((struct pmix_peer_t*)psave, - PMIX_PROTOCOL_V1, cred, len))) { - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "validation of client credentials failed: %s", - PMIx_Error_string(rc)); - free(msg); - info->proc_cnt--; - PMIX_RELEASE(info); - PMIX_RELEASE(psave); - pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL); - /* send an error reply to the client */ - goto error; - } - free(msg); - - /* send them success */ - rc = PMIX_SUCCESS; - if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&rc, sizeof(int)))) { - 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); - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - 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); - info->proc_cnt--; - PMIX_RELEASE(info); - pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL); - PMIX_RELEASE(psave); - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - return; - } - - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "connect-ack from client completed"); - - /* let the host server know that this client has connected */ - if (NULL != pmix_host_server.client_connected) { - (void)strncpy(proc.nspace, psave->info->nptr->nspace, PMIX_MAX_NSLEN); - proc.rank = psave->info->rank; - rc = pmix_host_server.client_connected(&proc, psave->info->server_object, NULL, NULL); - if (PMIX_SUCCESS != rc) { - 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); - CLOSE_THE_SOCKET(pnd->sd); - } - } - - /* start the events for this client */ - pmix_event_assign(&psave->recv_event, pmix_globals.evbase, pnd->sd, - EV_READ|EV_PERSIST, pmix_ptl_base_recv_handler, psave); - pmix_event_add(&psave->recv_event, NULL); - psave->recv_ev_active = true; - pmix_event_assign(&psave->send_event, pmix_globals.evbase, pnd->sd, - EV_WRITE|EV_PERSIST, pmix_ptl_base_send_handler, psave); - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "pmix:server client %s:%u has connected on socket %d", - psave->info->nptr->nspace, psave->info->rank, psave->sd); - - PMIX_RELEASE(pnd); - return; - - error: - /* send an error reply to the client */ - if (PMIX_SUCCESS != pmix_ptl_base_send_blocking(pnd->sd, (char*)&rc, sizeof(int))) { - PMIX_ERROR_LOG(rc); - } - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - return; -} diff --git a/opal/mca/pmix/pmix2x/pmix/src/runtime/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/runtime/Makefile.include index 9c1c170dab3..3e4e3c0b056 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/runtime/Makefile.include +++ b/opal/mca/pmix/pmix2x/pmix/src/runtime/Makefile.include @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, LLC. # All rights reserved. -# Copyright (c) 2014-2016 Intel, Inc. All rights reserved +# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. # Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # @@ -29,7 +29,7 @@ headers += \ runtime/pmix_rte.h \ runtime/pmix_progress_threads.h -libpmix_la_SOURCES += \ +sources += \ runtime/pmix_finalize.c \ runtime/pmix_init.c \ runtime/pmix_params.c \ diff --git a/opal/mca/pmix/pmix2x/pmix/src/runtime/help-pmix-runtime.txt b/opal/mca/pmix/pmix2x/pmix/src/runtime/help-pmix-runtime.txt index 3f78275d446..49275475a09 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/runtime/help-pmix-runtime.txt +++ b/opal/mca/pmix/pmix2x/pmix/src/runtime/help-pmix-runtime.txt @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. # Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -40,3 +40,13 @@ a fatal situation, but may negatively impact your launch performance. If you feel you have received this warning in error, or wish to ignore it in the future, you can disable it by setting the PMIx MCA parameter "pmix_suppress_missing_data_warning=1" +# +[ptl:message-too-large] +A message has been received that exceeds the size limit: + + Message size: %lu + Size limit: %lu + +The limit is enforced to protect against bad actors. If you believe that +the message was likely legitimate, then adjust the message size by +setting the ptl_base_max_msg_size MCA parameter. diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c index ca22d7c708d..cf4c564b014 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c @@ -1,13 +1,13 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -1156,11 +1156,19 @@ static void _store_internal(int sd, short args, void *cbdata) } } if (NULL == ns) { - /* shouldn't be possible */ - cd->status = PMIX_ERR_NOT_FOUND; - } else { - cd->status = pmix_hash_store(&ns->internal, cd->rank, cd->kv); + /* we may not know this nspace, but we can create it */ + ns = PMIX_NEW(pmix_nspace_t); + if (NULL == ns) { + cd->status = PMIX_ERR_NOMEM; + } else { + (void)strncpy(ns->nspace, cd->nspace, PMIX_MAX_NSLEN); + /* add the server object */ + ns->server = PMIX_NEW(pmix_server_nspace_t); + pmix_list_append(&pmix_globals.nspaces, &ns->super); + } } + cd->status = pmix_hash_store(&ns->internal, cd->rank, cd->kv); + if (cd->lock.active) { PMIX_WAKEUP_THREAD(&cd->lock); } @@ -1243,7 +1251,6 @@ PMIX_EXPORT pmix_status_t PMIx_generate_regex(const char *input, char **regexp) len = strlen(vptr); startnum = -1; memset(prefix, 0, PMIX_MAX_NODE_PREFIX); - numdigits = 0; for (i=0, j=0; i < len; i++) { if (!isalpha(vptr[i])) { /* found a non-alpha char */ @@ -1257,7 +1264,6 @@ PMIX_EXPORT pmix_status_t PMIx_generate_regex(const char *input, char **regexp) /* count the size of the numeric field - but don't * add the digits to the prefix */ - numdigits++; if (startnum < 0) { /* okay, this defines end of the prefix */ startnum = i; @@ -1284,8 +1290,10 @@ PMIX_EXPORT pmix_status_t PMIx_generate_regex(const char *input, char **regexp) vnum = strtol(&vptr[startnum], &sfx, 10); if (NULL != sfx) { suffix = strdup(sfx); + numdigits = (int)(sfx - &vptr[startnum]); } else { suffix = NULL; + numdigits = (int)strlen(&vptr[startnum]); } /* is this value already on our list? */ found = false; diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c index ab1915a4a06..1a24126908e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c @@ -7,7 +7,7 @@ * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -218,11 +218,12 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, /* if the rank is wildcard, then they are asking for the job-level * info for this nspace - provide it */ if (PMIX_RANK_WILDCARD == rank) { + pmix_buffer_t *bptr = &nptr->server->job_info; PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); pmix_bfrop.pack(&pbkt, &rank, 1, PMIX_PROC_RANK); /* the client is expecting this to arrive as a byte object * containing a buffer, so package it accordingly */ - pmix_bfrop.pack(&pbkt, &nptr->server->job_info, 1, PMIX_BUFFER); + pmix_bfrop.pack(&pbkt, &bptr, 1, PMIX_BUFFER); PMIX_UNLOAD_BUFFER(&pbkt, data, sz); PMIX_DESTRUCT(&pbkt); cbfunc(PMIX_SUCCESS, data, sz, cbdata, relfn, data); diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c index 5826c4b8870..2b38b175d21 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . @@ -824,37 +824,61 @@ pmix_status_t pmix_server_unpublish(pmix_peer_t *peer, return rc; } +static void spcbfunc(pmix_status_t status, + char nspace[], void *cbdata) +{ + pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; + + /* cleanup the caddy */ + if (NULL != cd->info) { + PMIX_INFO_FREE(cd->info, cd->ninfo); + } + if (NULL != cd->apps) { + PMIX_APP_CREATE(cd->apps, cd->napps); + } + if (NULL != cd->spcbfunc) { + cd->spcbfunc(status, nspace, cd->cbdata); + } + PMIX_RELEASE(cd); +} + pmix_status_t pmix_server_spawn(pmix_peer_t *peer, pmix_buffer_t *buf, pmix_spawn_cbfunc_t cbfunc, void *cbdata) { + pmix_setup_caddy_t *cd; int32_t cnt; - size_t napps, ninfo; - pmix_info_t *info=NULL; - pmix_app_t *apps=NULL; pmix_status_t rc; pmix_proc_t proc; pmix_output_verbose(2, pmix_globals.debug_output, - "recvd SPAWN"); + "PMIX SERVER recvd SPAWN"); if (NULL == pmix_host_server.spawn) { PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); return PMIX_ERR_NOT_SUPPORTED; } + /* setup */ + cd = PMIX_NEW(pmix_setup_caddy_t); + if (NULL == cd) { + return PMIX_ERR_NOMEM; + } + cd->spcbfunc = cbfunc; + cd->cbdata = cbdata; + /* unpack the number of job-level directives */ cnt=1; - if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ninfo, &cnt, PMIX_SIZE))) { + if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &cd->ninfo, &cnt, PMIX_SIZE))) { PMIX_ERROR_LOG(rc); return rc; } /* unpack the array of directives */ - if (0 < ninfo) { - PMIX_INFO_CREATE(info, ninfo); - cnt=ninfo; - if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, info, &cnt, PMIX_INFO))) { + if (0 < cd->ninfo) { + PMIX_INFO_CREATE(cd->info, cd->ninfo); + cnt = cd->ninfo; + if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, cd->info, &cnt, PMIX_INFO))) { PMIX_ERROR_LOG(rc); goto cleanup; } @@ -862,15 +886,19 @@ pmix_status_t pmix_server_spawn(pmix_peer_t *peer, /* unpack the number of apps */ cnt=1; - if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &napps, &cnt, PMIX_SIZE))) { + if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &cd->napps, &cnt, PMIX_SIZE))) { PMIX_ERROR_LOG(rc); - return rc; + goto cleanup; } /* unpack the array of apps */ - if (0 < napps) { - PMIX_APP_CREATE(apps, napps); - cnt=napps; - if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, apps, &cnt, PMIX_APP))) { + if (0 < cd->napps) { + PMIX_APP_CREATE(cd->apps, cd->napps); + if (NULL == cd->apps) { + rc = PMIX_ERR_NOMEM; + goto cleanup; + } + cnt = cd->napps; + if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, cd->apps, &cnt, PMIX_APP))) { PMIX_ERROR_LOG(rc); goto cleanup; } @@ -878,14 +906,17 @@ pmix_status_t pmix_server_spawn(pmix_peer_t *peer, /* call the local server */ (void)strncpy(proc.nspace, peer->info->nptr->nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->rank; - rc = pmix_host_server.spawn(&proc, info, ninfo, apps, napps, cbfunc, cbdata); + rc = pmix_host_server.spawn(&proc, cd->info, cd->ninfo, cd->apps, cd->napps, spcbfunc, cd); - cleanup: - if (NULL != info) { - PMIX_INFO_FREE(info, ninfo); - } - if (NULL != apps) { - PMIX_APP_FREE(apps, napps); + cleanup: + if (PMIX_SUCCESS != rc) { + if (NULL != cd->info) { + PMIX_INFO_FREE(cd->info, cd->ninfo); + } + if (NULL != cd->apps) { + PMIX_APP_FREE(cd->apps, cd->napps); + } + PMIX_RELEASE(cd); } return rc; } @@ -1732,9 +1763,12 @@ static void scadcon(pmix_setup_caddy_t *p) p->nlocalprocs = 0; p->info = NULL; p->ninfo = 0; + p->apps = NULL; + p->napps = 0; p->cbfunc = NULL; p->opcbfunc = NULL; p->setupcbfunc = NULL; + p->spcbfunc = NULL; p->cbdata = NULL; } static void scaddes(pmix_setup_caddy_t *p) diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.h b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.h index dac731d2242..655219d6030 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.h +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.h @@ -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-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. @@ -42,9 +42,12 @@ typedef struct { int nlocalprocs; pmix_info_t *info; size_t ninfo; + pmix_app_t *apps; + size_t napps; pmix_op_cbfunc_t opcbfunc; pmix_dmodex_response_fn_t cbfunc; pmix_setup_application_cbfunc_t setupcbfunc; + pmix_spawn_cbfunc_t spcbfunc; void *cbdata; } pmix_setup_caddy_t; PMIX_CLASS_DECLARATION(pmix_setup_caddy_t); diff --git a/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c index 157cf4d0412..495370d260e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c +++ b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c @@ -3,7 +3,6 @@ * All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/threads/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/threads/Makefile.include index d0d41f1c577..8e1562dd658 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/threads/Makefile.include +++ b/opal/mca/pmix/pmix2x/pmix/src/threads/Makefile.include @@ -32,7 +32,7 @@ headers += \ threads/wait_sync.h \ threads/thread_usage.h -libpmix_la_SOURCES += \ +sources += \ threads/mutex.c \ threads/thread.c \ threads/wait_sync.c diff --git a/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c index 196938a62bb..32aed913611 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c @@ -1,13 +1,13 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -95,7 +95,17 @@ static void pmix_tool_notify_recv(struct pmix_peer_t *peer, pmix_output_verbose(2, pmix_globals.debug_output, "pmix:tool_notify_recv - processing event"); - /* start the local notification chain */ + if (NULL == buf) { + return; + } + + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + return; + } + + /* start the local notification chain */ chain = PMIX_NEW(pmix_event_chain_t); chain->final_cbfunc = _notify_complete; chain->final_cbdata = chain; @@ -155,7 +165,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, { pmix_kval_t *kptr; pmix_status_t rc; - pmix_nspace_t *nptr, *nsptr; + pmix_nspace_t *nsptr; char hostname[PMIX_MAX_NSLEN]; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -223,21 +233,15 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, (void)strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); proc->rank = pmix_globals.myid.rank; + nsptr = PMIX_NEW(pmix_nspace_t); + (void)strncpy(nsptr->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + nsptr->server = PMIX_NEW(pmix_server_nspace_t); + pmix_list_append(&pmix_globals.nspaces, &nsptr->super); + /* 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 */ - nsptr = NULL; - PMIX_LIST_FOREACH(nptr, &pmix_globals.nspaces, pmix_nspace_t) { - if (0 == strncmp(pmix_globals.myid.nspace, nptr->nspace, PMIX_MAX_NSLEN)) { - nsptr = nptr; - break; - } - } - if (NULL == nsptr) { - PMIX_RELEASE_THREAD(&pmix_global_lock); - return PMIX_ERR_NOT_FOUND; - } /* the jobid is just our nspace */ kptr = PMIX_NEW(pmix_kval_t); @@ -245,7 +249,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_STRING; kptr->value->data.string = strdup(nsptr->nspace); - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -271,7 +275,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 0; - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -284,7 +288,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -297,7 +301,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_STRING; kptr->value->data.string = strdup("0"); - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -310,7 +314,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 0; - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); } @@ -322,7 +326,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -335,7 +339,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -348,7 +352,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -362,7 +366,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -464,7 +468,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_STRING; kptr->value->data.string = strdup(hostname); - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -478,7 +482,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_VALUE_CREATE(kptr->value, 1); kptr->value->type = PMIX_STRING; kptr->value->data.string = strdup("0"); - if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, pmix_globals.myid.rank, kptr))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/compress.h b/opal/mca/pmix/pmix2x/pmix/src/util/compress.h index d81cff74ebb..b07b0d2ea71 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/compress.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/compress.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) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/output.c b/opal/mca/pmix/pmix2x/pmix/src/util/output.c index a7f9cf463ad..1d3d4148dcd 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/output.c +++ b/opal/mca/pmix/pmix2x/pmix/src/util/output.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2008 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, diff --git a/opal/mca/pmix/pmix2x/pmix/test/Makefile.am b/opal/mca/pmix/pmix2x/pmix/test/Makefile.am index f96895a9de5..9140989a4e9 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/test/Makefile.am @@ -51,13 +51,13 @@ pmi_client_SOURCES = $(headers) \ pmi_client.c pmi_client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) pmi_client_LDADD = \ - $(top_builddir)/src/libpmix.la + $(top_builddir)/src/libpmi.la pmi2_client_SOURCES = $(headers) \ pmi2_client.c pmi2_client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) pmi2_client_LDADD = \ - $(top_builddir)/src/libpmix.la + $(top_builddir)/src/libpmi2.la endif pmix_client_SOURCES = $(headers) \ diff --git a/opal/mca/pmix/pmix2x/pmix/test/server_callbacks.c b/opal/mca/pmix/pmix2x/pmix/test/server_callbacks.c index df5c5763369..529aae581fa 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/server_callbacks.c +++ b/opal/mca/pmix/pmix2x/pmix/test/server_callbacks.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. @@ -17,7 +17,7 @@ #include "server_callbacks.h" #include "src/util/argv.h" -extern int spawn_wait; +extern bool spawn_wait; pmix_server_module_t mymodule = { .client_connected = connected, diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_common.c b/opal/mca/pmix/pmix2x/pmix/test/test_common.c index 5d9ba374416..d049a0c0fb8 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_common.c +++ b/opal/mca/pmix/pmix2x/pmix/test/test_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015-2017 Mellanox Technologies, Inc. @@ -631,3 +631,4 @@ int get_all_ranks_from_namespace(test_params params, char *nspace, pmix_proc_t * } return PMIX_SUCCESS; } + diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_common.h b/opal/mca/pmix/pmix2x/pmix/test/test_common.h index d87c6990532..d770317fc18 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_common.h +++ b/opal/mca/pmix/pmix2x/pmix/test/test_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_fence.c b/opal/mca/pmix/pmix2x/pmix/test/test_fence.c index df60b7ccb73..37fd7ac45a2 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_fence.c +++ b/opal/mca/pmix/pmix2x/pmix/test/test_fence.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016 Intel, Inc. All rights reserved. * Copyright (c) 2015-2017 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -436,3 +436,4 @@ int test_job_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) } return PMIX_SUCCESS; } +