From 8c960bae8d9c00dd04b53c6106c5bd67124c9beb Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 23 Jan 2017 07:07:40 -0800 Subject: [PATCH] Update to latest PMIx master Signed-off-by: Ralph Castain --- opal/mca/pmix/pmix2x/pmix/INSTALL | 2 +- opal/mca/pmix/pmix2x/pmix/LICENSE | 2 +- opal/mca/pmix/pmix2x/pmix/Makefile.am | 2 +- opal/mca/pmix/pmix2x/pmix/README | 2 +- opal/mca/pmix/pmix2x/pmix/VERSION | 6 +- .../pmix2x/pmix/config/c_get_alignment.m4 | 2 +- .../mca/pmix/pmix2x/pmix/config/distscript.sh | 2 +- opal/mca/pmix/pmix2x/pmix/config/pmix.m4 | 2 +- .../pmix/config/pmix_check_attributes.m4 | 2 +- .../pmix/config/pmix_check_broken_qsort.m4 | 2 +- .../config/pmix_check_compiler_version.m4 | 2 +- .../pmix/pmix2x/pmix/config/pmix_check_icc.m4 | 2 +- .../pmix2x/pmix/config/pmix_check_ident.m4 | 2 +- .../pmix2x/pmix/config/pmix_check_package.m4 | 2 +- .../pmix2x/pmix/config/pmix_check_psm2.m4 | 89 ++ .../pmix2x/pmix/config/pmix_check_vendor.m4 | 2 +- .../pmix/config/pmix_check_visibility.m4 | 2 +- .../pmix2x/pmix/config/pmix_check_withdir.m4 | 39 + .../pmix2x/pmix/config/pmix_config_subdir.m4 | 2 +- .../config/pmix_ensure_contains_optflags.m4 | 2 +- .../pmix2x/pmix/config/pmix_get_version.sh | 2 +- .../pmix2x/pmix/config/pmix_load_platform.m4 | 2 +- .../pmix/config/pmix_mca_priority_sort.pl | 2 +- .../pmix2x/pmix/config/pmix_search_libs.m4 | 2 +- .../pmix2x/pmix/contrib/make_dist_tarball | 2 +- .../pmix/pmix2x/pmix/contrib/perf_tools/pmi.h | 2 +- .../pmix2x/pmix/contrib/perf_tools/pmi2.c | 2 +- .../pmix2x/pmix/contrib/pmix-valgrind.supp | 2 +- opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec | 2 +- .../pmix2x/pmix/contrib/whitespace-purge.sh | 2 +- .../mca/pmix/pmix2x/pmix/examples/Makefile.am | 18 +- opal/mca/pmix/pmix2x/pmix/examples/server.c | 893 ++++++++++++++++++ .../pmix/pmix2x/pmix/include/pmix_common.h | 30 +- .../pmix/pmix2x/pmix/include/pmix_server.h | 30 +- .../pmix2x/pmix/include/pmix_version.h.in | 2 +- .../pmix/pmix2x/pmix/src/buffer_ops/copy.c | 4 +- .../pmix2x/pmix/src/buffer_ops/internal.h | 6 +- .../pmix/src/buffer_ops/internal_functions.c | 42 +- .../pmix2x/pmix/src/buffer_ops/open_close.c | 4 +- .../pmix/pmix2x/pmix/src/buffer_ops/types.h | 2 +- .../pmix/pmix2x/pmix/src/buffer_ops/unpack.c | 6 +- .../pmix2x/pmix/src/class/pmix_hash_table.c | 2 +- .../pmix/pmix2x/pmix/src/class/pmix_list.c | 2 +- .../pmix/pmix2x/pmix/src/class/pmix_list.h | 2 +- .../pmix/pmix2x/pmix/src/class/pmix_object.c | 2 +- .../pmix2x/pmix/src/class/pmix_value_array.c | 2 +- .../pmix2x/pmix/src/client/Makefile.include | 2 +- .../pmix/pmix2x/pmix/src/client/pmix_client.c | 2 + .../pmix/src/client/pmix_client_fence.c | 2 +- .../pmix2x/pmix/src/common/Makefile.include | 2 +- .../pmix2x/pmix/src/common/pmix_jobdata.c | 34 +- .../pmix/pmix2x/pmix/src/common/pmix_query.c | 8 +- .../pmix2x/pmix/src/dstore/Makefile.include | 2 +- .../pmix/pmix2x/pmix/src/dstore/pmix_dstore.c | 2 +- .../pmix/pmix2x/pmix/src/dstore/pmix_esh.h | 2 +- .../pmix/src/event/pmix_event_notification.c | 40 +- opal/mca/pmix/pmix2x/pmix/src/include/align.h | 2 +- .../pmix2x/pmix/src/include/hash_string.h | 2 +- .../pmix2x/pmix/src/include/pmix_config_top.h | 2 +- .../pmix2x/pmix/src/include/pmix_jobdata.h | 2 +- .../pmix/src/include/pmix_socket_errno.h | 2 +- .../pmix/pmix2x/pmix/src/include/prefetch.h | 2 +- .../pmix/pmix2x/pmix/src/mca/base/Makefile.am | 2 +- .../pmix/src/mca/base/help-mca-base.txt | 2 +- .../pmix2x/pmix/src/mca/base/help-mca-var.txt | 2 +- .../base/pmix_mca_base_component_compare.c | 2 +- .../pmix/src/mca/base/pmix_mca_base_var.c | 4 +- .../pmix/pmix2x/pmix/src/mca/pdl/Makefile.am | 2 +- .../pmix2x/pmix/src/mca/pdl/base/Makefile.am | 2 +- .../pmix/src/mca/pdl/base/pdl_base_select.c | 2 +- opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdl.h | 2 +- .../pmix/src/mca/pdl/pdlopen/Makefile.am | 2 +- .../pmix/src/mca/pdl/pdlopen/configure.m4 | 2 +- .../mca/pdl/pdlopen/pdl_pdlopen_component.c | 2 +- .../pmix/pmix2x/pmix/src/mca/pif/Makefile.am | 2 +- .../pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c | 2 +- .../src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c | 2 +- .../src/mca/pif/linux_ipv6/pif_linux_ipv6.c | 2 +- .../pmix/src/mca/pif/posix_ipv4/pif_posix.c | 2 +- .../src/mca/pinstalldirs/base/Makefile.am | 2 +- .../src/mca/pinstalldirs/config/configure.m4 | 2 +- .../pmix/src/mca/pinstalldirs/env/Makefile.am | 2 +- .../src/mca/pinstalldirs/env/configure.m4 | 2 +- .../pmix/pmix2x/pmix/src/mca/pnet/Makefile.am | 44 + .../pmix/src/mca/pnet/base/Makefile.include | 32 + .../pmix/pmix2x/pmix/src/mca/pnet/base/base.h | 91 ++ .../pmix/src/mca/pnet/base/pnet_base_fns.c | 146 +++ .../pmix/src/mca/pnet/base/pnet_base_frame.c | 93 ++ .../pmix/src/mca/pnet/base/pnet_base_select.c | 116 +++ .../pmix2x/pmix/src/mca/pnet/opa/Makefile.am | 54 ++ .../pmix2x/pmix/src/mca/pnet/opa/configure.m4 | 42 + .../pmix2x/pmix/src/mca/pnet/opa/pnet_opa.c | 238 +++++ .../pmix2x/pmix/src/mca/pnet/opa/pnet_opa.h | 27 + .../src/mca/pnet/opa/pnet_opa_component.c | 84 ++ opal/mca/pmix/pmix2x/pmix/src/mca/pnet/pnet.h | 122 +++ .../pmix/pmix2x/pmix/src/mca/psec/base/base.h | 8 +- .../pmix/src/mca/psec/native/psec_native.c | 6 +- .../pmix/src/mca/ptl/base/ptl_base_sendrecv.c | 1 - .../pmix2x/pmix/src/mca/ptl/tcp/ptl_tcp.c | 25 +- .../pmix/src/mca/ptl/tcp/ptl_tcp_component.c | 31 +- .../pmix/src/runtime/help-pmix-runtime.txt | 2 +- .../pmix2x/pmix/src/runtime/pmix_finalize.c | 6 +- .../pmix/pmix2x/pmix/src/runtime/pmix_init.c | 13 +- .../pmix/pmix2x/pmix/src/server/pmix_server.c | 152 ++- .../pmix2x/pmix/src/server/pmix_server_get.c | 17 +- .../pmix2x/pmix/src/server/pmix_server_ops.c | 3 + .../pmix2x/pmix/src/server/pmix_server_ops.h | 4 +- .../pmix/pmix2x/pmix/src/sm/Makefile.include | 2 +- opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c | 2 +- opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.h | 2 +- opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.c | 2 +- opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.h | 2 +- .../pmix2x/pmix/src/util/Makefile.include | 4 +- opal/mca/pmix/pmix2x/pmix/src/util/alfg.c | 136 +++ opal/mca/pmix/pmix2x/pmix/src/util/alfg.h | 37 + opal/mca/pmix/pmix2x/pmix/src/util/basename.c | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/basename.h | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/getid.c | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/getid.h | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/hash.c | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/hash.h | 2 +- .../pmix2x/pmix/src/util/keyval/keyval_lex.l | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/net.c | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/net.h | 6 +- opal/mca/pmix/pmix2x/pmix/src/util/output.h | 2 +- .../pmix/pmix2x/pmix/src/util/pmix_environ.c | 2 +- .../pmix/pmix2x/pmix/src/util/pmix_environ.h | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/printf.c | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/printf.h | 2 +- .../mca/pmix/pmix2x/pmix/src/util/show_help.c | 6 +- opal/mca/pmix/pmix2x/pmix/src/util/strnlen.h | 2 +- opal/mca/pmix/pmix2x/pmix/src/util/timings.h | 2 +- opal/mca/pmix/pmix2x/pmix/test/cli_stages.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/cli_stages.h | 2 +- opal/mca/pmix/pmix2x/pmix/test/pmi_client.c | 17 +- opal/mca/pmix/pmix2x/pmix/test/pmix_regex.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/pmix_test.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_cd.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_cd.h | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_common.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_error.h | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_fence.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_publish.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_publish.h | 2 +- .../pmix2x/pmix/test/test_resolve_peers.c | 2 +- .../pmix2x/pmix/test/test_resolve_peers.h | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_spawn.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/test_spawn.h | 2 +- opal/mca/pmix/pmix2x/pmix/test/utils.c | 2 +- opal/mca/pmix/pmix2x/pmix/test/utils.h | 2 +- 150 files changed, 2757 insertions(+), 267 deletions(-) create mode 100644 opal/mca/pmix/pmix2x/pmix/config/pmix_check_psm2.m4 create mode 100644 opal/mca/pmix/pmix2x/pmix/config/pmix_check_withdir.m4 create mode 100644 opal/mca/pmix/pmix2x/pmix/examples/server.c create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/Makefile.am create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/Makefile.include create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/base.h create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_fns.c create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_frame.c create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_select.c create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/Makefile.am create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/configure.m4 create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa.c create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa.h create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa_component.c create mode 100644 opal/mca/pmix/pmix2x/pmix/src/mca/pnet/pnet.h create mode 100644 opal/mca/pmix/pmix2x/pmix/src/util/alfg.c create mode 100644 opal/mca/pmix/pmix2x/pmix/src/util/alfg.h diff --git a/opal/mca/pmix/pmix2x/pmix/INSTALL b/opal/mca/pmix/pmix2x/pmix/INSTALL index 4c7087c0a6..59aef39d92 100644 --- a/opal/mca/pmix/pmix2x/pmix/INSTALL +++ b/opal/mca/pmix/pmix2x/pmix/INSTALL @@ -9,7 +9,7 @@ Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, Copyright (c) 2004-2005 The Regents of the University of California. All rights reserved. Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. -Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +Copyright (c) 2013-2017 Intel, Inc. All rights reserved. $COPYRIGHT$ Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/LICENSE b/opal/mca/pmix/pmix2x/pmix/LICENSE index 367b0c3c9c..77e74696d4 100644 --- a/opal/mca/pmix/pmix2x/pmix/LICENSE +++ b/opal/mca/pmix/pmix2x/pmix/LICENSE @@ -45,7 +45,7 @@ Copyright (c) 2010 ARM ltd. All rights reserved. Copyright (c) 2010-2011 Alex Brick . All rights reserved. Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights reserved. -Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +Copyright (c) 2013-2017 Intel, Inc. All rights reserved. Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved. $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/Makefile.am b/opal/mca/pmix/pmix2x/pmix/Makefile.am index bb1b69c2ee..68f59c81fa 100644 --- a/opal/mca/pmix/pmix2x/pmix/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/README b/opal/mca/pmix/pmix2x/pmix/README index 60df07dc77..bacf8a42ac 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-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. $COPYRIGHT$ Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/VERSION b/opal/mca/pmix/pmix2x/pmix/VERSION index a224a45203..4efc0a1610 100644 --- a/opal/mca/pmix/pmix2x/pmix/VERSION +++ b/opal/mca/pmix/pmix2x/pmix/VERSION @@ -23,14 +23,14 @@ release=0 # The only requirement is that it must be entirely printable ASCII # characters and have no white space. -greek=a1 +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=git8ed98a0 +repo_rev=git89ec3bc # 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="Dec 30, 2016" +date="Jan 23, 2017" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library diff --git a/opal/mca/pmix/pmix2x/pmix/config/c_get_alignment.m4 b/opal/mca/pmix/pmix2x/pmix/config/c_get_alignment.m4 index e785357cef..7e93c68f27 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/c_get_alignment.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/c_get_alignment.m4 @@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. -dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved. dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/config/distscript.sh b/opal/mca/pmix/pmix2x/pmix/config/distscript.sh index e0775b9595..3a4e0bc973 100755 --- a/opal/mca/pmix/pmix2x/pmix/config/distscript.sh +++ b/opal/mca/pmix/pmix2x/pmix/config/distscript.sh @@ -15,7 +15,7 @@ # and Technology (RIST). All rights reserved. # Copyright (c) 2015 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2016 Intel, Inc. All rights reserved. +# Copyright (c) 2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 index dd1bf3b2b5..4432ef708a 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix.m4 @@ -322,7 +322,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[ crt_externs.h signal.h \ ioLib.h sockLib.h hostLib.h limits.h \ sys/statfs.h sys/statvfs.h \ - netdb.h ucred.h]) + netdb.h ucred.h zlib.h]) AC_CHECK_HEADERS([sys/mount.h], [], [], [AC_INCLUDES_DEFAULT diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_attributes.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_attributes.m4 index 84146ac713..e9dd659a61 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_attributes.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_attributes.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # PMIx copyrights: -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. # ######################### # diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_broken_qsort.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_broken_qsort.m4 index 62351f339f..ae62a8bd89 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_broken_qsort.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_broken_qsort.m4 @@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. -dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved. dnl Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_compiler_version.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_compiler_version.m4 index e90258b7ca..7dfa315e87 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_compiler_version.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_compiler_version.m4 @@ -1,7 +1,7 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. -dnl Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved. dnl dnl $COPYRIGHT$ dnl diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_icc.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_icc.m4 index fcdf3c3196..bbf8f707cc 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_icc.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_icc.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. -dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved. dnl Copyright (c) 2016 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_ident.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_ident.m4 index 6b99483ed4..ba4aba03d9 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_ident.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_ident.m4 @@ -1,7 +1,7 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. -dnl Copyright (c) 2015-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2015-2017 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow 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 4ea549c071..2c7b7295b5 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-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_psm2.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_psm2.m4 new file mode 100644 index 0000000000..baac3b085a --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_psm2.m4 @@ -0,0 +1,89 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2006 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2006 QLogic Corp. All rights reserved. +# Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2016-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2015 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2016 Los Alamos National Security, LLC. All rights +# reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# PMIX_CHECK_PSM2(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +# check if PSM2 support can be found. sets prefix_{CPPFLAGS, +# LDFLAGS, LIBS} as needed and runs action-if-found if there is +# support, otherwise executes action-if-not-found +AC_DEFUN([PMIX_CHECK_PSM2],[ + if test -z "$pmix_check_psm2_happy" ; then + AC_ARG_WITH([psm2], + [AC_HELP_STRING([--with-psm2(=DIR)], + [Build PSM2 (Intel PSM2) support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])]) + PMIX_CHECK_WITHDIR([psm2], [$with_psm2], [include/psm2.h]) + AC_ARG_WITH([psm2-libdir], + [AC_HELP_STRING([--with-psm2-libdir=DIR], + [Search for PSM (Intel PSM2) libraries in DIR])]) + PMIX_CHECK_WITHDIR([psm2-libdir], [$with_psm2_libdir], [libpsm2.*]) + + pmix_check_psm2_$1_save_CPPFLAGS="$CPPFLAGS" + pmix_check_psm2_$1_save_LDFLAGS="$LDFLAGS" + pmix_check_psm2_$1_save_LIBS="$LIBS" + + AS_IF([test "$with_psm2" != "no"], + [AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "yes"], + [pmix_check_psm2_dir="$with_psm2"]) + AS_IF([test ! -z "$with_psm2_libdir" && test "$with_psm2_libdir" != "yes"], + [pmix_check_psm2_libdir="$with_psm2_libdir"]) + + PMIX_CHECK_PACKAGE([pmix_check_psm2], + [psm2.h], + [psm2], + [psm_mq_irecv], + [], + [$pmix_check_psm2_dir], + [$pmix_check_psm2_libdir], + [pmix_check_psm2_happy="yes"], + [pmix_check_psm2_happy="no"])], + [pmix_check_psm2_happy="no"]) + + CPPFLAGS="$pmix_check_psm2_$1_save_CPPFLAGS" + LDFLAGS="$pmix_check_psm2_$1_save_LDFLAGS" + LIBS="$pmix_check_psm2_$1_save_LIBS" + + AS_IF([test "$pmix_check_psm2_happy" = "yes" && test "$enable_progress_threads" = "yes"], + [AC_MSG_WARN([PSM2 driver does not currently support progress threads. Disabling MTL.]) + pmix_check_psm2_happy="no"]) + + AS_IF([test "$pmix_check_psm2_happy" = "yes"], + [AC_CHECK_HEADERS( + glob.h, + [], + [AC_MSG_WARN([glob.h not found. Can not build component.]) + pmix_check_psm2_happy="no"])]) + + fi + + AS_IF([test "$pmix_check_psm2_happy" = "yes"], + [$1_LDFLAGS="[$]$1_LDFLAGS $pmix_check_psm2_LDFLAGS" + $1_CPPFLAGS="[$]$1_CPPFLAGS $pmix_check_psm2_CPPFLAGS" + $1_LIBS="[$]$1_LIBS $pmix_check_psm2_LIBS" + $2], + [AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "no"], + [AC_MSG_ERROR([PSM2 support requested but not found. Aborting])]) + $3]) +]) diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_vendor.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_vendor.m4 index 1021d9cdc8..343a021e69 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_vendor.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_vendor.m4 @@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. -dnl Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved. dnl Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_visibility.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_visibility.m4 index 1f46849ae2..aafbdca564 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_visibility.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_visibility.m4 @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2016 Intel, Inc. All rights reserved. +# Copyright (c) 2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_withdir.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_withdir.m4 new file mode 100644 index 0000000000..ff1b3d4176 --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_withdir.m4 @@ -0,0 +1,39 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights +dnl reserved. +dnl Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2015 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2016-2017 Intel, Inc. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# PMIX_CHECK_WITHDIR(with_option_name, dir_value, file_in_dir) +# ---------------------------------------------------- +AC_DEFUN([PMIX_CHECK_WITHDIR],[ + AC_MSG_CHECKING([--with-$1 value]) + AS_IF([test "$2" = "yes" || test "$2" = "no" || test "x$2" = "x"], + [AC_MSG_RESULT([simple ok (unspecified)])], + [AS_IF([test ! -d "$2"], + [AC_MSG_RESULT([not found]) + AC_MSG_WARN([Directory $2 not found]) + AC_MSG_ERROR([Cannot continue])], + [AS_IF([test "x`ls $2/$3 2> /dev/null`" = "x"], + [AC_MSG_RESULT([not found]) + AC_MSG_WARN([Expected file $2/$3 not found]) + AC_MSG_ERROR([Cannot continue])], + [AC_MSG_RESULT([sanity check ok ($2)])] + ) + ] + ) + ] + ) +])dnl diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_config_subdir.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_config_subdir.m4 index e249197bec..248aebda35 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_config_subdir.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_config_subdir.m4 @@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved. dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_ensure_contains_optflags.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_ensure_contains_optflags.m4 index 375207393a..df6dcf2767 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_ensure_contains_optflags.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_ensure_contains_optflags.m4 @@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_get_version.sh b/opal/mca/pmix/pmix2x/pmix/config/pmix_get_version.sh index 926911ec92..da2548e863 100755 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_get_version.sh +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_get_version.sh @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_load_platform.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_load_platform.m4 index 0c8cc215a5..330c7e6799 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_load_platform.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_load_platform.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. -dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved. dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_mca_priority_sort.pl b/opal/mca/pmix/pmix2x/pmix/config/pmix_mca_priority_sort.pl index 9869100468..839f7fe287 100755 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_mca_priority_sort.pl +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_mca_priority_sort.pl @@ -2,7 +2,7 @@ # # Copyright (c) 2010 Sandia National Laboratories. All rights reserved. # -# Copyright (c) 2016 Intel, Inc. All rights reserved. +# Copyright (c) 2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_search_libs.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_search_libs.m4 index 9b288e2c35..97f052128c 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_search_libs.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_search_libs.m4 @@ -1,7 +1,7 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/contrib/make_dist_tarball b/opal/mca/pmix/pmix2x/pmix/contrib/make_dist_tarball index 7057cbd2a2..33d0289a1b 100755 --- a/opal/mca/pmix/pmix2x/pmix/contrib/make_dist_tarball +++ b/opal/mca/pmix/pmix2x/pmix/contrib/make_dist_tarball @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/contrib/perf_tools/pmi.h b/opal/mca/pmix/pmix2x/pmix/contrib/perf_tools/pmi.h index 6ebc6d2315..54613455cc 100644 --- a/opal/mca/pmix/pmix2x/pmix/contrib/perf_tools/pmi.h +++ b/opal/mca/pmix/pmix2x/pmix/contrib/perf_tools/pmi.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/contrib/perf_tools/pmi2.c b/opal/mca/pmix/pmix2x/pmix/contrib/perf_tools/pmi2.c index 0c0368da3d..f5247f090e 100644 --- a/opal/mca/pmix/pmix2x/pmix/contrib/perf_tools/pmi2.c +++ b/opal/mca/pmix/pmix2x/pmix/contrib/perf_tools/pmi2.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/contrib/pmix-valgrind.supp b/opal/mca/pmix/pmix2x/pmix/contrib/pmix-valgrind.supp index 464f5704a0..c36fc4efcb 100644 --- a/opal/mca/pmix/pmix2x/pmix/contrib/pmix-valgrind.supp +++ b/opal/mca/pmix/pmix2x/pmix/contrib/pmix-valgrind.supp @@ -1,6 +1,6 @@ # -*- text -*- # -# Copyright (c) 2015-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec index 7a97dc2e34..c37a923cfd 100644 --- a/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec @@ -12,7 +12,7 @@ # Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2015-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/contrib/whitespace-purge.sh b/opal/mca/pmix/pmix2x/pmix/contrib/whitespace-purge.sh index ce0f7e7d80..d760d53a90 100755 --- a/opal/mca/pmix/pmix2x/pmix/contrib/whitespace-purge.sh +++ b/opal/mca/pmix/pmix2x/pmix/contrib/whitespace-purge.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2015-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. # Copyright (c) 2015 Los Alamos National Security, LLC. All rights # reserved # Copyright (c) 2015 Cisco Systems, Inc. diff --git a/opal/mca/pmix/pmix2x/pmix/examples/Makefile.am b/opal/mca/pmix/pmix2x/pmix/examples/Makefile.am index f769c8483f..8b5c6e8d23 100644 --- a/opal/mca/pmix/pmix2x/pmix/examples/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/examples/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -19,7 +19,7 @@ # $HEADER$ # -AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/src/api +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 if !WANT_HIDDEN @@ -28,6 +28,12 @@ if !WANT_HIDDEN noinst_PROGRAMS += debugger debuggerd endif +if !WANT_HIDDEN +# this example uses internal symbols +# use --disable-visibility +noinst_PROGRAMS += server +endif + client_SOURCES = client.c client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) client_LDADD = $(top_builddir)/src/libpmix.la @@ -62,5 +68,13 @@ tool_SOURCES = tool.c tool_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) tool_LDADD = $(top_builddir)/src/libpmix.la +if !WANT_HIDDEN +# this example uses internal symbols +# use --disable-visibility +server_SOURCES = server.c +server_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) +server_LDADD = $(top_builddir)/src/libpmix.la +endif + distclean-local: rm -f *.o client debugger debuggerd dmodex dynamic fault pub server diff --git a/opal/mca/pmix/pmix2x/pmix/examples/server.c b/opal/mca/pmix/pmix2x/pmix/examples/server.c new file mode 100644 index 0000000000..5a1ccaa885 --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/examples/server.c @@ -0,0 +1,893 @@ +/* + * 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 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include PMIX_EVENT_HEADER + +#include "src/class/pmix_list.h" +#include "src/util/pmix_environ.h" +#include "src/util/output.h" +#include "src/util/printf.h" +#include "src/util/argv.h" +#include "src/buffer_ops/buffer_ops.h" + +static pmix_status_t connected(const pmix_proc_t *proc, void *server_object, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t finalized(const pmix_proc_t *proc, void *server_object, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t abort_fn(const pmix_proc_t *proc, void *server_object, + int status, const char msg[], + pmix_proc_t procs[], size_t nprocs, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t fencenb_fn(const pmix_proc_t procs[], size_t nprocs, + const pmix_info_t info[], size_t ninfo, + char *data, size_t ndata, + pmix_modex_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t dmodex_fn(const pmix_proc_t *proc, + const pmix_info_t info[], size_t ninfo, + pmix_modex_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t publish_fn(const pmix_proc_t *proc, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys, + const pmix_info_t info[], size_t ninfo, + pmix_lookup_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t unpublish_fn(const pmix_proc_t *proc, char **keys, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t spawn_fn(const pmix_proc_t *proc, + const pmix_info_t job_info[], size_t ninfo, + const pmix_app_t apps[], size_t napps, + pmix_spawn_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t connect_fn(const pmix_proc_t procs[], size_t nprocs, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t disconnect_fn(const pmix_proc_t procs[], size_t nprocs, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t register_event_fn(pmix_status_t *codes, size_t ncodes, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t deregister_events(pmix_status_t *codes, size_t ncodes, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t notify_event(pmix_status_t code, + const pmix_proc_t *source, + pmix_data_range_t range, + pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t query_fn(pmix_proc_t *proct, + pmix_query_t *queries, size_t nqueries, + pmix_info_cbfunc_t cbfunc, + void *cbdata); +static void tool_connect_fn(pmix_info_t *info, size_t ninfo, + pmix_tool_connection_cbfunc_t cbfunc, + void *cbdata); +static void log_fn(const pmix_proc_t *client, + const pmix_info_t data[], size_t ndata, + const pmix_info_t directives[], size_t ndirs, + pmix_op_cbfunc_t cbfunc, void *cbdata); + +static pmix_server_module_t mymodule = { + .client_connected = connected, + .client_finalized = finalized, + .abort = abort_fn, + .fence_nb = fencenb_fn, + .direct_modex = dmodex_fn, + .publish = publish_fn, + .lookup = lookup_fn, + .unpublish = unpublish_fn, + .spawn = spawn_fn, + .connect = connect_fn, + .disconnect = disconnect_fn, + .register_events = register_event_fn, + .deregister_events = deregister_events, + .notify_event = notify_event, + .query = query_fn, + .tool_connected = tool_connect_fn, + .log = log_fn +}; + +typedef struct { + pmix_list_item_t super; + pmix_pdata_t pdata; +} pmix_locdat_t; +PMIX_CLASS_INSTANCE(pmix_locdat_t, + pmix_list_item_t, + NULL, NULL); + +typedef struct { + pmix_object_t super; + volatile bool active; + pmix_proc_t caller; + pmix_info_t *info; + size_t ninfo; + pmix_op_cbfunc_t cbfunc; + pmix_spawn_cbfunc_t spcbfunc; + void *cbdata; +} myxfer_t; +static void xfcon(myxfer_t *p) +{ + p->info = NULL; + p->ninfo = 0; + p->active = true; + p->cbfunc = NULL; + p->spcbfunc = NULL; + p->cbdata = NULL; +} +static void xfdes(myxfer_t *p) +{ + if (NULL != p->info) { + PMIX_INFO_FREE(p->info, p->ninfo); + } +} +PMIX_CLASS_INSTANCE(myxfer_t, + pmix_object_t, + xfcon, xfdes); + +typedef struct { + pmix_list_item_t super; + pid_t pid; +} wait_tracker_t; +PMIX_CLASS_INSTANCE(wait_tracker_t, + pmix_list_item_t, + NULL, NULL); + +static volatile int wakeup; +static pmix_list_t pubdata; +static pmix_event_t handler; +static pmix_list_t children; + +static void set_namespace(int nprocs, char *ranks, char *nspace, + pmix_op_cbfunc_t cbfunc, myxfer_t *x); +static void errhandler(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); +static void wait_signal_callback(int fd, short event, void *arg); +static void errhandler_reg_callbk (pmix_status_t status, + size_t errhandler_ref, + void *cbdata); + +static void opcbfunc(pmix_status_t status, void *cbdata) +{ + myxfer_t *x = (myxfer_t*)cbdata; + + /* release the caller, if necessary */ + if (NULL != x->cbfunc) { + x->cbfunc(PMIX_SUCCESS, x->cbdata); + } + x->active = false; +} + +int main(int argc, char **argv) +{ + char **client_env=NULL; + char **client_argv=NULL; + char *tmp, **atmp, *executable=NULL, *tmpdir, *cleanup; + int rc, nprocs=1, n, k; + uid_t myuid; + gid_t mygid; + pid_t pid; + myxfer_t *x; + pmix_proc_t proc; + wait_tracker_t *child; + char *tdir; + uid_t uid = geteuid(); + pmix_info_t *info; + struct stat buf; + + /* define and pass a personal tmpdir to protect the system */ + if (NULL == (tdir = getenv("TMPDIR"))) { + if (NULL == (tdir = getenv("TEMP"))) { + if (NULL == (tdir = getenv("TMP"))) { + tdir = "/tmp"; + } + } + } + if (0 > asprintf(&tmpdir, "%s/pmix.%lu", tdir, (long unsigned)uid)) { + fprintf(stderr, "Out of memory\n"); + exit(1); + } + /* create the directory */ + if (0 != stat(tmpdir, &buf)) { + /* try to make directory */ + if (0 != mkdir(tmpdir, S_IRWXU)) { + fprintf(stderr, "Cannot make tmpdir %s", tmpdir); + exit(1); + } + } + asprintf(&cleanup, "rm -rf %s", tmpdir); + PMIX_INFO_CREATE(info, 1); + PMIX_INFO_LOAD(&info[0], PMIX_SERVER_TMPDIR, tmpdir, PMIX_STRING); + + /* setup the server library */ + if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, info, 1))) { + fprintf(stderr, "Init failed with error %d\n", rc); + return rc; + } + PMIX_INFO_FREE(info, 1); + + /* register the errhandler */ + PMIx_Register_event_handler(NULL, 0, NULL, 0, + errhandler, errhandler_reg_callbk, NULL); + + /* setup the pub data, in case it is used */ + PMIX_CONSTRUCT(&pubdata, pmix_list_t); + + /* setup to see sigchld on the forked tests */ + PMIX_CONSTRUCT(&children, pmix_list_t); + event_assign(&handler, pmix_globals.evbase, SIGCHLD, + EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler); + event_add(&handler, NULL); + + /* see if we were passed the number of procs to run or + * the executable to use */ + for (n=1; n < (argc-1); n++) { + if (0 == strcmp("-n", argv[n]) && + NULL != argv[n+1]) { + nprocs = strtol(argv[n+1], NULL, 10); + ++n; // step over the argument + } else if (0 == strcmp("-e", argv[n]) && + NULL != argv[n+1]) { + executable = strdup(argv[n+1]); + for (k=n+2; NULL != argv[k]; k++) { + pmix_argv_append_nosize(&client_argv, argv[k]); + } + n += k; + } + } + if (NULL == executable) { + executable = strdup("./simpclient"); + } + + /* we have a single namespace for all clients */ + atmp = NULL; + for (n=0; n < nprocs; n++) { + asprintf(&tmp, "%d", n); + pmix_argv_append_nosize(&atmp, tmp); + free(tmp); + } + tmp = pmix_argv_join(atmp, ','); + pmix_argv_free(atmp); + /* register the nspace */ + x = PMIX_NEW(myxfer_t); + set_namespace(nprocs, tmp, "foobar", opcbfunc, x); + + /* set common argv and env */ + client_env = pmix_argv_copy(environ); + pmix_argv_prepend_nosize(&client_argv, executable); + + wakeup = nprocs; + myuid = getuid(); + mygid = getgid(); + + /* if the nspace registration hasn't completed yet, + * wait for it here */ + PMIX_WAIT_FOR_COMPLETION(x->active); + free(tmp); + PMIX_RELEASE(x); + + /* prep the local node for launch */ + x = PMIX_NEW(myxfer_t); + if (PMIX_SUCCESS != (rc = PMIx_server_setup_local_support("foobar", NULL, 0, opcbfunc, x))) { + fprintf(stderr, "Setup local support failed: %d\n", rc); + PMIx_server_finalize(); + system(cleanup); + return rc; + } + PMIX_WAIT_FOR_COMPLETION(x->active); + PMIX_RELEASE(x); + + /* fork/exec the test */ + (void)strncpy(proc.nspace, "foobar", PMIX_MAX_NSLEN); + for (n = 0; n < nprocs; n++) { + proc.rank = n; + if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, &client_env))) {//n + fprintf(stderr, "Server fork setup failed with error %d\n", rc); + PMIx_server_finalize(); + system(cleanup); + return rc; + } + x = PMIX_NEW(myxfer_t); + if (PMIX_SUCCESS != (rc = PMIx_server_register_client(&proc, myuid, mygid, + NULL, opcbfunc, x))) { + fprintf(stderr, "Server fork setup failed with error %d\n", rc); + PMIx_server_finalize(); + system(cleanup); + return rc; + } + /* don't fork/exec the client until we know it is registered + * so we avoid a potential race condition in the server */ + PMIX_WAIT_FOR_COMPLETION(x->active); + PMIX_RELEASE(x); + pid = fork(); + if (pid < 0) { + fprintf(stderr, "Fork failed\n"); + PMIx_server_finalize(); + system(cleanup); + return -1; + } + child = PMIX_NEW(wait_tracker_t); + child->pid = pid; + pmix_list_append(&children, &child->super); + + if (pid == 0) { + execve(executable, client_argv, client_env); + /* Does not return */ + exit(0); + } + } + free(executable); + pmix_argv_free(client_argv); + pmix_argv_free(client_env); + + /* hang around until the client(s) finalize */ + while (0 < wakeup) { + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = 100000; + nanosleep(&ts, NULL); + } + + /* deregister the errhandler */ + PMIx_Deregister_event_handler(0, NULL, NULL); + + /* release any pub data */ + PMIX_LIST_DESTRUCT(&pubdata); + + /* finalize the server library */ + if (PMIX_SUCCESS != (rc = PMIx_server_finalize())) { + fprintf(stderr, "Finalize failed with error %d\n", rc); + } + + fprintf(stderr, "Test finished OK!\n"); + system(cleanup); + + return rc; +} + +static void setup_cbfunc(pmix_status_t status, + pmix_info_t info[], size_t ninfo, + void *provided_cbdata, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + myxfer_t *myxfer = (myxfer_t*)provided_cbdata; + size_t i; + + if (PMIX_SUCCESS == status && 0 < ninfo) { + myxfer->ninfo = ninfo; + PMIX_INFO_CREATE(myxfer->info, ninfo); + for (i=0; i < ninfo; i++) { + PMIX_INFO_XFER(&myxfer->info[i], &info[i]); + } + } + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + myxfer->active = false; +} + +static void set_namespace(int nprocs, char *ranks, char *nspace, + pmix_op_cbfunc_t cbfunc, myxfer_t *x) +{ + char *regex, *ppn; + char hostname[PMIX_MAXHOSTNAMELEN]; + pmix_status_t rc; + myxfer_t myxfer; + size_t i; + + gethostname(hostname, sizeof(hostname)); + + /* request application setup information - e.g., network + * security keys or endpoint info */ + PMIX_CONSTRUCT(&myxfer, myxfer_t); + myxfer.active = true; + if (PMIX_SUCCESS != (rc = PMIx_server_setup_application(nspace, NULL, 0, setup_cbfunc, &myxfer))) { + PMIX_DESTRUCT(&myxfer); + fprintf(stderr, "Failed to setup application: %d\n", rc); + exit(1); + } + PMIX_WAIT_FOR_COMPLETION(myxfer.active); + x->ninfo = myxfer.ninfo + 7; + + PMIX_INFO_CREATE(x->info, x->ninfo); + if (0 < myxfer.ninfo) { + for (i=0; i < myxfer.ninfo; i++) { + PMIX_INFO_XFER(&x->info[i], &myxfer.info[i]); + } + } + PMIX_DESTRUCT(&myxfer); + + (void)strncpy(x->info[i].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); + x->info[i].value.type = PMIX_UINT32; + x->info[i].value.data.uint32 = nprocs; + + ++i; + (void)strncpy(x->info[i].key, PMIX_SPAWNED, PMIX_MAX_KEYLEN); + x->info[i].value.type = PMIX_UINT32; + x->info[i].value.data.uint32 = 0; + + ++i; + (void)strncpy(x->info[i].key, PMIX_LOCAL_SIZE, PMIX_MAX_KEYLEN); + x->info[i].value.type = PMIX_UINT32; + x->info[i].value.data.uint32 = nprocs; + + ++i; + (void)strncpy(x->info[i].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); + x->info[i].value.type = PMIX_STRING; + x->info[i].value.data.string = strdup(ranks); + + ++i; + PMIx_generate_regex(hostname, ®ex); + (void)strncpy(x->info[i].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); + x->info[i].value.type = PMIX_STRING; + x->info[i].value.data.string = regex; + + ++i; + PMIx_generate_ppn(ranks, &ppn); + (void)strncpy(x->info[i].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); + x->info[i].value.type = PMIX_STRING; + x->info[i].value.data.string = ppn; + + ++i; + (void)strncpy(x->info[i].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); + x->info[i].value.type = PMIX_UINT32; + x->info[i].value.data.uint32 = nprocs; + + PMIx_server_register_nspace(nspace, nprocs, x->info, x->ninfo, + cbfunc, x); +} + +static void errhandler(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) +{ + pmix_output(0, "SERVER: ERRHANDLER CALLED WITH STATUS %d", status); +} + +static void errhandler_reg_callbk (pmix_status_t status, + size_t errhandler_ref, + void *cbdata) +{ + return; +} + +static pmix_status_t connected(const pmix_proc_t *proc, void *server_object, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + return PMIX_SUCCESS; +} +static pmix_status_t finalized(const pmix_proc_t *proc, void *server_object, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + pmix_output(0, "SERVER: FINALIZED %s:%d", + proc->nspace, proc->rank); + --wakeup; + /* ensure we call the cbfunc so the proc can exit! */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + return PMIX_SUCCESS; +} + +static void abcbfunc(pmix_status_t status, void *cbdata) +{ + myxfer_t *x = (myxfer_t*)cbdata; + + /* be sure to release the caller */ + if (NULL != x->cbfunc) { + x->cbfunc(status, x->cbdata); + } + PMIX_RELEASE(x); +} + +static pmix_status_t abort_fn(const pmix_proc_t *proc, + void *server_object, + int status, const char msg[], + pmix_proc_t procs[], size_t nprocs, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + pmix_status_t rc; + myxfer_t *x; + + if (NULL != procs) { + pmix_output(0, "SERVER: ABORT on %s:%d", procs[0].nspace, procs[0].rank); + } else { + pmix_output(0, "SERVER: ABORT OF ALL PROCS IN NSPACE %s", proc->nspace); + } + + /* instead of aborting the specified procs, notify them + * (if they have registered their errhandler) */ + + /* use the myxfer_t object to ensure we release + * the caller when notification has been queued */ + x = PMIX_NEW(myxfer_t); + (void)strncpy(x->caller.nspace, proc->nspace, PMIX_MAX_NSLEN); + x->caller.rank = proc->rank; + + PMIX_INFO_CREATE(x->info, 2); + (void)strncpy(x->info[0].key, "DARTH", PMIX_MAX_KEYLEN); + x->info[0].value.type = PMIX_INT8; + x->info[0].value.data.int8 = 12; + (void)strncpy(x->info[1].key, "VADER", PMIX_MAX_KEYLEN); + x->info[1].value.type = PMIX_DOUBLE; + x->info[1].value.data.dval = 12.34; + x->cbfunc = cbfunc; + x->cbdata = cbdata; + + if (PMIX_SUCCESS != (rc = PMIx_Notify_event(status, &x->caller, + PMIX_RANGE_NAMESPACE, + x->info, 2, + abcbfunc, x))) { + pmix_output(0, "SERVER: FAILED NOTIFY ERROR %d", (int)rc); + } + + return PMIX_SUCCESS; +} + + +static pmix_status_t fencenb_fn(const pmix_proc_t procs[], size_t nprocs, + const pmix_info_t info[], size_t ninfo, + char *data, size_t ndata, + pmix_modex_cbfunc_t cbfunc, void *cbdata) +{ + pmix_output(0, "SERVER: FENCENB"); + /* pass the provided data back to each participating proc */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, data, ndata, cbdata, NULL, NULL); + } + return PMIX_SUCCESS; +} + + +static pmix_status_t dmodex_fn(const pmix_proc_t *proc, + const pmix_info_t info[], size_t ninfo, + pmix_modex_cbfunc_t cbfunc, void *cbdata) +{ + pmix_output(0, "SERVER: DMODEX"); + + /* we don't have any data for remote procs as this + * test only runs one server - so report accordingly */ + if (NULL != cbfunc) { + cbfunc(PMIX_ERR_NOT_FOUND, NULL, 0, cbdata, NULL, NULL); + } + return PMIX_SUCCESS; +} + + +static pmix_status_t publish_fn(const pmix_proc_t *proc, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + pmix_locdat_t *p; + size_t n; + + pmix_output(0, "SERVER: PUBLISH"); + + for (n=0; n < ninfo; n++) { + p = PMIX_NEW(pmix_locdat_t); + (void)strncpy(p->pdata.proc.nspace, proc->nspace, PMIX_MAX_NSLEN); + p->pdata.proc.rank = proc->rank; + (void)strncpy(p->pdata.key, info[n].key, PMIX_MAX_KEYLEN); + pmix_value_xfer(&p->pdata.value, (pmix_value_t*)&info[n].value); + pmix_list_append(&pubdata, &p->super); + } + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + return PMIX_SUCCESS; +} + + +static pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys, + const pmix_info_t info[], size_t ninfo, + pmix_lookup_cbfunc_t cbfunc, void *cbdata) +{ + pmix_locdat_t *p, *p2; + pmix_list_t results; + size_t i, n; + pmix_pdata_t *pd = NULL; + pmix_status_t ret = PMIX_ERR_NOT_FOUND; + + pmix_output(0, "SERVER: LOOKUP"); + + PMIX_CONSTRUCT(&results, pmix_list_t); + + for (n=0; NULL != keys[n]; n++) { + PMIX_LIST_FOREACH(p, &pubdata, pmix_locdat_t) { + if (0 == strncmp(keys[n], p->pdata.key, PMIX_MAX_KEYLEN)) { + p2 = PMIX_NEW(pmix_locdat_t); + (void)strncpy(p2->pdata.proc.nspace, p->pdata.proc.nspace, PMIX_MAX_NSLEN); + p2->pdata.proc.rank = p->pdata.proc.rank; + (void)strncpy(p2->pdata.key, p->pdata.key, PMIX_MAX_KEYLEN); + pmix_value_xfer(&p2->pdata.value, &p->pdata.value); + pmix_list_append(&results, &p2->super); + break; + } + } + } + if (0 < (n = pmix_list_get_size(&results))) { + ret = PMIX_SUCCESS; + PMIX_PDATA_CREATE(pd, n); + for (i=0; i < n; i++) { + p = (pmix_locdat_t*)pmix_list_remove_first(&results); + if (p) { + (void)strncpy(pd[i].proc.nspace, p->pdata.proc.nspace, PMIX_MAX_NSLEN); + pd[i].proc.rank = p->pdata.proc.rank; + (void)strncpy(pd[i].key, p->pdata.key, PMIX_MAX_KEYLEN); + pmix_value_xfer(&pd[i].value, &p->pdata.value); + } + } + } + PMIX_LIST_DESTRUCT(&results); + if (NULL != cbfunc) { + cbfunc(ret, pd, n, cbdata); + } + if (0 < n) { + PMIX_PDATA_FREE(pd, n); + } + return PMIX_SUCCESS; +} + + +static pmix_status_t unpublish_fn(const pmix_proc_t *proc, char **keys, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + pmix_locdat_t *p, *p2; + size_t n; + + pmix_output(0, "SERVER: UNPUBLISH"); + + for (n=0; NULL != keys[n]; n++) { + PMIX_LIST_FOREACH_SAFE(p, p2, &pubdata, pmix_locdat_t) { + if (0 == strncmp(keys[n], p->pdata.key, PMIX_MAX_KEYLEN)) { + pmix_list_remove_item(&pubdata, &p->super); + PMIX_RELEASE(p); + break; + } + } + } + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + return PMIX_SUCCESS; +} + +static void spcbfunc(pmix_status_t status, void *cbdata) +{ + myxfer_t *x = (myxfer_t*)cbdata; + + if (NULL != x->spcbfunc) { + x->spcbfunc(PMIX_SUCCESS, "DYNSPACE", x->cbdata); + } +} + +static pmix_status_t spawn_fn(const pmix_proc_t *proc, + const pmix_info_t job_info[], size_t ninfo, + const pmix_app_t apps[], size_t napps, + pmix_spawn_cbfunc_t cbfunc, void *cbdata) +{ + myxfer_t *x; + + pmix_output(0, "SERVER: SPAWN"); + + /* in practice, we would pass this request to the local + * resource manager for launch, and then have that server + * execute our callback function. For now, we will fake + * the spawn and just pretend */ + + /* must register the nspace for the new procs before + * we return to the caller */ + x = PMIX_NEW(myxfer_t); + x->spcbfunc = cbfunc; + x->cbdata = cbdata; + + set_namespace(2, "0,1", "DYNSPACE", spcbfunc, x); + + return PMIX_SUCCESS; +} + + +static pmix_status_t connect_fn(const pmix_proc_t procs[], size_t nprocs, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + pmix_output(0, "SERVER: CONNECT"); + + /* in practice, we would pass this request to the local + * resource manager for handling */ + + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + + return PMIX_SUCCESS; +} + + +static pmix_status_t disconnect_fn(const pmix_proc_t procs[], size_t nprocs, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + pmix_output(0, "SERVER: DISCONNECT"); + + /* in practice, we would pass this request to the local + * resource manager for handling */ + + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + + return PMIX_SUCCESS; +} + +static pmix_status_t register_event_fn(pmix_status_t *codes, size_t ncodes, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + return PMIX_SUCCESS; +} + +static pmix_status_t deregister_events(pmix_status_t *codes, size_t ncodes, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + return PMIX_SUCCESS; +} + +static pmix_status_t notify_event(pmix_status_t code, + const pmix_proc_t *source, + pmix_data_range_t range, + pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + return PMIX_SUCCESS; +} + +typedef struct query_data_t { + pmix_info_t *data; + size_t ndata; +} query_data_t; + +static pmix_status_t query_fn(pmix_proc_t *proct, + pmix_query_t *queries, size_t nqueries, + pmix_info_cbfunc_t cbfunc, + void *cbdata) +{ + size_t n; + pmix_info_t *info; + + pmix_output(0, "SERVER: QUERY"); + + if (NULL == cbfunc) { + return PMIX_ERROR; + } + /* keep this simple */ + PMIX_INFO_CREATE(info, nqueries); + for (n=0; n < nqueries; n++) { + (void)strncpy(info[n].key, queries[n].keys[0], PMIX_MAX_KEYLEN); + info[n].value.type = PMIX_STRING; + if (0 > asprintf(&info[n].value.data.string, "%d", (int)n)) { + return PMIX_ERROR; + } + } + cbfunc(PMIX_SUCCESS, info, nqueries, cbdata, NULL, NULL); + return PMIX_SUCCESS; +} + +static void tool_connect_fn(pmix_info_t *info, size_t ninfo, + pmix_tool_connection_cbfunc_t cbfunc, + void *cbdata) +{ + pmix_proc_t proc; + + pmix_output(0, "SERVER: TOOL CONNECT"); + + /* just pass back an arbitrary nspace */ + (void)strncpy(proc.nspace, "TOOL", PMIX_MAX_NSLEN); + proc.rank = 0; + + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, &proc, cbdata); + } +} + +static void log_fn(const pmix_proc_t *client, + const pmix_info_t data[], size_t ndata, + const pmix_info_t directives[], size_t ndirs, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + pmix_output(0, "SERVER: LOG"); + + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } +} + +static void wait_signal_callback(int fd, short event, void *arg) +{ + pmix_event_t *sig = (pmix_event_t*) arg; + int status; + pid_t pid; + wait_tracker_t *t2; + + if (SIGCHLD != event_get_signal(sig)) { + return; + } + + /* we can have multiple children leave but only get one + * sigchild callback, so reap all the waitpids until we + * don't get anything valid back */ + while (1) { + pid = waitpid(-1, &status, WNOHANG); + if (-1 == pid && EINTR == errno) { + /* try it again */ + continue; + } + /* if we got garbage, then nothing we can do */ + if (pid <= 0) { + return; + } + + /* we are already in an event, so it is safe to access the list */ + PMIX_LIST_FOREACH(t2, &children, wait_tracker_t) { + if (pid == t2->pid) { + /* found it! */ + --wakeup; + break; + } + } + } +} diff --git a/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h b/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h index bccb9dc14c..27e1c21e40 100644 --- a/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h +++ b/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h @@ -182,6 +182,7 @@ typedef uint32_t pmix_rank_t; #define PMIX_LOCAL_PROCS "pmix.lprocs" // (pmix_proc_t array) array of pmix_proc_t of procs on the specified node #define PMIX_LOCAL_CPUSETS "pmix.lcpus" // (char*) colon-delimited cpusets of local peers within the specified nspace #define PMIX_PROC_URI "pmix.puri" // (char*) URI containing contact info for proc +#define PMIX_LOCALITY "pmix.loc" // (uint16_t) relative locality of two procs /* size info */ #define PMIX_UNIV_SIZE "pmix.univ.size" // (uint32_t) #procs in this nspace @@ -193,11 +194,18 @@ typedef uint32_t pmix_rank_t; #define PMIX_MAX_PROCS "pmix.max.size" // (uint32_t) max #procs for this job #define PMIX_NUM_NODES "pmix.num.nodes" // (uint32_t) #nodes in this nspace +/* Memory info */ +#define PMIX_AVAIL_PHYS_MEMORY "pmix.pmem" // (uint64_t) total available physical memory on this node +#define PMIX_DAEMON_MEMORY "pmix.dmn.mem" // (float) Mbytes of memory currently used by daemon +#define PMIX_CLIENT_AVG_MEMORY "pmix.cl.mem.avg" // (float) Average Mbytes of memory used by client processes + /* topology info */ #define PMIX_NET_TOPO "pmix.ntopo" // (char*) xml-representation of network topology #define PMIX_LOCAL_TOPO "pmix.ltopo" // (char*) xml-representation of local node topology #define PMIX_NODE_LIST "pmix.nlist" // (char*) comma-delimited list of nodes running procs for this job #define PMIX_TOPOLOGY "pmix.topo" // (hwloc_topology_t) pointer to the PMIx client's internal topology object +#define PMIX_TOPOLOGY_SIGNATURE "pmix.toposig" // (char*) topology signature string +#define PMIX_LOCALITY_STRING "pmix.locstr" // (char*) string describing a proc's location /* request-related info */ #define PMIX_COLLECT_DATA "pmix.collect" // (bool) collect data and return it at the end of the operation @@ -222,6 +230,8 @@ typedef uint32_t pmix_rank_t; #define PMIX_NODE_MAP "pmix.nmap" // (char*) regex of nodes containing procs for this job #define PMIX_PROC_MAP "pmix.pmap" // (char*) regex describing procs on each node within this job #define PMIX_ANL_MAP "pmix.anlmap" // (char*) process mapping in ANL notation (used in PMI-1/PMI-2) +#define PMIX_APP_MAP_TYPE "pmix.apmap.type" // (char*) type of mapping used to layout the application (e.g., cyclic) +#define PMIX_APP_MAP_REGEX "pmix.apmap.regex" // (char*) regex describing the result of the mapping /* attributes used internally to communicate data from the server to the client */ #define PMIX_PROC_BLOB "pmix.pblob" // (pmix_byte_object_t) packed blob of process data @@ -287,12 +297,15 @@ typedef uint32_t pmix_rank_t; #define PMIX_QUERY_DEBUG_SUPPORT "pmix.qry.debug" // return a comma-delimited list of supported debug attributes #define PMIX_QUERY_MEMORY_USAGE "pmix.qry.mem" // return info on memory usage for the procs indicated in the qualifiers #define PMIX_QUERY_LOCAL_ONLY "pmix.qry.local" // constrain the query to local information only +#define PMIX_QUERY_REPORT_AVG "pmix.qry.avg" // report average values +#define PMIX_QUERY_REPORT_MINMAX "pmix.qry.minmax" // report minimum and maximum value /* log attributes */ -#define PMIX_LOG_STDERR "pmix.log.stderr" // (bool) log data to stderr -#define PMIX_LOG_STDOUT "pmix.log.stdout" // (bool) log data to stdout -#define PMIX_LOG_SYSLOG "pmix.log.syslog" // (bool) log data to syslog - defaults to ERROR priority unless - // modified by directive +#define PMIX_LOG_STDERR "pmix.log.stderr" // (char*) log string to stderr +#define PMIX_LOG_STDOUT "pmix.log.stdout" // (char*) log string to stdout +#define PMIX_LOG_SYSLOG "pmix.log.syslog" // (char*) log data to syslog - defaults to ERROR priority unless +#define PMIX_LOG_MSG "pmix.log.msg" // (pmix_byte_object_t) message blob to be sent somewhere + /* debugger attributes */ #define PMIX_DEBUG_STOP_ON_EXEC "pmix.dbg.exec" // (bool) job is being spawned under debugger - instruct it to pause on start #define PMIX_DEBUG_STOP_IN_INIT "pmix.dbg.init" // (bool) instruct job to stop during PMIx init @@ -300,6 +313,15 @@ typedef uint32_t pmix_rank_t; #define PMIX_DEBUG_JOB "pmix.dbg.job" // (char*) nspace of the job to be debugged - the RM/PMIx server are #define PMIX_DEBUG_WAITING_FOR_NOTIFY "pmix.dbg.waiting" // (bool) job to be debugged is waiting for a release +/* Resource Manager identification */ +#define PMIX_RM_NAME "pmix.rm.name" // (char*) string name of the resource manager +#define PMIX_RM_VERSION "pmix.rm.version" // (char*) RM version string + +/* attributes for setting envars */ +#define PMIX_SET_ENVAR "pmix.set.envar" // (char*) string "key=value" value shall be put into the environment +#define PMIX_UNSET_ENVAR "pmix.unset.envar" // (char*) unset envar specified in string + + /**** PROCESS STATE DEFINITIONS ****/ typedef uint8_t pmix_proc_state_t; #define PMIX_PROC_STATE_UNDEF 0 /* undefined process state */ diff --git a/opal/mca/pmix/pmix2x/pmix/include/pmix_server.h b/opal/mca/pmix/pmix2x/pmix/include/pmix_server.h index 9416ab8964..d2145db743 100644 --- a/opal/mca/pmix/pmix2x/pmix/include/pmix_server.h +++ b/opal/mca/pmix/pmix2x/pmix/include/pmix_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science @@ -483,6 +483,34 @@ pmix_status_t PMIx_server_dmodex_request(const pmix_proc_t *proc, pmix_dmodex_response_fn_t cbfunc, void *cbdata); +/* define a callback function for the setup_application API. The returned info + * array is owned by the PMIx server library and will be free'd when the + * provided cbfunc is called. */ +typedef void (*pmix_setup_application_cbfunc_t)(pmix_status_t status, + pmix_info_t info[], size_t ninfo, + void *provided_cbdata, + pmix_op_cbfunc_t cbfunc, void *cbdata); + +/* Provide a function by which the resource manager can request + * any application-specific environmental variables prior to + * launch of an application. For example, network libraries may + * opt to provide security credentials for the application. This + * is defined as a non-blocking operation in case network + * libraries need to perform some action before responding. The + * returned env will be distributed along with the application */ +pmix_status_t PMIx_server_setup_application(const char nspace[], + pmix_info_t info[], size_t ninfo, + pmix_setup_application_cbfunc_t cbfunc, void *cbdata); + +/* Provide a function by which the local PMIx server can perform + * any application-specific operations prior to spawning local + * clients of a given application. For example, a network library + * might need to setup the local driver for "instant on" addressing. + */ +pmix_status_t PMIx_server_setup_local_support(const char nspace[], + pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); + #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/opal/mca/pmix/pmix2x/pmix/include/pmix_version.h.in b/opal/mca/pmix/pmix2x/pmix/include/pmix_version.h.in index 3c565a3feb..aeb51a9e83 100644 --- a/opal/mca/pmix/pmix2x/pmix/include/pmix_version.h.in +++ b/opal/mca/pmix/pmix2x/pmix/include/pmix_version.h.in @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/copy.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c index f80ed83e30..adae733c6d 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c @@ -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) 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 IBM Corporation. All rights reserved. @@ -1221,7 +1221,7 @@ pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest, pd = (pmix_pdata_t*)p->array; sd = (pmix_pdata_t*)src->array; for (n=0; n < src->size; n++) { - PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value, sd[n].value.type); + PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value.data, sd[n].value.type); } break; case PMIX_BUFFER: diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal.h b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal.h index e3702549aa..2d91e1533c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal.h +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal.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-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 IBM Corporation. All rights reserved. @@ -45,12 +45,12 @@ /* * The default starting chunk size */ -#define PMIX_BFROP_DEFAULT_INITIAL_SIZE 128 +#define PMIX_BFROP_DEFAULT_INITIAL_SIZE 2048 /* * The default threshold size when we switch from doubling the * buffer size to addatively increasing it */ -#define PMIX_BFROP_DEFAULT_THRESHOLD_SIZE 1024 +#define PMIX_BFROP_DEFAULT_THRESHOLD_SIZE 4096 /* * Internal type corresponding to size_t. Do not use this in diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal_functions.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal_functions.c index c8b4bc70e6..e7ea14eff1 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal_functions.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/internal_functions.c @@ -9,8 +9,10 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2017 Los Alamos National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,6 +40,7 @@ char* pmix_bfrop_buffer_extend(pmix_buffer_t *buffer, size_t bytes_to_add) { size_t required, to_alloc; size_t pack_offset, unpack_offset; + char *tmp; /* Check to see if we have enough space already */ @@ -47,35 +50,27 @@ char* pmix_bfrop_buffer_extend(pmix_buffer_t *buffer, size_t bytes_to_add) required = buffer->bytes_used + bytes_to_add; if (required >= pmix_bfrop_threshold_size) { - to_alloc = ((required + pmix_bfrop_threshold_size - 1) - / pmix_bfrop_threshold_size) * pmix_bfrop_threshold_size; + to_alloc = (required + pmix_bfrop_threshold_size - 1) & ~(pmix_bfrop_threshold_size - 1); } else { - to_alloc = buffer->bytes_allocated; - if(0 == to_alloc) { - to_alloc = pmix_bfrop_initial_size; - } + to_alloc = buffer->bytes_allocated ? buffer->bytes_allocated : pmix_bfrop_initial_size; while(to_alloc < required) { to_alloc <<= 1; } } - if (NULL != buffer->base_ptr) { - pack_offset = ((char*) buffer->pack_ptr) - ((char*) buffer->base_ptr); - unpack_offset = ((char*) buffer->unpack_ptr) - - ((char*) buffer->base_ptr); - buffer->base_ptr = (char*)realloc(buffer->base_ptr, to_alloc); - memset(buffer->base_ptr + pack_offset, 0, to_alloc - buffer->bytes_allocated); - } else { - pack_offset = 0; - unpack_offset = 0; - buffer->bytes_used = 0; - buffer->base_ptr = (char*)malloc(to_alloc); - memset(buffer->base_ptr, 0, to_alloc); - } - - if (NULL == buffer->base_ptr) { + pack_offset = ((char*) buffer->pack_ptr) - ((char*) buffer->base_ptr); + unpack_offset = ((char*) buffer->unpack_ptr) - ((char*) buffer->base_ptr); + tmp = (char*)realloc(buffer->base_ptr, to_alloc); + if (NULL == tmp) { return NULL; } + + buffer->base_ptr = tmp; + + /* This memset is meant to keep valgrind happy. If possible it should be removed + * in the future. */ + memset(buffer->base_ptr + pack_offset, 0, to_alloc - buffer->bytes_allocated); + buffer->pack_ptr = ((char*) buffer->base_ptr) + pack_offset; buffer->unpack_ptr = ((char*) buffer->base_ptr) + unpack_offset; buffer->bytes_allocated = to_alloc; @@ -117,6 +112,5 @@ pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type) { - int32_t n=1; - return pmix_bfrop_unpack_datatype(buffer, type, &n, PMIX_DATA_TYPE); + return pmix_bfrop_unpack_datatype(buffer, type, &(int32_t){1}, PMIX_DATA_TYPE); } diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/open_close.c b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/open_close.c index eabe0da7f3..35cdb4b82c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/open_close.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/open_close.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-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 IBM Corporation. All rights reserved. @@ -174,7 +174,7 @@ pmix_status_t pmix_bfrop_open(void) } pmix_bfrop_num_reg_types = PMIX_UNDEF; pmix_bfrop_threshold_size = PMIX_BFROP_DEFAULT_THRESHOLD_SIZE; - pmix_bfrop_initial_size = 1; + pmix_bfrop_initial_size = PMIX_BFROP_DEFAULT_INITIAL_SIZE; /* Register all the supported types */ PMIX_REGISTER_TYPE("PMIX_BOOL", PMIX_BOOL, diff --git a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/types.h b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/types.h index 5a1f7c8b94..073ac0ddad 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/types.h +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/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-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow 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 c6fe22f802..661b7bed2b 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c +++ b/opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c @@ -10,7 +10,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-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. @@ -688,7 +688,6 @@ 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; @@ -1275,9 +1274,6 @@ pmix_status_t pmix_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest, case PMIX_COMPRESSED_STRING: nbytes = sizeof(pmix_byte_object_t); break; - case PMIX_INFO: - nbytes = sizeof(pmix_info_t); - break; case PMIX_PERSIST: nbytes = sizeof(pmix_persistence_t); break; diff --git a/opal/mca/pmix/pmix2x/pmix/src/class/pmix_hash_table.c b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_hash_table.c index 971ed4e478..46ecdd762c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/class/pmix_hash_table.c +++ b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_hash_table.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/class/pmix_list.c b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_list.c index dd2bb3f2ab..169f7a989e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/class/pmix_list.c +++ b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_list.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Voltaire All rights reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/class/pmix_list.h b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_list.h index c0b0a33105..448d43d5e1 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/class/pmix_list.h +++ b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_list.h @@ -13,7 +13,7 @@ * Copyright (c) 2007 Voltaire All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/class/pmix_object.c b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_object.c index b09ad9d97a..8c0352075a 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/class/pmix_object.c +++ b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_object.c @@ -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) 2014-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2017 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/class/pmix_value_array.c b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_value_array.c index 166759beee..0eeb0812af 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/class/pmix_value_array.c +++ b/opal/mca/pmix/pmix2x/pmix/src/class/pmix_value_array.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/client/Makefile.include index f7a7ddefbd..c6b4e88ef5 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/Makefile.include +++ b/opal/mca/pmix/pmix2x/pmix/src/client/Makefile.include @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2014-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. # Copyright (c) 2014 Artem Y. Polyakov . # All rights reserved. # Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. 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 e70d5782c4..ebe5788412 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client.c @@ -575,6 +575,8 @@ static void _putfn(int sd, short args, void *cbdata) if (NULL == tmp) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); rc = PMIX_ERR_NOMEM; + PMIX_ERROR_LOG(rc); + goto done; } kv->value->type = PMIX_COMPRESSED_STRING; kv->value->data.bo.bytes = (char*)tmp; 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 644931bda5..5b7ff86b27 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-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2017 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 . diff --git a/opal/mca/pmix/pmix2x/pmix/src/common/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/common/Makefile.include index 1403813f4d..cb63de841b 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/common/Makefile.include +++ b/opal/mca/pmix/pmix2x/pmix/src/common/Makefile.include @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2015-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. # Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # 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 8e7d5e11e4..e655606419 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 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -157,7 +157,7 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) proc_type_str, nspace); /* check buf data */ - if ((NULL == job_data) && (0 != job_data->bytes_used)) { + if ((NULL == job_data) || (0 == job_data->bytes_used)) { rc = PMIX_ERR_BAD_PARAM; PMIX_ERROR_LOG(rc); return rc; @@ -269,21 +269,6 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) PMIX_DESTRUCT(&kv); goto exit; } - /* if the value contains a string that is longer than the - * limit, then compress it */ - if (PMIX_STRING_SIZE_CHECK(kv.value)) { - if (pmix_util_compress_string(kv.value->data.string, &tmp, &len)) { - if (NULL == tmp) { - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - rc = PMIX_ERR_NOMEM; - goto exit; - } - kv.value->type = PMIX_COMPRESSED_STRING; - free(kv.value->data.string); - kv.value->data.bo.bytes = (char*)tmp; - kv.value->data.bo.size = len; - } - } /* the name of the node is in the key, and the value is * a comma-delimited list of procs on that node. See if we already * have this node */ @@ -297,6 +282,12 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) if (NULL == nrec) { /* Create a node record and store that list */ nrec = PMIX_NEW(pmix_nrec_t); + if (NULL == nrec) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + PMIX_DESTRUCT(&buf2); + PMIX_DESTRUCT(&kv); + goto exit; + } nrec->name = strdup(kv.key); pmix_list_append(&nsptr->nodes, &nrec->super); } else { @@ -381,12 +372,9 @@ static inline pmix_status_t _job_data_store(const char *nspace, void *cbdata) #if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) if (NULL != cb->dstore_fn) { - uint32_t size = (uint32_t)pmix_value_array_get_size(cb->bufs); - for (i = 0; i < size; i++) { - if (PMIX_SUCCESS != (rc = _rank_key_dstore_store(cbdata))) { - PMIX_ERROR_LOG(rc); - goto exit; - } + if (PMIX_SUCCESS != (rc = _rank_key_dstore_store(cbdata))) { + PMIX_ERROR_LOG(rc); + goto exit; } } #endif diff --git a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_query.c b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_query.c index 7f426203a3..2dc7bc11da 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/common/pmix_query.c +++ b/opal/mca/pmix/pmix2x/pmix/src/common/pmix_query.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-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -78,11 +78,7 @@ static void query_cbfunc(struct pmix_peer_t *peer, cnt = results->ninfo; if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, results->info, &cnt, PMIX_INFO))) { PMIX_ERROR_LOG(rc); - pmix_output(0, "TYPE: %d", results->info[0].value.type); - results->status = rc; - PMIX_INFO_FREE(results->info, results->ninfo); - results->info = NULL; - results->ninfo = 0; + goto complete; } } diff --git a/opal/mca/pmix/pmix2x/pmix/src/dstore/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/dstore/Makefile.include index 465071084f..a86441154c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/dstore/Makefile.include +++ b/opal/mca/pmix/pmix2x/pmix/src/dstore/Makefile.include @@ -1,6 +1,6 @@ # Copyright (c) 2015-2016 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2016 Intel, Inc. 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/dstore/pmix_dstore.c b/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_dstore.c index 8a18bd3a59..414ca3bfdc 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_dstore.c +++ b/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_dstore.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/dstore/pmix_esh.h b/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_esh.h index 0109547208..1f0fb4d561 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_esh.h +++ b/opal/mca/pmix/pmix2x/pmix/src/dstore/pmix_esh.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2015-2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/event/pmix_event_notification.c b/opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_notification.c index 85c43063ec..bf39c43dea 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 @@ -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-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -438,15 +438,6 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) return; } -/* just a simple tracker so we know who we notified */ -typedef struct pmix_event_trkr_t { - pmix_list_item_t super; - pmix_peer_t *peer; -} pmix_event_trkr_t; -static PMIX_CLASS_INSTANCE(pmix_event_trkr_t, - pmix_list_item_t, - NULL, NULL); - static void _notify_client_event(int sd, short args, void *cbdata) { @@ -455,9 +446,7 @@ static void _notify_client_event(int sd, short args, void *cbdata) pmix_regevents_info_t *reginfoptr; pmix_peer_events_info_t *pr; size_t n; - bool matched, notify;; - pmix_list_t recips; - pmix_event_trkr_t *trkr; + bool matched; pmix_output_verbose(2, pmix_globals.debug_output, "pmix_server: _notify_error notifying clients of error %s", @@ -477,7 +466,6 @@ static void _notify_client_event(int sd, short args, void *cbdata) /* cycle across our registered events and send the message to * any client who registered for it */ - PMIX_CONSTRUCT(&recips, pmix_list_t); PMIX_LIST_FOREACH(reginfoptr, &pmix_server_globals.events, pmix_regevents_info_t) { if ((PMIX_MAX_ERR_CONSTANT == reginfoptr->code && !cd->nondefault) || cd->status == reginfoptr->code) { @@ -506,30 +494,14 @@ static void _notify_client_event(int sd, short args, void *cbdata) continue; } } - /* if we have already notified this client, then don't do it again */ - notify = true; - PMIX_LIST_FOREACH(trkr, &recips, pmix_event_trkr_t) { - if (trkr->peer == pr->peer) { - notify = false; - break; - } - } - if (!notify) { - continue; - } - /* add this peer to the list of prior recipients */ - trkr = PMIX_NEW(pmix_event_trkr_t); - trkr->peer = pr->peer; - pmix_list_append(&recips, &trkr->super); pmix_output_verbose(2, pmix_globals.debug_output, - "pmix_server: notifying client %s:%d of code %d", - pr->peer->info->nptr->nspace, pr->peer->info->rank, cd->status); + "pmix_server: notifying client %s:%d", + pr->peer->info->nptr->nspace, pr->peer->info->rank); PMIX_RETAIN(cd->buf); PMIX_SERVER_QUEUE_REPLY(pr->peer, 0, cd->buf); } } } - PMIX_LIST_DESTRUCT(&recips); /* notify the caller */ if (NULL != cd->cbfunc) { @@ -558,8 +530,8 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, size_t n; pmix_output_verbose(2, pmix_globals.debug_output, - "pmix_server: notify client of event %s with %lu ninfos", - PMIx_Error_string(status), ninfo); + "pmix_server: notify client of event %s", + PMIx_Error_string(status)); cd = PMIX_NEW(pmix_notify_caddy_t); cd->status = status; diff --git a/opal/mca/pmix/pmix2x/pmix/src/include/align.h b/opal/mca/pmix/pmix2x/pmix/src/include/align.h index 354e2760c6..d5cbbfeffe 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/include/align.h +++ b/opal/mca/pmix/pmix2x/pmix/src/include/align.h @@ -12,7 +12,7 @@ * Copyright (c) 2006 Voltaire All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * - * Copyright (c) 2016 Intel, Inc. 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/include/hash_string.h b/opal/mca/pmix/pmix2x/pmix/src/include/hash_string.h index 1f5dedcdfe..27273c48d8 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/include/hash_string.h +++ b/opal/mca/pmix/pmix2x/pmix/src/include/hash_string.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. 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/include/pmix_config_top.h b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_config_top.h index aeefec4ad7..5e4ff40964 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_config_top.h +++ b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_config_top.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * diff --git a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_jobdata.h b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_jobdata.h index 581223cd21..b8318f9c46 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_jobdata.h +++ b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_jobdata.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/include/pmix_socket_errno.h b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_socket_errno.h index e0619bac17..788f6e50d1 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_socket_errno.h +++ b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_socket_errno.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-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/include/prefetch.h b/opal/mca/pmix/pmix2x/pmix/src/include/prefetch.h index c01f31f748..725c3687dd 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/include/prefetch.h +++ b/opal/mca/pmix/pmix2x/pmix/src/include/prefetch.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/base/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/base/Makefile.am index 8de612d928..da006f7788 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/base/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/base/Makefile.am @@ -10,7 +10,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2010-2016 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016 Intel, Inc. 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/mca/base/help-mca-base.txt b/opal/mca/pmix/pmix2x/pmix/src/mca/base/help-mca-base.txt index 32e00ef35a..2f90456c09 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/base/help-mca-base.txt +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/base/help-mca-base.txt @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016 Intel, Inc. 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/mca/base/help-mca-var.txt b/opal/mca/pmix/pmix2x/pmix/src/mca/base/help-mca-var.txt index 9000837dd2..23ed149b02 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/base/help-mca-var.txt +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/base/help-mca-var.txt @@ -13,7 +13,7 @@ # Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2016 Intel, Inc. 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/mca/base/pmix_mca_base_component_compare.c b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_component_compare.c index 78ae2781a9..cc8dfc497e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_component_compare.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_component_compare.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow 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 03ae705735..bbf159454b 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 @@ -13,7 +13,7 @@ * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2015 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) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -1926,7 +1926,7 @@ static char *source_name(pmix_mca_base_var_t *var) static int var_value_string (pmix_mca_base_var_t *var, char **value_string) { - const pmix_mca_base_var_storage_t *value=NULL; + pmix_mca_base_var_storage_t *value=NULL; int ret; assert (PMIX_MCA_BASE_VAR_TYPE_MAX > var->mbv_type); diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/Makefile.am index 3e130185e0..735036e567 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/Makefile.am @@ -3,7 +3,7 @@ # University Research and Technology # Corporation. All rights reserved. # Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016 Intel, Inc. 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/mca/pdl/base/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/base/Makefile.am index a38047a09d..ffa50be601 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/base/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/base/Makefile.am @@ -1,6 +1,6 @@ # # Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016 Intel, Inc. 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/mca/pdl/base/pdl_base_select.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/base/pdl_base_select.c index 78b88f48f6..3d8a24a817 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/base/pdl_base_select.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/base/pdl_base_select.c @@ -4,7 +4,7 @@ * All rights reserved. * * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdl.h b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdl.h index 2d98c621bd..b5fa1136a9 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdl.h +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdl.h @@ -3,7 +3,7 @@ * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. 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/mca/pdl/pdlopen/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdlopen/Makefile.am index cd31f80679..0e8bd27766 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdlopen/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdlopen/Makefile.am @@ -2,7 +2,7 @@ # Copyright (c) 2004-2010 The Trustees of Indiana University. # All rights reserved. # Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016 Intel, Inc. 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/mca/pdl/pdlopen/configure.m4 b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdlopen/configure.m4 index 824d2dc9ee..3eea7d5615 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdlopen/configure.m4 +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdlopen/configure.m4 @@ -4,7 +4,7 @@ # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. # -# Copyright (c) 2016 Intel, Inc. 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/mca/pdl/pdlopen/pdl_pdlopen_component.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_component.c index e93bc408ec..6cccfaeffe 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_component.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_component.c @@ -3,7 +3,7 @@ * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. 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/mca/pif/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/Makefile.am index b3438bff21..64b212e0f9 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pif/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/Makefile.am @@ -1,6 +1,6 @@ # # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016 Intel, Inc. 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/mca/pif/bsdx_ipv4/pif_bsdx.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c index e94da9d975..e7f2a1e734 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c index 5289834727..1b3699d9cd 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/mca/pif/linux_ipv6/pif_linux_ipv6.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c index dc19ec1a45..911a09070f 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/mca/pif/posix_ipv4/pif_posix.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/posix_ipv4/pif_posix.c index e0028e9787..f6ea0b38a4 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pif/posix_ipv4/pif_posix.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pif/posix_ipv4/pif_posix.c @@ -4,7 +4,7 @@ * Copyright (c) 2013 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/base/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/base/Makefile.am index 7f31473a17..29055b0284 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/base/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/base/Makefile.am @@ -1,7 +1,7 @@ # # Copyright (c) 2006 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2016 Intel, Inc. 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/mca/pinstalldirs/config/configure.m4 b/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/config/configure.m4 index c057b438d0..562ad7f4f7 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/config/configure.m4 +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/config/configure.m4 @@ -3,7 +3,7 @@ # Copyright (c) 2006 Los Alamos National Security, LLC. All rights # reserved. # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016 Intel, Inc. All rights reserved +# Copyright (c) 2016-2017 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/mca/pinstalldirs/env/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/env/Makefile.am index cc22cf173a..0e03ed2e0a 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/env/Makefile.am +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/env/Makefile.am @@ -3,7 +3,7 @@ # reserved. # Copyright (c) 2009 High Performance Computing Center Stuttgart, # University of Stuttgart. All rights reserved. -# Copyright (c) 2016 Intel, Inc. 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/mca/pinstalldirs/env/configure.m4 b/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/env/configure.m4 index 47e18c3c51..600897a0a4 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/env/configure.m4 +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pinstalldirs/env/configure.m4 @@ -3,7 +3,7 @@ # Copyright (c) 2006 Los Alamos National Security, LLC. All rights # reserved. # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016 Intel, Inc. All rights reserved +# Copyright (c) 2016-2017 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/mca/pnet/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/Makefile.am new file mode 100644 index 0000000000..e7e0e8d35f --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/Makefile.am @@ -0,0 +1,44 @@ +# -*- 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-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +AM_CPPFLAGS = $(LTDLINCL) + +# main library setup +noinst_LTLIBRARIES = libmca_pnet.la +libmca_pnet_la_SOURCES = + +# local files +headers = pnet.h +sources = + +# Conditionally install the header files +if WANT_INSTALL_HEADERS +pmixdir = $(pmixincludedir)/$(subdir) +nobase_pmix_HEADERS = $(headers) +endif + +include base/Makefile.include + +libmca_pnet_la_SOURCES += $(headers) $(sources) + +distclean-local: + rm -f base/static-components.h diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/Makefile.include new file mode 100644 index 0000000000..20f030174d --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/Makefile.include @@ -0,0 +1,32 @@ +# -*- 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-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This makefile.am does not stand on its own - it is included from +# src/Makefile.am + +headers += \ + base/base.h + +sources += \ + base/pnet_base_frame.c \ + base/pnet_base_select.c \ + base/pnet_base_fns.c diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/base.h b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/base.h new file mode 100644 index 0000000000..082b4bf9a0 --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/base.h @@ -0,0 +1,91 @@ +/* -*- C -*- + * + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2006 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. + * Copyright (c) 2014-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 + * + * $HEADER$ + * + */ +#ifndef PMIX_PNET_BASE_H_ +#define PMIX_PNET_BASE_H_ + +#include + + +#ifdef HAVE_SYS_TIME_H +#include /* for struct timeval */ +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "src/class/pmix_list.h" +#include "src/class/pmix_pointer_array.h" +#include "src/mca/mca.h" +#include "src/mca/base/pmix_mca_base_framework.h" + +#include "src/mca/pnet/pnet.h" + + +BEGIN_C_DECLS + +/* + * MCA Framework + */ +extern pmix_mca_base_framework_t pmix_pnet_base_framework; +/** + * PNET select function + * + * Cycle across available components and construct the list + * of active modules + */ +pmix_status_t pmix_pnet_base_select(void); + +/** + * Track an active component / module + */ +struct pmix_pnet_base_active_module_t { + pmix_list_item_t super; + int pri; + pmix_pnet_module_t *module; + pmix_pnet_base_component_t *component; +}; +typedef struct pmix_pnet_base_active_module_t pmix_pnet_base_active_module_t; +PMIX_CLASS_DECLARATION(pmix_pnet_base_active_module_t); + + +/* framework globals */ +struct pmix_pnet_globals_t { + pmix_list_t actives; + bool initialized; +}; +typedef struct pmix_pnet_globals_t pmix_pnet_globals_t; + +extern pmix_pnet_globals_t pmix_pnet_globals; + +pmix_status_t pmix_pnet_base_setup_app(char *nspace, pmix_list_t *ilist); +pmix_status_t pmix_pnet_base_setup_local_network(char *nspace, + pmix_info_t info[], + size_t ninfo); +pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *peer, char ***env); +void pmix_pnet_base_child_finalized(pmix_peer_t *peer); +void pmix_pnet_base_local_app_finalized(char *nspace); + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_fns.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_fns.c new file mode 100644 index 0000000000..4ce0f0b93f --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_fns.c @@ -0,0 +1,146 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016 Mellanox Technologies, Inc. + * All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#include +#include "src/include/pmix_globals.h" + +#include "src/class/pmix_list.h" +#include "src/util/error.h" + +#include "src/mca/pnet/base/base.h" + + +pmix_status_t pmix_pnet_base_setup_app(char *nspace, pmix_list_t *ilist) +{ + pmix_pnet_base_active_module_t *active; + pmix_status_t rc; + + if (!pmix_pnet_globals.initialized) { + return PMIX_ERR_INIT; + } + + /* protect against bozo inputs */ + if (NULL == nspace || NULL == ilist) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { + if (NULL != active->module->setup_app) { + if (PMIX_SUCCESS != (rc = active->module->setup_app(nspace, ilist))) { + return rc; + } + } + } + + return PMIX_SUCCESS; +} + +pmix_status_t pmix_pnet_base_setup_local_network(char *nspace, + pmix_info_t info[], + size_t ninfo) +{ + pmix_pnet_base_active_module_t *active; + pmix_status_t rc; + + if (!pmix_pnet_globals.initialized) { + return PMIX_ERR_INIT; + } + + /* protect against bozo inputs */ + if (NULL == nspace) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { + if (NULL != active->module->setup_local_network) { + if (PMIX_SUCCESS != (rc = active->module->setup_local_network(nspace, info, ninfo))) { + return rc; + } + } + } + + return PMIX_SUCCESS; +} + +pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *peer, char ***env) +{ + pmix_pnet_base_active_module_t *active; + pmix_status_t rc; + + if (!pmix_pnet_globals.initialized) { + return PMIX_ERR_INIT; + } + + /* protect against bozo inputs */ + if (NULL == peer || NULL == env) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { + if (NULL != active->module->setup_fork) { + if (PMIX_SUCCESS != (rc = active->module->setup_fork(peer, env))) { + return rc; + } + } + } + + return PMIX_SUCCESS; +} + +void pmix_pnet_base_child_finalized(pmix_peer_t *peer) +{ + pmix_pnet_base_active_module_t *active; + + if (!pmix_pnet_globals.initialized) { + return; + } + + /* protect against bozo inputs */ + if (NULL == peer) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + return; + } + + PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { + if (NULL != active->module->child_finalized) { + active->module->child_finalized(peer); + } + } + + return; +} + +void pmix_pnet_base_local_app_finalized(char *nspace) +{ + pmix_pnet_base_active_module_t *active; + + if (!pmix_pnet_globals.initialized) { + return; + } + + /* protect against bozo inputs */ + if (NULL == nspace) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + return; + } + + PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { + if (NULL != active->module->local_app_finalized) { + active->module->local_app_finalized(nspace); + } + } + + return; +} diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_frame.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_frame.c new file mode 100644 index 0000000000..b0890ff6b3 --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_frame.c @@ -0,0 +1,93 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. + * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +/** @file: + * + */ +#include + +#include + +#ifdef HAVE_STRING_H +#include +#endif + +#include "src/class/pmix_list.h" +#include "src/mca/base/base.h" +#include "src/mca/pnet/base/base.h" + +/* + * The following file was created by configure. It contains extern + * statements and the definition of an array of pointers to each + * component's public mca_base_component_t struct. + */ + +#include "src/mca/pnet/base/static-components.h" + +/* Instantiate the global vars */ +pmix_pnet_globals_t pmix_pnet_globals = {{{0}}}; +pmix_pnet_module_t pmix_pnet = { + .setup_app = pmix_pnet_base_setup_app, + .setup_local_network = pmix_pnet_base_setup_local_network, + .setup_fork = pmix_pnet_base_setup_fork, + .child_finalized = pmix_pnet_base_child_finalized, + .local_app_finalized = pmix_pnet_base_local_app_finalized +}; + +static pmix_status_t pmix_pnet_close(void) +{ + pmix_pnet_base_active_module_t *active, *prev; + + if (!pmix_pnet_globals.initialized) { + return PMIX_SUCCESS; + } + pmix_pnet_globals.initialized = false; + + PMIX_LIST_FOREACH_SAFE(active, prev, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { + pmix_list_remove_item(&pmix_pnet_globals.actives, &active->super); + if (NULL != active->module->finalize) { + active->module->finalize(); + } + PMIX_RELEASE(active); + } + PMIX_DESTRUCT(&pmix_pnet_globals.actives); + + return pmix_mca_base_framework_components_close(&pmix_pnet_base_framework, NULL); +} + +static pmix_status_t pmix_pnet_open(pmix_mca_base_open_flag_t flags) +{ + /* initialize globals */ + pmix_pnet_globals.initialized = true; + PMIX_CONSTRUCT(&pmix_pnet_globals.actives, pmix_list_t); + + /* Open up all available components */ + return pmix_mca_base_framework_components_open(&pmix_pnet_base_framework, flags); +} + +PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, pnet, "PMIx Network Operations", + NULL, pmix_pnet_open, pmix_pnet_close, + mca_pnet_base_static_components, 0); + +PMIX_CLASS_INSTANCE(pmix_pnet_base_active_module_t, + pmix_list_item_t, + NULL, NULL); diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_select.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_select.c new file mode 100644 index 0000000000..83149ea0ef --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/base/pnet_base_select.c @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include + +#include + +#include "src/mca/mca.h" +#include "src/mca/base/base.h" + +#include "src/mca/pnet/base/base.h" + +static bool selected = false; + +/* Function for selecting a prioritized list of components + * from all those that are available. */ +int pmix_pnet_base_select(void) +{ + pmix_mca_base_component_list_item_t *cli = NULL; + pmix_mca_base_component_t *component = NULL; + pmix_mca_base_module_t *module = NULL; + pmix_pnet_module_t *nmodule; + pmix_pnet_base_active_module_t *newmodule, *mod; + int rc, priority; + bool inserted; + + if (selected) { + /* ensure we don't do this twice */ + return PMIX_SUCCESS; + } + selected = true; + + /* Query all available components and ask if they have a module */ + PMIX_LIST_FOREACH(cli, &pmix_pnet_base_framework.framework_components, pmix_mca_base_component_list_item_t) { + component = (pmix_mca_base_component_t *) cli->cli_component; + + pmix_output_verbose(5, pmix_pnet_base_framework.framework_output, + "mca:pnet:select: checking available component %s", component->pmix_mca_component_name); + + /* If there's no query function, skip it */ + if (NULL == component->pmix_mca_query_component) { + pmix_output_verbose(5, pmix_pnet_base_framework.framework_output, + "mca:pnet:select: Skipping component [%s]. It does not implement a query function", + component->pmix_mca_component_name ); + continue; + } + + /* Query the component */ + pmix_output_verbose(5, pmix_pnet_base_framework.framework_output, + "mca:pnet:select: Querying component [%s]", + component->pmix_mca_component_name); + rc = component->pmix_mca_query_component(&module, &priority); + + /* If no module was returned, then skip component */ + if (PMIX_SUCCESS != rc || NULL == module) { + pmix_output_verbose(5, pmix_pnet_base_framework.framework_output, + "mca:pnet:select: Skipping component [%s]. Query failed to return a module", + component->pmix_mca_component_name ); + continue; + } + + /* If we got a module, keep it */ + nmodule = (pmix_pnet_module_t*) module; + /* let it initialize */ + if (NULL != nmodule->init && PMIX_SUCCESS != nmodule->init()) { + continue; + } + /* add to the list of selected modules */ + newmodule = PMIX_NEW(pmix_pnet_base_active_module_t); + newmodule->pri = priority; + newmodule->module = nmodule; + newmodule->component = (pmix_pnet_base_component_t*)cli->cli_component; + + /* maintain priority order */ + inserted = false; + PMIX_LIST_FOREACH(mod, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { + if (priority > mod->pri) { + pmix_list_insert_pos(&pmix_pnet_globals.actives, + (pmix_list_item_t*)mod, &newmodule->super); + inserted = true; + break; + } + } + if (!inserted) { + /* must be lowest priority - add to end */ + pmix_list_append(&pmix_pnet_globals.actives, &newmodule->super); + } + } + + if (4 < pmix_output_get_verbosity(pmix_pnet_base_framework.framework_output)) { + pmix_output(0, "Final pnet priorities"); + /* show the prioritized list */ + PMIX_LIST_FOREACH(mod, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { + pmix_output(0, "\tpnet: %s Priority: %d", mod->component->base.pmix_mca_component_name, mod->pri); + } + } + + return PMIX_SUCCESS;; +} diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/Makefile.am b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/Makefile.am new file mode 100644 index 0000000000..637a93ef00 --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/Makefile.am @@ -0,0 +1,54 @@ +# -*- 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-2017 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +AM_CPPFLAGS = $(pnet_opa_CPPFLAGS) + +headers = pnet_opa.h +sources = \ + pnet_opa_component.c \ + pnet_opa.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_pnet_opa_DSO +lib = +lib_sources = +component = mca_pnet_opa.la +component_sources = $(headers) $(sources) +else +lib = libmca_pnet_opa.la +lib_sources = $(headers) $(sources) +component = +component_sources = +endif + +mcacomponentdir = $(pmixlibdir) +mcacomponent_LTLIBRARIES = $(component) +mca_pnet_opa_la_SOURCES = $(component_sources) +mca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS) +mca_pnet_opa_la_LDFLAGS = -module -avoid-version $(pnet_opa_LDFLAGS) + +noinst_LTLIBRARIES = $(lib) +libmca_pnet_opa_la_SOURCES = $(lib_sources) +libmca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS) +libmca_pnet_opa_la_LDFLAGS = -module -avoid-version $(pnet_opa_LDFLAGS diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/configure.m4 b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/configure.m4 new file mode 100644 index 0000000000..a1864a9a17 --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/configure.m4 @@ -0,0 +1,42 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2013 Sandia National Laboratories. All rights reserved. +# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_pnet_opa_CONFIG([action-if-can-compile], +# [action-if-cant-compile]) +# ------------------------------------------------ +AC_DEFUN([MCA_pmix_pnet_opa_CONFIG],[ + AC_CONFIG_FILES([src/mca/pnet/opa/Makefile]) + + PMIX_CHECK_PSM2([pnet_opa], + [pnet_opa_happy="yes"], + [pnet_opa_happy="no"]) + + AS_IF([test "$pnet_opa_happy" = "yes"], + [$1], + [$2]) + + # substitute in the things needed to build psm2 + AC_SUBST([pnet_opa_CFLAGS]) + AC_SUBST([pnet_opa_CPPFLAGS]) + AC_SUBST([pnet_opa_LDFLAGS]) + AC_SUBST([pnet_opa_LIBS]) +])dnl diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa.c new file mode 100644 index 0000000000..598930e35f --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa.c @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#include + +#include + +#include "src/mca/base/pmix_mca_base_var.h" +#include "src/include/pmix_socket_errno.h" +#include "src/include/pmix_globals.h" +#include "src/class/pmix_list.h" +#include "src/util/alfg.h" +#include "src/util/argv.h" +#include "src/util/error.h" +#include "src/util/output.h" +#include "src/util/pmix_environ.h" + +#include "src/mca/pnet/pnet.h" +#include "pnet_opa.h" + +static pmix_status_t opa_init(void); +static void opa_finalize(void); +static pmix_status_t setup_app(char *nspace, pmix_list_t *ilist); +static pmix_status_t setup_local_network(char *nspace, + pmix_info_t info[], + size_t ninfo); +static pmix_status_t setup_fork(const pmix_proc_t *peer, char ***env); +static void child_finalized(pmix_peer_t *peer); +static void local_app_finalized(char *nspace); + +pmix_pnet_module_t pmix_opa_module = { + .init = opa_init, + .finalize = opa_finalize, + .setup_app = setup_app, + .setup_local_network = setup_local_network, + .setup_fork = setup_fork, + .child_finalized = child_finalized, + .local_app_finalized = local_app_finalized +}; + +static pmix_status_t opa_init(void) +{ + pmix_output_verbose(2, pmix_globals.debug_output, + "pnet: opa init"); + return PMIX_SUCCESS; +} + +static void opa_finalize(void) +{ + pmix_output_verbose(2, pmix_globals.debug_output, + "pnet: opa finalize"); +} + +/* some network transports require a little bit of information to + * "pre-condition" them - i.e., to setup their individual transport + * connections so they can generate their endpoint addresses. This + * function provides a means for doing so. The resulting info is placed + * into the app_context's env array so it will automatically be pushed + * into the environment of every MPI process when launched. + */ + +static inline void transports_use_rand(uint64_t* unique_key) { + pmix_rng_buff_t rng; + pmix_srand(&rng,(unsigned int)time(NULL)); + unique_key[0] = pmix_rand(&rng); + unique_key[1] = pmix_rand(&rng); +} + +static char* transports_print(uint64_t *unique_key) +{ + unsigned int *int_ptr; + size_t i, j, string_key_len, written_len; + char *string_key = NULL, *format = NULL; + + /* string is two 64 bit numbers printed in hex with a dash between + * and zero padding. + */ + string_key_len = (sizeof(uint64_t) * 2) * 2 + strlen("-") + 1; + string_key = (char*) malloc(string_key_len); + if (NULL == string_key) { + return NULL; + } + + string_key[0] = '\0'; + written_len = 0; + + /* get a format string based on the length of an unsigned int. We + * want to have zero padding for sizeof(unsigned int) * 2 + * characters -- when printing as a hex number, each byte is + * represented by 2 hex characters. Format will contain something + * that looks like %08lx, where the number 8 might be a different + * number if the system has a different sized long (8 would be for + * sizeof(int) == 4)). + */ + asprintf(&format, "%%0%dx", (int)(sizeof(unsigned int)) * 2); + + /* print the first number */ + int_ptr = (unsigned int*) &unique_key[0]; + for (i = 0 ; i < sizeof(uint64_t) / sizeof(unsigned int) ; ++i) { + if (0 == int_ptr[i]) { + /* inject some energy */ + for (j=0; j < sizeof(unsigned int); j++) { + int_ptr[i] |= j << j; + } + } + snprintf(string_key + written_len, + string_key_len - written_len, + format, int_ptr[i]); + written_len = strlen(string_key); + } + + /* print the middle dash */ + snprintf(string_key + written_len, string_key_len - written_len, "-"); + written_len = strlen(string_key); + + /* print the second number */ + int_ptr = (unsigned int*) &unique_key[1]; + for (i = 0 ; i < sizeof(uint64_t) / sizeof(unsigned int) ; ++i) { + if (0 == int_ptr[i]) { + /* inject some energy */ + for (j=0; j < sizeof(unsigned int); j++) { + int_ptr[i] |= j << j; + } + } + snprintf(string_key + written_len, + string_key_len - written_len, + format, int_ptr[i]); + written_len = strlen(string_key); + } + free(format); + + return string_key; +} + +static pmix_status_t setup_app(char *nspace, pmix_list_t *ilist) +{ + uint64_t unique_key[2]; + char *string_key, *cs_env; + int fd_rand; + size_t bytes_read; + pmix_kval_t *kv; + + /* put the number here - or else create an appropriate string. this just needs to + * eventually be a string variable + */ + if(-1 == (fd_rand = open("/dev/urandom", O_RDONLY))) { + transports_use_rand(unique_key); + } else { + bytes_read = read(fd_rand, (char *) unique_key, 16); + if(bytes_read != 16) { + transports_use_rand(unique_key); + } + close(fd_rand); + } + + if (NULL == (string_key = transports_print(unique_key))) { + PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); + return PMIX_ERR_OUT_OF_RESOURCE; + } + + if (PMIX_SUCCESS != pmix_mca_base_var_env_name("pmix_precondition_transports", &cs_env)) { + PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); + free(string_key); + return PMIX_ERR_OUT_OF_RESOURCE; + } + + kv = PMIX_NEW(pmix_kval_t); + if (NULL == kv) { + free(string_key); + free(cs_env); + return PMIX_ERR_OUT_OF_RESOURCE; + } + kv->key = strdup(PMIX_SET_ENVAR); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kv->value) { + free(string_key); + free(cs_env); + PMIX_RELEASE(kv); + return PMIX_ERR_OUT_OF_RESOURCE; + } + kv->value->type = PMIX_STRING; + if (0 > asprintf(&kv->value->data.string, "%s=%s", cs_env, string_key)) { + free(string_key); + free(cs_env); + PMIX_RELEASE(kv); + return PMIX_ERR_OUT_OF_RESOURCE; + } + pmix_list_append(ilist, &kv->super); + free(cs_env); + free(string_key); + + return PMIX_SUCCESS; +} + +static pmix_status_t setup_local_network(char *nspace, + pmix_info_t info[], + size_t ninfo) +{ + return PMIX_SUCCESS; +} + +static pmix_status_t setup_fork(const pmix_proc_t *peer, char ***env) +{ + return PMIX_SUCCESS; +} + +static void child_finalized(pmix_peer_t *peer) +{ + +} + +static void local_app_finalized(char *nspace) +{ + +} diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa.h b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa.h new file mode 100644 index 0000000000..5e714169f4 --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_PNET_OPA_H +#define PMIX_PNET_OPA_H + +#include + + +#include "src/mca/pnet/pnet.h" + +BEGIN_C_DECLS + +/* the component must be visible data for the linker to find it */ +PMIX_EXPORT extern pmix_pnet_base_component_t mca_pnet_opa_component; +extern pmix_pnet_module_t pmix_opa_module; + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa_component.c b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa_component.c new file mode 100644 index 0000000000..8098d89cdb --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/opa/pnet_opa_component.c @@ -0,0 +1,84 @@ +/* -*- 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 Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2016-2017 Intel, Inc. 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 "pmix_common.h" + + +#include "src/mca/pnet/pnet.h" +#include "pnet_opa.h" + +static pmix_status_t component_open(void); +static pmix_status_t component_close(void); +static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority); + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +pmix_pnet_base_component_t mca_pnet_opa_component = { + .base = { + PMIX_PNET_BASE_VERSION_1_0_0, + + /* Component name and version */ + .pmix_mca_component_name = "opa", + PMIX_MCA_BASE_MAKE_VERSION(component, + PMIX_MAJOR_VERSION, + PMIX_MINOR_VERSION, + PMIX_RELEASE_VERSION), + + /* Component open and close functions */ + .pmix_mca_open_component = component_open, + .pmix_mca_close_component = component_close, + .pmix_mca_query_component = component_query, + }, + .data = { + /* The component is checkpoint ready */ + PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT + } +}; + + +static int component_open(void) +{ + return PMIX_SUCCESS; +} + + +static int component_query(pmix_mca_base_module_t **module, int *priority) +{ + *priority = 10; + *module = (pmix_mca_base_module_t *)&pmix_opa_module; + return PMIX_SUCCESS; +} + + +static int component_close(void) +{ + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/pnet.h b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/pnet.h new file mode 100644 index 0000000000..f3d02bccc7 --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/pnet/pnet.h @@ -0,0 +1,122 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** + * @file + * + * This interface is for use by PMIx servers to obtain network-related info + * such as security keys that need to be shared across applications, and to + * setup network support for applications prior to launch + * + * Available plugins may be defined at runtime via the typical MCA parameter + * syntax. + */ + +#ifndef PMIX_PNET_H +#define PMIX_PNET_H + +#include + +#include "src/class/pmix_list.h" +#include "src/mca/mca.h" +#include "src/mca/base/pmix_mca_base_var.h" +#include "src/mca/base/pmix_mca_base_framework.h" +#include "src/include/pmix_globals.h" + +BEGIN_C_DECLS + +/****** MODULE DEFINITION ******/ + +/** + * Initialize the module. Returns an error if the module cannot + * run, success if it can and wants to be used. + */ +typedef pmix_status_t (*pmix_pnet_base_module_init_fn_t)(void); + +/** + * Finalize the module. Tear down any allocated storage, disconnect + * from any system support (e.g., LDAP server) + */ +typedef void (*pmix_pnet_base_module_fini_fn_t)(void); + +/** + * Provide an opportunity for the network to define values that + * are to be passed to an application. This can include security + * tokens required for application processes to communicate with + * each other + */ +typedef pmix_status_t (*pmix_pnet_base_module_setup_app_fn_t)(char *nspace, pmix_list_t *ilist); + +/** + * Give the local network library an opportunity to setup address information + * for the application by passing in the layout type and a regex describing + * the layout */ +typedef pmix_status_t (*pmix_pnet_base_module_setup_local_net_fn_t)(char *nspace, + pmix_info_t info[], + size_t ninfo); + +/** + * Give the local network library an opportunity to add any envars to the + * environment of a local application process prior to fork/exec + */ +typedef pmix_status_t (*pmix_pnet_base_module_setup_fork_fn_t)(const pmix_proc_t *peer, char ***env); + +/** + * Provide an opportunity for the local network library to cleanup when a + * local application process terminates + */ +typedef void (*pmix_pnet_base_module_child_finalized_fn_t)(pmix_peer_t *peer); + +/** + * Provide an opportunity for the local network library to cleanup after + * all local clients for a given application have terminated + */ +typedef void (*pmix_pnet_base_module_local_app_finalized_fn_t)(char *nspace); + +/** + * Base structure for a PNET module + */ +typedef struct { + char *name; + /* init/finalize */ + pmix_pnet_base_module_init_fn_t init; + pmix_pnet_base_module_fini_fn_t finalize; + pmix_pnet_base_module_setup_app_fn_t setup_app; + pmix_pnet_base_module_setup_local_net_fn_t setup_local_network; + pmix_pnet_base_module_setup_fork_fn_t setup_fork; + pmix_pnet_base_module_child_finalized_fn_t child_finalized; + pmix_pnet_base_module_local_app_finalized_fn_t local_app_finalized; +} pmix_pnet_module_t; + +/* declare the global APIs */ +PMIX_EXPORT extern pmix_pnet_module_t pmix_pnet; + +/* + * the standard component data structure + */ +struct pmix_pnet_base_component_t { + pmix_mca_base_component_t base; + pmix_mca_base_component_data_t data; +}; +typedef struct pmix_pnet_base_component_t pmix_pnet_base_component_t; + +/* + * Macro for use in components that are of type pnet + */ +#define PMIX_PNET_BASE_VERSION_1_0_0 \ + PMIX_MCA_BASE_VERSION_1_0_0("pnet", 1, 0, 0) + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/base/base.h b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/base/base.h index e68c3cfe37..df720e48d4 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/base/base.h +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/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-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$ @@ -21,8 +21,8 @@ * $HEADER$ * */ -#ifndef PMIX_BFROP_BASE_H_ -#define PMIX_BFROP_BASE_H_ +#ifndef PMIX_PSEC_BASE_H_ +#define PMIX_PSEC_BASE_H_ #include @@ -48,7 +48,7 @@ BEGIN_C_DECLS */ extern pmix_mca_base_framework_t pmix_psec_base_framework; /** - * BFROP select function + * PSEC select function * * Cycle across available components and construct the list * of active modules diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/native/psec_native.c b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/native/psec_native.c index b6bb634ba3..ebfcb6308f 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/psec/native/psec_native.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/psec/native/psec_native.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * * $COPYRIGHT$ @@ -169,6 +169,10 @@ static pmix_status_t validate_cred(pmix_peer_t *peer, if (PMIX_PROTOCOL_V2 == protocol) { /* this is a tcp protocol, so the cred is actually the uid/gid * passed upwards from the client */ + if (NULL == cred) { + /* not allowed */ + return PMIX_ERR_INVALID_CRED; + } ln = len; euid = 0; gid = 0; 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 544e0e55e6..169a607ccf 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 @@ -144,7 +144,6 @@ static void lost_connection(pmix_peer_t *peer, pmix_status_t err) static pmix_status_t send_msg(int sd, pmix_ptl_send_t *msg) { - pmix_status_t ret = PMIX_SUCCESS; struct iovec iov[2]; int iov_count; ssize_t remain = msg->sdbytes, rc; 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 5ae066d2eb..9f3eee1816 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 @@ -222,15 +222,23 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (0 == strncmp(mca_ptl_tcp_component.super.uri, "tcp4", 4)) { /* separate the IP address from the port */ p = strdup(mca_ptl_tcp_component.super.uri); + if (NULL == p) { + return PMIX_ERR_NOMEM; + } p2 = strchr(&p[7], ':'); + if (NULL == p2) { + free(p); + return PMIX_ERR_BAD_PARAM; + } *p2 = '\0'; ++p2; - host = strdup(&p[7]); + host = &p[7]; /* load the address */ in = (struct sockaddr_in*)&mca_ptl_tcp_component.connection; in->sin_family = AF_INET; in->sin_addr.s_addr = inet_addr(host); if (in->sin_addr.s_addr == INADDR_NONE) { + free(p); return PMIX_ERR_BAD_PARAM; } in->sin_port = htons(atoi(p2)); @@ -238,26 +246,35 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, } else { /* separate the IP address from the port */ p = strdup(mca_ptl_tcp_component.super.uri); + if (NULL == p) { + return PMIX_ERR_NOMEM; + } p2 = strchr(&p[7], ':'); + if (NULL == p2) { + free(p); + return PMIX_ERR_BAD_PARAM; + } *p2 = '\0'; if (']' == p[strlen(p)-1]) { p[strlen(p)-1] = '\0'; } if ('[' == p[7]) { - host = strdup(&p[8]); + host = &p[8]; } else { - host = strdup(&p[7]); + host = &p[7]; } /* load the address */ in6 = (struct sockaddr_in6*)&mca_ptl_tcp_component.connection; in6->sin6_family = AF_INET6; if (0 == inet_pton(AF_INET6, host, (void*)&in6->sin6_addr)) { pmix_output (0, "ptl_tcp_parse_uri: Could not convert %s\n", host); + free(p); return PMIX_ERR_BAD_PARAM; } in6->sin6_port = htons(atoi(p2)); len = sizeof(struct sockaddr_in6); } + free(p); /* establish the connection */ if (PMIX_SUCCESS != (rc = pmix_ptl_base_connect(&mca_ptl_tcp_component.connection, len, &sd))) { @@ -270,7 +287,6 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (PMIX_SUCCESS != (rc = send_connect_ack(sd))) { PMIX_ERROR_LOG(rc); CLOSE_THE_SOCKET(sd); - pmix_client_globals.myserver.sd = -1; return rc; } @@ -278,7 +294,6 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (PMIX_SUCCESS != (rc = recv_connect_ack(sd))) { PMIX_ERROR_LOG(rc); CLOSE_THE_SOCKET(sd); - pmix_client_globals.myserver.sd = -1; return rc; } 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 5a1d4067a5..6e2283b885 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 @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -677,7 +677,7 @@ static void connection_handler(int sd, short args, void *cbdata) pmix_peer_t *peer; pmix_rank_t rank; pmix_status_t rc; - char *msg, *mg, *sec, *cred = NULL; + char *msg, *mg, *sec; char *nspace; uint32_t len, u32; size_t cnt, msglen, n; @@ -733,7 +733,7 @@ static void connection_handler(int sd, short args, void *cbdata) /* extract the name of the sec module they used */ PMIX_STRNLEN(msglen, mg, cnt); if (msglen < cnt) { - sec = msg; + sec = mg; mg += strlen(sec) + 1; cnt -= strlen(sec) + 1; } else { @@ -758,21 +758,21 @@ static void connection_handler(int sd, short args, void *cbdata) goto error; } /* convert it to host byte order */ - len = ntohl(len); + pnd->len = ntohl(len); /* if a credential is present, then create space and * extract it for processing */ - if (0 < len) { - cred = (char*)malloc(len); - if (NULL == cred) { + if (0 < pnd->len) { + pnd->cred = (char*)malloc(pnd->len); + if (NULL == pnd->cred) { /* probably cannot send an error reply if we are out of memory */ free(msg); CLOSE_THE_SOCKET(pnd->sd); PMIX_RELEASE(pnd); return; } - memcpy(cred, mg, len); - mg += len; - cnt -= len; + memcpy(pnd->cred, mg, pnd->len); + mg += pnd->len; + cnt -= pnd->len; } /* get the request type */ @@ -845,14 +845,7 @@ static void connection_handler(int sd, short args, void *cbdata) ++n; /* pass along the bfrop, buffer_type, and sec fields so * we can assign them once we create a peer object */ - if (NULL != sec) { - pnd->psec = strdup(sec); - } - /* pass along the credential for later */ - if (NULL != cred) { - pnd->cred = cred; - pnd->len = len; - } + pnd->psec = strdup(sec); /* release the msg */ free(msg); /* request an nspace for this requestor - it will @@ -963,7 +956,7 @@ static void connection_handler(int sd, short args, void *cbdata) /* validate the connection */ if (PMIX_SUCCESS != (rc = pmix_psec.validate_connection((struct pmix_peer_t*)peer, - PMIX_PROTOCOL_V2, cred, len))) { + PMIX_PROTOCOL_V2, pnd->cred, pnd->len))) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "validation of client connection failed"); info->proc_cnt--; 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 5a4f222896..53021d855e 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) 2016 Intel, Inc. 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/runtime/pmix_finalize.c b/opal/mca/pmix/pmix2x/pmix/src/runtime/pmix_finalize.c index 53ed907db2..7af883a8b0 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/runtime/pmix_finalize.c +++ b/opal/mca/pmix/pmix2x/pmix/src/runtime/pmix_finalize.c @@ -12,7 +12,7 @@ * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010-2015 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -35,6 +35,7 @@ #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/pif/base/base.h" #include "src/mca/pinstalldirs/base/base.h" +#include "src/mca/pnet/base/base.h" #include "src/mca/psec/base/base.h" #include "src/mca/ptl/base/base.h" #include "src/dstore/pmix_dstore.h" @@ -81,6 +82,9 @@ void pmix_rte_finalize(void) /* close the security framework */ (void)pmix_mca_base_framework_close(&pmix_psec_base_framework); + /* close the pnet framework */ + (void)pmix_mca_base_framework_close(&pmix_pnet_base_framework); + /* finalize the mca */ /* Clear out all the registered MCA params */ pmix_deregister_params(); diff --git a/opal/mca/pmix/pmix2x/pmix/src/runtime/pmix_init.c b/opal/mca/pmix/pmix2x/pmix/src/runtime/pmix_init.c index a15364cfd2..4060d8a02b 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/runtime/pmix_init.c +++ b/opal/mca/pmix/pmix2x/pmix/src/runtime/pmix_init.c @@ -15,7 +15,7 @@ * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2010-2015 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -43,6 +43,7 @@ #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/pif/base/base.h" #include "src/mca/pinstalldirs/base/base.h" +#include "src/mca/pnet/base/base.h" #include "src/mca/psec/base/base.h" #include "src/mca/ptl/base/base.h" @@ -214,6 +215,16 @@ int pmix_rte_init(pmix_proc_type_t type, return ret; } + /* open the pnet and select the active modules for this environment */ + if (PMIX_SUCCESS != (ret = pmix_mca_base_framework_open(&pmix_pnet_base_framework, 0))) { + error = "pmix_pnet_base_open"; + goto return_error; + } + if (PMIX_SUCCESS != (ret = pmix_pnet_base_select())) { + error = "pmix_pnet_base_select"; + goto return_error; + } + /* tell libevent that we need thread support */ pmix_event_use_threads(); 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 2795ffc51e..e7383ad917 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c @@ -59,6 +59,7 @@ #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/pinstalldirs/base/base.h" +#include "src/mca/pnet/pnet.h" #include "src/runtime/pmix_progress_threads.h" #include "src/runtime/pmix_rte.h" #include "src/mca/ptl/base/base.h" @@ -286,8 +287,8 @@ static void _register_nspace(int sd, short args, void *cbdata) pmix_info_t *iptr; pmix_value_t val; char *msg; - bool nodata = false; #if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) + bool nodata = false; pmix_buffer_t *jobdata = PMIX_NEW(pmix_buffer_t); char *nspace = NULL; int32_t cnt; @@ -337,8 +338,10 @@ static void _register_nspace(int sd, short args, void *cbdata) cd->info[i].key); if (0 == strcmp(cd->info[i].key, PMIX_REGISTER_NODATA)) { +#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) /* we don't want to save any job data for this nspace */ nodata = true; +#endif /* free anything that was previously stored */ PMIX_DESTRUCT(&nptr->server->job_info); PMIX_CONSTRUCT(&nptr->server->job_info, pmix_buffer_t); @@ -531,6 +534,10 @@ static void _deregister_nspace(int sd, short args, void *cbdata) rc = pmix_dstore_nspace_del(cd->proc.nspace); #endif + /* release any job-level resources */ + pmix_pnet.local_app_finalized(cd->proc.nspace); + + /* release the caller */ if (NULL != cd->opcbfunc) { cd->opcbfunc(rc, cd->cbdata); } @@ -843,9 +850,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_setup_fork(const pmix_proc_t *proc, char * { char rankstr[128]; pmix_listener_t *lt; -#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) pmix_status_t rc; -#endif pmix_output_verbose(2, pmix_globals.debug_output, "pmix:server setup_fork for nspace %s rank %d", @@ -875,6 +880,12 @@ PMIX_EXPORT pmix_status_t PMIx_server_setup_fork(const pmix_proc_t *proc, char * } #endif + /* get any network contribution */ + if (PMIX_SUCCESS != (rc = pmix_pnet.setup_fork(proc, env))) { + PMIX_ERROR_LOG(rc); + return rc; + } + return PMIX_SUCCESS; } @@ -1419,6 +1430,139 @@ PMIX_EXPORT pmix_status_t PMIx_generate_ppn(const char *input, char **regexp) return PMIX_SUCCESS; } +static void _setup_op(pmix_status_t rc, void *cbdata) +{ + pmix_setup_caddy_t *fcd = (pmix_setup_caddy_t*)cbdata; + + if (NULL != fcd->info) { + PMIX_INFO_FREE(fcd->info, fcd->ninfo); + } + PMIX_RELEASE(fcd); +} + +static void _setup_app(int sd, short args, void *cbdata) +{ + pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; + pmix_setup_caddy_t *fcd = NULL; + pmix_status_t rc; + pmix_list_t ilist; + pmix_kval_t *kv; + size_t n; + + PMIX_CONSTRUCT(&ilist, pmix_list_t); + + /* pass to the network libraries */ + if (PMIX_SUCCESS != (rc = pmix_pnet.setup_app(cd->nspace, &ilist))) { + goto depart; + } + + /* setup the return callback */ + fcd = PMIX_NEW(pmix_setup_caddy_t); + if (NULL == fcd) { + rc = PMIX_ERR_NOMEM; + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + goto depart; + } + + /* if anything came back, construct the info array */ + if (0 < (fcd->ninfo = pmix_list_get_size(&ilist))) { + PMIX_INFO_CREATE(fcd->info, fcd->ninfo); + n = 0; + PMIX_LIST_FOREACH(kv, &ilist, pmix_kval_t) { + (void)strncpy(fcd->info[n].key, kv->key, PMIX_MAX_KEYLEN); + if (PMIX_SUCCESS != (rc = pmix_value_xfer(&fcd->info[n].value, kv->value))) { + PMIX_INFO_FREE(fcd->info, fcd->ninfo); + PMIX_RELEASE(fcd); + fcd = NULL; + goto depart; + } + } + } + + depart: + /* always execute the callback to avoid hanging */ + if (NULL != cd->setupcbfunc) { + if (NULL == fcd) { + cd->setupcbfunc(rc, NULL, 0, cd->cbdata, NULL, NULL); + } else { + cd->setupcbfunc(rc, fcd->info, fcd->ninfo, cd->cbdata, _setup_op, fcd); + } + } + + /* cleanup memory */ + PMIX_LIST_DESTRUCT(&ilist); + if (NULL != cd->nspace) { + free(cd->nspace); + } + PMIX_RELEASE(cd); +} + +pmix_status_t PMIx_server_setup_application(const char nspace[], + pmix_info_t info[], size_t ninfo, + pmix_setup_application_cbfunc_t cbfunc, void *cbdata) +{ + pmix_setup_caddy_t *cd; + + /* need to threadshift this request */ + cd = PMIX_NEW(pmix_setup_caddy_t); + if (NULL == cd) { + return PMIX_ERR_NOMEM; + } + if (NULL != nspace) { + cd->nspace = strdup(nspace); + } + cd->info = info; + cd->ninfo = ninfo; + cd->setupcbfunc = cbfunc; + cd->cbdata = cbdata; + PMIX_THREADSHIFT(cd, _setup_app); + + return PMIX_SUCCESS; +} + +static void _setup_local_support(int sd, short args, void *cbdata) +{ + pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; + pmix_status_t rc; + + /* pass to the network libraries */ + rc = pmix_pnet.setup_local_network(cd->nspace, cd->info, cd->ninfo); + + /* pass the info back */ + if (NULL != cd->opcbfunc) { + cd->opcbfunc(rc, cd->cbdata); + } + /* cleanup memory */ + if (NULL != cd->nspace) { + free(cd->nspace); + } + PMIX_RELEASE(cd); +} + +pmix_status_t PMIx_server_setup_local_support(const char nspace[], + pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + pmix_setup_caddy_t *cd; + + /* need to threadshift this request */ + cd = PMIX_NEW(pmix_setup_caddy_t); + if (NULL == cd) { + return PMIX_ERR_NOMEM; + } + if (NULL != nspace) { + cd->nspace = strdup(nspace); + } + cd->info = info; + cd->ninfo = ninfo; + cd->opcbfunc = cbfunc; + cd->cbdata = cbdata; + PMIX_THREADSHIFT(cd, _setup_local_support); + + return PMIX_SUCCESS; +} + + /**** THE FOLLOWING CALLBACK FUNCTIONS ARE USED BY THE HOST SERVER **** **** THEY THEREFORE CAN OCCUR IN EITHER THE HOST SERVER'S THREAD **** **** CONTEXT, OR IN OUR OWN THREAD CONTEXT IF THE CALLBACK OCCURS **** @@ -2091,6 +2235,8 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, event_del(&peer->recv_event); peer->recv_ev_active = false; } + /* let the network libraries cleanup */ + pmix_pnet.child_finalized(peer); return rc; } 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 0a2f2f894a..8117993e87 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 @@ -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-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . @@ -198,6 +198,11 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * give the host server a chance to tell us about it */ rc = create_local_tracker(nspace, rank, info, ninfo, cbfunc, cbdata, &lcd); + if (PMIX_ERR_NOMEM == rc) { + PMIX_INFO_FREE(info, ninfo); + return rc; + } + /* * Its possible there are no local processes on this * host, so lets ask for this explicitly. There can @@ -237,6 +242,9 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * for now */ rc = create_local_tracker(nspace, rank, info, ninfo, cbfunc, cbdata, &lcd); + if (PMIX_ERR_NOMEM == rc) { + PMIX_INFO_FREE(info, ninfo); + } return rc; } @@ -265,8 +273,9 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, return PMIX_SUCCESS; } if (PMIX_ERR_NOT_FOUND != rc || NULL == lcd) { - /* we have a problem - e.g., out of memory */ - return rc; + /* we have a problem - e.g., out of memory */ + PMIX_INFO_FREE(info, ninfo); + return rc; } /* Getting here means that we didn't already have a request for @@ -330,7 +339,6 @@ static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, * one and add it to our list */ lcd = PMIX_NEW(pmix_dmdx_local_t); if (NULL == lcd){ - PMIX_INFO_FREE(info, ninfo); return PMIX_ERR_NOMEM; } strncpy(lcd->proc.nspace, nspace, PMIX_MAX_NSLEN); @@ -422,6 +430,7 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, pmix_rank_t rank, hts[0] = &nptr->server->remote; hts[1] = &nptr->server->mylocal; } else if (PMIX_RANK_WILDCARD == rank) { + local = true; hts[0] = NULL; } else { local = false; 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 57e674dd5e..b57089f84a 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 @@ -1555,11 +1555,14 @@ static void scadcon(pmix_setup_caddy_t *p) { memset(&p->proc, 0, sizeof(pmix_proc_t)); p->active = true; + p->nspace = NULL; p->server_object = NULL; p->nlocalprocs = 0; p->info = NULL; p->ninfo = 0; p->cbfunc = NULL; + p->opcbfunc = NULL; + p->setupcbfunc = 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 2abb45f6f9..d81bbfed6b 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-2016 Intel, Inc. All rights reserved + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. @@ -32,6 +32,7 @@ typedef struct { pmix_object_t super; pmix_event_t ev; volatile bool active; + char *nspace; pmix_status_t status; pmix_proc_t proc; uid_t uid; @@ -42,6 +43,7 @@ typedef struct { size_t ninfo; pmix_op_cbfunc_t opcbfunc; pmix_dmodex_response_fn_t cbfunc; + pmix_setup_application_cbfunc_t setupcbfunc; void *cbdata; } pmix_setup_caddy_t; PMIX_CLASS_DECLARATION(pmix_setup_caddy_t); diff --git a/opal/mca/pmix/pmix2x/pmix/src/sm/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/sm/Makefile.include index 968aaf021a..5f0734d1d3 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/sm/Makefile.include +++ b/opal/mca/pmix/pmix2x/pmix/src/sm/Makefile.include @@ -1,7 +1,7 @@ # # Copyright (c) 2016 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2016 Intel, Inc. 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/sm/pmix_mmap.c b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c index b018c4714f..8dac3d5a82 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c +++ b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2015-2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/sm/pmix_mmap.h b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.h index ccebf28c60..1070ce6822 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.h +++ b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_mmap.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2015-2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/sm/pmix_sm.c b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.c index 1762e5ccba..027600998e 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.c +++ b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2015-2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/sm/pmix_sm.h b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.h index 31b832834f..b3713d3fd2 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.h +++ b/opal/mca/pmix/pmix2x/pmix/src/sm/pmix_sm.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2015-2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. 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/util/Makefile.include b/opal/mca/pmix/pmix2x/pmix/src/util/Makefile.include index ca252abf8c..0e8a6fc10f 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/Makefile.include +++ b/opal/mca/pmix/pmix2x/pmix/src/util/Makefile.include @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -28,6 +28,7 @@ LEX_OUTPUT_ROOT = lex.pmix_show_help_yy # Source code files headers += \ + util/alfg.h \ util/argv.h \ util/error.h \ util/printf.h \ @@ -52,6 +53,7 @@ headers += \ util/compress.h sources += \ + util/alfg.c \ util/argv.c \ util/error.c \ util/printf.c \ diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/alfg.c b/opal/mca/pmix/pmix2x/pmix/src/util/alfg.c new file mode 100644 index 0000000000..74aab4fbfc --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/util/alfg.c @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2014 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#include + +#include "alfg.h" + +/* Mask corresponding to the primitive polynomial + *--------------------------------------------------- + * + * p(x) = 1 + x^25 + x^27 + x^29 + x^30 + x^31 + x^32 + * + *--------------------------------------------------- + */ +#define MASK 0x80000057U + +/* Additive lagged Fibonacci parameters: + *--------------------------------------------------- + * + * x_n = (x_(n - TAP1) + x_(n - TAP2) ) mod M + * + *--------------------------------------------------- + */ +#define TAP1 127 +#define TAP2 97 +#define CBIT 21 /* Canonical bit */ + + +/** + * @brief Galois shift register: Used to seed the ALFG's + * canonical rectangle + * + * @param[in] unsigned int *seed: used to seed the Galois register + * @param[out] uint32_t lsb: least significant bit of the Galois + * register after shift + */ +static uint32_t galois(unsigned int *seed){ + + uint32_t lsb; + lsb = (*seed & 1) ? 1 : 0; + *seed >>= 1; + /* tap it with the mask */ + *seed = *seed ^ (lsb*MASK); + + return lsb; +} + +/* PMIX global rng buffer */ +static pmix_rng_buff_t alfg_buffer; + +/** + * @brief Routine to seed the ALFG register + * + * @param[in] uint32_t seed + * @param[out] pmix_rng_buff_t *buff: handle to ALFG buffer state + */ +int pmix_srand(pmix_rng_buff_t *buff, uint32_t seed) { + + int i, j; + uint32_t seed_cpy = seed; + buff->tap1 = TAP1 - 1; + buff->tap2 = TAP2 - 1; + + /* zero out the register */ + for( i = 0; i < TAP1; i++){ + buff->alfg[i] = 0; + } + /* set the canonical bit */ + buff->alfg[CBIT] = 1; + + /* seed the ALFG register by blasting + * the canonical rectangle with bits + */ + for ( j = 1; j < TAP1; j++){ + for( i = 1; i < 32; i++){ + buff->alfg[j] = buff->alfg[j] ^ ((galois(&seed_cpy))<tap1); + int *tap2 = &(buff->tap2); + uint64_t overflow; + uint32_t temp; + + /* prevent overflow */ + overflow = (uint64_t) buff->alfg[*tap1] + (uint64_t) buff->alfg[*tap2]; + /* circular buffer arithmetic */ + temp = (*tap1 + 1) == TAP1 ? 0 : (*tap1 + 1); + /* Division modulo 2^32 */ + buff->alfg[temp] = (uint32_t) ( overflow & ((1ULL<<32) -1)); + + /* increment tap points */ + *tap1 = (*tap1 + 1)%TAP1; + *tap2 = (*tap2 + 1)%TAP1; + + return buff->alfg[temp]; + +} + +/** + * @brief A wrapper for pmix_rand() with our global ALFG buffer; + * + * @param[in] none + * @param[out] int, the same as normal rand(3) + */ +int pmix_random(void){ + /* always return a positive int */ + return (int)(pmix_rand(&alfg_buffer) & 0x7FFFFFFF); +} diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/alfg.h b/opal/mca/pmix/pmix2x/pmix/src/util/alfg.h new file mode 100644 index 0000000000..f70822c69d --- /dev/null +++ b/opal/mca/pmix/pmix2x/pmix/src/util/alfg.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_ALFG_H +#define PMIX_ALFG_H + +#include + +#include "src/include/pmix_stdint.h" + + +struct pmix_rng_buff_t { + uint32_t alfg[127]; + int tap1; + int tap2; +}; +typedef struct pmix_rng_buff_t pmix_rng_buff_t; + + +/* NOTE: UNLIKE OTHER PMIX FUNCTIONS, THIS FUNCTION RETURNS A 1 IF + * SUCCESSFUL INSTEAD OF PMIX_SUCCESS */ +PMIX_EXPORT int pmix_srand(pmix_rng_buff_t *buff, uint32_t seed); + +PMIX_EXPORT uint32_t pmix_rand(pmix_rng_buff_t *buff); + +PMIX_EXPORT int pmix_random(void); + +#endif /* PMIX_ALFG_H */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/basename.c b/opal/mca/pmix/pmix2x/pmix/src/util/basename.c index 69dd1ed61c..aa876644b1 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/basename.c +++ b/opal/mca/pmix/pmix2x/pmix/src/util/basename.c @@ -12,7 +12,7 @@ * Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/basename.h b/opal/mca/pmix/pmix2x/pmix/src/util/basename.h index ea4d299b15..580a820a90 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/basename.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/basename.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-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/getid.c b/opal/mca/pmix/pmix2x/pmix/src/util/getid.c index d2ae01f54d..15b688889c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/getid.c +++ b/opal/mca/pmix/pmix2x/pmix/src/util/getid.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/getid.h b/opal/mca/pmix/pmix2x/pmix/src/util/getid.h index f34d0ebfb0..c951a3acc0 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/getid.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/getid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/hash.c b/opal/mca/pmix/pmix2x/pmix/src/util/hash.c index b6d4d3f158..9aa767eb39 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/hash.c +++ b/opal/mca/pmix/pmix2x/pmix/src/util/hash.c @@ -6,7 +6,7 @@ * reserved. * Copyright (c) 2011-2014 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) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/hash.h b/opal/mca/pmix/pmix2x/pmix/src/util/hash.h index 4930948c4a..8cd219a94a 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/hash.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/hash.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * 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$ diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/keyval/keyval_lex.l b/opal/mca/pmix/pmix2x/pmix/src/util/keyval/keyval_lex.l index 88bb11708a..49a49fc09f 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/keyval/keyval_lex.l +++ b/opal/mca/pmix/pmix2x/pmix/src/util/keyval/keyval_lex.l @@ -16,7 +16,7 @@ * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. 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/util/net.c b/opal/mca/pmix/pmix2x/pmix/src/util/net.c index 7c50173e04..0bbc846f54 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/net.c +++ b/opal/mca/pmix/pmix2x/pmix/src/util/net.c @@ -12,7 +12,7 @@ * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/net.h b/opal/mca/pmix/pmix2x/pmix/src/util/net.h index f640931cf8..9ffa1bd0d2 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/net.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/net.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -100,8 +100,8 @@ PMIX_EXPORT bool pmix_net_islocalhost(const struct sockaddr *addr); * same net, false otherwise. */ PMIX_EXPORT bool pmix_net_samenetwork(const struct sockaddr *addr1, - const struct sockaddr *addr2, - uint32_t prefixlen); + const struct sockaddr *addr2, + uint32_t prefixlen); /** diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/output.h b/opal/mca/pmix/pmix2x/pmix/src/util/output.h index 9276cdb91f..8e6a24081c 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/output.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/output.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 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/util/pmix_environ.c b/opal/mca/pmix/pmix2x/pmix/src/util/pmix_environ.c index ff5ef60da8..ce706b70da 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/pmix_environ.c +++ b/opal/mca/pmix/pmix2x/pmix/src/util/pmix_environ.c @@ -12,7 +12,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2013 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) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/pmix_environ.h b/opal/mca/pmix/pmix2x/pmix/src/util/pmix_environ.h index 852152f5f4..5f2c5208b2 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/pmix_environ.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/pmix_environ.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 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 (c) 2016 IBM Corporation. All rights reserved. diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/printf.c b/opal/mca/pmix/pmix2x/pmix/src/util/printf.c index 897b9b47d7..805d600828 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/printf.c +++ b/opal/mca/pmix/pmix2x/pmix/src/util/printf.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/printf.h b/opal/mca/pmix/pmix2x/pmix/src/util/printf.h index d71cfd78cf..8724a218c7 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/printf.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/printf.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-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/show_help.c b/opal/mca/pmix/pmix2x/pmix/src/util/show_help.c index 21b29337b9..1b8bc486fb 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/show_help.c +++ b/opal/mca/pmix/pmix2x/pmix/src/util/show_help.c @@ -12,7 +12,7 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -309,7 +309,9 @@ char *pmix_show_help_vstring(const char *filename, const char *topic, if (PMIX_SUCCESS == rc) { /* Apply the formatting to make the final output string */ - vasprintf(&output, single_string, arglist); + if (0 > vasprintf(&output, single_string, arglist)) { + output = NULL; + } free(single_string); } diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/strnlen.h b/opal/mca/pmix/pmix2x/pmix/src/util/strnlen.h index ec2401e346..9c4f39fea3 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/strnlen.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/strnlen.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/src/util/timings.h b/opal/mca/pmix/pmix2x/pmix/src/util/timings.h index 5c0d14d201..1e732c8a7b 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/util/timings.h +++ b/opal/mca/pmix/pmix2x/pmix/src/util/timings.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2014 Artem Polyakov - * 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$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/cli_stages.c b/opal/mca/pmix/pmix2x/pmix/test/cli_stages.c index cb92364d0e..65286291c7 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/cli_stages.c +++ b/opal/mca/pmix/pmix2x/pmix/test/cli_stages.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2016 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$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/cli_stages.h b/opal/mca/pmix/pmix2x/pmix/test/cli_stages.h index 7f449fd4ae..3b3dfffae8 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/cli_stages.h +++ b/opal/mca/pmix/pmix2x/pmix/test/cli_stages.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2016 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$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/pmi_client.c b/opal/mca/pmix/pmix2x/pmix/test/pmi_client.c index 0f4abb5427..22cf1a86dc 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/pmi_client.c +++ b/opal/mca/pmix/pmix2x/pmix/test/pmi_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -31,7 +31,8 @@ static void log_fatal(const char *format, ...) va_start(arglist, format); if (_verbose > 0) { - if (0 > vasprintf(output, format, arglist)) { + if (0 > vasprintf(output, format, arglist) || + NULL == *output) { return; } fprintf(stderr, "FATAL: %s", *output); @@ -47,13 +48,15 @@ static void log_error(const char *format, ...) va_start(arglist, format); if (_verbose > 0) { - if (0 > vasprintf(output, format, arglist)) { + if (0 > vasprintf(output, format, arglist) || + NULL == *output) { + va_end(arglist); return; } fprintf(stderr, "ERROR: %s", *output); - va_end(arglist); free(*output); } + va_end(arglist); } static void log_info(const char *format, ...) @@ -63,13 +66,15 @@ static void log_info(const char *format, ...) va_start(arglist, format); if (_verbose > 0) { - if (0 > vasprintf(output, format, arglist)) { + if (0 > vasprintf(output, format, arglist) || + NULL == *output) { + va_end(arglist); return; } fprintf(stderr, "INFO: %s", *output); - va_end(arglist); free(*output); } + va_end(arglist); } #define log_assert(e, msg) \ diff --git a/opal/mca/pmix/pmix2x/pmix/test/pmix_regex.c b/opal/mca/pmix/pmix2x/pmix/test/pmix_regex.c index d4511e6c0f..d1fa14bb31 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/pmix_regex.c +++ b/opal/mca/pmix/pmix2x/pmix/test/pmix_regex.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-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/test/pmix_test.c b/opal/mca/pmix/pmix2x/pmix/test/pmix_test.c index 0366e4534b..036f70aa63 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/pmix_test.c +++ b/opal/mca/pmix/pmix2x/pmix/test/pmix_test.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-2017 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. diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_cd.c b/opal/mca/pmix/pmix2x/pmix/test/test_cd.c index e8cdb81905..52b69ba031 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_cd.c +++ b/opal/mca/pmix/pmix2x/pmix/test/test_cd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_cd.h b/opal/mca/pmix/pmix2x/pmix/test/test_cd.h index 5aea5eda1f..c35b509f47 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_cd.h +++ b/opal/mca/pmix/pmix2x/pmix/test/test_cd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_common.c b/opal/mca/pmix/pmix2x/pmix/test/test_common.c index deafa6d5d3..59c9598620 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-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_error.h b/opal/mca/pmix/pmix2x/pmix/test/test_error.h index 151ad62bb2..5085378339 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_error.h +++ b/opal/mca/pmix/pmix2x/pmix/test/test_error.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_fence.c b/opal/mca/pmix/pmix2x/pmix/test/test_fence.c index d9e0b74a4f..b3f059aab3 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 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_publish.c b/opal/mca/pmix/pmix2x/pmix/test/test_publish.c index 3357531b71..bf00cdc508 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_publish.c +++ b/opal/mca/pmix/pmix2x/pmix/test/test_publish.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_publish.h b/opal/mca/pmix/pmix2x/pmix/test/test_publish.h index 8634b96b9f..98ac242bc1 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_publish.h +++ b/opal/mca/pmix/pmix2x/pmix/test/test_publish.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_resolve_peers.c b/opal/mca/pmix/pmix2x/pmix/test/test_resolve_peers.c index 8c85031fc7..727f5d9b22 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_resolve_peers.c +++ b/opal/mca/pmix/pmix2x/pmix/test/test_resolve_peers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_resolve_peers.h b/opal/mca/pmix/pmix2x/pmix/test/test_resolve_peers.h index 874c3d272b..185285e71a 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_resolve_peers.h +++ b/opal/mca/pmix/pmix2x/pmix/test/test_resolve_peers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_spawn.c b/opal/mca/pmix/pmix2x/pmix/test/test_spawn.c index da1922d4c8..2d7dfc4c17 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_spawn.c +++ b/opal/mca/pmix/pmix2x/pmix/test/test_spawn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/test_spawn.h b/opal/mca/pmix/pmix2x/pmix/test/test_spawn.h index c217c659a8..c7828e543b 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/test_spawn.h +++ b/opal/mca/pmix/pmix2x/pmix/test/test_spawn.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix2x/pmix/test/utils.c b/opal/mca/pmix/pmix2x/pmix/test/utils.c index 633cd75ee7..afd75182af 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/utils.c +++ b/opal/mca/pmix/pmix2x/pmix/test/utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 Research Organization for Information Science diff --git a/opal/mca/pmix/pmix2x/pmix/test/utils.h b/opal/mca/pmix/pmix2x/pmix/test/utils.h index e984d018ab..f607cf95c2 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/utils.h +++ b/opal/mca/pmix/pmix2x/pmix/test/utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$