Update to PMIx 3.1.2
Update the OPAL glue configure code to correctly link the opal/pmix3 component to the hwloc used by OMPI instead of defaulting to the system-level hwloc. Required a corresponding update to the PMIx hwloc configure code so we treat hwloc the same way we handle libevent in embedded scenarios. Roll to PMIx v3.1.2 for plugging of memory leaks and addition of faster PMIx_Get response Signed-off-by: Ralph Castain <rhc@pmix.org>
Этот коммит содержится в:
родитель
bc58e22b03
Коммит
335f8c5100
2
.gitignore
поставляемый
2
.gitignore
поставляемый
@ -365,6 +365,8 @@ opal/mca/hwloc/base/static-components.h.new.struct
|
||||
|
||||
opal/mca/installdirs/config/install_dirs.h
|
||||
|
||||
!opal/mca/pmix/pmix*/pmix/AUTHORS
|
||||
!opal/mca/pmix/pmix*/pmix/contrib/perf_tools/Makefile
|
||||
opal/mca/pmix/pmix*/pmix/include/pmix/autogen/config.h
|
||||
opal/mca/pmix/pmix*/pmix/include/pmix/autogen/config.h.in
|
||||
opal/mca/pmix/pmix*/pmix/src/include/private/autogen/config.h.in
|
||||
|
@ -13,7 +13,7 @@
|
||||
# Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2015-2016 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
@ -53,14 +53,14 @@ AC_DEFUN([MCA_opal_pmix_pmix3x_CONFIG],[
|
||||
opal_pmix_pmix3x_timing_flag=--disable-pmix-timing
|
||||
fi
|
||||
|
||||
opal_pmix_pmix3x_args="$opal_pmix_pmix3x_timing_flag --without-tests-examples --disable-pmix-binaries --disable-pmix-backward-compatibility --disable-visibility --enable-embedded-libevent --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\""
|
||||
opal_pmix_pmix3x_args="$opal_pmix_pmix3x_timing_flag --without-tests-examples --disable-pmix-binaries --disable-pmix-backward-compatibility --disable-visibility --enable-embedded-libevent --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --enable-embedded-hwloc --with-hwloc-header=\\\"$opal_hwloc_base_include\\\""
|
||||
AS_IF([test "$enable_debug" = "yes"],
|
||||
[opal_pmix_pmix3x_args="--enable-debug $opal_pmix_pmix3x_args"
|
||||
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"],
|
||||
[opal_pmix_pmix3x_args="--disable-debug $opal_pmix_pmix3x_args"
|
||||
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"])
|
||||
AC_MSG_CHECKING([if want to install standalone libpmix])
|
||||
AS_IF([test "$enable_install_libpmix" == "yes"],
|
||||
AS_IF([test "$enable_install_libpmix" = "yes"],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
opal_pmix_pmix3x_args="--with-pmix-symbol-rename=OPAL_MCA_PMIX3X_ --enable-embedded-mode $opal_pmix_pmix3x_args"])
|
||||
|
@ -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-2017 Intel, Inc. All rights reserved.
|
||||
Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
$COPYRIGHT$
|
||||
|
||||
Additional copyrights may follow
|
||||
@ -22,9 +22,9 @@ For More Information
|
||||
|
||||
This file is a *very* short overview of building and installing
|
||||
the PMIx library. Much more information is available in the
|
||||
FAQ section on the PMIx web site:
|
||||
How-To section on the PMIx web site:
|
||||
|
||||
http://pmix.github.io/pmix/faq
|
||||
https://pmix.org/support/how-to/
|
||||
|
||||
|
||||
Developer Builds
|
||||
@ -56,6 +56,24 @@ shell$ ./configure --prefix=/where/to/install
|
||||
[...lots of output...]
|
||||
shell$ make all install
|
||||
|
||||
NOTE: this version of PMIx requires the Libevent package to build
|
||||
and operate. Any version of Libevent greater than or equal to
|
||||
2.0.21 is acceptable.
|
||||
|
||||
NOTE: this version of PMIx optionally supports the HWLOC package
|
||||
for providing topology information to both the host environment
|
||||
(by collecting local inventory for rollup) and local client
|
||||
processes. Any version of HWLOC greater than 1.10 is supported,
|
||||
although versions in the 2.x series are recommended.
|
||||
|
||||
Note that you must point configure at the libevent installation
|
||||
using the --with-libevent=<dir> option if it is in a non-standard
|
||||
location. Similarly, non-standard locations for the HWLOC package
|
||||
must be specified using the --with-hwloc=<dir> option. In both
|
||||
cases, PMIx will automatically detect these packages in standard
|
||||
locations and build-in support for them unless otherwise specified
|
||||
using the respective configure option.
|
||||
|
||||
If you need special access to install, then you can execute "make
|
||||
all" as a user with write permissions in the build tree, and a
|
||||
separate "make install" as a user with write permissions to the
|
||||
|
@ -26,7 +26,7 @@ Copyright (c) 2006-2010 Sun Microsystems, Inc. All rights reserved.
|
||||
Copyright (c) 2006-2010 The University of Houston. All rights reserved.
|
||||
Copyright (c) 2006-2009 Myricom, Inc. All rights reserved.
|
||||
Copyright (c) 2007-2008 UT-Battelle, LLC. All rights reserved.
|
||||
Copyright (c) 2007-2018 IBM Corporation. All rights reserved.
|
||||
Copyright (c) 2007-2019 IBM Corporation. All rights reserved.
|
||||
Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing
|
||||
Centre, Federal Republic of Germany
|
||||
Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany
|
||||
@ -36,7 +36,7 @@ Copyright (c) 2008-2009 Institut National de Recherche en
|
||||
Informatique. All rights reserved.
|
||||
Copyright (c) 2007 Lawrence Livermore National Security, LLC.
|
||||
All rights reserved.
|
||||
Copyright (c) 2007-2018 Mellanox Technologies. All rights reserved.
|
||||
Copyright (c) 2007-2019 Mellanox Technologies. All rights reserved.
|
||||
Copyright (c) 2006-2010 QLogic Corporation. All rights reserved.
|
||||
Copyright (c) 2008-2010 Oak Ridge National Labs. All rights reserved.
|
||||
Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved.
|
||||
@ -45,7 +45,7 @@ Copyright (c) 2010 ARM ltd. All rights reserved.
|
||||
Copyright (c) 2010-2011 Alex Brick <bricka@ccs.neu.edu>. All rights reserved.
|
||||
Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights
|
||||
reserved.
|
||||
Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
$COPYRIGHT$
|
||||
|
@ -37,10 +37,6 @@ dist_pmixdata_DATA =
|
||||
if ! PMIX_EMBEDDED_MODE
|
||||
dist_pmixdata_DATA += contrib/pmix-valgrind.supp
|
||||
|
||||
if PMIX_HAVE_PANDOC
|
||||
SUBDIRS += man
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
if PMIX_TESTS_EXAMPLES
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
|
||||
Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
$COPYRIGHT$
|
||||
|
||||
@ -17,8 +17,61 @@ the README file, PMIx typically maintains two separate version
|
||||
series simultaneously - the current release and one that is locked
|
||||
to only bug fixes. Since these series are semi-independent of each
|
||||
other, a single NEWS-worthy item might apply to different series. For
|
||||
example, a bug might be fixed in the master, and then moved to the
|
||||
current release as well as the "stable" bug fix release branch.
|
||||
example, a bug might be fixed in the master, and then moved to
|
||||
multiple release branches.
|
||||
|
||||
|
||||
3.1.2 -- 24 Jan 2019
|
||||
----------------------
|
||||
- Fix a bug in macro identifying system events
|
||||
- Restore some non-standard macros to the pmix_extend.h
|
||||
header - these are considered "deprecated" and will be
|
||||
removed from public-facing headers in future releases
|
||||
|
||||
|
||||
3.1.1 -- 18 Jan 2019
|
||||
----------------------
|
||||
- Fix a bug in registration of default event handlers
|
||||
that somehow slipped thru testing
|
||||
|
||||
|
||||
3.1.0 -- 17 Jan 2019
|
||||
----------------------
|
||||
**** THIS RELEASE MARKS THE STARTING POINT FOR FULL COMPLIANCE
|
||||
**** WITH THE PMIX v3 STANDARD. ALL API BEHAVIORS AND ATTRIBUTE
|
||||
**** DEFINITIONS MEET THE v3 STANDARD SPECIFICATIONS.
|
||||
- Add a new, faster dstore GDS component 'ds21'
|
||||
- Performance optimizations for the dstore GDS components.
|
||||
- Plug miscellaneous memory leaks
|
||||
- Silence an unnecessary warning message when checking connection
|
||||
to a non-supporting server
|
||||
- Ensure lost-connection events get delivered to default event
|
||||
handlers
|
||||
- Correctly handle cache refresh for queries
|
||||
- Protect against race conditions between host and internal library
|
||||
when dealing with async requests
|
||||
- Cleanup tool operations and add support for connections to
|
||||
remote servers. Initial support for debugger direct/indirect
|
||||
launch verified with PRRTE. Cleanup setting of tmpdir options.
|
||||
Drop rendezvous files when acting as a launcher
|
||||
- Automatically store the server URI for easy access by client
|
||||
- Provide MCA parameter to control TCP connect retry/timeout
|
||||
- Update event notification system to properly evict oldest events
|
||||
when more space is needed
|
||||
- Fix a number of error paths
|
||||
- Update IOF cache code to properly drop oldest message. Provide
|
||||
MCA parameter for setting cache size.
|
||||
- Handle setsockopt(SO_RCVTIMEO) not being supported
|
||||
- Ensure that epilogs get run even when connections unexpectedly
|
||||
terminate. Properly split epilog strings to process multiple
|
||||
paths
|
||||
- Pass the tool's command line to the server so it can be returned
|
||||
in queries
|
||||
- Add support for C11 atomics
|
||||
- Support collection and forwarding of fabric-specific envars
|
||||
- Improve handling of hwloc configure option
|
||||
- Fix PMIx_server_generate_regex to preserve node ordering
|
||||
- Fix a bug when registering default event handlers
|
||||
|
||||
|
||||
3.0.2 -- 18 Sept 2018
|
||||
@ -89,6 +142,46 @@ current release as well as the "stable" bug fix release branch.
|
||||
- Fix several memory and file descriptor leaks
|
||||
|
||||
|
||||
2.2.2 -- 24 Jan 2019
|
||||
----------------------
|
||||
- Fix a bug in macro identifying system events
|
||||
|
||||
|
||||
2.2.1 -- 18 Jan 2019
|
||||
----------------------
|
||||
- Fix a bug in registration of default event handlers
|
||||
that somehow slipped thru testing
|
||||
|
||||
|
||||
2.2.0 -- 17 Jan 2019
|
||||
----------------------
|
||||
**** THIS RELEASE MARKS THE STARTING POINT FOR FULL COMPLIANCE
|
||||
**** WITH THE PMIX v2.2 STANDARD. ALL API BEHAVIORS AND ATTRIBUTE
|
||||
**** DEFINITIONS MEET THE v2.2 STANDARD SPECIFICATIONS.
|
||||
- Add a new, faster dstore GDS component 'ds21'
|
||||
- Performance optimizations for the dstore GDS components.
|
||||
- Plug miscellaneous memory leaks
|
||||
- Silence an unnecessary warning message when checking connection
|
||||
to a non-supporting server
|
||||
- Ensure lost-connection events get delivered to default event
|
||||
handlers
|
||||
- Correctly handle cache refresh for queries
|
||||
- Protect against race conditions between host and internal library
|
||||
when dealing with async requests
|
||||
- Cleanup tool operations and add support for connections to
|
||||
remote servers.
|
||||
- Automatically store the server URI for easy access by client
|
||||
- Provide MCA parameter to control TCP connect retry/timeout
|
||||
- Update event notification system to properly evict oldest events
|
||||
when more space is needed
|
||||
- Fix a number of error paths
|
||||
- Handle setsockopt(SO_RCVTIMEO) not being supported
|
||||
- Pass the tool's command line to the server so it can be returned
|
||||
in queries
|
||||
- Add support for C11 atomics
|
||||
- Fix a bug when registering default event handlers
|
||||
|
||||
|
||||
2.1.4 -- 18 Sep 2018
|
||||
----------------------
|
||||
- Updated configury to silence warnings on older compilers
|
||||
|
@ -43,6 +43,11 @@ joe@mycomputer.example.com!). You can subscribe to the list here:
|
||||
|
||||
https://groups.google.com/d/forum/pmix
|
||||
|
||||
Finally, just to round out all the possible ways to communicate with the
|
||||
PMIx community, you are invited to join the community's Slack channel:
|
||||
|
||||
pmix-workspace.slack.com
|
||||
|
||||
Thanks for your time.
|
||||
|
||||
===========================================================================
|
||||
@ -192,21 +197,22 @@ PMIx's version numbers are the union of several different values:
|
||||
major, minor, release, and an optional quantifier.
|
||||
|
||||
* Major: The major number is the first integer in the version string
|
||||
(e.g., v1.2.3). Changes in the major number typically indicate a
|
||||
significant change in the code base and/or end-user
|
||||
functionality. The major number is always included in the version
|
||||
number.
|
||||
(e.g., v1.2.3) and indicates the corresponding version of the PMIx
|
||||
Standard. In other words, a PMIx library release starting with "v2"
|
||||
indicates that the implementation conforms to version 2 of the PMIx
|
||||
Standard.
|
||||
|
||||
* Minor: The minor number is the second integer in the version
|
||||
string (e.g., v1.2.3). Changes in the minor number typically
|
||||
indicate a incremental change in the code base and/or end-user
|
||||
functionality. The minor number is always included in the version
|
||||
number:
|
||||
functionality, but not the supported version of the Standard.
|
||||
The minor number is always included in the version number.
|
||||
|
||||
* Release: The release number is the third integer in the version
|
||||
string (e.g., v1.2.3). Changes in the release number typically
|
||||
indicate a bug fix in the code base and/or end-user
|
||||
functionality.
|
||||
functionality. The release number is always included in the
|
||||
version number.
|
||||
|
||||
* Quantifier: PMIx version numbers sometimes have an arbitrary
|
||||
string affixed to the end of the version number. Common strings
|
||||
@ -293,16 +299,15 @@ Application Binary Interface (ABI) Compatibility
|
||||
------------------------------------------------
|
||||
|
||||
PMIx provides forward ABI compatibility in all versions of a given
|
||||
feature release series and its corresponding
|
||||
super stable series. For example, on a single platform, an pmix
|
||||
feature release series. For example, on a single platform, an pmix
|
||||
application linked against PMIx v1.3.2 shared libraries can be
|
||||
updated to point to the shared libraries in any successive v1.3.x or
|
||||
v1.4 release and still work properly (e.g., via the LD_LIBRARY_PATH
|
||||
environment variable or other operating system mechanism).
|
||||
|
||||
PMIx reserves the right to break ABI compatibility at new feature
|
||||
PMIx reserves the right to break ABI compatibility at new major
|
||||
release series. For example, the same pmix application from above
|
||||
(linked against PMIx v1.3.2 shared libraries) will *not* work with
|
||||
(linked against PMIx v1.3.2 shared libraries) may *not* work with
|
||||
PMIx v1.5 shared libraries.
|
||||
|
||||
===========================================================================
|
||||
|
@ -14,7 +14,7 @@
|
||||
# <major>.<minor>.<release>.
|
||||
|
||||
major=3
|
||||
minor=0
|
||||
minor=1
|
||||
release=2
|
||||
|
||||
# greek is used for alpha or beta release tags. If it is non-empty,
|
||||
@ -30,7 +30,7 @@ greek=
|
||||
# command, or with the date (if "git describe" fails) in the form of
|
||||
# "date<date>".
|
||||
|
||||
repo_rev=gite574b10d
|
||||
repo_rev=git0f7075f7
|
||||
|
||||
# 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="Sep 18, 2018"
|
||||
date="Jan 24, 2019"
|
||||
|
||||
# The shared library version of each of PMIx's public libraries.
|
||||
# These versions are maintained in accordance with the "Library
|
||||
@ -75,6 +75,13 @@ date="Sep 18, 2018"
|
||||
# Version numbers are described in the Libtool current:revision:age
|
||||
# format.
|
||||
|
||||
libpmix_so_version=4:2:2
|
||||
libpmix_so_version=4:22:2
|
||||
libpmi_so_version=1:0:0
|
||||
libpmi2_so_version=1:0:0
|
||||
|
||||
# "Common" components install standalone libraries that are run-time
|
||||
# # linked by one or more components. So they need to be versioned as
|
||||
# # well. Yuck; this somewhat breaks the
|
||||
# # components-don't-affect-the-build-system abstraction.
|
||||
#
|
||||
libmca_common_dstore_so_version=1:0:0
|
||||
|
@ -17,7 +17,7 @@ dnl Copyright (c) 2009 Los Alamos National Security, LLC. All rights
|
||||
dnl reserved.
|
||||
dnl Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved.
|
||||
dnl Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved.
|
||||
dnl Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
dnl and Technology (RIST). All rights reserved.
|
||||
dnl Copyright (c) 2016 Mellanox Technologies, Inc.
|
||||
@ -189,12 +189,36 @@ AC_DEFUN([PMIX_SETUP_CORE],[
|
||||
[Link the output PMIx library to this extra lib (used in embedded mode)]))
|
||||
AC_MSG_CHECKING([for extra lib])
|
||||
AS_IF([test ! -z "$with_pmix_extra_lib"],
|
||||
[AC_MSG_RESULT([$with_pmix_extra_lib])
|
||||
PMIX_EXTRA_LIB=$with_pmix_extra_lib],
|
||||
[AS_IF([test "$with_pmix_extra_lib" == "yes" || test "$with_pmix_extra_lib" == "no"],
|
||||
[AC_MSG_RESULT([ERROR])
|
||||
AC_MSG_WARN([Invalid value for --with-extra-pmix-lib:])
|
||||
AC_MSG_WARN([ $with_pmix_extra_lib])
|
||||
AC_MSG_WARN([Must be path name of the library to add])
|
||||
AC_MSG_ERROR([Cannot continue])],
|
||||
[AC_MSG_RESULT([$with_pmix_extra_lib])
|
||||
PMIX_EXTRA_LIB=$with_pmix_extra_lib])],
|
||||
[AC_MSG_RESULT([no])
|
||||
PMIX_EXTRA_LIB=])
|
||||
AC_SUBST(PMIX_EXTRA_LIB)
|
||||
|
||||
# Add any extra libtool lib?
|
||||
AC_ARG_WITH([pmix-extra-ltlib],
|
||||
AC_HELP_STRING([--with-pmix-extra-ltlib=LIB],
|
||||
[Link any embedded components/tools that require it to the provided libtool lib (used in embedded mode)]))
|
||||
AC_MSG_CHECKING([for extra ltlib])
|
||||
AS_IF([test ! -z "$with_pmix_extra_ltlib"],
|
||||
[AS_IF([test "$with_pmix_extra_ltlib" == "yes" || test "$with_pmix_extra_ltlib" == "no"],
|
||||
[AC_MSG_RESULT([ERROR])
|
||||
AC_MSG_WARN([Invalid value for --with-pmix-extra-ltlib:])
|
||||
AC_MSG_WARN([ $with_pmix_extra_ltlib])
|
||||
AC_MSG_WARN([Must be path name of the library to add])
|
||||
AC_MSG_ERROR([Cannot continue])],
|
||||
[AC_MSG_RESULT([$with_pmix_extra_ltlib])
|
||||
PMIX_EXTRA_LTLIB=$with_pmix_extra_ltlib])],
|
||||
[AC_MSG_RESULT([no])
|
||||
PMIX_EXTRA_LTLIB=])
|
||||
AC_SUBST(PMIX_EXTRA_LTLIB)
|
||||
|
||||
#
|
||||
# Package/brand string
|
||||
#
|
||||
@ -391,7 +415,8 @@ 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 zlib.h])
|
||||
netdb.h ucred.h zlib.h sys/auxv.h \
|
||||
sys/sysctl.h])
|
||||
|
||||
AC_CHECK_HEADERS([sys/mount.h], [], [],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
@ -655,10 +680,6 @@ AC_DEFUN([PMIX_SETUP_CORE],[
|
||||
[AC_DEFINE_UNQUOTED([HAVE_UNIX_BYTESWAP], [1],
|
||||
[whether unix byteswap routines -- htonl, htons, nothl, ntohs -- are available])])
|
||||
|
||||
# check pandoc separately so we can setup an AM_CONDITIONAL off it
|
||||
AC_CHECK_PROG([pmix_have_pandoc], [pandoc], [yes], [no])
|
||||
AM_CONDITIONAL([PMIX_HAVE_PANDOC], [test "x$pmix_have_pandoc" = "xyes"])
|
||||
|
||||
#
|
||||
# Make sure we can copy va_lists (need check declared, not linkable)
|
||||
#
|
||||
@ -1078,20 +1099,6 @@ AC_DEFINE_UNQUOTED([PMIX_ENABLE_TIMING], [$WANT_PMIX_TIMING],
|
||||
[Whether we want developer-level timing support or not])
|
||||
|
||||
#
|
||||
# Install header files
|
||||
#
|
||||
AC_MSG_CHECKING([if want to head developer-level header files])
|
||||
AC_ARG_WITH(devel-headers,
|
||||
AC_HELP_STRING([--with-devel-headers],
|
||||
[also install developer-level header files (only for internal PMIx developers, default: disabled)]))
|
||||
if test "$with_devel_headers" = "yes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
WANT_INSTALL_HEADERS=1
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
WANT_INSTALL_HEADERS=0
|
||||
fi
|
||||
|
||||
#
|
||||
# Install backward compatibility support for PMI-1 and PMI-2
|
||||
#
|
||||
|
@ -57,4 +57,6 @@ AC_DEFUN([PMIX_CHECK_DSTOR_LOCK],[
|
||||
fi
|
||||
fi
|
||||
LIBS="$orig_libs"
|
||||
AM_CONDITIONAL([HAVE_DSTORE_PTHREAD_LOCK], [test "$_x_ac_pthread_lock_found" = "1"])
|
||||
AM_CONDITIONAL([HAVE_DSTORE_FCNTL_LOCK], [test "$_x_ac_fcntl_lock_found" = "1"])
|
||||
])
|
||||
|
@ -1,7 +1,7 @@
|
||||
dnl -*- shell-script -*-
|
||||
dnl
|
||||
dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2014 Research Organization for Information Science
|
||||
dnl and Technology (RIST). All rights reserved.
|
||||
dnl
|
||||
@ -57,6 +57,13 @@ AC_DEFUN([PMIX_CHECK_OS_FLAVORS],
|
||||
[$pmix_have_solaris],
|
||||
[Whether or not we have solaris])
|
||||
|
||||
AS_IF([test "$pmix_found_apple" = "yes"],
|
||||
[pmix_have_apple=1],
|
||||
[pmix_have_apple=0])
|
||||
AC_DEFINE_UNQUOTED([PMIX_HAVE_APPLE],
|
||||
[$pmix_have_apple],
|
||||
[Whether or not we have apple])
|
||||
|
||||
# check for sockaddr_in (a good sign we have TCP)
|
||||
AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h])
|
||||
AC_CHECK_TYPES([struct sockaddr_in],
|
||||
|
@ -2,22 +2,22 @@ dnl
|
||||
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
dnl University Research and Technology
|
||||
dnl Corporation. All rights reserved.
|
||||
dnl Copyright (c) 2004-2015 The University of Tennessee and The University
|
||||
dnl Copyright (c) 2004-2018 The University of Tennessee and The University
|
||||
dnl of Tennessee Research Foundation. All rights
|
||||
dnl reserved.
|
||||
dnl Copyright (c) 2004-2006 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) 2008-2015 Cisco Systems, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
dnl Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
dnl and Technology (RIST). All rights reserved.
|
||||
dnl Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights
|
||||
dnl Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights
|
||||
dnl reserved.
|
||||
dnl Copyright (c) 2017 Amazon.com, Inc. or its affiliates. All Rights
|
||||
dnl reserved.
|
||||
dnl Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2018-2019 Intel, Inc. All rights reserved.
|
||||
dnl $COPYRIGHT$
|
||||
dnl
|
||||
dnl Additional copyrights may follow
|
||||
@ -25,65 +25,262 @@ dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
|
||||
dnl This is a C test to see if 128-bit __atomic_compare_exchange_n()
|
||||
dnl actually works (e.g., it compiles and links successfully on
|
||||
dnl ARM64+clang, but returns incorrect answers as of August 2018).
|
||||
AC_DEFUN([PMIX_ATOMIC_COMPARE_EXCHANGE_N_TEST_SOURCE],[[
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef union {
|
||||
uint64_t fake@<:@2@:>@;
|
||||
__int128 real;
|
||||
} pmix128;
|
||||
|
||||
static void test1(void)
|
||||
{
|
||||
// As of Aug 2018, we could not figure out a way to assign 128-bit
|
||||
// constants -- the compilers would not accept it. So use a fake
|
||||
// union to assign 2 uin64_t's to make a single __int128.
|
||||
pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }};
|
||||
pmix128 expected = { .fake = { 0x11EEDDCCBBAA0099, 0x88776655443322FF }};
|
||||
pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }};
|
||||
bool r = __atomic_compare_exchange_n(&ptr.real, &expected.real,
|
||||
desired.real, true,
|
||||
__ATOMIC_RELAXED, __ATOMIC_RELAXED);
|
||||
if ( !(r == false && ptr.real == expected.real)) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void test2(void)
|
||||
{
|
||||
pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }};
|
||||
pmix128 expected = ptr;
|
||||
pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }};
|
||||
bool r = __atomic_compare_exchange_n(&ptr.real, &expected.real,
|
||||
desired.real, true,
|
||||
__ATOMIC_RELAXED, __ATOMIC_RELAXED);
|
||||
if (!(r == true && ptr.real == desired.real)) {
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
|
||||
dnl ------------------------------------------------------------------
|
||||
|
||||
dnl This is a C test to see if 128-bit __sync_bool_compare_and_swap()
|
||||
dnl actually works (e.g., it compiles and links successfully on
|
||||
dnl ARM64+clang, but returns incorrect answers as of August 2018).
|
||||
AC_DEFUN([PMIX_SYNC_BOOL_COMPARE_AND_SWAP_TEST_SOURCE],[[
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef union {
|
||||
uint64_t fake@<:@2@:>@;
|
||||
__int128 real;
|
||||
} pmix128;
|
||||
|
||||
static void test1(void)
|
||||
{
|
||||
// As of Aug 2018, we could not figure out a way to assign 128-bit
|
||||
// constants -- the compilers would not accept it. So use a fake
|
||||
// union to assign 2 uin64_t's to make a single __int128.
|
||||
pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }};
|
||||
pmix128 oldval = { .fake = { 0x11EEDDCCBBAA0099, 0x88776655443322FF }};
|
||||
pmix128 newval = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }};
|
||||
bool r = __sync_bool_compare_and_swap(&ptr.real, oldval.real, newval.real);
|
||||
if (!(r == false && ptr.real != newval.real)) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void test2(void)
|
||||
{
|
||||
pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }};
|
||||
pmix128 oldval = ptr;
|
||||
pmix128 newval = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }};
|
||||
bool r = __sync_bool_compare_and_swap(&ptr.real, oldval.real, newval.real);
|
||||
if (!(r == true && ptr.real == newval.real)) {
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
|
||||
dnl This is a C test to see if 128-bit __atomic_compare_exchange_n()
|
||||
dnl actually works (e.g., it compiles and links successfully on
|
||||
dnl ARM64+clang, but returns incorrect answers as of August 2018).
|
||||
AC_DEFUN([PMIX_ATOMIC_COMPARE_EXCHANGE_STRONG_TEST_SOURCE],[[
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
typedef union {
|
||||
uint64_t fake@<:@2@:>@;
|
||||
_Atomic __int128 real;
|
||||
} pmix128;
|
||||
|
||||
static void test1(void)
|
||||
{
|
||||
// As of Aug 2018, we could not figure out a way to assign 128-bit
|
||||
// constants -- the compilers would not accept it. So use a fake
|
||||
// union to assign 2 uin64_t's to make a single __int128.
|
||||
pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }};
|
||||
pmix128 expected = { .fake = { 0x11EEDDCCBBAA0099, 0x88776655443322FF }};
|
||||
pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }};
|
||||
bool r = atomic_compare_exchange_strong (&ptr.real, &expected.real,
|
||||
desired.real, true,
|
||||
atomic_relaxed, atomic_relaxed);
|
||||
if ( !(r == false && ptr.real == expected.real)) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void test2(void)
|
||||
{
|
||||
pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }};
|
||||
pmix128 expected = ptr;
|
||||
pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }};
|
||||
bool r = atomic_compare_exchange_strong (&ptr.real, &expected.real,
|
||||
desired.real, true,
|
||||
atomic_relaxed, atomic_relaxed);
|
||||
if (!(r == true && ptr.real == desired.real)) {
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
test1();
|
||||
test2();
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
|
||||
dnl ------------------------------------------------------------------
|
||||
|
||||
dnl
|
||||
dnl Check to see if a specific function is linkable.
|
||||
dnl
|
||||
dnl Check with:
|
||||
dnl 1. No compiler/linker flags.
|
||||
dnl 2. CFLAGS += -mcx16
|
||||
dnl 3. LIBS += -latomic
|
||||
dnl 4. Finally, if it links ok with any of #1, #2, or #3, actually try
|
||||
dnl to run the test code (if we're not cross-compiling) and verify
|
||||
dnl that it actually gives us the correct result.
|
||||
dnl
|
||||
dnl Note that we unfortunately can't use AC SEARCH_LIBS because its
|
||||
dnl check incorrectly fails (because these functions are special compiler
|
||||
dnl intrinsics -- SEARCH_LIBS tries with "check FUNC()", which the
|
||||
dnl compiler complains doesn't match the internal prototype). So we have
|
||||
dnl to use our own LINK_IFELSE tests. Indeed, since these functions are
|
||||
dnl so special, we actually need a valid source code that calls the
|
||||
dnl functions with correct arguments, etc. It's not enough, for example,
|
||||
dnl to do the usual "try to set a function pointer to the symbol" trick to
|
||||
dnl determine if these functions are available, because the compiler may
|
||||
dnl not implement these as actual symbols. So just try to link a real
|
||||
dnl test code.
|
||||
dnl
|
||||
dnl $1: function name to print
|
||||
dnl $2: program to test
|
||||
dnl $3: action if any of 1, 2, or 3 succeeds
|
||||
dnl #4: action if all of 1, 2, and 3 fail
|
||||
dnl
|
||||
AC_DEFUN([PMIX_ASM_CHECK_ATOMIC_FUNC],[
|
||||
PMIX_VAR_SCOPE_PUSH([pmix_asm_check_func_happy pmix_asm_check_func_CFLAGS_save pmix_asm_check_func_LIBS_save])
|
||||
|
||||
pmix_asm_check_func_CFLAGS_save=$CFLAGS
|
||||
pmix_asm_check_func_LIBS_save=$LIBS
|
||||
|
||||
dnl Check with no compiler/linker flags
|
||||
AC_MSG_CHECKING([for $1])
|
||||
AC_LINK_IFELSE([$2],
|
||||
[pmix_asm_check_func_happy=1
|
||||
AC_MSG_RESULT([yes])],
|
||||
[pmix_asm_check_func_happy=0
|
||||
AC_MSG_RESULT([no])])
|
||||
|
||||
dnl If that didn't work, try again with CFLAGS+=mcx16
|
||||
AS_IF([test $pmix_asm_check_func_happy -eq 0],
|
||||
[AC_MSG_CHECKING([for $1 with -mcx16])
|
||||
CFLAGS="$CFLAGS -mcx16"
|
||||
AC_LINK_IFELSE([$2],
|
||||
[pmix_asm_check_func_happy=1
|
||||
AC_MSG_RESULT([yes])],
|
||||
[pmix_asm_check_func_happy=0
|
||||
CFLAGS=$pmix_asm_check_func_CFLAGS_save
|
||||
AC_MSG_RESULT([no])])
|
||||
])
|
||||
|
||||
dnl If that didn't work, try again with LIBS+=-latomic
|
||||
AS_IF([test $pmix_asm_check_func_happy -eq 0],
|
||||
[AC_MSG_CHECKING([for $1 with -latomic])
|
||||
LIBS="$LIBS -latomic"
|
||||
AC_LINK_IFELSE([$2],
|
||||
[pmix_asm_check_func_happy=1
|
||||
AC_MSG_RESULT([yes])],
|
||||
[pmix_asm_check_func_happy=0
|
||||
LIBS=$pmix_asm_check_func_LIBS_save
|
||||
AC_MSG_RESULT([no])])
|
||||
])
|
||||
|
||||
dnl If we have it, try it and make sure it gives a correct result.
|
||||
dnl As of Aug 2018, we know that it links but does *not* work on clang
|
||||
dnl 6 on ARM64.
|
||||
AS_IF([test $pmix_asm_check_func_happy -eq 1],
|
||||
[AC_MSG_CHECKING([if $1() gives correct results])
|
||||
AC_RUN_IFELSE([$2],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[pmix_asm_check_func_happy=0
|
||||
AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])])
|
||||
])
|
||||
|
||||
dnl If we were unsuccessful, restore CFLAGS/LIBS
|
||||
AS_IF([test $pmix_asm_check_func_happy -eq 0],
|
||||
[CFLAGS=$pmix_asm_check_func_CFLAGS_save
|
||||
LIBS=$pmix_asm_check_func_LIBS_save])
|
||||
|
||||
dnl Run the user actions
|
||||
AS_IF([test $pmix_asm_check_func_happy -eq 1], [$3], [$4])
|
||||
|
||||
PMIX_VAR_SCOPE_POP
|
||||
])
|
||||
|
||||
dnl ------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128], [
|
||||
PMIX_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result])
|
||||
|
||||
PMIX_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result CFLAGS_save])
|
||||
# Do we have __sync_bool_compare_and_swap?
|
||||
# Use a special macro because we need to check with a few different
|
||||
# CFLAGS/LIBS.
|
||||
PMIX_ASM_CHECK_ATOMIC_FUNC([__sync_bool_compare_and_swap],
|
||||
[AC_LANG_SOURCE(PMIX_SYNC_BOOL_COMPARE_AND_SWAP_TEST_SOURCE)],
|
||||
[sync_bool_compare_and_swap_128_result=1],
|
||||
[sync_bool_compare_and_swap_128_result=0])
|
||||
|
||||
AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128],
|
||||
[enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])])
|
||||
|
||||
sync_bool_compare_and_swap_128_result=0
|
||||
|
||||
if test ! "$enable_cross_cmpset128" = "yes" ; then
|
||||
AC_MSG_CHECKING([for processor support of __sync builtin atomic compare-and-swap on 128-bit values])
|
||||
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
sync_bool_compare_and_swap_128_result=1],
|
||||
[AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([no (cross compiling)])])
|
||||
|
||||
if test $sync_bool_compare_and_swap_128_result = 0 ; then
|
||||
CFLAGS_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS -mcx16"
|
||||
|
||||
AC_MSG_CHECKING([for __sync builtin atomic compare-and-swap on 128-bit values with -mcx16 flag])
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
sync_bool_compare_and_swap_128_result=1
|
||||
CFLAGS_save="$CFLAGS"],
|
||||
[AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([no (cross compiling)])])
|
||||
|
||||
CFLAGS=$CFLAGS_save
|
||||
fi
|
||||
else
|
||||
AC_MSG_CHECKING([for compiler support of __sync builtin atomic compare-and-swap on 128-bit values])
|
||||
|
||||
# Check if the compiler supports the __sync builtin
|
||||
AC_TRY_LINK([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);],
|
||||
[AC_MSG_RESULT([yes])
|
||||
sync_bool_compare_and_swap_128_result=1],
|
||||
[AC_MSG_RESULT([no])])
|
||||
|
||||
if test $sync_bool_compare_and_swap_128_result = 0 ; then
|
||||
CFLAGS_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS -mcx16"
|
||||
|
||||
AC_MSG_CHECKING([for __sync builtin atomic compare-and-swap on 128-bit values with -mcx16 flag])
|
||||
AC_TRY_LINK([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);],
|
||||
[AC_MSG_RESULT([yes])
|
||||
sync_bool_compare_and_swap_128_result=1
|
||||
CFLAGS_save="$CFLAGS"],
|
||||
[AC_MSG_RESULT([no])])
|
||||
|
||||
CFLAGS=$CFLAGS_save
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED([PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128], [$sync_bool_compare_and_swap_128_result],
|
||||
[Whether the __sync builtin atomic compare and swap supports 128-bit values])
|
||||
AC_DEFINE_UNQUOTED([PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128],
|
||||
[$sync_bool_compare_and_swap_128_result],
|
||||
[Whether the __sync builtin atomic compare and swap supports 128-bit values])
|
||||
|
||||
PMIX_VAR_SCOPE_POP
|
||||
])
|
||||
@ -112,7 +309,7 @@ __sync_add_and_fetch(&tmp, 1);],
|
||||
pmix_asm_sync_have_64bit=0])
|
||||
|
||||
AC_DEFINE_UNQUOTED([PMIX_ASM_SYNC_HAVE_64BIT],[$pmix_asm_sync_have_64bit],
|
||||
[Whether 64-bit is supported by the __sync builtin atomics])
|
||||
[Whether 64-bit is supported by the __sync builtin atomics])
|
||||
|
||||
# Check for 128-bit support
|
||||
PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128
|
||||
@ -120,73 +317,110 @@ __sync_add_and_fetch(&tmp, 1);],
|
||||
|
||||
|
||||
AC_DEFUN([PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128], [
|
||||
PMIX_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result atomic_compare_exchange_n_128_CFLAGS_save atomic_compare_exchange_n_128_LIBS_save])
|
||||
|
||||
PMIX_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result CFLAGS_save])
|
||||
atomic_compare_exchange_n_128_CFLAGS_save=$CFLAGS
|
||||
atomic_compare_exchange_n_128_LIBS_save=$LIBS
|
||||
|
||||
AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128],
|
||||
[enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])])
|
||||
# Do we have __sync_bool_compare_and_swap?
|
||||
# Use a special macro because we need to check with a few different
|
||||
# CFLAGS/LIBS.
|
||||
PMIX_ASM_CHECK_ATOMIC_FUNC([__atomic_compare_exchange_n],
|
||||
[AC_LANG_SOURCE(PMIX_ATOMIC_COMPARE_EXCHANGE_N_TEST_SOURCE)],
|
||||
[atomic_compare_exchange_n_128_result=1],
|
||||
[atomic_compare_exchange_n_128_result=0])
|
||||
|
||||
atomic_compare_exchange_n_128_result=0
|
||||
|
||||
if test ! "$enable_cross_cmpset128" = "yes" ; then
|
||||
AC_MSG_CHECKING([for processor support of __atomic builtin atomic compare-and-swap on 128-bit values])
|
||||
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
atomic_compare_exchange_n_128_result=1],
|
||||
[AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([no (cross compiling)])])
|
||||
|
||||
if test $atomic_compare_exchange_n_128_result = 0 ; then
|
||||
CFLAGS_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS -mcx16"
|
||||
|
||||
AC_MSG_CHECKING([for __atomic builtin atomic compare-and-swap on 128-bit values with -mcx16 flag])
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
atomic_compare_exchange_n_128_result=1
|
||||
CFLAGS_save="$CFLAGS"],
|
||||
[AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([no (cross compiling)])])
|
||||
|
||||
CFLAGS=$CFLAGS_save
|
||||
fi
|
||||
|
||||
if test $atomic_compare_exchange_n_128_result = 1 ; then
|
||||
AC_MSG_CHECKING([if __int128 atomic compare-and-swap is always lock-free])
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [if (!__atomic_always_lock_free(16, 0)) { return 1; }])],
|
||||
# If we have it and it works, check to make sure it is always lock
|
||||
# free.
|
||||
AS_IF([test $atomic_compare_exchange_n_128_result -eq 1],
|
||||
[AC_MSG_CHECKING([if __int128 atomic compare-and-swap is always lock-free])
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [if (!__atomic_always_lock_free(16, 0)) { return 1; }])],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128
|
||||
atomic_compare_exchange_n_128_result=0],
|
||||
[AC_MSG_RESULT([no (cross compiling)])])
|
||||
fi
|
||||
else
|
||||
AC_MSG_CHECKING([for compiler support of __atomic builtin atomic compare-and-swap on 128-bit values])
|
||||
[atomic_compare_exchange_n_128_result=0
|
||||
# If this test fails, need to reset CFLAGS/LIBS (the
|
||||
# above tests atomically set CFLAGS/LIBS or not; this
|
||||
# test is running after the fact, so we have to undo
|
||||
# the side-effects of setting CFLAGS/LIBS if the above
|
||||
# tests passed).
|
||||
CFLAGS=$atomic_compare_exchange_n_128_CFLAGS_save
|
||||
LIBS=$atomic_compare_exchange_n_128_LIBS_save
|
||||
AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])])
|
||||
])
|
||||
|
||||
# Check if the compiler supports the __atomic builtin
|
||||
AC_TRY_LINK([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);],
|
||||
[AC_MSG_RESULT([yes])
|
||||
atomic_compare_exchange_n_128_result=1],
|
||||
[AC_MSG_RESULT([no])])
|
||||
AC_DEFINE_UNQUOTED([PMIX_HAVE_GCC_BUILTIN_CSWAP_INT128],
|
||||
[$atomic_compare_exchange_n_128_result],
|
||||
[Whether the __atomic builtin atomic compare swap is both supported and lock-free on 128-bit values])
|
||||
|
||||
if test $atomic_compare_exchange_n_128_result = 0 ; then
|
||||
CFLAGS_save=$CFLAGS
|
||||
CFLAGS="$CFLAGS -mcx16"
|
||||
dnl If we could not find decent support for 128-bits __atomic let's
|
||||
dnl try the GCC _sync
|
||||
AS_IF([test $atomic_compare_exchange_n_128_result -eq 0],
|
||||
[PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128])
|
||||
|
||||
AC_MSG_CHECKING([for __atomic builtin atomic compare-and-swap on 128-bit values with -mcx16 flag])
|
||||
AC_TRY_LINK([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);],
|
||||
[AC_MSG_RESULT([yes])
|
||||
atomic_compare_exchange_n_128_result=1
|
||||
CFLAGS_save="$CFLAGS"],
|
||||
[AC_MSG_RESULT([no])])
|
||||
PMIX_VAR_SCOPE_POP
|
||||
])
|
||||
|
||||
CFLAGS=$CFLAGS_save
|
||||
fi
|
||||
fi
|
||||
AC_DEFUN([PMIX_CHECK_GCC_ATOMIC_BUILTINS], [
|
||||
AC_MSG_CHECKING([for __atomic builtin atomics])
|
||||
|
||||
AC_DEFINE_UNQUOTED([PMIX_HAVE_GCC_BUILTIN_CSWAP_INT128], [$atomic_compare_exchange_n_128_result],
|
||||
[Whether the __atomic builtin atomic compare and swap is lock-free on 128-bit values])
|
||||
AC_TRY_LINK([
|
||||
#include <stdint.h>
|
||||
uint32_t tmp, old = 0;
|
||||
uint64_t tmp64, old64 = 0;], [
|
||||
__atomic_thread_fence(__ATOMIC_SEQ_CST);
|
||||
__atomic_compare_exchange_n(&tmp, &old, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
|
||||
__atomic_add_fetch(&tmp, 1, __ATOMIC_RELAXED);
|
||||
__atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
|
||||
__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);],
|
||||
[AC_MSG_RESULT([yes])
|
||||
$1],
|
||||
[AC_MSG_RESULT([no])
|
||||
$2])
|
||||
|
||||
# Check for 128-bit support
|
||||
PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128
|
||||
])
|
||||
|
||||
AC_DEFUN([PMIX_CHECK_C11_CSWAP_INT128], [
|
||||
PMIX_VAR_SCOPE_PUSH([atomic_compare_exchange_result atomic_compare_exchange_CFLAGS_save atomic_compare_exchange_LIBS_save])
|
||||
|
||||
atomic_compare_exchange_CFLAGS_save=$CFLAGS
|
||||
atomic_compare_exchange_LIBS_save=$LIBS
|
||||
|
||||
# Do we have C11 atomics on 128-bit integers?
|
||||
# Use a special macro because we need to check with a few different
|
||||
# CFLAGS/LIBS.
|
||||
PMIX_ASM_CHECK_ATOMIC_FUNC([atomic_compare_exchange_strong_16],
|
||||
[AC_LANG_SOURCE(PMIX_ATOMIC_COMPARE_EXCHANGE_STRONG_TEST_SOURCE)],
|
||||
[atomic_compare_exchange_result=1],
|
||||
[atomic_compare_exchange_result=0])
|
||||
|
||||
# If we have it and it works, check to make sure it is always lock
|
||||
# free.
|
||||
AS_IF([test $atomic_compare_exchange_result -eq 1],
|
||||
[AC_MSG_CHECKING([if C11 __int128 atomic compare-and-swap is always lock-free])
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdatomic.h>], [_Atomic __int128_t x; if (!atomic_is_lock_free(&x)) { return 1; }])],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[atomic_compare_exchange_result=0
|
||||
# If this test fails, need to reset CFLAGS/LIBS (the
|
||||
# above tests atomically set CFLAGS/LIBS or not; this
|
||||
# test is running after the fact, so we have to undo
|
||||
# the side-effects of setting CFLAGS/LIBS if the above
|
||||
# tests passed).
|
||||
CFLAGS=$atomic_compare_exchange_CFLAGS_save
|
||||
LIBS=$atomic_compare_exchange_LIBS_save
|
||||
AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])])
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([PMIX_HAVE_C11_CSWAP_INT128],
|
||||
[$atomic_compare_exchange_result],
|
||||
[Whether C11 atomic compare swap is both supported and lock-free on 128-bit values])
|
||||
|
||||
dnl If we could not find decent support for 128-bits atomic let's
|
||||
dnl try the GCC _sync
|
||||
AS_IF([test $atomic_compare_exchange_result -eq 0],
|
||||
[PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128])
|
||||
|
||||
PMIX_VAR_SCOPE_POP
|
||||
])
|
||||
@ -533,7 +767,7 @@ dnl PMIX_CHECK_ASM_TYPE
|
||||
dnl
|
||||
dnl Sets PMIX_ASM_TYPE to the prefix for the function type to
|
||||
dnl set a symbol's type as function (needed on ELF for shared
|
||||
dnl libaries). If no .type directive is needed, sets PMIX_ASM_TYPE
|
||||
dnl libraries). If no .type directive is needed, sets PMIX_ASM_TYPE
|
||||
dnl to an empty string
|
||||
dnl
|
||||
dnl We look for @ \# %
|
||||
@ -727,7 +961,7 @@ AC_DEFUN([PMIX_CHECK_SPARCV8PLUS],[
|
||||
AC_MSG_CHECKING([if have Sparc v8+/v9 support])
|
||||
sparc_result=0
|
||||
PMIX_TRY_ASSEMBLE([$pmix_cv_asm_text
|
||||
casa [%o0] 0x80, %o1, %o2],
|
||||
casa [%o0] 0x80, %o1, %o2],
|
||||
[sparc_result=1],
|
||||
[sparc_result=0])
|
||||
if test "$sparc_result" = "1" ; then
|
||||
@ -746,35 +980,8 @@ dnl
|
||||
dnl PMIX_CHECK_CMPXCHG16B
|
||||
dnl
|
||||
dnl #################################################################
|
||||
AC_DEFUN([PMIX_CHECK_CMPXCHG16B],[
|
||||
PMIX_VAR_SCOPE_PUSH([cmpxchg16b_result])
|
||||
|
||||
AC_ARG_ENABLE([cross-cmpxchg16b],[AC_HELP_STRING([--enable-cross-cmpxchg16b],
|
||||
[enable the use of the cmpxchg16b instruction when cross compiling])])
|
||||
|
||||
if test ! "$enable_cross_cmpxchg16b" = "yes" ; then
|
||||
AC_MSG_CHECKING([if processor supports x86_64 16-byte compare-and-exchange])
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([[unsigned char tmp[16];]],[[
|
||||
__asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
cmpxchg16b_result=1],
|
||||
[AC_MSG_RESULT([no])
|
||||
cmpxchg16b_result=0],
|
||||
[AC_MSG_RESULT([no (cross-compiling)])
|
||||
cmpxchg16b_result=0])
|
||||
else
|
||||
AC_MSG_CHECKING([if assembler supports x86_64 16-byte compare-and-exchange])
|
||||
|
||||
PMIX_TRY_ASSEMBLE([$pmix_cv_asm_text
|
||||
cmpxchg16b 0],
|
||||
[AC_MSG_RESULT([yes])
|
||||
cmpxchg16b_result=1],
|
||||
[AC_MSG_RESULT([no])
|
||||
cmpxchg16b_result=0])
|
||||
fi
|
||||
if test "$cmpxchg16b_result" = 1; then
|
||||
AC_MSG_CHECKING([if compiler correctly handles volatile 128bits])
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdint.h>
|
||||
AC_DEFUN([PMIX_CMPXCHG16B_TEST_SOURCE],[[
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
union pmix_counted_pointer_t {
|
||||
@ -788,8 +995,10 @@ union pmix_counted_pointer_t {
|
||||
int128_t value;
|
||||
#endif
|
||||
};
|
||||
typedef union pmix_counted_pointer_t pmix_counted_pointer_t;],
|
||||
[volatile pmix_counted_pointer_t a;
|
||||
typedef union pmix_counted_pointer_t pmix_counted_pointer_t;
|
||||
|
||||
int main(int argc, char* argv) {
|
||||
volatile pmix_counted_pointer_t a;
|
||||
pmix_counted_pointer_t b;
|
||||
|
||||
a.data.counter = 0;
|
||||
@ -814,12 +1023,28 @@ typedef union pmix_counted_pointer_t pmix_counted_pointer_t;],
|
||||
return (a.value != b.value);
|
||||
#else
|
||||
return 0;
|
||||
#endif])],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
cmpxchg16b_result=0],
|
||||
[AC_MSG_RESULT([untested, assuming ok])])
|
||||
fi
|
||||
#endif
|
||||
}
|
||||
]])
|
||||
|
||||
AC_DEFUN([PMIX_CHECK_CMPXCHG16B],[
|
||||
PMIX_VAR_SCOPE_PUSH([cmpxchg16b_result])
|
||||
|
||||
PMIX_ASM_CHECK_ATOMIC_FUNC([cmpxchg16b],
|
||||
[AC_LANG_PROGRAM([[unsigned char tmp[16];]],
|
||||
[[__asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])],
|
||||
[cmpxchg16b_result=1],
|
||||
[cmpxchg16b_result=0])
|
||||
# If we have it, make sure it works.
|
||||
AS_IF([test $cmpxchg16b_result -eq 1],
|
||||
[AC_MSG_CHECKING([if cmpxchg16b_result works])
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE(PMIX_CMPXCHG16B_TEST_SOURCE)],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[cmpxchg16b_result=0
|
||||
AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])])
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([PMIX_HAVE_CMPXCHG16B], [$cmpxchg16b_result],
|
||||
[Whether the processor supports the cmpxchg16b instruction])
|
||||
PMIX_VAR_SCOPE_POP
|
||||
@ -832,7 +1057,7 @@ dnl
|
||||
dnl Check if the compiler is capable of doing GCC-style inline
|
||||
dnl assembly. Some compilers emit a warning and ignore the inline
|
||||
dnl assembly (xlc on OS X) and compile without error. Therefore,
|
||||
dnl the test attempts to run the emited code to check that the
|
||||
dnl the test attempts to run the emitted code to check that the
|
||||
dnl assembly is actually run. To run this test, one argument to
|
||||
dnl the macro must be an assembly instruction in gcc format to move
|
||||
dnl the value 0 into the register containing the variable ret.
|
||||
@ -885,7 +1110,7 @@ return ret;
|
||||
|
||||
if test "$asm_result" = "yes" ; then
|
||||
PMIX_C_GCC_INLINE_ASSEMBLY=1
|
||||
pmix_cv_asm_inline_supported="yes"
|
||||
pmix_cv_asm_inline_supported="yes"
|
||||
else
|
||||
PMIX_C_GCC_INLINE_ASSEMBLY=0
|
||||
fi
|
||||
@ -912,18 +1137,30 @@ AC_DEFUN([PMIX_CONFIG_ASM],[
|
||||
AC_REQUIRE([PMIX_SETUP_CC])
|
||||
AC_REQUIRE([AM_PROG_AS])
|
||||
|
||||
AC_ARG_ENABLE([c11-atomics],[AC_HELP_STRING([--enable-c11-atomics],
|
||||
[Enable use of C11 atomics if available (default: enabled)])])
|
||||
|
||||
AC_ARG_ENABLE([builtin-atomics],
|
||||
[AC_HELP_STRING([--enable-builtin-atomics],
|
||||
[Enable use of __sync builtin atomics (default: enabled)])],
|
||||
[], [enable_builtin_atomics="yes"])
|
||||
[Enable use of __sync builtin atomics (default: disabled)])])
|
||||
|
||||
pmix_cv_asm_builtin="BUILTIN_NO"
|
||||
AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" != "no"],
|
||||
[PMIX_CHECK_GCC_ATOMIC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_GCC"], [])])
|
||||
AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" != "no"],
|
||||
[PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], [])])
|
||||
AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"],
|
||||
[AC_MSG_WARN([__sync builtin atomics requested but not found - proceeding with inline atomics])])
|
||||
PMIX_CHECK_C11_CSWAP_INT128
|
||||
|
||||
if test "x$enable_c11_atomics" != "xno" && test "$pmix_cv_c11_supported" = "yes" ; then
|
||||
pmix_cv_asm_builtin="BUILTIN_C11"
|
||||
PMIX_CHECK_C11_CSWAP_INT128
|
||||
elif test "x$enable_c11_atomics" = "xyes"; then
|
||||
AC_MSG_WARN([C11 atomics were requested but are not supported])
|
||||
AC_MSG_ERROR([Cannot continue])
|
||||
else
|
||||
pmix_cv_asm_builtin="BUILTIN_NO"
|
||||
AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"],
|
||||
[PMIX_CHECK_GCC_ATOMIC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_GCC"], [])])
|
||||
AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"],
|
||||
[PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], [])])
|
||||
AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"],
|
||||
[AC_MSG_ERROR([__sync builtin atomics requested but not found.])])
|
||||
fi
|
||||
|
||||
PMIX_CHECK_ASM_PROC
|
||||
PMIX_CHECK_ASM_TEXT
|
||||
@ -960,9 +1197,9 @@ AC_DEFUN([PMIX_CONFIG_ASM],[
|
||||
ia64-*)
|
||||
pmix_cv_asm_arch="IA64"
|
||||
PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"],
|
||||
[AC_MSG_ERROR([No atomic primitives available for $host])])
|
||||
[AC_MSG_ERROR([No atomic primitives available for $host])])
|
||||
;;
|
||||
aarch64*)
|
||||
aarch64*)
|
||||
pmix_cv_asm_arch="ARM64"
|
||||
PMIX_ASM_SUPPORT_64BIT=1
|
||||
PMIX_ASM_ARM_VERSION=8
|
||||
@ -994,7 +1231,7 @@ AC_DEFUN([PMIX_CONFIG_ASM],[
|
||||
# uses Linux kernel helpers for some atomic operations
|
||||
pmix_cv_asm_arch="ARM"
|
||||
PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"],
|
||||
[AC_MSG_ERROR([No atomic primitives available for $host])])
|
||||
[AC_MSG_ERROR([No atomic primitives available for $host])])
|
||||
;;
|
||||
|
||||
mips-*|mips64*)
|
||||
@ -1002,7 +1239,7 @@ AC_DEFUN([PMIX_CONFIG_ASM],[
|
||||
# a MIPS III machine (r4000 and later)
|
||||
pmix_cv_asm_arch="MIPS"
|
||||
PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"],
|
||||
[AC_MSG_ERROR([No atomic primitives available for $host])])
|
||||
[AC_MSG_ERROR([No atomic primitives available for $host])])
|
||||
;;
|
||||
|
||||
powerpc-*|powerpc64-*|powerpcle-*|powerpc64le-*|rs6000-*|ppc-*)
|
||||
@ -1070,11 +1307,11 @@ AC_MSG_ERROR([Can not continue.])
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "x$PMIX_ASM_SUPPORT_64BIT" = "x1" && test "$pmix_cv_asm_builtin" = "BUILTIN_SYNC" &&
|
||||
test "$pmix_asm_sync_have_64bit" = "0" ; then
|
||||
# __sync builtins exist but do not implement 64-bit support. Fall back on inline asm.
|
||||
pmix_cv_asm_builtin="BUILTIN_NO"
|
||||
fi
|
||||
if test "x$PMIX_ASM_SUPPORT_64BIT" = "x1" && test "$pmix_cv_asm_builtin" = "BUILTIN_SYNC" &&
|
||||
test "$pmix_asm_sync_have_64bit" = "0" ; then
|
||||
# __sync builtins exist but do not implement 64-bit support. Fall back on inline asm.
|
||||
pmix_cv_asm_builtin="BUILTIN_NO"
|
||||
fi
|
||||
|
||||
if test "$pmix_cv_asm_builtin" = "BUILTIN_SYNC" || test "$pmix_cv_asm_builtin" = "BUILTIN_GCC" ; then
|
||||
AC_DEFINE([PMIX_C_GCC_INLINE_ASSEMBLY], [1],
|
||||
@ -1097,7 +1334,7 @@ AC_MSG_ERROR([Can not continue.])
|
||||
;;
|
||||
esac
|
||||
|
||||
pmix_cv_asm_inline_supported="no"
|
||||
pmix_cv_asm_inline_supported="no"
|
||||
# now that we know our architecture, try to inline assemble
|
||||
PMIX_CHECK_INLINE_C_GCC([$PMIX_GCC_INLINE_ASSIGN])
|
||||
|
||||
|
@ -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) 2010-2015 Cisco Systems, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
dnl $COPYRIGHT$
|
||||
dnl
|
||||
dnl Additional copyrights may follow
|
||||
@ -428,7 +428,7 @@ AC_DEFUN([MCA_CONFIGURE_FRAMEWORK],[
|
||||
# Create the final .h file that will be included in the type's
|
||||
# top-level glue. This lists all the static components. We don't
|
||||
# need to do this for "common".
|
||||
if test "$2" != "common"; then
|
||||
if test "$1" != "common"; then
|
||||
cat > $outfile <<EOF
|
||||
/*
|
||||
* \$HEADER\$
|
||||
|
@ -14,8 +14,8 @@ 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) 2012-2017 Los Alamos National Security, LLC. All rights
|
||||
dnl reserved.
|
||||
dnl Copyright (c) 2015 Research Organization for Information Science
|
||||
dnl and Technology (RIST). All rights reserved.
|
||||
dnl Copyright (c) 2015-2019 Research Organization for Information Science
|
||||
dnl and Technology (RIST). All rights reserved.
|
||||
dnl Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
dnl $COPYRIGHT$
|
||||
dnl
|
||||
@ -60,7 +60,12 @@ AC_DEFUN([PMIX_PROG_CC_C11_HELPER],[
|
||||
PMIX_CC_HELPER([if $CC $1 supports C11 _Static_assert], [pmix_prog_cc_c11_helper__static_assert_available],
|
||||
[[#include <stdint.h>]],[[_Static_assert(sizeof(int64_t) == 8, "WTH");]])
|
||||
|
||||
AS_IF([test $pmix_prog_cc_c11_helper__Thread_local_available -eq 1 && test $pmix_prog_cc_c11_helper_atomic_var_available -eq 1],
|
||||
PMIX_CC_HELPER([if $CC $1 supports C11 atomic_fetch_xor_explicit], [pmix_prog_cc_c11_helper_atomic_fetch_xor_explicit_available],
|
||||
[[#include <stdatomic.h>
|
||||
#include <stdint.h>]],[[_Atomic uint32_t a; uint32_t b; atomic_fetch_xor_explicit(&a, b, memory_order_relaxed);]])
|
||||
|
||||
|
||||
AS_IF([test $pmix_prog_cc_c11_helper__Thread_local_available -eq 1 && test $pmix_prog_cc_c11_helper_atomic_var_available -eq 1 && test $pmix_prog_cc_c11_helper_atomic_fetch_xor_explicit_available -eq 1],
|
||||
[$2],
|
||||
[$3])
|
||||
|
||||
@ -128,7 +133,7 @@ AC_DEFUN([PMIX_SETUP_CC],[
|
||||
AC_REQUIRE([_PMIX_PROG_CC])
|
||||
AC_REQUIRE([AM_PROG_CC_C_O])
|
||||
|
||||
PMIX_VAR_SCOPE_PUSH([pmix_prog_cc_c11_helper__Thread_local_available pmix_prog_cc_c11_helper_atomic_var_available pmix_prog_cc_c11_helper__Atomic_available pmix_prog_cc_c11_helper__static_assert_available pmix_prog_cc_c11_helper__Generic_available pmix_prog_cc__thread_available])
|
||||
PMIX_VAR_SCOPE_PUSH([pmix_prog_cc_c11_helper__Thread_local_available pmix_prog_cc_c11_helper_atomic_var_available pmix_prog_cc_c11_helper__Atomic_available pmix_prog_cc_c11_helper__static_assert_available pmix_prog_cc_c11_helper__Generic_available pmix_prog_cc__thread_available pmix_prog_cc_c11_helper_atomic_fetch_xor_explicit_available])
|
||||
|
||||
PMIX_PROG_CC_C11
|
||||
|
||||
|
@ -2,7 +2,8 @@ dnl -*- shell-script -*-
|
||||
dnl
|
||||
dnl Copyright (c) 2016 Research Organization for Information Science
|
||||
dnl and Technology (RIST). All rights reserved.
|
||||
dnl Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2017-2019 Intel, Inc. All rights reserved.
|
||||
dnl Copyright (c) 2018 Cisco, Inc. All rights reserved.
|
||||
dnl $COPYRIGHT$
|
||||
dnl
|
||||
dnl Additional copyrights may follow
|
||||
@ -33,6 +34,7 @@ AC_DEFUN([PMIX_CAPTURE_CONFIGURE_CLI],[
|
||||
|
||||
eval "$1=\$$1\\ \$quoted_arg"
|
||||
done
|
||||
AC_DEFINE_UNQUOTED([$1], ["$$1"], [Capture the configure cmd line])
|
||||
PMIX_VAR_SCOPE_POP
|
||||
AC_SUBST($1)
|
||||
])
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
||||
# Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
@ -13,6 +13,43 @@
|
||||
# MCA_hwloc_CONFIG([action-if-found], [action-if-not-found])
|
||||
# --------------------------------------------------------------------
|
||||
AC_DEFUN([PMIX_HWLOC_CONFIG],[
|
||||
AC_ARG_WITH([hwloc-header],
|
||||
[AC_HELP_STRING([--with-hwloc-header=HEADER],
|
||||
[The value that should be included in C files to include hwloc.h])])
|
||||
|
||||
AC_ARG_ENABLE([embedded-hwloc],
|
||||
[AC_HELP_STRING([--enable-embedded-hwloc],
|
||||
[Enable use of locally embedded hwloc])])
|
||||
|
||||
AS_IF([test "$enable_embedded_hwloc" = "yes"],
|
||||
[_PMIX_HWLOC_EMBEDDED_MODE],
|
||||
[_PMIX_HWLOC_EXTERNAL])
|
||||
|
||||
AC_MSG_CHECKING([hwloc header])
|
||||
AC_DEFINE_UNQUOTED([PMIX_HWLOC_HEADER], [$PMIX_HWLOC_HEADER],
|
||||
[Location of hwloc.h])
|
||||
AC_MSG_RESULT([$PMIX_HWLOC_HEADER])
|
||||
|
||||
AC_DEFINE_UNQUOTED([PMIX_HAVE_HWLOC], [$pmix_hwloc_support],
|
||||
[Whether or not we have hwloc support])
|
||||
|
||||
PMIX_SUMMARY_ADD([[External Packages]],[[HWLOC]], [pmix_hwloc], [$pmix_hwloc_support_will_build ($pmix_hwloc_source)])
|
||||
])
|
||||
|
||||
AC_DEFUN([_PMIX_HWLOC_EMBEDDED_MODE],[
|
||||
AC_MSG_CHECKING([for hwloc])
|
||||
AC_MSG_RESULT([assumed available (embedded mode)])
|
||||
|
||||
AS_IF([test -z "$with_hwloc_header" || test "$with_hwloc_header" = "yes"],
|
||||
[PMIX_HWLOC_HEADER="<hwloc.h>"],
|
||||
[PMIX_HWLOC_HEADER="$with_hwloc_header"])
|
||||
|
||||
pmix_hwloc_support=1
|
||||
pmix_hwloc_source=embedded
|
||||
pmix_hwloc_support_will_build=yes
|
||||
])
|
||||
|
||||
AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[
|
||||
PMIX_VAR_SCOPE_PUSH([pmix_hwloc_dir pmix_hwloc_libdir pmix_hwloc_standard_lib_location pmix_hwloc_standard_header_location])
|
||||
|
||||
AC_ARG_WITH([hwloc],
|
||||
@ -45,6 +82,17 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[
|
||||
AC_MSG_RESULT([$pmix_hwloc_dir and $pmix_hwloc_libdir])],
|
||||
[AC_MSG_RESULT([$with_hwloc_libdir])])
|
||||
else
|
||||
pmix_hwloc_dir=/usr/include
|
||||
if test -d /usr/lib; then
|
||||
pmix_hwloc_libdir=/usr/lib
|
||||
elif test -d /usr/lib64; then
|
||||
pmix_hwloc_libdir=/usr/lib64
|
||||
else
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_WARN([Could not find /usr/lib or /usr/lib64 - you may])
|
||||
AC_MSG_WARN([need to specify --with-hwloc_libdir=<path>])
|
||||
AC_MSG_ERROR([Can not continue])
|
||||
fi
|
||||
AC_MSG_RESULT([(default search paths)])
|
||||
pmix_hwloc_standard_header_location=yes
|
||||
pmix_hwloc_standard_lib_location=yes
|
||||
@ -62,18 +110,13 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[
|
||||
[$pmix_hwloc_libdir],
|
||||
[pmix_hwloc_support=1],
|
||||
[pmix_hwloc_support=0])
|
||||
if test $pmix_hwloc_support = "1"; then
|
||||
LIBS="$LIBS -lhwloc"
|
||||
PMIX_EMBEDDED_LIBS="$PMIX_EMBEDDED_LIBS -lhwloc"
|
||||
if test "$pmix_hwloc_standard_header_location" != "yes"; then
|
||||
PMIX_EMBEDDED_CPPFLAGS="$PMIX_EMBEDDED_CPPFLAGS $pmix_hwloc_CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $pmix_hwloc_CPPFLAGS"
|
||||
fi
|
||||
if test "$pmix_hwloc_standard_lib_location" != "yes"; then
|
||||
PMIX_EMBEDDED_LDFLAGS="$PMIX_EMBEDDED_LDFLAGS $pmix_hwloc_LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $pmix_hwloc_LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
AS_IF([test "$pmix_hwloc_standard_header_location" != "yes"],
|
||||
[PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_hwloc_CPPFLAGS)])
|
||||
|
||||
AS_IF([test "$pmix_hwloc_standard_lib_location" != "yes"],
|
||||
[PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_hwloc_LDFLAGS)])
|
||||
PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_hwloc_LIBS)
|
||||
fi
|
||||
|
||||
if test ! -z "$with_hwloc" && test "$with_hwloc" != "no" && test "$pmix_hwloc_support" != "1"; then
|
||||
@ -98,11 +141,16 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[
|
||||
AC_MSG_CHECKING([will hwloc support be built])
|
||||
if test "$pmix_hwloc_support" != "1"; then
|
||||
AC_MSG_RESULT([no])
|
||||
pmix_hwloc_source=none
|
||||
pmix_hwloc_support_will_build=no
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
pmix_hwloc_source=$pmix_hwloc_dir
|
||||
pmix_hwloc_support_will_build=yes
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED([PMIX_HAVE_HWLOC], [$pmix_hwloc_support],
|
||||
[Whether or not we have hwloc support])
|
||||
# Set output variables
|
||||
PMIX_HWLOC_HEADER="<hwloc.h>"
|
||||
|
||||
PMIX_VAR_SCOPE_POP
|
||||
])dnl
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
||||
# Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2017 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
@ -35,6 +35,8 @@ AC_DEFUN([PMIX_LIBEVENT_CONFIG],[
|
||||
AC_DEFINE_UNQUOTED([PMIX_EVENT2_THREAD_HEADER], [$PMIX_EVENT2_THREAD_HEADER],
|
||||
[Location of event2/thread.h])
|
||||
AC_MSG_RESULT([$PMIX_EVENT2_THREAD_HEADER])
|
||||
|
||||
PMIX_SUMMARY_ADD([[External Packages]],[[Libevent]], [pmix_libevent], [yes ($pmix_libevent_source)])
|
||||
])
|
||||
|
||||
AC_DEFUN([_PMIX_LIBEVENT_EMBEDDED_MODE],[
|
||||
@ -47,6 +49,7 @@ AC_DEFUN([_PMIX_LIBEVENT_EMBEDDED_MODE],[
|
||||
[PMIX_EVENT_HEADER="$with_libevent_header"
|
||||
PMIX_EVENT2_THREAD_HEADER="$with_libevent_header"])
|
||||
|
||||
pmix_libevent_source=embedded
|
||||
])
|
||||
|
||||
AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[
|
||||
@ -115,9 +118,8 @@ AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[
|
||||
|
||||
AS_IF([test "$pmix_event_defaults" = "no"],
|
||||
[PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_libevent_CPPFLAGS)
|
||||
PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_libevent_LIBS)
|
||||
PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_libevent_LDFLAGS)])
|
||||
|
||||
PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_libevent_LIBS)
|
||||
|
||||
# Ensure that this libevent has the symbol
|
||||
# "evthread_set_lock_callbacks", which will only exist if
|
||||
@ -138,6 +140,7 @@ AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[
|
||||
# Set output variables
|
||||
PMIX_EVENT_HEADER="<event.h>"
|
||||
PMIX_EVENT2_THREAD_HEADER="<event2/thread.h>"
|
||||
pmix_libevent_source=$pmix_event_dir
|
||||
|
||||
PMIX_VAR_SCOPE_POP
|
||||
])dnl
|
||||
|
79
opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4
Обычный файл
79
opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4
Обычный файл
@ -0,0 +1,79 @@
|
||||
dnl -*- shell-script -*-
|
||||
dnl
|
||||
dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights
|
||||
dnl reserved.
|
||||
dnl Copyright (c) 2016-2018 Cisco Systems, Inc. All rights reserved
|
||||
dnl Copyright (c) 2016 Research Organization for Information Science
|
||||
dnl and Technology (RIST). All rights reserved.
|
||||
dnl Copyright (c) 2018-2019 Intel, Inc. All rights reserved.
|
||||
dnl $COPYRIGHT$
|
||||
dnl
|
||||
dnl Additional copyrights may follow
|
||||
dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
AC_DEFUN([PMIX_SUMMARY_ADD],[
|
||||
PMIX_VAR_SCOPE_PUSH([pmix_summary_section pmix_summary_line pmix_summary_section_current])
|
||||
|
||||
dnl need to replace spaces in the section name with somethis else. _ seems like a reasonable
|
||||
dnl choice. if this changes remember to change PMIX_PRINT_SUMMARY as well.
|
||||
pmix_summary_section=$(echo $1 | tr ' ' '_')
|
||||
pmix_summary_line="$2: $4"
|
||||
pmix_summary_section_current=$(eval echo \$pmix_summary_values_$pmix_summary_section)
|
||||
|
||||
if test -z "$pmix_summary_section_current" ; then
|
||||
if test -z "$pmix_summary_sections" ; then
|
||||
pmix_summary_sections=$pmix_summary_section
|
||||
else
|
||||
pmix_summary_sections="$pmix_summary_sections $pmix_summary_section"
|
||||
fi
|
||||
eval pmix_summary_values_$pmix_summary_section=\"$pmix_summary_line\"
|
||||
else
|
||||
eval pmix_summary_values_$pmix_summary_section=\"$pmix_summary_section_current,$pmix_summary_line\"
|
||||
fi
|
||||
|
||||
PMIX_VAR_SCOPE_POP
|
||||
])
|
||||
|
||||
AC_DEFUN([PMIX_SUMMARY_PRINT],[
|
||||
PMIX_VAR_SCOPE_PUSH([pmix_summary_section pmix_summary_section_name])
|
||||
cat <<EOF
|
||||
|
||||
PMIx configuration:
|
||||
-----------------------
|
||||
Version: $PMIX_MAJOR_VERSION.$PMIX_MINOR_VERSION.$PMIX_RELEASE_VERSION$PMIX_GREEK_VERSION
|
||||
EOF
|
||||
|
||||
if test $WANT_DEBUG = 0 ; then
|
||||
echo "Debug build: no"
|
||||
else
|
||||
echo "Debug build: yes"
|
||||
fi
|
||||
|
||||
if test ! -z $with_platform ; then
|
||||
echo "Platform file: $with_platform"
|
||||
else
|
||||
echo "Platform file: (none)"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
for pmix_summary_section in $(echo $pmix_summary_sections) ; do
|
||||
pmix_summary_section_name=$(echo $pmix_summary_section | tr '_' ' ')
|
||||
echo "$pmix_summary_section_name"
|
||||
echo "-----------------------"
|
||||
echo "$(eval echo \$pmix_summary_values_$pmix_summary_section)" | tr ',' $'\n' | sort -f
|
||||
echo " "
|
||||
done
|
||||
|
||||
if test $WANT_DEBUG = 1 ; then
|
||||
cat <<EOF
|
||||
*****************************************************************************
|
||||
THIS IS A DEBUG BUILD! DO NOT USE THIS BUILD FOR PERFORMANCE MEASUREMENTS!
|
||||
*****************************************************************************
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
PMIX_VAR_SCOPE_POP
|
||||
])
|
@ -19,7 +19,7 @@
|
||||
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2013 Mellanox Technologies, Inc.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
# Copyright (c) 2016-2018 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
@ -245,13 +245,15 @@ AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
|
||||
AC_SUBST([libpmix_so_version])
|
||||
AC_SUBST([libpmi_so_version])
|
||||
AC_SUBST([libpmi2_so_version])
|
||||
AC_SUBST([libmca_common_dstore_so_version])
|
||||
|
||||
AC_CONFIG_FILES(pmix_config_prefix[contrib/Makefile]
|
||||
pmix_config_prefix[examples/Makefile]
|
||||
pmix_config_prefix[man/Makefile]
|
||||
pmix_config_prefix[test/Makefile]
|
||||
pmix_config_prefix[test/simple/Makefile])
|
||||
|
||||
pmix_show_title "Configuration complete"
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
PMIX_SUMMARY_PRINT
|
||||
|
@ -25,8 +25,6 @@
|
||||
EXTRA_DIST = \
|
||||
make_dist_tarball \
|
||||
buildrpm.sh \
|
||||
cron-run-all-md2nroff.pl \
|
||||
md2nroff.pl \
|
||||
platform/optimized \
|
||||
pmix_jenkins.sh \
|
||||
pmix-release.sh \
|
||||
|
@ -1,187 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Script to pull down the latest markdown man pages from the PMIx
|
||||
# git repo. Iterate over them, converting each to an nroff man page
|
||||
# and also copying+committing them to the gh-pages branch. Finally,
|
||||
# git push them back upstream (so that Github will render + serve them
|
||||
# up as web pages).
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use POSIX;
|
||||
use File::Basename;
|
||||
use Getopt::Long;
|
||||
use File::Temp;
|
||||
|
||||
my $repo_arg;
|
||||
my $source_branch_arg = "master";
|
||||
my $pages_branch_arg = "gh-pages";
|
||||
my $logfile_dir_arg = "/tmp";
|
||||
my $verbose_arg;
|
||||
my $help_arg;
|
||||
|
||||
my $ok = Getopt::Long::GetOptions("repo=s" => \$repo_arg,
|
||||
"source-branch=s" => \$source_branch_arg,
|
||||
"pages-branch=s" => \$pages_branch_arg,
|
||||
"logfile-dir=s" => \$logfile_dir_arg,
|
||||
"help|h" => \$help_arg,
|
||||
"verbose" => \$verbose_arg,
|
||||
);
|
||||
|
||||
if (!$ok || $help_arg) {
|
||||
print "Invalid command line argument.\n\n"
|
||||
if (!$ok);
|
||||
print "Options:
|
||||
--help | -h Print this message
|
||||
--repo Git repo to be updated
|
||||
--source-branch Branch containing source files (default: master)
|
||||
--pages-branch Branch where man pages are to be output (default: gh-pages)
|
||||
--logfile-dir Directory where execution log is to be written (default: /tmp)
|
||||
--verbose Print debug info during execution\n";
|
||||
exit($ok ? 0 : 1);
|
||||
}
|
||||
|
||||
# Sanity checks
|
||||
die "Must specify a git repo"
|
||||
if (!defined($repo_arg));
|
||||
|
||||
#####################################################################
|
||||
|
||||
my $logfile_dir = $logfile_dir_arg;
|
||||
my $logfile_counter = 1;
|
||||
|
||||
sub doit {
|
||||
my $allowed_to_fail = shift;
|
||||
my $cmd = shift;
|
||||
my $stdout_file = shift;
|
||||
|
||||
# Put a prefix on the logfiles so that we know that they belong to
|
||||
# this script, and put a counter so that we know the sequence of
|
||||
# logfiles
|
||||
$stdout_file = "runall-md2nroff-$logfile_counter-$stdout_file";
|
||||
++$logfile_counter;
|
||||
|
||||
# Redirect stdout if requested
|
||||
if (defined $stdout_file) {
|
||||
$stdout_file = "$logfile_dir/$stdout_file.log";
|
||||
unlink($stdout_file);
|
||||
$cmd .= " >$stdout_file";
|
||||
} elsif (!$verbose_arg && $cmd !~ />/) {
|
||||
$cmd .= " >/dev/null";
|
||||
}
|
||||
$cmd .= " 2>&1";
|
||||
|
||||
my $rc = system($cmd);
|
||||
if (0 != $rc && !$allowed_to_fail) {
|
||||
# If we die/fail, ensure to change out of the temp tree so
|
||||
# that it can be removed upon exit.
|
||||
chdir("/");
|
||||
die "Command $cmd failed: exit status $rc";
|
||||
}
|
||||
|
||||
system("cat $stdout_file")
|
||||
if ($verbose_arg && defined($stdout_file) && -f $stdout_file);
|
||||
}
|
||||
|
||||
sub verbose {
|
||||
print @_
|
||||
if ($verbose_arg);
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
# Setup a logfile dir just for this run
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
|
||||
localtime(time);
|
||||
$logfile_dir =
|
||||
sprintf("%s/cron-run-all-md2nroff-logs-%04d-%02d-%02d-%02d%02d",
|
||||
$logfile_dir_arg, $year + 1900, $mon + 1, $mday,
|
||||
$hour, $min);
|
||||
my $rc = system("mkdir $logfile_dir");
|
||||
if ($rc != 0 || ! -d $logfile_dir || ! -w $logfile_dir) {
|
||||
chdir("/");
|
||||
die "mkdir of $logfile_dir failed, or can't write to it";
|
||||
}
|
||||
|
||||
# First, git clone the source branch of the repo
|
||||
verbose("*** Cloning repo: $repo_arg / $source_branch_arg...\n");
|
||||
my $tmpdir = File::Temp->newdir();
|
||||
|
||||
chdir($tmpdir);
|
||||
doit(0, "git clone --single-branch --branch $source_branch_arg $repo_arg source", "git-clone");
|
||||
|
||||
# Next, git clone the pages branch of repo
|
||||
if (defined($pages_branch_arg)) {
|
||||
verbose("*** Cloning repo: $repo_arg / $pages_branch_arg...\n");
|
||||
doit(0, "git clone --single-branch --branch $pages_branch_arg $repo_arg pages", "git-clone2");
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
# Find all the *.\d.md files in the source repo
|
||||
verbose("*** Finding markdown man pages...\n");
|
||||
opendir(DIR, "source/man");
|
||||
my @markdown_files = grep { /\.\d\.md$/ && -f "source/man/$_" } readdir(DIR);
|
||||
closedir(DIR);
|
||||
verbose("Found: @markdown_files\n");
|
||||
|
||||
#####################################################################
|
||||
|
||||
# Copy each of the markdown files to the pages branch checkout
|
||||
if (defined($pages_branch_arg)) {
|
||||
chdir("pages/master");
|
||||
foreach my $file (@markdown_files) {
|
||||
doit(0, "cp ../../source/man/$file man/$file", "loop-cp");
|
||||
|
||||
# Is there a new man page? If so, we need to "git add" it.
|
||||
my $out = `git status --porcelain man/$file`;
|
||||
doit(0, "git add man/$file", "loop-git-add")
|
||||
if ($out =~ /^\?\?/);
|
||||
}
|
||||
|
||||
# Git commit those files in the pages repo and push them to the
|
||||
# upstream repo so that they go live. If nothing changed, the commit
|
||||
# and push will be no-ops.
|
||||
chdir("..");
|
||||
doit(1, "git commit --no-verify -a -m \"Updated Markdown man pages from $source_branch_arg\"",
|
||||
"git-commit-first");
|
||||
doit(1, "git push", "git-push-first");
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
# Now process each of the Markdown files in the source repo and
|
||||
# generate new nroff man pages.
|
||||
chdir("$tmpdir/source/man");
|
||||
foreach my $file (@markdown_files) {
|
||||
doit(0, "../contrib/md2nroff.pl --source $file", "loop2-md2nroff");
|
||||
|
||||
# Did we generate a new man page? If so, we need to "git add" it.
|
||||
my $man_file = basename($file);
|
||||
|
||||
$man_file =~ m/\.(\d)\.md$/;
|
||||
my $section = $1;
|
||||
|
||||
$man_file =~ s/\.md$//;
|
||||
|
||||
my $full_filename = "man$section/$man_file";
|
||||
|
||||
my $out = `git status --porcelain $full_filename`;
|
||||
doit(0, "git add $full_filename", "loop2-git-add")
|
||||
if ($out =~ /^\?\?/);
|
||||
}
|
||||
|
||||
# Similar to above: commit the newly-generated nroff pages and push
|
||||
# them back upstream. If nothing changed, these will be no-ops.
|
||||
doit(1, "git commit --no-verify -a -m \"Updated nroff-generated man pages\"", "git-commit-final");
|
||||
doit(1, "git push", "git-push-final");
|
||||
|
||||
# chdir out of the tmpdir so that it can be removed
|
||||
chdir("/");
|
||||
|
||||
# If we get here, we finished successfully, so there's no need to keep
|
||||
# the logfile dir around
|
||||
system("rm -rf $logfile_dir");
|
||||
|
||||
exit(0);
|
@ -1,164 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Script to convert markdown to nroff man pages.
|
||||
#
|
||||
# The main conversion work is done via pandoc. But pandoc doesn't do
|
||||
# everything exactly the way we want it, so use some perl regular
|
||||
# expressions to fix up what pandoc doesn't get right.
|
||||
#
|
||||
# Do a "smart" write of the resulting output man page -- only write to
|
||||
# the output file if the contents have actually changed compared to
|
||||
# what was already there.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use POSIX;
|
||||
use File::Basename;
|
||||
use Getopt::Long;
|
||||
use File::Temp qw/tempfile/;
|
||||
|
||||
my $source_arg;
|
||||
my $target_arg;
|
||||
my $help_arg;
|
||||
|
||||
my $ok = Getopt::Long::GetOptions("source=s" => \$source_arg,
|
||||
"target=s" => \$target_arg,
|
||||
"help|h" => \$help_arg,
|
||||
);
|
||||
|
||||
if ($help_arg) {
|
||||
print "$0 --source input_MD_file --target output_nroff_file\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
# Sanity checks
|
||||
die "Must specify a source file"
|
||||
if (!defined($source_arg));
|
||||
die "Source file does not exist ($source_arg)"
|
||||
if (! -r $source_arg);
|
||||
|
||||
my $pandoc = `which pandoc`;
|
||||
die "Cannot find pandoc executable"
|
||||
if ($pandoc eq "");
|
||||
|
||||
#####################################################################
|
||||
|
||||
my $file = $source_arg;
|
||||
$file =~ m/(\d+).md/;
|
||||
my $section = $1;
|
||||
die "Could not figure out the man page section: $source_arg"
|
||||
if (!defined($section));
|
||||
my $shortfile = basename($file);
|
||||
$shortfile =~ s/\.$section\.md$//;
|
||||
|
||||
# If the target file was not specified, derive it from the source file
|
||||
my $target;
|
||||
if (!defined($target_arg)) {
|
||||
$target_arg = $source_arg;
|
||||
|
||||
$target_arg =~ m/\.(\d)\.md$/;
|
||||
my $section = $1;
|
||||
|
||||
my $dirname = dirname($target_arg);
|
||||
my $basename = basename($target_arg);
|
||||
$basename =~ s/\.md$//;
|
||||
|
||||
$target = "$dirname/man$section/$basename";
|
||||
} else {
|
||||
$target = $target_arg;
|
||||
}
|
||||
|
||||
print "*** Processing: $file -> $target\n";
|
||||
|
||||
# Read in the file
|
||||
my $pandoc_input;
|
||||
open(IN, $file)
|
||||
|| die "Can't open $file";
|
||||
$pandoc_input .= $_
|
||||
while (<IN>);
|
||||
close(IN);
|
||||
|
||||
# Remove the Jekyll header
|
||||
$pandoc_input =~ s/.*---\n.+?---\n//s;
|
||||
|
||||
# Remove the {% include ... %} directives
|
||||
$pandoc_input =~ s/\n{0,1}\s*{%\s+include .+?\s+%}\s*\n/\n/g;
|
||||
|
||||
# Change {% highlight c %} to ```c
|
||||
$pandoc_input =~ s/^\s*{%\s+highlight\s+c\s+%}\s*$/\n```c/gmi;
|
||||
|
||||
# Change {% endhighlight %} to ```
|
||||
$pandoc_input =~ s/^\s*\{\%\s+endhighlight\s+\%\}\s*$/```\n/gmi;
|
||||
|
||||
# Pandoc does not handle markdown links in output nroff properly,
|
||||
# so just remove all links.
|
||||
while ($pandoc_input =~ m/\[(.+?)\]\(.+?\)/) {
|
||||
my $text = $1;
|
||||
$pandoc_input =~ s/\[(.+?)\]\(.+?\)/$text/;
|
||||
}
|
||||
|
||||
# Add the pandoc header
|
||||
$pandoc_input = "% $shortfile($section) PMIx Programmer's Manual | \@VERSION\@
|
||||
% PMIx
|
||||
% \@DATE\@\n\n$pandoc_input";
|
||||
|
||||
# Generate the nroff output
|
||||
my ($fh, $temp_filename) = tempfile();
|
||||
print $fh $pandoc_input;
|
||||
close($fh);
|
||||
|
||||
open(IN, "pandoc -s --from=markdown --to=man $temp_filename|")
|
||||
|| die "Can't run pandoc";
|
||||
my $pandoc_nroff;
|
||||
$pandoc_nroff .= $_
|
||||
while (<IN>);
|
||||
close(IN);
|
||||
unlink($temp_filename);
|
||||
|
||||
# Now that we have the nroff string result, is it different than the
|
||||
# target file?
|
||||
my $write_nroff = 1;
|
||||
if (-r $target) {
|
||||
# If the target file exists, read it in
|
||||
open(IN, $target)
|
||||
|| die "Can't open $target";
|
||||
my $target_nroff;
|
||||
$target_nroff .= $_
|
||||
while (<IN>);
|
||||
close(IN);
|
||||
|
||||
# Remove the date from the target nroff string so that we can
|
||||
# compare and ignore if the date has changed. Note that some
|
||||
# versions of pandoc render dates as xxxx\-xx\-xx, and others
|
||||
# render it as xxxx-xx-xx. Handle both.
|
||||
$target_nroff =~ s/\"\d\d\d\d\\\-\d\d\\\-\d\d\"/\"\\\@DATE\\\@\"/;
|
||||
$target_nroff =~ s/\"\d\d\d\d\-\d\d\-\d\d\"/\"\\\@DATE\\\@\"/;
|
||||
|
||||
$write_nroff = 0
|
||||
if ($pandoc_nroff eq $target_nroff);
|
||||
}
|
||||
|
||||
# Do we need to write a new target nroff?
|
||||
if ($write_nroff) {
|
||||
|
||||
# What's the date right now?
|
||||
my $now_string = strftime "%Y\\-%m\\-%d", localtime;
|
||||
$pandoc_nroff =~ s/\\\@DATE\\\@/$now_string/g;
|
||||
|
||||
# Make sure the target directory exists
|
||||
my $dirname = dirname($target);
|
||||
mkdir($dirname)
|
||||
if (! -d $dirname);
|
||||
|
||||
open(OUT, ">$target")
|
||||
|| die "Can't write to $target";
|
||||
print OUT $pandoc_nroff;
|
||||
close(OUT);
|
||||
|
||||
print "--> Wrote new $target\n";
|
||||
} else {
|
||||
print "--> $target unchanged; not written\n";
|
||||
}
|
||||
|
||||
exit(0);
|
@ -192,7 +192,7 @@
|
||||
|
||||
Summary: An extended/exascale implementation of PMI
|
||||
Name: %{?_name:%{_name}}%{!?_name:pmix}
|
||||
Version: 3.0.2
|
||||
Version: 3.1.2
|
||||
Release: 1%{?dist}
|
||||
License: BSD
|
||||
Group: Development/Libraries
|
||||
|
@ -11,13 +11,14 @@
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
headers = examples.h
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/include -I$(top_builddir)/include/pmix
|
||||
|
||||
@ -28,56 +29,56 @@ if !WANT_HIDDEN
|
||||
noinst_PROGRAMS += server
|
||||
endif
|
||||
|
||||
client_SOURCES = client.c
|
||||
client_SOURCES = client.c examples.h
|
||||
client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
client_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
client2_SOURCES = client2.c
|
||||
client2_SOURCES = client2.c examples.h
|
||||
client2_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
client2_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
debugger_SOURCES = debugger.c
|
||||
debugger_SOURCES = debugger.c examples.h
|
||||
debugger_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
debugger_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
debuggerd_SOURCES = debuggerd.c
|
||||
debuggerd_SOURCES = debuggerd.c examples.h
|
||||
debuggerd_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
debuggerd_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
alloc_SOURCES = alloc.c
|
||||
alloc_SOURCES = alloc.c examples.h
|
||||
alloc_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
alloc_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
jctrl_SOURCES = jctrl.c
|
||||
jctrl_SOURCES = jctrl.c examples.h
|
||||
jctrl_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
jctrl_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
dmodex_SOURCES = dmodex.c
|
||||
dmodex_SOURCES = dmodex.c examples.h
|
||||
dmodex_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
dmodex_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
dynamic_SOURCES = dynamic.c
|
||||
dynamic_SOURCES = dynamic.c examples.h
|
||||
dynamic_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
dynamic_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
fault_SOURCES = fault.c
|
||||
fault_SOURCES = fault.c examples.h
|
||||
fault_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
fault_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
pub_SOURCES = pub.c
|
||||
pub_SOURCES = pub.c examples.h
|
||||
pub_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
pub_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
pubi_SOURCES = pubi.c
|
||||
pubi_SOURCES = pubi.c examples.h
|
||||
pubi_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
pubi_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
tool_SOURCES = tool.c
|
||||
tool_SOURCES = tool.c examples.h
|
||||
tool_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
tool_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
if !WANT_HIDDEN
|
||||
server_SOURCES = server.c
|
||||
server_SOURCES = server.c examples.h
|
||||
server_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
server_LDADD = $(top_builddir)/src/libpmix.la
|
||||
endif
|
||||
|
@ -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-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -30,16 +30,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <pmix.h>
|
||||
|
||||
/* define a structure for collecting returned
|
||||
* info from an allocation request */
|
||||
typedef struct {
|
||||
volatile bool active;
|
||||
pmix_info_t *info;
|
||||
size_t ninfo;
|
||||
} mydata_t;
|
||||
|
||||
static volatile bool waiting_for_allocation = true;
|
||||
#include "examples.h"
|
||||
|
||||
/* this is a callback function for the PMIx_Query and
|
||||
* PMIx_Allocate APIs. The query will callback with a status indicating
|
||||
@ -59,7 +50,7 @@ static void infocbfunc(pmix_status_t status,
|
||||
pmix_release_cbfunc_t release_fn,
|
||||
void *release_cbdata)
|
||||
{
|
||||
mydata_t *mq = (mydata_t*)cbdata;
|
||||
myquery_data_t *mq = (myquery_data_t*)cbdata;
|
||||
size_t n;
|
||||
|
||||
fprintf(stderr, "Allocation request returned %s", PMIx_Error_string(status));
|
||||
@ -75,6 +66,9 @@ static void infocbfunc(pmix_status_t status,
|
||||
PMIX_INFO_XFER(&mq->info[n], &info[n]);
|
||||
}
|
||||
}
|
||||
/* the status returned here indicates whether the requested
|
||||
* information was found or not - preserve it */
|
||||
mq->lock.status = status;
|
||||
|
||||
/* let the library release the data and cleanup from
|
||||
* the operation */
|
||||
@ -83,7 +77,7 @@ static void infocbfunc(pmix_status_t status,
|
||||
}
|
||||
|
||||
/* release the block */
|
||||
mq->active = false;
|
||||
DEBUG_WAKEUP_THREAD(&mq->lock);
|
||||
}
|
||||
|
||||
/* this is an event notification function that we explicitly request
|
||||
@ -100,12 +94,37 @@ static void release_fn(size_t evhdlr_registration_id,
|
||||
pmix_event_notification_cbfunc_fn_t cbfunc,
|
||||
void *cbdata)
|
||||
{
|
||||
myrel_t *lock;
|
||||
size_t n;
|
||||
|
||||
/* find the return object */
|
||||
lock = NULL;
|
||||
for (n=0; n < ninfo; n++) {
|
||||
if (0 == strncmp(info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) {
|
||||
lock = (myrel_t*)info[n].value.data.ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* if the object wasn't returned, then that is an error */
|
||||
if (NULL == lock) {
|
||||
fprintf(stderr, "LOCK WASN'T RETURNED IN RELEASE CALLBACK\n");
|
||||
/* let the event handler progress */
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* tell the event handler state machine that we are the last step */
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata);
|
||||
}
|
||||
/* flag that the allocation is complete so we can exit */
|
||||
waiting_for_allocation = false;
|
||||
/* the status will be PMIX_ERR_ALLOC_COMPLETE since that is the code
|
||||
* we registered to receive. The result of the allocation request is
|
||||
* in the info array - for now, just assume success */
|
||||
lock->lock.status = PMIX_SUCCESS;
|
||||
/* release the lock */
|
||||
DEBUG_WAKEUP_THREAD(&lock->lock);
|
||||
}
|
||||
|
||||
/* event handler registration is done asynchronously because it
|
||||
@ -114,18 +133,20 @@ static void release_fn(size_t evhdlr_registration_id,
|
||||
* the status of the request (success or an error), plus a numerical index
|
||||
* to the registered event. The index is used later on to deregister
|
||||
* an event handler - if we don't explicitly deregister it, then the
|
||||
* PMIx server will do so when it see us exit */
|
||||
* PMIx server will do so when it sees us exit */
|
||||
static void evhandler_reg_callbk(pmix_status_t status,
|
||||
size_t evhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
volatile int *active = (volatile int*)cbdata;
|
||||
mylock_t *lock = (mylock_t*)cbdata;
|
||||
|
||||
if (PMIX_SUCCESS != status) {
|
||||
fprintf(stderr, "EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n",
|
||||
status, (unsigned long)evhandler_ref);
|
||||
}
|
||||
*active = status;
|
||||
lock->status = status;
|
||||
lock->evhandler_ref = evhandler_ref;
|
||||
DEBUG_WAKEUP_THREAD(lock);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -138,11 +159,12 @@ int main(int argc, char **argv)
|
||||
uint32_t nprocs;
|
||||
pmix_info_t *info;
|
||||
uint64_t nnodes = 12;
|
||||
mydata_t mydata;
|
||||
myquery_data_t mydata;
|
||||
pmix_query_t *query;
|
||||
char *myallocation = "MYALLOCATION";
|
||||
volatile int active;
|
||||
pmix_status_t code = PMIX_NOTIFY_ALLOC_COMPLETE;
|
||||
mylock_t mylock;
|
||||
pmix_status_t code;
|
||||
myrel_t myrel;
|
||||
|
||||
/* init us */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
|
||||
@ -163,63 +185,64 @@ int main(int argc, char **argv)
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs);
|
||||
|
||||
/* initialize the return info struct */
|
||||
mydata.info = NULL;
|
||||
mydata.ninfo = 0;
|
||||
|
||||
if (0 == myproc.rank) {
|
||||
/* try to get an allocation */
|
||||
mydata.active = true;
|
||||
DEBUG_CONSTRUCT_MYQUERY(&mydata);
|
||||
PMIX_INFO_CREATE(info, 2);
|
||||
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_NUM_NODES, &nnodes, PMIX_UINT64);
|
||||
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, NULL))) {
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, &mydata))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Allocation_request_nb failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
while (mydata.active) {
|
||||
usleep(10);
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&mydata.lock);
|
||||
PMIX_INFO_FREE(info, 2);
|
||||
if (NULL != mydata.info) {
|
||||
PMIX_INFO_FREE(mydata.info, mydata.ninfo);
|
||||
}
|
||||
fprintf(stderr, "Client ns %s rank %d: Allocation returned status: %s\n",
|
||||
myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status));
|
||||
DEBUG_DESTRUCT_MYQUERY(&mydata);
|
||||
|
||||
} else if (1 == myproc.rank) {
|
||||
/* register a handler specifically for when the allocation
|
||||
* operation completes */
|
||||
PMIX_INFO_CREATE(info, 1);
|
||||
/* demonstrate a notification based approach - register a handler
|
||||
* specifically for when the allocation operation completes */
|
||||
DEBUG_CONSTRUCT_MYREL(&myrel);
|
||||
PMIX_INFO_CREATE(info, 2);
|
||||
PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
|
||||
active = -1;
|
||||
PMIx_Register_event_handler(&code, 1, info, 1,
|
||||
release_fn, evhandler_reg_callbk, (void*)&active);
|
||||
while (-1 == active) {
|
||||
usleep(10);
|
||||
}
|
||||
if (0 != active) {
|
||||
exit(active);
|
||||
}
|
||||
PMIX_INFO_FREE(info, 1);
|
||||
PMIX_INFO_LOAD(&info[1], PMIX_EVENT_RETURN_OBJECT, &myrel, PMIX_POINTER);
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
code = PMIX_NOTIFY_ALLOC_COMPLETE;
|
||||
PMIx_Register_event_handler(&code, 1, info, 2,
|
||||
release_fn, evhandler_reg_callbk, (void*)&mylock);
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
PMIX_INFO_FREE(info, 2);
|
||||
rc = mylock.status;
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
|
||||
/* now wait to hear that the request is complete */
|
||||
while (waiting_for_allocation) {
|
||||
usleep(10);
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&myrel.lock);
|
||||
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n",
|
||||
myproc.nspace, myproc.rank, PMIx_Error_string(myrel.lock.status));
|
||||
DEBUG_DESTRUCT_MYREL(&myrel);
|
||||
|
||||
} else {
|
||||
/* I am not the root rank, so let me wait a little while and then
|
||||
* query the status of the allocation request */
|
||||
/* demonstrate a query-based approach - wait a little while and ask to
|
||||
* see if it was done */
|
||||
usleep(10);
|
||||
DEBUG_CONSTRUCT_MYQUERY(&mydata);
|
||||
|
||||
PMIX_QUERY_CREATE(query, 1);
|
||||
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_ALLOC_STATUS);
|
||||
PMIX_INFO_CREATE(query[0].qualifiers, 1);
|
||||
PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING);
|
||||
mydata.active = true;
|
||||
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, 1, infocbfunc, (void*)&mydata))) {
|
||||
fprintf(stderr, "PMIx_Query_info failed: %d\n", rc);
|
||||
goto done;
|
||||
}
|
||||
while (mydata.active) {
|
||||
usleep(10);
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&mydata.lock);
|
||||
PMIX_QUERY_FREE(query, 1);
|
||||
fprintf(stderr, "[%s:%d] Allocation returned status: %s\n",
|
||||
myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status));
|
||||
DEBUG_DESTRUCT_MYQUERY(&mydata);
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -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-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -31,8 +31,8 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <pmix.h>
|
||||
#include "examples.h"
|
||||
|
||||
static volatile bool waiting_for_debugger = true;
|
||||
static pmix_proc_t myproc;
|
||||
|
||||
/* this is the event notification function we pass down below
|
||||
@ -66,10 +66,36 @@ static void release_fn(size_t evhdlr_registration_id,
|
||||
pmix_event_notification_cbfunc_fn_t cbfunc,
|
||||
void *cbdata)
|
||||
{
|
||||
myrel_t *lock;
|
||||
size_t n;
|
||||
|
||||
/* find the return object */
|
||||
lock = NULL;
|
||||
for (n=0; n < ninfo; n++) {
|
||||
if (0 == strncmp(info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) {
|
||||
lock = (myrel_t*)info[n].value.data.ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* if the object wasn't returned, then that is an error */
|
||||
if (NULL == lock) {
|
||||
fprintf(stderr, "LOCK WASN'T RETURNED IN RELEASE CALLBACK\n");
|
||||
/* let the event handler progress */
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* tell the event handler state machine that we are the last step */
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata);
|
||||
}
|
||||
waiting_for_debugger = false;
|
||||
/* the status will be PMIX_ERR_DEBUGGER_RELEASE since that is the code
|
||||
* we registered to receive, so just return success */
|
||||
lock->lock.status = PMIX_SUCCESS;
|
||||
/* release the lock */
|
||||
DEBUG_WAKEUP_THREAD(&lock->lock);
|
||||
}
|
||||
|
||||
/* event handler registration is done asynchronously because it
|
||||
@ -83,27 +109,34 @@ static void evhandler_reg_callbk(pmix_status_t status,
|
||||
size_t evhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
volatile int *active = (volatile int*)cbdata;
|
||||
mylock_t *lock = (mylock_t*)cbdata;
|
||||
|
||||
if (PMIX_SUCCESS != status) {
|
||||
fprintf(stderr, "Client %s:%d EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n",
|
||||
myproc.nspace, myproc.rank, status, (unsigned long)evhandler_ref);
|
||||
}
|
||||
*active = status;
|
||||
lock->status = status;
|
||||
lock->evhandler_ref = evhandler_ref;
|
||||
DEBUG_WAKEUP_THREAD(lock);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
pmix_status_t rc;
|
||||
pmix_value_t value;
|
||||
pmix_value_t *val = &value;
|
||||
char *tmp, *ptr, *p;
|
||||
char *tmp;
|
||||
pmix_proc_t proc;
|
||||
uint32_t nprocs, m, n, local_cnt, *localpeers;
|
||||
uint32_t nprocs, n;
|
||||
pmix_info_t *info;
|
||||
bool flag, local;
|
||||
volatile int active;
|
||||
bool flag;
|
||||
mylock_t mylock;
|
||||
myrel_t myrel;
|
||||
pmix_status_t dbg = PMIX_ERR_DEBUGGER_RELEASE;
|
||||
pid_t pid;
|
||||
|
||||
pid = getpid();
|
||||
fprintf(stderr, "Client %lu: Running\n", (unsigned long)pid);
|
||||
|
||||
/* init us - note that the call to "init" includes the return of
|
||||
* any job-related info provided by the RM. This includes any
|
||||
@ -114,20 +147,21 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
exit(0);
|
||||
}
|
||||
fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
|
||||
fprintf(stderr, "Client ns %s rank %d pid %lu: Running\n", myproc.nspace, myproc.rank, (unsigned long)pid);
|
||||
|
||||
|
||||
/* register our default event handler - again, this isn't strictly
|
||||
* required, but is generally good practice */
|
||||
active = -1;
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
PMIx_Register_event_handler(NULL, 0, NULL, 0,
|
||||
notification_fn, evhandler_reg_callbk, (void*)&active);
|
||||
while (-1 == active) {
|
||||
sleep(1);
|
||||
}
|
||||
if (0 != active) {
|
||||
notification_fn, evhandler_reg_callbk, (void*)&mylock);
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
rc = mylock.status;
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
fprintf(stderr, "[%s:%d] Default handler registration failed\n", myproc.nspace, myproc.rank);
|
||||
exit(active);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* job-related info is found in our nspace, assigned to the
|
||||
@ -145,21 +179,24 @@ int main(int argc, char **argv)
|
||||
* debugger */
|
||||
if (PMIX_SUCCESS == (rc = PMIx_Get(&proc, PMIX_DEBUG_WAIT_FOR_NOTIFY, NULL, 0, &val))) {
|
||||
/* register for debugger release */
|
||||
active = -1;
|
||||
PMIx_Register_event_handler(&dbg, 1, NULL, 0,
|
||||
release_fn, evhandler_reg_callbk, (void*)&active);
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
PMIX_INFO_CREATE(info, 1);
|
||||
DEBUG_CONSTRUCT_MYREL(&myrel);
|
||||
PMIX_INFO_LOAD(&info[0], PMIX_EVENT_RETURN_OBJECT, &myrel, PMIX_POINTER);
|
||||
PMIx_Register_event_handler(&dbg, 1, info, 1,
|
||||
release_fn, evhandler_reg_callbk, (void*)&mylock);
|
||||
/* wait for registration to complete */
|
||||
while (-1 == active) {
|
||||
sleep(1);
|
||||
}
|
||||
if (0 != active) {
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
rc = mylock.status;
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
PMIX_INFO_FREE(info, 1);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
fprintf(stderr, "[%s:%d] Debug handler registration failed\n", myproc.nspace, myproc.rank);
|
||||
exit(active);
|
||||
goto done;
|
||||
}
|
||||
/* wait for debugger release */
|
||||
while (waiting_for_debugger) {
|
||||
sleep(1);
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&myrel.lock);
|
||||
DEBUG_DESTRUCT_MYREL(&myrel);
|
||||
}
|
||||
|
||||
/* get our universe size */
|
||||
@ -196,7 +233,7 @@ int main(int argc, char **argv)
|
||||
value.type = PMIX_UINT64;
|
||||
value.data.uint64 = 1234;
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, tmp, &value))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Put local failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
free(tmp);
|
||||
@ -207,7 +244,7 @@ int main(int argc, char **argv)
|
||||
value.type = PMIX_STRING;
|
||||
value.data.string = "1234";
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Put remote failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
free(tmp);
|
||||
@ -230,96 +267,53 @@ int main(int argc, char **argv)
|
||||
}
|
||||
PMIX_INFO_FREE(info, 1);
|
||||
|
||||
/* get the number of local peers */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_SIZE, NULL, 0, &val))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_SIZE failed: %d", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
local_cnt = val->data.uint32;
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
|
||||
/* create an array for the peers */
|
||||
localpeers = (uint32_t*)malloc(local_cnt * sizeof(int));
|
||||
|
||||
/* get the list of local peers */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_PEERS failed: %d", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
ptr = strdup(val->data.string);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
|
||||
/* populate the peers array */
|
||||
p = strtok(ptr, ",");
|
||||
localpeers[0] = strtoul(p, NULL, 10);
|
||||
for (n=1; n < local_cnt; n++) {
|
||||
p = strtok(NULL, ",");
|
||||
localpeers[n] = strtoul(p, NULL, 10);
|
||||
}
|
||||
free(ptr);
|
||||
|
||||
/* check the returned data */
|
||||
for (n=0; n < nprocs; n++) {
|
||||
if (n == myproc.rank) {
|
||||
continue;
|
||||
if (0 > asprintf(&tmp, "%s-%d-local", myproc.nspace, myproc.rank)) {
|
||||
exit(1);
|
||||
}
|
||||
proc.rank = n;
|
||||
local = false;
|
||||
for (m=0; m < local_cnt; m++) {
|
||||
if (localpeers[m] == proc.rank) {
|
||||
local = true;
|
||||
break;
|
||||
}
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc);
|
||||
goto done;
|
||||
}
|
||||
if (local) {
|
||||
if (0 > asprintf(&tmp, "%s-%d-local", proc.nspace, proc.rank)) {
|
||||
exit(1);
|
||||
}
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc);
|
||||
goto done;
|
||||
}
|
||||
if (PMIX_UINT64 != val->type) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
goto done;
|
||||
}
|
||||
if (1234 != val->data.uint64) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %d\n", myproc.nspace, myproc.rank, tmp, (int)val->data.uint64);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
goto done;
|
||||
}
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp);
|
||||
if (PMIX_UINT64 != val->type) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
} else {
|
||||
if (0 > asprintf(&tmp, "%s-%d-remote", proc.nspace, proc.rank)) {
|
||||
exit(1);
|
||||
}
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc);
|
||||
goto done;
|
||||
}
|
||||
if (PMIX_STRING != val->type) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
goto done;
|
||||
}
|
||||
if (0 != strcmp(val->data.string, "1234")) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %s\n", myproc.nspace, myproc.rank, tmp, val->data.string);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
goto done;
|
||||
}
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp);
|
||||
goto done;
|
||||
}
|
||||
if (1234 != val->data.uint64) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %d\n", myproc.nspace, myproc.rank, tmp, (int)val->data.uint64);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
goto done;
|
||||
}
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
if (0 > asprintf(&tmp, "%s-%d-remote", myproc.nspace, myproc.rank)) {
|
||||
exit(1);
|
||||
}
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc);
|
||||
goto done;
|
||||
}
|
||||
if (PMIX_STRING != val->type) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
goto done;
|
||||
}
|
||||
if (0 != strcmp(val->data.string, "1234")) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %s\n", myproc.nspace, myproc.rank, tmp, val->data.string);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
goto done;
|
||||
}
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
free(tmp);
|
||||
}
|
||||
free(localpeers);
|
||||
|
||||
done:
|
||||
/* finalize us */
|
||||
|
@ -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-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -31,6 +31,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <pmix.h>
|
||||
#include "examples.h"
|
||||
|
||||
static pmix_proc_t myproc;
|
||||
|
||||
@ -62,25 +63,27 @@ static void evhandler_reg_callbk(pmix_status_t status,
|
||||
size_t evhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
volatile int *active = (volatile int*)cbdata;
|
||||
mylock_t *lock = (mylock_t*)cbdata;
|
||||
|
||||
if (PMIX_SUCCESS != status) {
|
||||
fprintf(stderr, "Client %s:%d EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n",
|
||||
myproc.nspace, myproc.rank, status, (unsigned long)evhandler_ref);
|
||||
}
|
||||
*active = status;
|
||||
lock->status = status;
|
||||
lock->evhandler_ref = evhandler_ref;
|
||||
DEBUG_WAKEUP_THREAD(lock);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
pmix_status_t rc;
|
||||
pmix_value_t value;
|
||||
pmix_value_t *val, *vptr;
|
||||
pmix_proc_t proc;
|
||||
uint32_t nprocs, n, k;
|
||||
pmix_info_t *info;
|
||||
bool flag;
|
||||
volatile int active;
|
||||
mylock_t mylock;
|
||||
pmix_data_array_t da, *dptr;
|
||||
|
||||
/* init us - note that the call to "init" includes the return of
|
||||
@ -97,15 +100,16 @@ int main(int argc, char **argv)
|
||||
|
||||
/* register our default event handler - again, this isn't strictly
|
||||
* required, but is generally good practice */
|
||||
active = -1;
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
PMIx_Register_event_handler(NULL, 0, NULL, 0,
|
||||
notification_fn, evhandler_reg_callbk, (void*)&active);
|
||||
while (-1 == active) {
|
||||
sleep(1);
|
||||
}
|
||||
if (0 != active) {
|
||||
notification_fn, evhandler_reg_callbk, (void*)&mylock);
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
rc = mylock.status;
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
fprintf(stderr, "[%s:%d] Default handler registration failed\n", myproc.nspace, myproc.rank);
|
||||
exit(active);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* job-related info is found in our nspace, assigned to the
|
||||
|
@ -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-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -33,24 +33,19 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <pmix.h>
|
||||
#include "examples.h"
|
||||
|
||||
static uint32_t nprocs;
|
||||
static pmix_proc_t myproc;
|
||||
static uint32_t getcount = 0;
|
||||
|
||||
#define WAIT_FOR_COMPLETION(a) \
|
||||
do { \
|
||||
while ((a)) { \
|
||||
usleep(10); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static void opcbfunc(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
bool *active = (bool*)cbdata;
|
||||
mylock_t *lock = (mylock_t*)cbdata;
|
||||
|
||||
fprintf(stderr, "%s:%d completed fence_nb\n", myproc.nspace, myproc.rank);
|
||||
*active = false;
|
||||
lock->status = status;
|
||||
DEBUG_WAKEUP_THREAD(lock);
|
||||
}
|
||||
|
||||
static void valcbfunc(pmix_status_t status,
|
||||
@ -98,7 +93,7 @@ int main(int argc, char **argv)
|
||||
char *tmp;
|
||||
pmix_proc_t proc;
|
||||
uint32_t n, num_gets;
|
||||
bool active;
|
||||
mylock_t mylock;
|
||||
|
||||
/* init us */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
|
||||
@ -170,9 +165,10 @@ int main(int argc, char **argv)
|
||||
PMIX_PROC_CONSTRUCT(&proc);
|
||||
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
active = true;
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Fence_nb(&proc, 1, NULL, 0, opcbfunc, &active))) {
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Fence_nb(&proc, 1, NULL, 0, opcbfunc, &mylock))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -203,7 +199,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* wait for the first fence to finish */
|
||||
WAIT_FOR_COMPLETION(active);
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
|
||||
/* wait for all my "get" calls to complete */
|
||||
while (getcount < num_gets) {
|
||||
|
@ -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-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -35,7 +35,7 @@
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <pmix.h>
|
||||
|
||||
#include "examples.h"
|
||||
|
||||
static pmix_proc_t myproc;
|
||||
|
||||
|
124
opal/mca/pmix/pmix3x/pmix/examples/examples.h
Обычный файл
124
opal/mca/pmix/pmix3x/pmix/examples/examples.h
Обычный файл
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <pmix_common.h>
|
||||
|
||||
typedef struct {
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
volatile bool active;
|
||||
pmix_status_t status;
|
||||
int count;
|
||||
size_t evhandler_ref;
|
||||
} mylock_t;
|
||||
|
||||
#define DEBUG_CONSTRUCT_LOCK(l) \
|
||||
do { \
|
||||
pthread_mutex_init(&(l)->mutex, NULL); \
|
||||
pthread_cond_init(&(l)->cond, NULL); \
|
||||
(l)->active = true; \
|
||||
(l)->status = PMIX_SUCCESS; \
|
||||
(l)->count = 0; \
|
||||
(l)->evhandler_ref = 0; \
|
||||
} while(0)
|
||||
|
||||
#define DEBUG_DESTRUCT_LOCK(l) \
|
||||
do { \
|
||||
pthread_mutex_destroy(&(l)->mutex); \
|
||||
pthread_cond_destroy(&(l)->cond); \
|
||||
} while(0)
|
||||
|
||||
#define DEBUG_WAIT_THREAD(lck) \
|
||||
do { \
|
||||
pthread_mutex_lock(&(lck)->mutex); \
|
||||
while ((lck)->active) { \
|
||||
pthread_cond_wait(&(lck)->cond, &(lck)->mutex); \
|
||||
} \
|
||||
pthread_mutex_unlock(&(lck)->mutex); \
|
||||
} while(0)
|
||||
|
||||
#define DEBUG_WAKEUP_THREAD(lck) \
|
||||
do { \
|
||||
pthread_mutex_lock(&(lck)->mutex); \
|
||||
(lck)->active = false; \
|
||||
pthread_cond_broadcast(&(lck)->cond); \
|
||||
pthread_mutex_unlock(&(lck)->mutex); \
|
||||
} while(0)
|
||||
|
||||
/* define a structure for collecting returned
|
||||
* info from a query */
|
||||
typedef struct {
|
||||
mylock_t lock;
|
||||
pmix_info_t *info;
|
||||
size_t ninfo;
|
||||
} myquery_data_t;
|
||||
|
||||
#define DEBUG_CONSTRUCT_MYQUERY(q) \
|
||||
do { \
|
||||
DEBUG_CONSTRUCT_LOCK(&((q)->lock)); \
|
||||
(q)->info = NULL; \
|
||||
(q)->ninfo = 0; \
|
||||
} while(0)
|
||||
|
||||
#define DEBUG_DESTRUCT_MYQUERY(q) \
|
||||
do { \
|
||||
DEBUG_DESTRUCT_LOCK(&((q)->lock)); \
|
||||
if (NULL != (q)->info) { \
|
||||
PMIX_INFO_FREE((q)->info, (q)->ninfo); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/* define a structure for releasing when a given
|
||||
* nspace terminates */
|
||||
typedef struct {
|
||||
mylock_t lock;
|
||||
char *nspace;
|
||||
int exit_code;
|
||||
bool exit_code_given;
|
||||
} myrel_t;
|
||||
|
||||
|
||||
#define DEBUG_CONSTRUCT_MYREL(r) \
|
||||
do { \
|
||||
DEBUG_CONSTRUCT_LOCK(&((r)->lock)); \
|
||||
(r)->nspace = NULL; \
|
||||
(r)->exit_code = 0; \
|
||||
(r)->exit_code_given = false; \
|
||||
} while(0)
|
||||
|
||||
#define DEBUG_DESTRUCT_MYREL(r) \
|
||||
do { \
|
||||
DEBUG_DESTRUCT_LOCK(&((r)->lock)); \
|
||||
if (NULL != (r)->nspace) { \
|
||||
free((r)->nspace); \
|
||||
} \
|
||||
} while(0)
|
@ -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-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -28,11 +28,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <pmix.h>
|
||||
#include "examples.h"
|
||||
|
||||
static pmix_proc_t myproc;
|
||||
static bool completed;
|
||||
|
||||
static void notification_fn(size_t evhdlr_registration_id,
|
||||
pmix_status_t status,
|
||||
@ -42,22 +43,67 @@ static void notification_fn(size_t evhdlr_registration_id,
|
||||
pmix_event_notification_cbfunc_fn_t cbfunc,
|
||||
void *cbdata)
|
||||
{
|
||||
fprintf(stderr, "Client %s:%d NOTIFIED with status %d\n", myproc.nspace, myproc.rank, status);
|
||||
completed = true;
|
||||
myrel_t *lock;
|
||||
bool found;
|
||||
int exit_code;
|
||||
size_t n;
|
||||
pmix_proc_t *affected = NULL;
|
||||
|
||||
/* find our return object */
|
||||
lock = NULL;
|
||||
found = false;
|
||||
for (n=0; n < ninfo; n++) {
|
||||
if (0 == strncmp(info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) {
|
||||
lock = (myrel_t*)info[n].value.data.ptr;
|
||||
/* not every RM will provide an exit code, but check if one was given */
|
||||
} else if (0 == strncmp(info[n].key, PMIX_EXIT_CODE, PMIX_MAX_KEYLEN)) {
|
||||
exit_code = info[n].value.data.integer;
|
||||
found = true;
|
||||
} else if (0 == strncmp(info[n].key, PMIX_EVENT_AFFECTED_PROC, PMIX_MAX_KEYLEN)) {
|
||||
affected = info[n].value.data.proc;
|
||||
}
|
||||
}
|
||||
/* if the object wasn't returned, then that is an error */
|
||||
if (NULL == lock) {
|
||||
fprintf(stderr, "LOCK WASN'T RETURNED IN RELEASE CALLBACK\n");
|
||||
/* let the event handler progress */
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* tell the event handler state machine that we are the last step */
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata);
|
||||
}
|
||||
fprintf(stderr, "DEBUGGER DAEMON NOTIFIED TERMINATED - AFFECTED %s\n",
|
||||
(NULL == affected) ? "NULL" : affected->nspace);
|
||||
|
||||
if (found) {
|
||||
lock->exit_code = exit_code;
|
||||
lock->exit_code_given = true;
|
||||
}
|
||||
DEBUG_WAKEUP_THREAD(&lock->lock);
|
||||
}
|
||||
|
||||
static void op_callbk(pmix_status_t status,
|
||||
void *cbdata)
|
||||
{
|
||||
mylock_t *lock = (mylock_t*)cbdata;
|
||||
fprintf(stderr, "Client %s:%d OP CALLBACK CALLED WITH STATUS %d\n", myproc.nspace, myproc.rank, status);
|
||||
DEBUG_WAKEUP_THREAD(lock);
|
||||
}
|
||||
|
||||
static void errhandler_reg_callbk(pmix_status_t status,
|
||||
static void evhandler_reg_callbk(pmix_status_t status,
|
||||
size_t errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
mylock_t *lock = (mylock_t*)cbdata;
|
||||
|
||||
fprintf(stderr, "Client %s:%d ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu\n",
|
||||
myproc.nspace, myproc.rank, status, (unsigned long)errhandler_ref);
|
||||
DEBUG_WAKEUP_THREAD(lock);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -67,6 +113,10 @@ int main(int argc, char **argv)
|
||||
pmix_value_t *val = &value;
|
||||
pmix_proc_t proc;
|
||||
uint32_t nprocs;
|
||||
pmix_info_t *info;
|
||||
mylock_t mylock;
|
||||
myrel_t myrel;
|
||||
pmix_status_t code[2] = {PMIX_ERR_PROC_ABORTED, PMIX_ERR_JOB_TERMINATED};
|
||||
|
||||
/* init us */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
|
||||
@ -87,11 +137,27 @@ int main(int argc, char **argv)
|
||||
nprocs = val->data.uint32;
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs);
|
||||
completed = false;
|
||||
|
||||
/* register our errhandler */
|
||||
PMIx_Register_event_handler(NULL, 0, NULL, 0,
|
||||
notification_fn, errhandler_reg_callbk, NULL);
|
||||
/* register another handler specifically for when the target
|
||||
* job completes */
|
||||
DEBUG_CONSTRUCT_MYREL(&myrel);
|
||||
PMIX_INFO_CREATE(info, 2);
|
||||
PMIX_INFO_LOAD(&info[0], PMIX_EVENT_RETURN_OBJECT, &myrel, PMIX_POINTER);
|
||||
/* only call me back when one of us terminates */
|
||||
PMIX_INFO_LOAD(&info[1], PMIX_NSPACE, myproc.nspace, PMIX_STRING);
|
||||
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
PMIx_Register_event_handler(code, 2, info, 2,
|
||||
notification_fn, evhandler_reg_callbk, (void*)&mylock);
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
if (PMIX_SUCCESS != mylock.status) {
|
||||
rc = mylock.status;
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
PMIX_INFO_FREE(info, 2);
|
||||
goto done;
|
||||
}
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
PMIX_INFO_FREE(info, 2);
|
||||
|
||||
/* call fence to sync */
|
||||
PMIX_PROC_CONSTRUCT(&proc);
|
||||
@ -109,17 +175,16 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
/* everyone simply waits */
|
||||
while (!completed) {
|
||||
struct timespec ts;
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = 100000;
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&myrel.lock);
|
||||
DEBUG_DESTRUCT_MYREL(&myrel);
|
||||
|
||||
done:
|
||||
/* finalize us */
|
||||
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
|
||||
PMIx_Deregister_event_handler(1, op_callbk, NULL);
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
PMIx_Deregister_event_handler(1, op_callbk, &mylock);
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
|
||||
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
|
@ -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-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -32,6 +32,7 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include <pmix.h>
|
||||
#include "examples.h"
|
||||
|
||||
static pmix_proc_t myproc;
|
||||
|
||||
@ -63,13 +64,15 @@ static void evhandler_reg_callbk(pmix_status_t status,
|
||||
size_t evhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
volatile int *active = (volatile int*)cbdata;
|
||||
mylock_t *lock = (mylock_t*)cbdata;
|
||||
|
||||
if (PMIX_SUCCESS != status) {
|
||||
fprintf(stderr, "Client %s:%d EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n",
|
||||
myproc.nspace, myproc.rank, status, (unsigned long)evhandler_ref);
|
||||
}
|
||||
*active = status;
|
||||
lock->status = status;
|
||||
lock->evhandler_ref = evhandler_ref;
|
||||
DEBUG_WAKEUP_THREAD(lock);
|
||||
}
|
||||
|
||||
static void infocbfunc(pmix_status_t status,
|
||||
@ -78,26 +81,27 @@ static void infocbfunc(pmix_status_t status,
|
||||
pmix_release_cbfunc_t release_fn,
|
||||
void *release_cbdata)
|
||||
{
|
||||
volatile int *active = (volatile int*)cbdata;
|
||||
mylock_t *lock = (mylock_t*)cbdata;
|
||||
|
||||
/* release the caller */
|
||||
if (NULL != release_fn) {
|
||||
release_fn(release_cbdata);
|
||||
}
|
||||
|
||||
*active = status;
|
||||
lock->status = status;
|
||||
DEBUG_WAKEUP_THREAD(lock);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
pmix_status_t rc;
|
||||
pmix_value_t value;
|
||||
pmix_value_t *val = &value;
|
||||
pmix_proc_t proc;
|
||||
uint32_t nprocs, n;
|
||||
pmix_info_t *info, *iptr;
|
||||
bool flag;
|
||||
volatile int active;
|
||||
mylock_t mylock;
|
||||
pmix_data_array_t *dptr;
|
||||
|
||||
/* init us - note that the call to "init" includes the return of
|
||||
@ -111,15 +115,16 @@ int main(int argc, char **argv)
|
||||
|
||||
/* register our default event handler - again, this isn't strictly
|
||||
* required, but is generally good practice */
|
||||
active = -1;
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
PMIx_Register_event_handler(NULL, 0, NULL, 0,
|
||||
notification_fn, evhandler_reg_callbk, (void*)&active);
|
||||
while (-1 == active) {
|
||||
sleep(1);
|
||||
}
|
||||
if (0 != active) {
|
||||
notification_fn, evhandler_reg_callbk, (void*)&mylock);
|
||||
/* wait for registration to complete */
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
rc = mylock.status;
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
fprintf(stderr, "[%s:%d] Default handler registration failed\n", myproc.nspace, myproc.rank);
|
||||
exit(active);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* job-related info is found in our nspace, assigned to the
|
||||
@ -145,12 +150,8 @@ int main(int argc, char **argv)
|
||||
PMIX_INFO_LOAD(&info[0], PMIX_JOB_CTRL_PREEMPTIBLE, (void*)&flag, PMIX_BOOL);
|
||||
/* can't use "load" to load a pmix_data_array_t */
|
||||
(void)strncpy(info[1].key, PMIX_JOB_CTRL_CHECKPOINT_METHOD, PMIX_MAX_KEYLEN);
|
||||
info[1].value.type = PMIX_DATA_ARRAY;
|
||||
dptr = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t));
|
||||
info[1].value.data.darray = dptr;
|
||||
dptr->type = PMIX_INFO;
|
||||
dptr->size = 2;
|
||||
PMIX_INFO_CREATE(dptr->array, dptr->size);
|
||||
PMIX_DATA_ARRAY_CREATE(info[1].value.data.darray, 2, PMIX_INFO);
|
||||
dptr = info[1].value.data.darray;
|
||||
rc = SIGUSR2;
|
||||
iptr = (pmix_info_t*)dptr->array;
|
||||
PMIX_INFO_LOAD(&iptr[0], PMIX_JOB_CTRL_CHECKPOINT_SIGNAL, &rc, PMIX_INT);
|
||||
@ -159,18 +160,19 @@ int main(int argc, char **argv)
|
||||
|
||||
/* since this is informational and not a requested operation, the target parameter
|
||||
* doesn't mean anything and can be ignored */
|
||||
active = -1;
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Job_control_nb(NULL, 0, info, 2, infocbfunc, (void*)&active))) {
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Job_control_nb(NULL, 0, info, 2, infocbfunc, (void*)&mylock))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Job_control_nb failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
goto done;
|
||||
}
|
||||
while (-1 == active) {
|
||||
sleep(1);
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
PMIX_INFO_FREE(info, 2);
|
||||
if (0 != active) {
|
||||
rc = mylock.status;
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Job_control_nb failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
exit(active);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* now request that this process be monitored using heartbeats */
|
||||
@ -185,20 +187,21 @@ int main(int argc, char **argv)
|
||||
PMIX_INFO_LOAD(&info[2], PMIX_MONITOR_HEARTBEAT_DROPS, &n, PMIX_UINT32);
|
||||
|
||||
/* make the request */
|
||||
active = -1;
|
||||
DEBUG_CONSTRUCT_LOCK(&mylock);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Process_monitor_nb(iptr, PMIX_MONITOR_HEARTBEAT_ALERT,
|
||||
info, 3, infocbfunc, (void*)&active))) {
|
||||
info, 3, infocbfunc, (void*)&mylock))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Process_monitor_nb failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
goto done;
|
||||
}
|
||||
while (-1 == active) {
|
||||
sleep(1);
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&mylock);
|
||||
PMIX_INFO_FREE(iptr, 1);
|
||||
PMIX_INFO_FREE(info, 3);
|
||||
if (0 != active) {
|
||||
rc = mylock.status;
|
||||
DEBUG_DESTRUCT_LOCK(&mylock);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Process_monitor_nb failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
exit(active);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* send a heartbeat */
|
||||
|
@ -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-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -29,6 +29,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <pmix_tool.h>
|
||||
#include "examples.h"
|
||||
|
||||
static void cbfunc(pmix_status_t status,
|
||||
pmix_info_t *info, size_t ninfo,
|
||||
@ -36,15 +37,28 @@ static void cbfunc(pmix_status_t status,
|
||||
pmix_release_cbfunc_t release_fn,
|
||||
void *release_cbdata)
|
||||
{
|
||||
volatile bool *active = (volatile bool*)cbdata;
|
||||
myquery_data_t *mq = (myquery_data_t*)cbdata;
|
||||
size_t n;
|
||||
|
||||
/* do something with the returned info - it will be
|
||||
mq->lock.status = status;
|
||||
|
||||
/* save the returned info - it will be
|
||||
* released in the release_fn */
|
||||
if (0 < ninfo) {
|
||||
PMIX_INFO_CREATE(mq->info, ninfo);
|
||||
mq->ninfo = ninfo;
|
||||
for (n=0; n < ninfo; n++) {
|
||||
PMIX_INFO_XFER(&mq->info[n], &info[n]);
|
||||
}
|
||||
}
|
||||
|
||||
/* let the library release the data */
|
||||
if (NULL != release_fn) {
|
||||
release_fn(release_cbdata);
|
||||
}
|
||||
*active = false;
|
||||
|
||||
/* release the block */
|
||||
DEBUG_WAKEUP_THREAD(&mq->lock);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -52,31 +66,154 @@ int main(int argc, char **argv)
|
||||
pmix_status_t rc;
|
||||
pmix_proc_t myproc;
|
||||
pmix_query_t *query;
|
||||
size_t nq;
|
||||
volatile bool active;
|
||||
size_t nq, ninfo = 0, n, m;
|
||||
myquery_data_t mydata;
|
||||
pmix_info_t *info = NULL, *iptr;
|
||||
char *server_uri = NULL;
|
||||
char *nspace = NULL;
|
||||
char *nodename = NULL;
|
||||
pmix_data_array_t *darray, *dptr;
|
||||
bool geturi = false;
|
||||
char hostname[1024];
|
||||
|
||||
gethostname(hostname, 1024);
|
||||
for (n=1; n < (size_t)argc; n++) {
|
||||
if (0 == strcmp("-u", argv[n]) || 0 == strcmp("--url", argv[n])) {
|
||||
if (NULL == argv[n+1]) {
|
||||
fprintf(stderr, "Must provide URI argument to %s option\n", argv[n]);
|
||||
exit(1);
|
||||
}
|
||||
server_uri = argv[n+1];
|
||||
} else if (0 == strcmp("-nspace", argv[n]) || 0 == strcmp("--nspace", argv[n])) {
|
||||
if (NULL == argv[n+1]) {
|
||||
fprintf(stderr, "Must provide nspace argument to %s option\n", argv[n]);
|
||||
exit(1);
|
||||
}
|
||||
nspace = argv[n+1];
|
||||
} else if (0 == strcmp("-uri", argv[n]) || 0 == strcmp("--uri", argv[n])) {
|
||||
/* retrieve the PMIx server's uri from the indicated node */
|
||||
nodename = argv[n+1];
|
||||
geturi = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != server_uri) {
|
||||
ninfo = 1;
|
||||
PMIX_INFO_CREATE(info, ninfo);
|
||||
PMIX_INFO_LOAD(&info[0], PMIX_SERVER_URI, server_uri, PMIX_STRING);
|
||||
fprintf(stderr, "Connecting to %s\n", server_uri);
|
||||
}
|
||||
|
||||
/* init us */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_tool_init(&myproc, NULL, 0))) {
|
||||
if (PMIX_SUCCESS != (rc = PMIx_tool_init(&myproc, info, ninfo))) {
|
||||
fprintf(stderr, "PMIx_tool_init failed: %d\n", rc);
|
||||
exit(rc);
|
||||
}
|
||||
if (NULL != info) {
|
||||
PMIX_INFO_FREE(info, ninfo);
|
||||
}
|
||||
|
||||
/* query something */
|
||||
nq = 2;
|
||||
PMIX_QUERY_CREATE(query, nq);
|
||||
query[0].keys = (char**)malloc(2 * sizeof(char*));
|
||||
query[0].keys[0] = strdup("foobar");
|
||||
query[0].keys[1] = NULL;
|
||||
query[1].keys = (char**)malloc(2 * sizeof(char*));
|
||||
query[1].keys[0] = strdup("spastic");
|
||||
query[1].keys[1] = NULL;
|
||||
active = true;
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&active))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
if (geturi) {
|
||||
nq = 1;
|
||||
PMIX_QUERY_CREATE(query, nq);
|
||||
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_SERVER_URI);
|
||||
if (NULL != nodename) {
|
||||
PMIX_QUERY_QUALIFIERS_CREATE(&query[0], 1);
|
||||
PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_HOSTNAME, nodename, PMIX_STRING);
|
||||
}
|
||||
DEBUG_CONSTRUCT_MYQUERY(&mydata);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&mydata))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&mydata.lock);
|
||||
/* find the response */
|
||||
if (PMIX_SUCCESS == mydata.lock.status) {
|
||||
/* should be in the first key */
|
||||
if (PMIX_CHECK_KEY(&mydata.info[0], PMIX_SERVER_URI)) {
|
||||
fprintf(stderr, "PMIx server URI for node %s: %s\n",
|
||||
(NULL == nodename) ? hostname : nodename,
|
||||
mydata.info[0].value.data.string);
|
||||
} else {
|
||||
fprintf(stderr, "Query returned wrong info key at first posn: %s\n", mydata.info[0].key);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Query returned error: %s\n", PMIx_Error_string(mydata.lock.status));
|
||||
}
|
||||
DEBUG_DESTRUCT_MYQUERY(&mydata);
|
||||
goto done;
|
||||
}
|
||||
while(active) {
|
||||
usleep(10);
|
||||
|
||||
if (NULL == nspace) {
|
||||
/* query the list of active nspaces */
|
||||
nq = 1;
|
||||
PMIX_QUERY_CREATE(query, nq);
|
||||
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_NAMESPACE_INFO);
|
||||
DEBUG_CONSTRUCT_MYQUERY(&mydata);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&mydata))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&mydata.lock);
|
||||
/* find the response */
|
||||
if (PMIX_SUCCESS == mydata.lock.status) {
|
||||
/* should be in the first key */
|
||||
if (PMIX_CHECK_KEY(&mydata.info[0], PMIX_QUERY_NAMESPACE_INFO)) {
|
||||
darray = mydata.info[0].value.data.darray;
|
||||
fprintf(stderr, "ACTIVE NSPACES:\n");
|
||||
if (NULL == darray || 0 == darray->size || NULL == darray->array) {
|
||||
fprintf(stderr, "\tNone\n");
|
||||
} else {
|
||||
info = (pmix_info_t*)darray->array;
|
||||
if (NULL == info) {
|
||||
fprintf(stderr, "Error\n");
|
||||
} else {
|
||||
for (n=0; n < darray->size; n++) {
|
||||
dptr = info[n].value.data.darray;
|
||||
if (NULL == dptr || 0 == dptr->size || NULL == dptr->array) {
|
||||
fprintf(stderr, "Error in array %s\n", (NULL == dptr) ? "NULL" : "NON-NULL");
|
||||
break;
|
||||
}
|
||||
iptr = (pmix_info_t*)dptr->array;
|
||||
for (m=0; m < dptr->size; m++) {
|
||||
fprintf(stderr, "\t%s", iptr[m].value.data.string);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Query returned wrong info key at first posn: %s\n", mydata.info[0].key);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Query returned error: %s\n", PMIx_Error_string(mydata.lock.status));
|
||||
}
|
||||
DEBUG_DESTRUCT_MYQUERY(&mydata);
|
||||
} else {
|
||||
nq = 1;
|
||||
PMIX_QUERY_CREATE(query, nq);
|
||||
PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_JOB_SIZE);
|
||||
PMIX_INFO_CREATE(query[0].qualifiers, 1);
|
||||
query[0].nqual = 1;
|
||||
PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_NSPACE, nspace, PMIX_STRING);
|
||||
DEBUG_CONSTRUCT_MYQUERY(&mydata);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&mydata))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
DEBUG_WAIT_THREAD(&mydata.lock);
|
||||
/* find the response */
|
||||
if (PMIX_SUCCESS == mydata.lock.status) {
|
||||
/* should be in the first key */
|
||||
if (PMIX_CHECK_KEY(&mydata.info[0], PMIX_JOB_SIZE)) {
|
||||
fprintf(stderr, "JOB SIZE FOR NSPACE %s: %lu\n", nspace, (unsigned long)mydata.info[0].value.data.uint32);
|
||||
} else {
|
||||
fprintf(stderr, "Query returned wrong info key at first posn: %s\n", mydata.info[0].key);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Query returned error: %s\n", PMIx_Error_string(mydata.lock.status));
|
||||
}
|
||||
DEBUG_DESTRUCT_MYQUERY(&mydata);
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
@ -14,7 +14,8 @@ if WANT_PRIMARY_HEADERS
|
||||
include_HEADERS = \
|
||||
pmix.h \
|
||||
pmix_server.h \
|
||||
pmix_tool.h
|
||||
pmix_tool.h \
|
||||
pmix_extend.h
|
||||
|
||||
if WANT_PMI_BACKWARD
|
||||
include_HEADERS += \
|
||||
|
@ -129,7 +129,7 @@ PMIX_EXPORT pmix_status_t PMIx_Abort(int status, const char msg[],
|
||||
* the information locally until _PMIx_Commit_ is called. The provided scope
|
||||
* value is passed to the local PMIx server, which will distribute the data
|
||||
* as directed. */
|
||||
PMIX_EXPORT pmix_status_t PMIx_Put(pmix_scope_t scope, const char key[], pmix_value_t *val);
|
||||
PMIX_EXPORT pmix_status_t PMIx_Put(pmix_scope_t scope, const pmix_key_t key, pmix_value_t *val);
|
||||
|
||||
|
||||
/* Push all previously _PMIx_Put_ values to the local PMIx server.
|
||||
@ -200,7 +200,7 @@ PMIX_EXPORT pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs
|
||||
* an error. The timeout parameter can help avoid "hangs" due to programming
|
||||
* errors that prevent the target proc from ever exposing its data.
|
||||
*/
|
||||
PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
|
||||
PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const pmix_key_t key,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_value_t **val);
|
||||
|
||||
@ -208,7 +208,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
|
||||
* be executed once the specified data has been _PMIx_Put_
|
||||
* by the identified process and retrieved by the local server. The info
|
||||
* array is used as described above for the blocking form of this call. */
|
||||
PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char key[],
|
||||
PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t key,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_value_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
@ -337,7 +337,7 @@ PMIX_EXPORT pmix_status_t PMIx_Unpublish_nb(char **keys,
|
||||
*/
|
||||
PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo,
|
||||
const pmix_app_t apps[], size_t napps,
|
||||
char nspace[]);
|
||||
pmix_nspace_t nspace);
|
||||
|
||||
|
||||
/* Non-blocking form of the _PMIx_Spawn_ function. The callback
|
||||
@ -394,7 +394,7 @@ PMIX_EXPORT pmix_status_t PMIx_Disconnect_nb(const pmix_proc_t ranges[], size_t
|
||||
* for releasing the array when done with it - the PMIX_PROC_FREE macro is
|
||||
* provided for this purpose.
|
||||
*/
|
||||
PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, const char *nspace,
|
||||
PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, const pmix_nspace_t nspace,
|
||||
pmix_proc_t **procs, size_t *nprocs);
|
||||
|
||||
|
||||
@ -402,7 +402,7 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, const char *n
|
||||
* that nspace. The returned string will contain a comma-delimited list
|
||||
* of nodenames. The caller is responsible for releasing the string
|
||||
* when done with it */
|
||||
PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist);
|
||||
PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const pmix_nspace_t nspace, char **nodelist);
|
||||
|
||||
/* Query information about the system in general - can include
|
||||
* a list of active nspaces, network topology, etc. Also can be
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
155
opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h
Обычный файл
155
opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h
Обычный файл
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Artem Y. Polyakov <artpol84@gmail.com>.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer listed
|
||||
* in this license in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* - Neither the name of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* The copyright holders provide no reassurances that the source code
|
||||
* provided does not infringe any patent, copyright, or any other
|
||||
* intellectual property rights of third parties. The copyright holders
|
||||
* disclaim any liability to any recipient for claims brought against
|
||||
* recipient by any third party for infringement of that parties
|
||||
* intellectual property rights.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef PMIx_EXTEND_H
|
||||
#define PMIx_EXTEND_H
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* expose some functions that are resolved in the
|
||||
* PMIx library, but part of a header that
|
||||
* includes internal functions - we don't
|
||||
* want to expose the entire header here. These
|
||||
* back the associated macros included in the
|
||||
* PMIx Standard
|
||||
*/
|
||||
void pmix_value_load(pmix_value_t *v, const void *data, pmix_data_type_t type);
|
||||
|
||||
pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data, size_t *sz);
|
||||
|
||||
pmix_status_t pmix_value_xfer(pmix_value_t *kv, const pmix_value_t *src);
|
||||
|
||||
pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg);
|
||||
|
||||
pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg);
|
||||
|
||||
pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite);
|
||||
|
||||
void pmix_argv_free(char **argv);
|
||||
|
||||
char **pmix_argv_split(const char *src_string, int delimiter);
|
||||
|
||||
int pmix_argv_count(char **argv);
|
||||
|
||||
char *pmix_argv_join(char **argv, int delimiter);
|
||||
|
||||
char **pmix_argv_copy(char **argv);
|
||||
|
||||
pmix_status_t pmix_setenv(const char *name, const char *value,
|
||||
bool overwrite, char ***env);
|
||||
|
||||
|
||||
/* the following are a set of legacy macros not included in the
|
||||
* PMIx Standard, but used in some codes (e.g., the Slurm plugin).
|
||||
* These should be considered "deprecated" and will be removed
|
||||
* in the next major release of the PRI */
|
||||
#define PMIX_VAL_FIELD_int(x) ((x)->data.integer)
|
||||
#define PMIX_VAL_FIELD_uint32_t(x) ((x)->data.uint32)
|
||||
#define PMIX_VAL_FIELD_uint16_t(x) ((x)->data.uint16)
|
||||
#define PMIX_VAL_FIELD_string(x) ((x)->data.string)
|
||||
#define PMIX_VAL_FIELD_float(x) ((x)->data.fval)
|
||||
#define PMIX_VAL_FIELD_byte(x) ((x)->data.byte)
|
||||
#define PMIX_VAL_FIELD_flag(x) ((x)->data.flag)
|
||||
|
||||
#define PMIX_VAL_TYPE_int PMIX_INT
|
||||
#define PMIX_VAL_TYPE_uint32_t PMIX_UINT32
|
||||
#define PMIX_VAL_TYPE_uint16_t PMIX_UINT16
|
||||
#define PMIX_VAL_TYPE_string PMIX_STRING
|
||||
#define PMIX_VAL_TYPE_float PMIX_FLOAT
|
||||
#define PMIX_VAL_TYPE_byte PMIX_BYTE
|
||||
#define PMIX_VAL_TYPE_flag PMIX_BOOL
|
||||
|
||||
#define PMIX_VAL_set_assign(_v, _field, _val ) \
|
||||
do { \
|
||||
(_v)->type = PMIX_VAL_TYPE_ ## _field; \
|
||||
PMIX_VAL_FIELD_ ## _field((_v)) = _val; \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_VAL_set_strdup(_v, _field, _val ) \
|
||||
do { \
|
||||
(_v)->type = PMIX_VAL_TYPE_ ## _field; \
|
||||
PMIX_VAL_FIELD_ ## _field((_v)) = strdup(_val); \
|
||||
} while (0)
|
||||
|
||||
#define PMIX_VAL_SET_int PMIX_VAL_set_assign
|
||||
#define PMIX_VAL_SET_uint32_t PMIX_VAL_set_assign
|
||||
#define PMIX_VAL_SET_uint16_t PMIX_VAL_set_assign
|
||||
#define PMIX_VAL_SET_string PMIX_VAL_set_strdup
|
||||
#define PMIX_VAL_SET_float PMIX_VAL_set_assign
|
||||
#define PMIX_VAL_SET_byte PMIX_VAL_set_assign
|
||||
#define PMIX_VAL_SET_flag PMIX_VAL_set_assign
|
||||
|
||||
#define PMIX_VAL_SET(_v, _field, _val ) \
|
||||
PMIX_VAL_SET_ ## _field(_v, _field, _val)
|
||||
|
||||
#define PMIX_VAL_cmp_val(_val1, _val2) ((_val1) != (_val2))
|
||||
#define PMIX_VAL_cmp_float(_val1, _val2) (((_val1)>(_val2))?(((_val1)-(_val2))>0.000001):(((_val2)-(_val1))>0.000001))
|
||||
#define PMIX_VAL_cmp_ptr(_val1, _val2) strncmp(_val1, _val2, strlen(_val1)+1)
|
||||
|
||||
#define PMIX_VAL_CMP_int PMIX_VAL_cmp_val
|
||||
#define PMIX_VAL_CMP_uint32_t PMIX_VAL_cmp_val
|
||||
#define PMIX_VAL_CMP_uint16_t PMIX_VAL_cmp_val
|
||||
#define PMIX_VAL_CMP_float PMIX_VAL_cmp_float
|
||||
#define PMIX_VAL_CMP_string PMIX_VAL_cmp_ptr
|
||||
#define PMIX_VAL_CMP_byte PMIX_VAL_cmp_val
|
||||
#define PMIX_VAL_CMP_flag PMIX_VAL_cmp_val
|
||||
|
||||
#define PMIX_VAL_ASSIGN(_v, _field, _val) \
|
||||
PMIX_VAL_set_assign(_v, _field, _val)
|
||||
|
||||
#define PMIX_VAL_CMP(_field, _val1, _val2) \
|
||||
PMIX_VAL_CMP_ ## _field(_val1, _val2)
|
||||
|
||||
#define PMIX_VAL_FREE(_v) \
|
||||
PMIx_free_value_data(_v)
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -596,7 +596,7 @@ PMIX_EXPORT pmix_status_t PMIx_generate_ppn(const char *input, char **ppn);
|
||||
* for the PMIx server library to correctly handle collectives
|
||||
* as a collective operation call can occur before all the
|
||||
* procs have been started */
|
||||
PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const char nspace[], int nlocalprocs,
|
||||
PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const pmix_nspace_t nspace, int nlocalprocs,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
@ -605,7 +605,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const char nspace[], int n
|
||||
* intended to support persistent PMIx servers by providing
|
||||
* an opportunity for the host RM to tell the PMIx server
|
||||
* library to release all memory for a completed job */
|
||||
PMIX_EXPORT void PMIx_server_deregister_nspace(const char nspace[],
|
||||
PMIX_EXPORT void PMIx_server_deregister_nspace(const pmix_nspace_t nspace,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
/* Register a client process with the PMIx server library. The
|
||||
@ -676,7 +676,7 @@ typedef void (*pmix_setup_application_cbfunc_t)(pmix_status_t status,
|
||||
* operation in case network libraries need to perform some action
|
||||
* before responding. Any returned env will be distributed along
|
||||
* with the application */
|
||||
PMIX_EXPORT pmix_status_t PMIx_server_setup_application(const char nspace[],
|
||||
PMIX_EXPORT pmix_status_t PMIx_server_setup_application(const pmix_nspace_t nspace,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_setup_application_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
@ -692,7 +692,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_setup_application(const char nspace[],
|
||||
* for the first local client - i.e., they will only be executed
|
||||
* once for a given nspace
|
||||
*/
|
||||
PMIX_EXPORT pmix_status_t PMIx_server_setup_local_support(const char nspace[],
|
||||
PMIX_EXPORT pmix_status_t PMIx_server_setup_local_support(const pmix_nspace_t nspace,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2018 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018-2019 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -19,5 +19,5 @@
|
||||
#define PMIX_VERSION_MINOR @pmixminor@
|
||||
#define PMIX_VERSION_RELEASE @pmixrelease@
|
||||
|
||||
#define PMIX_NUMERIC_VERSION 0x00030001
|
||||
#define PMIX_NUMERIC_VERSION 0x00030100
|
||||
#endif
|
||||
|
@ -1,60 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
# of Tennessee Research Foundation. All rights
|
||||
# reserved.
|
||||
# Copyright (c) 2004-2009 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-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$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
if !PMIX_EMBEDDED_MODE
|
||||
|
||||
man_MANS = \
|
||||
man3/pmix_init.3 \
|
||||
man3/pmix_finalize.3 \
|
||||
man3/pmix_initialized.3 \
|
||||
man3/pmix_abort.3 \
|
||||
man3/pmix_put.3 \
|
||||
man3/pmix_commit.3 \
|
||||
man7/pmix.7 \
|
||||
man7/pmix_constants.7
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
|
||||
man3/pmix_init.3:
|
||||
$(top_srcdir)/contrib/md2nroff.pl --source=pmix_init.3.md;
|
||||
|
||||
man3/pmix_finalize.3:
|
||||
$(top_srcdir)/contrib/md2nroff.pl --source=pmix_finalize.3.md;
|
||||
|
||||
man3/pmix_initialized.3:
|
||||
$(top_srcdir)/contrib/md2nroff.pl --source=pmix_initialized.3.md;
|
||||
|
||||
man3/pmix_abort.3:
|
||||
$(top_srcdir)/contrib/md2nroff.pl --source=pmix_abort.3.md;
|
||||
|
||||
man3/pmix_put.3:
|
||||
$(top_srcdir)/contrib/md2nroff.pl --source=pmix_put.3.md;
|
||||
|
||||
man3/pmix_commit.3:
|
||||
$(top_srcdir)/contrib/md2nroff.pl --source=pmix_commit.3.md;
|
||||
|
||||
man7/pmix.7:
|
||||
$(top_srcdir)/contrib/md2nroff.pl --source=pmix.7.md;
|
||||
|
||||
man7/pmix_constants.7:
|
||||
$(top_srcdir)/contrib/md2nroff.pl --source=pmix_constants.7.md;
|
||||
|
||||
endif # !PMIX_EMBEDDED_MODE
|
@ -1,186 +0,0 @@
|
||||
This file describes how the developer side of man pages work in PMIx.
|
||||
|
||||
The Definitive Source Of Truth man pages are the Markdown man pages in
|
||||
this directory (i.e., the files ending in .<digit>.md. If you want to
|
||||
edit man pages, you need to edit the .<digit>.md pages. Do NOT edit
|
||||
the .<digit> nroff man pages directly; these files are automatically
|
||||
generated -- you will lose any manual edits the next time those files
|
||||
are generated.
|
||||
|
||||
The Markdown web pages are rendered in two different ways:
|
||||
|
||||
1. Nroff man pages. These man pages are put into the `master` branch
|
||||
and later included in PMIx distribution tarballs.
|
||||
|
||||
2. HTML. The http://open-mpi.github.io/pmix/ web site (which is
|
||||
served by the Github web servers) automatically renders the content
|
||||
of the `gh-pages` branch of the PMIx repo.
|
||||
|
||||
Markdown syntax
|
||||
===============
|
||||
|
||||
The definitive man pages are the Markdown man pages. To edit them,
|
||||
you need to understand the syntax used in these files.
|
||||
|
||||
The canonical reference for Markdown is here:
|
||||
|
||||
http://daringfireball.net/projects/markdown/syntax
|
||||
|
||||
Note, however, that the PMIx Markdown man pages are served via
|
||||
the Github Pages web servers, which use a system called Jekyll to
|
||||
render the Markdown into HTML (https://github.com/jekyll/jekyll).
|
||||
As such, there are a few Jekyll annotations in the PMIx Markdown
|
||||
pages (so that they can be served up properly from Github's web
|
||||
servers).
|
||||
|
||||
If you're familiar with Markdown, you should be ok. But there are a
|
||||
small number differences and quirks with which you should be familiar:
|
||||
|
||||
1. The first few lines of each file are a YAML header and include
|
||||
directive for Jekyll. DO NOT REMOVE THIS HEADER (or the file will
|
||||
not render to HTML properly when served up from Github's web
|
||||
servers). Here's a sample YAML header from pmix.7.md:
|
||||
|
||||
---
|
||||
layout: page
|
||||
title: PMIx(7)
|
||||
tagline: PMIx Programmer's Manual
|
||||
---
|
||||
{% include JB/setup %}
|
||||
|
||||
The whole block is needed, and it must be the first input in the
|
||||
file.
|
||||
|
||||
2. In Github-flavored Markdown, you may be used to using "fenced
|
||||
blocks" for multi-line code blocks, like this:
|
||||
|
||||
```c
|
||||
void my_c_code(void) {
|
||||
int i;
|
||||
/* Hello, world */
|
||||
}
|
||||
```
|
||||
|
||||
Such fenced blocks will not work in Jekyll. Instead, you must
|
||||
delineate your code blocks with Jekyll delimiters:
|
||||
|
||||
{% highlight c %}
|
||||
void my_c_code(void) {
|
||||
int i;
|
||||
/* Hello, world */
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
This will result in a pretty code box in the rendered HTML output,
|
||||
and it will be syntax highlighted for the C language. Leave the
|
||||
"c" out of the first directive if your multi-line block is not C
|
||||
code, and then it won't do C syntax highlighting.
|
||||
|
||||
3. The PMIx man pages are full of 2-level lists of things. E.g.,
|
||||
lists of functions, and then in some of the functions, there is a
|
||||
sub-list of flags that can be used with that function.
|
||||
|
||||
The convention used in the PMIx man pages is to highlight a
|
||||
word/phrase representing each list item. Then use a ":" to start
|
||||
the next line that describes that item. For example:
|
||||
|
||||
*PMIX_FLOAT*
|
||||
: A single-precision floating point value (IEEE 754).
|
||||
|
||||
This will make the token "PMIX_FLOAT" be highlighted in both
|
||||
HTML and nroff output, and then the paragraph that comes after it
|
||||
will be properly delimited and indented.
|
||||
|
||||
To make a sub-list inside an item, use the same format, but prefix
|
||||
the sub-list items with "-", like this:
|
||||
|
||||
*scope*
|
||||
: Flag that controls the visible scope of the data.
|
||||
|
||||
- *PMIX_GLOBAL*
|
||||
: Indicates that the data is to be visible to all applications executed
|
||||
by this user.
|
||||
|
||||
4. There may be a small number of places in the PMIx man pages where
|
||||
there are unnumbered lists with deliberate line breaks. For
|
||||
example:
|
||||
|
||||
foo / bar
|
||||
baz / goo
|
||||
: Something really intelligent
|
||||
|
||||
Note the first line is "foo / bar", and then there is
|
||||
a deliberate line break, and then the second line is "baz / goo".
|
||||
|
||||
To effect the deliberate line break, you have to put two blank
|
||||
spaces after "bar". To show that graphically (showing "_"
|
||||
for " "):
|
||||
|
||||
foo / bar__
|
||||
baz / goo
|
||||
: Something really intelligent
|
||||
|
||||
5. The "SEE ALSO" items at the end of each man page are linked to
|
||||
their corresponding man pages. Note that the links are made to
|
||||
".html" files -- *not* ".md" files. If you care, the reason is
|
||||
because the Github web servers statically generate .html files from
|
||||
the .md files when you git push to the gh-pages branch. Hence, the
|
||||
man pages are actually served from static .html files on the Github
|
||||
web servers.
|
||||
|
||||
Also, since links are meaningless in nroff, they are effectively
|
||||
ignored in the resulting nroff output.
|
||||
|
||||
Workflow
|
||||
========
|
||||
|
||||
The workflow is like this:
|
||||
|
||||
1. Developer edits .<digit>.md files for new changes.
|
||||
|
||||
2. In a perfect world, the developer makes perfect edits and pushes
|
||||
the changes up to `master`. An automated cron job will eventually
|
||||
notice the new pages, and do two things:
|
||||
|
||||
2a. Copy the modified Markdown pages to the `gh-master` branch (so
|
||||
that they go live on the web site).
|
||||
|
||||
2b. Re-generate any relevant nroff man pages in `master`.
|
||||
|
||||
The automated cron job actually does exist and does these things,
|
||||
but it should only be relied upon once a developer is sure that
|
||||
their changes to the Markdown man pages are correct.
|
||||
|
||||
3. To check that the changes will render properly, developers should
|
||||
do two things:
|
||||
|
||||
3a. Run "make nroff". This will convert all the Markdown man pages
|
||||
into nroff man pages (in the man/ directory). Check to ensure
|
||||
that your changes look appropriate in the rendered nroff
|
||||
output.
|
||||
|
||||
*CAUTION* The "pandoc" utility is used to generate the nroff
|
||||
files from the Markdown source. Different versions of pandoc
|
||||
will generate slightly different nroff output. Meaning: when
|
||||
you run "make nroff", you might end up changing every nroff man
|
||||
page, simply because your version of pandoc is different than
|
||||
the last person who ran it. Please only check in your changes,
|
||||
if possible.
|
||||
|
||||
3b. Check out the `gh-pages` branch from PMIx and copy any
|
||||
modified Markdown pages into the "master/man" directory (i.e.,
|
||||
the directory for man pages from the master development
|
||||
branch).
|
||||
|
||||
Then run the "jekyll serve" command from the top-level
|
||||
directory in `gh-pages`. This runs a local web server on your
|
||||
computer and renders the Markdown files into HTML such that you
|
||||
can point a browser to http://127.0.0.1:4000 and see the web
|
||||
site.
|
||||
|
||||
If you make any changes to files in the tree where "jekyll" is
|
||||
running, Jekyll will notice the changes and automatically
|
||||
re-generate the relevant HTML. Meaning: you can just refresh
|
||||
the page from http://127.0.0.1:4000 in your browser and you'll
|
||||
see your changes -- there's no need to restart Jekyll to force
|
||||
it to notice new changes.
|
@ -1,62 +0,0 @@
|
||||
.TH "pmix_abort" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
|
||||
.SH NAME
|
||||
.PP
|
||||
PMIx_Abort \- Abort the specified processes
|
||||
.SH SYNOPSIS
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
#include\ <pmix.h>
|
||||
|
||||
pmix\\_status\\_t\ PMIx\\_Abort(int\ status,\ const\ char\ msg[],
|
||||
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ pmix\\_proc\\_t\ procs[],\ size_t\ nprocs);
|
||||
\f[]
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.PP
|
||||
\f[I]status\f[] : Status value to be returned.
|
||||
A value of zero is permitted by PMIx, but may not be returned by some
|
||||
resource managers.
|
||||
.PP
|
||||
\f[I]msg\f[] : A string message to be displayed
|
||||
.PP
|
||||
\f[I]procs\f[] : An array of pmix_proc_t structures defining the
|
||||
processes to be aborted.
|
||||
A \f[I]NULL\f[] for the proc array indicates that all processes in the
|
||||
caller\[aq]s nspace are to be aborted.
|
||||
A wildcard value for the rank in any structure indicates that all
|
||||
processes in that nspace are to be aborted.
|
||||
.PP
|
||||
\f[I]nprocs\f[] : Number of pmix_proc_t structures in the \f[I]procs\f[]
|
||||
array
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Request that the provided array of procs be aborted, returning the
|
||||
provided \f[I]status\f[] and printing the provided message.
|
||||
A \f[I]NULL\f[] for the proc array indicates that all processes in the
|
||||
caller\[aq]s nspace are to be aborted.
|
||||
.PP
|
||||
The response to this request is somewhat dependent on the specific
|
||||
resource manager and its configuration (e.g., some resource managers
|
||||
will not abort the application if the provided \f[I]status\f[] is zero
|
||||
unless specifically configured to do so), and thus lies outside the
|
||||
control of PMIx itself.
|
||||
However, the client will inform the RM of the request that the
|
||||
application be aborted, regardless of the value of the provided
|
||||
\f[I]status\f[].
|
||||
.PP
|
||||
Passing a \f[I]NULL\f[] msg parameter is allowed.
|
||||
Note that race conditions caused by multiple processes calling
|
||||
PMIx_Abort are left to the server implementation to resolve with regard
|
||||
to which status is returned and what messages (if any) are printed.
|
||||
.SH RETURN VALUE
|
||||
.PP
|
||||
Returns PMIX_SUCCESS on success.
|
||||
On error, a negative value corresponding to a PMIx errno is returned.
|
||||
.SH ERRORS
|
||||
.PP
|
||||
PMIx errno values are defined in \f[C]pmix_common.h\f[].
|
||||
.SH NOTES
|
||||
.SH SEE ALSO
|
||||
.SH AUTHORS
|
||||
PMIx.
|
@ -1,35 +0,0 @@
|
||||
.TH "pmix_commit" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
|
||||
.SH NAME
|
||||
.PP
|
||||
PMIx_Commit \- Push all previously \f[I]PMIx_Put\f[] values to the local
|
||||
PMIx server.
|
||||
.SH SYNOPSIS
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
#include\ <pmix.h>
|
||||
|
||||
pmix\\_status\\_t\ PMIx_Commit(void);
|
||||
\f[]
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.PP
|
||||
\f[I]none\f[]
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This is an asynchronous operation \- the library will immediately return
|
||||
to the caller while the data is transmitted to the local server in the
|
||||
background
|
||||
.SH RETURN VALUE
|
||||
.PP
|
||||
Returns PMIX_SUCCESS on success.
|
||||
On error, a negative value corresponding to a PMIx errno is returned.
|
||||
.SH ERRORS
|
||||
.PP
|
||||
PMIx errno values are defined in \f[C]pmix_common.h\f[].
|
||||
.SH NOTES
|
||||
.SH SEE ALSO
|
||||
.PP
|
||||
\f[C]PMIx_Put\f[](3)
|
||||
.SH AUTHORS
|
||||
PMIx.
|
@ -1,45 +0,0 @@
|
||||
.TH "pmix_finalize" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
|
||||
.SH NAME
|
||||
.PP
|
||||
PMIx_Finalize \- Finalize the PMIx Client
|
||||
.SH SYNOPSIS
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
#include\ <pmix.h>
|
||||
|
||||
pmix\\_status\\_t\ PMIx\\_Finalize(const\ pmix\\_info\\_t\ info[],\ size_t\ ninfo);
|
||||
\f[]
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.PP
|
||||
\f[I]info\f[] : An optional array of pmix_info_t structures
|
||||
.PP
|
||||
\f[I]ninfo\f[] : Number of pmix_info_t structures in the pmix_info_t
|
||||
array
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Finalize the PMIx client, closing the connection with the local PMIx
|
||||
server and releasing all malloc\[aq]d memory.
|
||||
.PP
|
||||
The info array is used to pass user requests regarding the fence
|
||||
operation.
|
||||
This can include:
|
||||
.IP "(a)" 4
|
||||
PMIX_EMBED_BARRIER \- By default, \f[I]PMIx_Finalize\f[] does not
|
||||
include an internal barrier operation.
|
||||
This attribute directs \f[I]PMIx_Finalize\f[] to execute a barrier as
|
||||
part of the finalize operation.
|
||||
.SH RETURN VALUE
|
||||
.PP
|
||||
Returns PMIX_SUCCESS on success.
|
||||
On error, a negative value corresponding to a PMIx errno is returned.
|
||||
.SH ERRORS
|
||||
.PP
|
||||
PMIx errno values are defined in \f[C]pmix_common.h\f[].
|
||||
.SH NOTES
|
||||
.SH SEE ALSO
|
||||
.PP
|
||||
\f[C]PMIx_Init\f[](3)
|
||||
.SH AUTHORS
|
||||
PMIx.
|
@ -1,52 +0,0 @@
|
||||
.TH "pmix_init" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
|
||||
.SH NAME
|
||||
.PP
|
||||
PMIx_Init \- Initialize the PMIx Client
|
||||
.SH SYNOPSIS
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
#include\ <pmix.h>
|
||||
|
||||
pmix\\_status\\_t\ PMIx_Init(pmix\\_proc\\_t\ *proc);
|
||||
\f[]
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.PP
|
||||
\f[I]proc\f[] : Pointer to a pmix_proc_t object in which the
|
||||
client\[aq]s namespace and rank are to be returned.
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Initialize the PMIx client, returning the process identifier assigned to
|
||||
this client\[aq]s application in the provided pmix_proc_t struct.
|
||||
Passing a value of \f[I]NULL\f[] for this parameter is allowed if the
|
||||
user wishes solely to initialize the PMIx system and does not require
|
||||
return of the identifier at that time.
|
||||
.PP
|
||||
When called, the PMIx client will check for the required connection
|
||||
information of the local PMIx server and will establish the connection.
|
||||
If the information is not found, or the server connection fails, then an
|
||||
appropriate error constant will be returned.
|
||||
.PP
|
||||
If successful, the function will return PMIX_SUCCESS and will fill the
|
||||
provided structure with the server\-assigned namespace and rank of the
|
||||
process within the application.
|
||||
In addition, all startup information provided by the resource manager
|
||||
will be made available to the client process via subsequent calls to
|
||||
\f[I]PMIx_Get\f[].
|
||||
.PP
|
||||
Note that the PMIx client library is referenced counted, and so multiple
|
||||
calls to PMIx_Init are allowed.
|
||||
Thus, one way to obtain the namespace and rank of the process is to
|
||||
simply call PMIx_Init with a non\-NULL parameter.
|
||||
.SH RETURN VALUE
|
||||
.PP
|
||||
Returns PMIX_SUCCESS on success.
|
||||
On error, a negative value corresponding to a PMIx errno is returned.
|
||||
.SH ERRORS
|
||||
.PP
|
||||
PMIx errno values are defined in \f[C]pmix_common.h\f[].
|
||||
.SH NOTES
|
||||
.SH SEE ALSO
|
||||
.SH AUTHORS
|
||||
PMIx.
|
@ -1,30 +0,0 @@
|
||||
.TH "pmix_initialized" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
|
||||
.SH NAME
|
||||
.PP
|
||||
PMIx_Initialized \- Check if \f[I]PMIx_Init\f[] has been called
|
||||
.SH SYNOPSIS
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
#include\ <pmix.h>
|
||||
|
||||
int\ PMIx_Initialized(void);
|
||||
\f[]
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.PP
|
||||
\f[I]none\f[]
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Check to see if the PMIx Client library has been intialized
|
||||
.SH RETURN VALUE
|
||||
.PP
|
||||
Returns \f[I]true\f[] if the PMIx Client has been initialized, and
|
||||
\f[I]false\f[] if not.
|
||||
.SH ERRORS
|
||||
.SH NOTES
|
||||
.SH SEE ALSO
|
||||
.PP
|
||||
\f[C]PMIx_Init\f[](3)
|
||||
.SH AUTHORS
|
||||
PMIx.
|
@ -1,60 +0,0 @@
|
||||
.TH "pmix_put" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
|
||||
.SH NAME
|
||||
.PP
|
||||
PMIx_Put \- Push a value into the client\[aq]s namespace
|
||||
.SH SYNOPSIS
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
#include\ <pmix.h>
|
||||
|
||||
pmix\\_status\\_t\ PMIx\\_Init(pmix\\_scope\\_t\ scope,\ const\ char\ key[],\ pmix\\_value\\_t\ *val);
|
||||
\f[]
|
||||
.fi
|
||||
.SH ARGUMENTS
|
||||
.PP
|
||||
\f[I]scope\f[] : Defines a scope for data "put" by PMI per the
|
||||
following:
|
||||
.IP "(a)" 4
|
||||
PMI_LOCAL \- the data is intended only for other application processes
|
||||
on the same node.
|
||||
Data marked in this way will not be included in data packages sent to
|
||||
remote requestors
|
||||
.IP "(b)" 4
|
||||
PMI_REMOTE \- the data is intended solely for application processes on
|
||||
remote nodes.
|
||||
Data marked in this way will not be shared with other processes on the
|
||||
same node
|
||||
.IP "(c)" 4
|
||||
PMI_GLOBAL \- the data is to be shared with all other requesting
|
||||
processes, regardless of location
|
||||
.PP
|
||||
\f[I]key\f[] : String key identifying the information.
|
||||
This can be either one of the PMIx defined attributes, or a
|
||||
user\-defined value
|
||||
.PP
|
||||
\f[I]val\f[] : Pointer to a pmix_value_t structure containing the data
|
||||
to be pushed along with the type of the provided data.
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Push a value into the client\[aq]s namespace.
|
||||
The client library will cache the information locally until
|
||||
\f[I]PMIx_Commit\f[] is called.
|
||||
The provided scope value is passed to the local PMIx server, which will
|
||||
distribute the data as directed.
|
||||
.SH RETURN VALUE
|
||||
.PP
|
||||
Returns PMIX_SUCCESS on success.
|
||||
On error, a negative value corresponding to a PMIx errno is returned.
|
||||
.SH ERRORS
|
||||
.PP
|
||||
PMIx errno values are defined in \f[C]pmix_common.h\f[].
|
||||
.SH NOTES
|
||||
.PP
|
||||
See \[aq]pmix_common.h\[aq] for definition of the pmix_value_t
|
||||
structure.
|
||||
.SH SEE ALSO
|
||||
.PP
|
||||
\f[C]PMIx_Constants\f[](7), \f[C]PMIx_Structures\f[](7)
|
||||
.SH AUTHORS
|
||||
PMIx.
|
@ -1,35 +0,0 @@
|
||||
.TH "pmix" "7" "2015\-10\-29" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
|
||||
.SH NAME
|
||||
.PP
|
||||
Process Management Interface \- Exascale
|
||||
.SH SYNOPSIS
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
#include\ <pmix.h>
|
||||
\f[]
|
||||
.fi
|
||||
.SH OVERVIEW
|
||||
.PP
|
||||
The Process Management Interface (PMI) has been used for quite some time
|
||||
as a means of exchanging wireup information needed for interprocess
|
||||
communication.
|
||||
Two versions (PMI\-1 and PMI\-2) have been released as part of the MPICH
|
||||
effort.
|
||||
While PMI\-2 demonstrates better scaling properties than its PMI\-1
|
||||
predecessor, attaining rapid launch and wireup of the roughly 1M
|
||||
processes executing across 100k nodes expected for exascale operations
|
||||
remains challenging.
|
||||
.PP
|
||||
PMI Exascale (PMIx) represents an attempt to resolve these questions by
|
||||
providing an extended version of the PMI standard specifically designed
|
||||
to support clusters up to and including exascale sizes.
|
||||
The overall objective of the project is not to branch the existing
|
||||
pseudo\-standard definitions \- in fact, PMIx fully supports both of the
|
||||
existing PMI\-1 and PMI\-2 APIs \- but rather to (a) augment and extend
|
||||
those APIs to eliminate some current restrictions that impact
|
||||
scalability, and (b) provide a reference implementation of the
|
||||
PMI\-server that demonstrates the desired level of scalability.
|
||||
.SH SEE ALSO
|
||||
.SH AUTHORS
|
||||
PMIx.
|
@ -1,79 +0,0 @@
|
||||
.TH "pmix_constants" "7" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@"
|
||||
.SH NAME
|
||||
.PP
|
||||
PMIx Constants
|
||||
.SH SYNOPSIS
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
#include\ <pmix_common.h>
|
||||
\f[]
|
||||
.fi
|
||||
.SH OVERVIEW
|
||||
.PP
|
||||
PMIx relies on the following types of constants:
|
||||
.PP
|
||||
\f[I]Maximum Sizes\f[] : In order to minimize malloc performance
|
||||
penalties, PMIx utilizes constant\-sized arrays wherever possible.
|
||||
These constants provide the user with the maximum size of the various
|
||||
array types.
|
||||
.PP
|
||||
\f[I]Attributes\f[] : .
|
||||
.PP
|
||||
\f[I]Errors\f[] : PMIx uses negative error constants, with 0 indicating
|
||||
"success".
|
||||
.SH MAXIMUM SIZES
|
||||
.PP
|
||||
The .
|
||||
.PP
|
||||
\f[I]PMIX_MAX_NSLEN\f[] : The maximum length of a namespace.
|
||||
Note that any declaration of an array to hold a key string must include
|
||||
one extra space for the terminating \f[I]NULL\f[].
|
||||
.PP
|
||||
\f[I]PMIX_MAX_KEYLEN\f[] : Maximum length of the key string used in
|
||||
structures such as the \f[I]pmix\f[]info_t_.
|
||||
Note that any declaration of an array to hold a key string must include
|
||||
one extra space for the terminating \f[I]NULL\f[].
|
||||
.SH ATTRIBUTES
|
||||
.PP
|
||||
Define a set of "standard" PMIx attributes that can be queried using the
|
||||
PMIx_Get function.
|
||||
Implementations (and users) are free to extend as desired \- thus,
|
||||
functions calling PMIx_Get must be capable of handling the "not found"
|
||||
condition.
|
||||
Note that these are attributes of the system and the job as opposed to
|
||||
values the application (or underlying programming library) might choose
|
||||
to expose \- i.e., they are values provided by the resource manager as
|
||||
opposed to the application.
|
||||
Thus, these keys are RESERVED for use by PMIx, and users should avoid
|
||||
defining any attribute starting with the keyword \f[I]PMIX\f[].
|
||||
.PP
|
||||
A list of the current PMIx attributes, and the type of their associated
|
||||
data value, is provided here.
|
||||
.PP
|
||||
\f[I]PMIX_ATTR_UNDEF (NULL)\f[] : Used to initialize an attribute field,
|
||||
indicating that the attribute has not yet been assigned.
|
||||
.PP
|
||||
\f[I]PMIX_USERID (uint32_t)\f[] : .
|
||||
.PP
|
||||
\f[I]PMIX_GRPID (uint32_t)\f[] : An access domain represents a single
|
||||
logical connection into a fabric.
|
||||
It may map to a single physical or virtual NIC or a port.
|
||||
An access domain defines the boundary across which fabric resources may
|
||||
be associated.
|
||||
Each access domain belongs to a single fabric domain.
|
||||
.PP
|
||||
\f[I]PMIX_CPUSET (char*)\f[] : .
|
||||
.SH ERROR CONSTANTS
|
||||
.PP
|
||||
\&.
|
||||
.PP
|
||||
\f[I]PMIX_SUCCESS\f[] : Indicates that the operation was successful.
|
||||
.PP
|
||||
\f[I]PMIX_ERROR\f[] : A general error code \- an error occurred, but no
|
||||
specific reason can be provided.
|
||||
.SH SEE ALSO
|
||||
.PP
|
||||
\f[C]pmix\f[](7)
|
||||
.SH AUTHORS
|
||||
PMIx.
|
@ -15,7 +15,7 @@
|
||||
# reserved.
|
||||
# Copyright (c) 2017 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2017-2018 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
@ -30,7 +30,8 @@ headers += \
|
||||
atomics/sys/atomic.h \
|
||||
atomics/sys/atomic_impl.h \
|
||||
atomics/sys/timer.h \
|
||||
atomics/sys/cma.h
|
||||
atomics/sys/cma.h \
|
||||
atomics/sys/atomic_stdc.h
|
||||
|
||||
include atomics/sys/x86_64/Makefile.include
|
||||
include atomics/sys/arm/Makefile.include
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
@ -47,6 +47,7 @@
|
||||
#define PMIX_BUILTIN_SYNC 0200
|
||||
#define PMIX_BUILTIN_GCC 0202
|
||||
#define PMIX_BUILTIN_NO 0203
|
||||
#define PMIX_BUILTIN_C11 0204
|
||||
|
||||
/* Formats */
|
||||
#define PMIX_DEFAULT 1000 /* standard for given architecture */
|
||||
|
@ -12,9 +12,9 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2010 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2010 ARM ltd. All rights reserved.
|
||||
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2017-2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -110,7 +110,7 @@ void pmix_atomic_isync(void)
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1
|
||||
#define PMIX_HAVE_ATOMIC_MATH_32 1
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
int32_t prev, tmp;
|
||||
bool ret;
|
||||
@ -138,7 +138,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add
|
||||
atomic_?mb can be inlined). Instead, we "inline" them by hand in
|
||||
the assembly, meaning there is one function call overhead instead
|
||||
of two */
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
bool rc;
|
||||
|
||||
@ -149,7 +149,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
pmix_atomic_wmb();
|
||||
return pmix_atomic_compare_exchange_strong_32 (addr, oldval, newval);
|
||||
@ -158,7 +158,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t
|
||||
#if (PMIX_ASM_SUPPORT_64BIT == 1)
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
int64_t prev;
|
||||
int tmp;
|
||||
@ -189,7 +189,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
atomic_?mb can be inlined). Instead, we "inline" them by hand in
|
||||
the assembly, meaning there is one function call overhead instead
|
||||
of two */
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
bool rc;
|
||||
|
||||
@ -200,7 +200,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
pmix_atomic_wmb();
|
||||
return pmix_atomic_compare_exchange_strong_64 (addr, oldval, newval);
|
||||
@ -210,7 +210,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t
|
||||
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_ADD_32 1
|
||||
static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int inc)
|
||||
static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t* v, int inc)
|
||||
{
|
||||
int32_t t, old;
|
||||
int tmp;
|
||||
@ -231,7 +231,7 @@ static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int inc)
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_SUB_32 1
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t* v, int dec)
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t* v, int dec)
|
||||
{
|
||||
int32_t t, old;
|
||||
int tmp;
|
||||
|
@ -12,9 +12,9 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2010 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2010 ARM ltd. All rights reserved.
|
||||
* Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2016-2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -83,7 +83,7 @@ static inline void pmix_atomic_isync (void)
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
int32_t prev, tmp;
|
||||
bool ret;
|
||||
@ -103,7 +103,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr, int32_t newval)
|
||||
static inline int32_t pmix_atomic_swap_32(pmix_atomic_int32_t *addr, int32_t newval)
|
||||
{
|
||||
int32_t ret, tmp;
|
||||
|
||||
@ -122,7 +122,7 @@ static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr, int32_t newval
|
||||
atomic_?mb can be inlined). Instead, we "inline" them by hand in
|
||||
the assembly, meaning there is one function call overhead instead
|
||||
of two */
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
int32_t prev, tmp;
|
||||
bool ret;
|
||||
@ -143,7 +143,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
int32_t prev, tmp;
|
||||
bool ret;
|
||||
@ -165,7 +165,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t
|
||||
|
||||
#define pmix_atomic_ll_32(addr, ret) \
|
||||
do { \
|
||||
volatile int32_t *_addr = (addr); \
|
||||
pmix_atomic_int32_t *_addr = (addr); \
|
||||
int32_t _ret; \
|
||||
\
|
||||
__asm__ __volatile__ ("ldaxr %w0, [%1] \n" \
|
||||
@ -177,7 +177,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t
|
||||
|
||||
#define pmix_atomic_sc_32(addr, newval, ret) \
|
||||
do { \
|
||||
volatile int32_t *_addr = (addr); \
|
||||
pmix_atomic_int32_t *_addr = (addr); \
|
||||
int32_t _newval = (int32_t) newval; \
|
||||
int _ret; \
|
||||
\
|
||||
@ -189,7 +189,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t
|
||||
ret = (_ret == 0); \
|
||||
} while (0)
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
int64_t prev;
|
||||
int tmp;
|
||||
@ -210,7 +210,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_swap_64 (volatile int64_t *addr, int64_t newval)
|
||||
static inline int64_t pmix_atomic_swap_64 (pmix_atomic_int64_t *addr, int64_t newval)
|
||||
{
|
||||
int64_t ret;
|
||||
int tmp;
|
||||
@ -230,7 +230,7 @@ static inline int64_t pmix_atomic_swap_64 (volatile int64_t *addr, int64_t newva
|
||||
atomic_?mb can be inlined). Instead, we "inline" them by hand in
|
||||
the assembly, meaning there is one function call overhead instead
|
||||
of two */
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
int64_t prev;
|
||||
int tmp;
|
||||
@ -252,7 +252,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
int64_t prev;
|
||||
int tmp;
|
||||
@ -275,7 +275,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t
|
||||
|
||||
#define pmix_atomic_ll_64(addr, ret) \
|
||||
do { \
|
||||
volatile int64_t *_addr = (addr); \
|
||||
pmix_atomic_int64_t *_addr = (addr); \
|
||||
int64_t _ret; \
|
||||
\
|
||||
__asm__ __volatile__ ("ldaxr %0, [%1] \n" \
|
||||
@ -287,7 +287,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t
|
||||
|
||||
#define pmix_atomic_sc_64(addr, newval, ret) \
|
||||
do { \
|
||||
volatile int64_t *_addr = (addr); \
|
||||
pmix_atomic_int64_t *_addr = (addr); \
|
||||
int64_t _newval = (int64_t) newval; \
|
||||
int _ret; \
|
||||
\
|
||||
@ -300,7 +300,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t
|
||||
} while (0)
|
||||
|
||||
#define PMIX_ASM_MAKE_ATOMIC(type, bits, name, inst, reg) \
|
||||
static inline type pmix_atomic_fetch_ ## name ## _ ## bits (volatile type *addr, type value) \
|
||||
static inline type pmix_atomic_fetch_ ## name ## _ ## bits (pmix_atomic_ ## type *addr, type value) \
|
||||
{ \
|
||||
type newval, old; \
|
||||
int32_t tmp; \
|
||||
|
@ -16,7 +16,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -57,7 +57,13 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "src/atomics/sys/architecture.h"
|
||||
#include "src/include/pmix_stdint.h"
|
||||
#include "src/include/pmix_stdatomic.h"
|
||||
|
||||
#if PMIX_ASSEMBLY_BUILTIN == PMIX_BUILTIN_C11
|
||||
|
||||
#include "atomic_stdc.h"
|
||||
|
||||
#else /* !PMIX_C_HAVE__ATOMIC */
|
||||
|
||||
/* do some quick #define cleanup in cases where we are doing
|
||||
testing... */
|
||||
@ -93,7 +99,7 @@ BEGIN_C_DECLS
|
||||
*/
|
||||
struct pmix_atomic_lock_t {
|
||||
union {
|
||||
volatile int32_t lock; /**< The lock address (an integer) */
|
||||
pmix_atomic_int32_t lock; /**< The lock address (an integer) */
|
||||
volatile unsigned char sparc_lock; /**< The lock address on sparc */
|
||||
char padding[sizeof(int)]; /**< Array for optional padding */
|
||||
} u;
|
||||
@ -148,6 +154,8 @@ enum {
|
||||
PMIX_ATOMIC_LOCK_LOCKED = 1
|
||||
};
|
||||
|
||||
#define PMIX_ATOMIC_LOCK_INIT {.u = {.lock = PMIX_ATOMIC_LOCK_UNLOCKED}}
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Load the appropriate architecture files and set some reasonable
|
||||
@ -351,19 +359,19 @@ void pmix_atomic_unlock(pmix_atomic_lock_t *lock);
|
||||
#if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_32
|
||||
static inline
|
||||
#endif
|
||||
bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval,
|
||||
bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval,
|
||||
int32_t newval);
|
||||
|
||||
#if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_32
|
||||
static inline
|
||||
#endif
|
||||
bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval,
|
||||
bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval,
|
||||
int32_t newval);
|
||||
|
||||
#if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_32
|
||||
static inline
|
||||
#endif
|
||||
bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval,
|
||||
bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval,
|
||||
int32_t newval);
|
||||
#endif
|
||||
|
||||
@ -376,19 +384,19 @@ bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t
|
||||
#if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_64
|
||||
static inline
|
||||
#endif
|
||||
bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval,
|
||||
bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval,
|
||||
int64_t newval);
|
||||
|
||||
#if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_64
|
||||
static inline
|
||||
#endif
|
||||
bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval,
|
||||
bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval,
|
||||
int64_t newval);
|
||||
|
||||
#if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_64
|
||||
static inline
|
||||
#endif
|
||||
bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval,
|
||||
bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval,
|
||||
int64_t newval);
|
||||
|
||||
#endif
|
||||
@ -400,20 +408,20 @@ bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t
|
||||
|
||||
#if defined(DOXYGEN) || PMIX_HAVE_ATOMIC_MATH_32 || PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32
|
||||
|
||||
static inline int32_t pmix_atomic_add_fetch_32(volatile int32_t *addr, int delta);
|
||||
static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t *addr, int delta);
|
||||
static inline int32_t pmix_atomic_and_fetch_32(volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_and_32(volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_or_fetch_32(volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_or_32(volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_xor_fetch_32(volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_xor_32(volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_sub_fetch_32(volatile int32_t *addr, int delta);
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t *addr, int delta);
|
||||
static inline int32_t pmix_atomic_min_fetch_32 (volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_min_32 (volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_max_fetch_32 (volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_add_fetch_32(pmix_atomic_int32_t *addr, int delta);
|
||||
static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t *addr, int delta);
|
||||
static inline int32_t pmix_atomic_and_fetch_32(pmix_atomic_int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_and_32(pmix_atomic_int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_or_fetch_32(pmix_atomic_int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_or_32(pmix_atomic_int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_xor_fetch_32(pmix_atomic_int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_xor_32(pmix_atomic_int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_sub_fetch_32(pmix_atomic_int32_t *addr, int delta);
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t *addr, int delta);
|
||||
static inline int32_t pmix_atomic_min_fetch_32 (pmix_atomic_int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_min_32 (pmix_atomic_int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_max_fetch_32 (pmix_atomic_int32_t *addr, int32_t value);
|
||||
static inline int32_t pmix_atomic_fetch_max_32 (pmix_atomic_int32_t *addr, int32_t value);
|
||||
|
||||
#endif /* PMIX_HAVE_ATOMIC_MATH_32 */
|
||||
|
||||
@ -430,19 +438,19 @@ static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t
|
||||
|
||||
#if defined(DOXYGEN) || PMIX_HAVE_ATOMIC_MATH_64 || PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64
|
||||
|
||||
static inline int64_t pmix_atomic_add_fetch_64(volatile int64_t *addr, int64_t delta);
|
||||
static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t *addr, int64_t delta);
|
||||
static inline int64_t pmix_atomic_and_fetch_64(volatile int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_and_64(volatile int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_or_fetch_64(volatile int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_or_64(volatile int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_xor_64(volatile int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_sub_fetch_64(volatile int64_t *addr, int64_t delta);
|
||||
static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t delta);
|
||||
static inline int64_t pmix_atomic_min_fetch_64 (volatile int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_min_64 (volatile int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_max_fetch_64 (volatile int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_max_64 (volatile int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_add_fetch_64(pmix_atomic_int64_t *addr, int64_t delta);
|
||||
static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t *addr, int64_t delta);
|
||||
static inline int64_t pmix_atomic_and_fetch_64(pmix_atomic_int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_and_64(pmix_atomic_int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_or_fetch_64(pmix_atomic_int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_or_64(pmix_atomic_int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_xor_64(pmix_atomic_int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_sub_fetch_64(pmix_atomic_int64_t *addr, int64_t delta);
|
||||
static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t *addr, int64_t delta);
|
||||
static inline int64_t pmix_atomic_min_fetch_64 (pmix_atomic_int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_min_64 (pmix_atomic_int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_max_fetch_64 (pmix_atomic_int64_t *addr, int64_t value);
|
||||
static inline int64_t pmix_atomic_fetch_max_64 (pmix_atomic_int64_t *addr, int64_t value);
|
||||
|
||||
#endif /* PMIX_HAVE_ATOMIC_MATH_64 */
|
||||
|
||||
@ -459,7 +467,7 @@ static inline int64_t pmix_atomic_fetch_max_64 (volatile int64_t *addr, int64_t
|
||||
*/
|
||||
#if defined(DOXYGEN) || PMIX_ENABLE_DEBUG
|
||||
static inline size_t
|
||||
pmix_atomic_add_fetch_size_t(volatile size_t *addr, size_t delta)
|
||||
pmix_atomic_add_fetch_size_t(pmix_atomic_size_t *addr, size_t delta)
|
||||
{
|
||||
#if SIZEOF_SIZE_T == 4
|
||||
return (size_t) pmix_atomic_add_fetch_32((int32_t*) addr, delta);
|
||||
@ -471,7 +479,7 @@ pmix_atomic_add_fetch_size_t(volatile size_t *addr, size_t delta)
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
pmix_atomic_fetch_add_size_t(volatile size_t *addr, size_t delta)
|
||||
pmix_atomic_fetch_add_size_t(pmix_atomic_size_t *addr, size_t delta)
|
||||
{
|
||||
#if SIZEOF_SIZE_T == 4
|
||||
return (size_t) pmix_atomic_fetch_add_32((int32_t*) addr, delta);
|
||||
@ -483,7 +491,7 @@ pmix_atomic_fetch_add_size_t(volatile size_t *addr, size_t delta)
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
pmix_atomic_sub_fetch_size_t(volatile size_t *addr, size_t delta)
|
||||
pmix_atomic_sub_fetch_size_t(pmix_atomic_size_t *addr, size_t delta)
|
||||
{
|
||||
#if SIZEOF_SIZE_T == 4
|
||||
return (size_t) pmix_atomic_sub_fetch_32((int32_t*) addr, delta);
|
||||
@ -495,7 +503,7 @@ pmix_atomic_sub_fetch_size_t(volatile size_t *addr, size_t delta)
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
pmix_atomic_fetch_sub_size_t(volatile size_t *addr, size_t delta)
|
||||
pmix_atomic_fetch_sub_size_t(pmix_atomic_size_t *addr, size_t delta)
|
||||
{
|
||||
#if SIZEOF_SIZE_T == 4
|
||||
return (size_t) pmix_atomic_fetch_sub_32((int32_t*) addr, delta);
|
||||
@ -508,15 +516,15 @@ pmix_atomic_fetch_sub_size_t(volatile size_t *addr, size_t delta)
|
||||
|
||||
#else
|
||||
#if SIZEOF_SIZE_T == 4
|
||||
#define pmix_atomic_add_fetch_size_t(addr, delta) ((size_t) pmix_atomic_add_fetch_32((volatile int32_t *) addr, delta))
|
||||
#define pmix_atomic_fetch_add_size_t(addr, delta) ((size_t) pmix_atomic_fetch_add_32((volatile int32_t *) addr, delta))
|
||||
#define pmix_atomic_sub_fetch_size_t(addr, delta) ((size_t) pmix_atomic_sub_fetch_32((volatile int32_t *) addr, delta))
|
||||
#define pmix_atomic_fetch_sub_size_t(addr, delta) ((size_t) pmix_atomic_fetch_sub_32((volatile int32_t *) addr, delta))
|
||||
#define pmix_atomic_add_fetch_size_t(addr, delta) ((size_t) pmix_atomic_add_fetch_32((pmix_atomic_int32_t *) addr, delta))
|
||||
#define pmix_atomic_fetch_add_size_t(addr, delta) ((size_t) pmix_atomic_fetch_add_32((pmix_atomic_int32_t *) addr, delta))
|
||||
#define pmix_atomic_sub_fetch_size_t(addr, delta) ((size_t) pmix_atomic_sub_fetch_32((pmix_atomic_int32_t *) addr, delta))
|
||||
#define pmix_atomic_fetch_sub_size_t(addr, delta) ((size_t) pmix_atomic_fetch_sub_32((pmix_atomic_int32_t *) addr, delta))
|
||||
#elif SIZEOF_SIZE_T == 8
|
||||
#define pmix_atomic_add_fetch_size_t(addr, delta) ((size_t) pmix_atomic_add_fetch_64((volatile int64_t *) addr, delta))
|
||||
#define pmix_atomic_fetch_add_size_t(addr, delta) ((size_t) pmix_atomic_fetch_add_64((volatile int64_t *) addr, delta))
|
||||
#define pmix_atomic_sub_fetch_size_t(addr, delta) ((size_t) pmix_atomic_sub_fetch_64((volatile int64_t *) addr, delta))
|
||||
#define pmix_atomic_fetch_sub_size_t(addr, delta) ((size_t) pmix_atomic_fetch_sub_64((volatile int64_t *) addr, delta))
|
||||
#define pmix_atomic_add_fetch_size_t(addr, delta) ((size_t) pmix_atomic_add_fetch_64((pmix_atomic_int64_t *) addr, delta))
|
||||
#define pmix_atomic_fetch_add_size_t(addr, delta) ((size_t) pmix_atomic_fetch_add_64((pmix_atomic_int64_t *) addr, delta))
|
||||
#define pmix_atomic_sub_fetch_size_t(addr, delta) ((size_t) pmix_atomic_sub_fetch_64((pmix_atomic_int64_t *) addr, delta))
|
||||
#define pmix_atomic_fetch_sub_size_t(addr, delta) ((size_t) pmix_atomic_fetch_sub_64((pmix_atomic_int64_t *) addr, delta))
|
||||
#else
|
||||
#error "Unknown size_t size"
|
||||
#endif
|
||||
@ -526,20 +534,20 @@ pmix_atomic_fetch_sub_size_t(volatile size_t *addr, size_t delta)
|
||||
/* these are always done with inline functions, so always mark as
|
||||
static inline */
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_xx (volatile void *addr, void *oldval,
|
||||
static inline bool pmix_atomic_compare_exchange_strong_xx (pmix_atomic_intptr_t *addr, intptr_t *oldval,
|
||||
int64_t newval, size_t length);
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_xx (volatile void *addr, void *oldval,
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_xx (pmix_atomic_intptr_t *addr, intptr_t *oldval,
|
||||
int64_t newval, size_t length);
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_xx (volatile void *addr, void *oldval,
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_xx (pmix_atomic_intptr_t *addr, intptr_t *oldval,
|
||||
int64_t newval, size_t length);
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_ptr (volatile void* addr, void *oldval,
|
||||
void *newval);
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_ptr (volatile void* addr, void *oldval,
|
||||
void *newval);
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* addr, void *oldval,
|
||||
void *newval);
|
||||
static inline bool pmix_atomic_compare_exchange_strong_ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval,
|
||||
intptr_t newval);
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval,
|
||||
intptr_t newval);
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval,
|
||||
intptr_t newval);
|
||||
|
||||
/**
|
||||
* Atomic compare and set of generic type with relaxed semantics. This
|
||||
@ -555,7 +563,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* a
|
||||
* See pmix_atomic_compare_exchange_* for pseudo-code.
|
||||
*/
|
||||
#define pmix_atomic_compare_exchange_strong( ADDR, OLDVAL, NEWVAL ) \
|
||||
pmix_atomic_compare_exchange_strong_xx( (volatile void*)(ADDR), (void *)(OLDVAL), \
|
||||
pmix_atomic_compare_exchange_strong_xx( (pmix_atomic_intptr_t*)(ADDR), (intptr_t *)(OLDVAL), \
|
||||
(intptr_t)(NEWVAL), sizeof(*(ADDR)) )
|
||||
|
||||
/**
|
||||
@ -572,7 +580,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* a
|
||||
* See pmix_atomic_compare_exchange_acq_* for pseudo-code.
|
||||
*/
|
||||
#define pmix_atomic_compare_exchange_strong_acq( ADDR, OLDVAL, NEWVAL ) \
|
||||
pmix_atomic_compare_exchange_strong_acq_xx( (volatile void*)(ADDR), (void *)(OLDVAL), \
|
||||
pmix_atomic_compare_exchange_strong_acq_xx( (pmix_atomic_intptr_t*)(ADDR), (intptr_t *)(OLDVAL), \
|
||||
(intptr_t)(NEWVAL), sizeof(*(ADDR)) )
|
||||
|
||||
/**
|
||||
@ -589,7 +597,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* a
|
||||
* See pmix_atomic_compare_exchange_rel_* for pseudo-code.
|
||||
*/
|
||||
#define pmix_atomic_compare_exchange_strong_rel( ADDR, OLDVAL, NEWVAL ) \
|
||||
pmix_atomic_compare_exchange_strong_rel_xx( (volatile void*)(ADDR), (void *)(OLDVAL), \
|
||||
pmix_atomic_compare_exchange_strong_rel_xx( (pmix_atomic_intptr_t*)(ADDR), (intptr_t *)(OLDVAL), \
|
||||
(intptr_t)(NEWVAL), sizeof(*(ADDR)) )
|
||||
|
||||
|
||||
@ -597,15 +605,15 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* a
|
||||
|
||||
#if defined(DOXYGEN) || (PMIX_HAVE_ATOMIC_MATH_32 || PMIX_HAVE_ATOMIC_MATH_64)
|
||||
|
||||
static inline void pmix_atomic_add_xx(volatile void* addr,
|
||||
static inline void pmix_atomic_add_xx(pmix_atomic_intptr_t* addr,
|
||||
int32_t value, size_t length);
|
||||
static inline void pmix_atomic_sub_xx(volatile void* addr,
|
||||
static inline void pmix_atomic_sub_xx(pmix_atomic_intptr_t* addr,
|
||||
int32_t value, size_t length);
|
||||
|
||||
static inline intptr_t pmix_atomic_add_fetch_ptr( volatile void* addr, void* delta );
|
||||
static inline intptr_t pmix_atomic_fetch_add_ptr( volatile void* addr, void* delta );
|
||||
static inline intptr_t pmix_atomic_sub_fetch_ptr( volatile void* addr, void* delta );
|
||||
static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr, void* delta );
|
||||
static inline intptr_t pmix_atomic_add_fetch_ptr( pmix_atomic_intptr_t* addr, void* delta );
|
||||
static inline intptr_t pmix_atomic_fetch_add_ptr( pmix_atomic_intptr_t* addr, void* delta );
|
||||
static inline intptr_t pmix_atomic_sub_fetch_ptr( pmix_atomic_intptr_t* addr, void* delta );
|
||||
static inline intptr_t pmix_atomic_fetch_sub_ptr( pmix_atomic_intptr_t* addr, void* delta );
|
||||
|
||||
/**
|
||||
* Atomically increment the content depending on the type. This
|
||||
@ -618,7 +626,7 @@ static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr, void* del
|
||||
* @param delta Value to add (converted to <TYPE>).
|
||||
*/
|
||||
#define pmix_atomic_add( ADDR, VALUE ) \
|
||||
pmix_atomic_add_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \
|
||||
pmix_atomic_add_xx( (pmix_atomic_intptr_t*)(ADDR), (int32_t)(VALUE), \
|
||||
sizeof(*(ADDR)) )
|
||||
|
||||
/**
|
||||
@ -632,7 +640,7 @@ static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr, void* del
|
||||
* @param delta Value to substract (converted to <TYPE>).
|
||||
*/
|
||||
#define pmix_atomic_sub( ADDR, VALUE ) \
|
||||
pmix_atomic_sub_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \
|
||||
pmix_atomic_sub_xx( (pmix_atomic_intptr_t*)(ADDR), (int32_t)(VALUE), \
|
||||
sizeof(*(ADDR)) )
|
||||
|
||||
#endif /* PMIX_HAVE_ATOMIC_MATH_32 || PMIX_HAVE_ATOMIC_MATH_64 */
|
||||
@ -644,6 +652,8 @@ static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr, void* del
|
||||
*/
|
||||
#include "src/atomics/sys/atomic_impl.h"
|
||||
|
||||
#endif /* !PMIX_C_HAVE__ATOMIC */
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* PMIX_SYS_ATOMIC_H */
|
||||
|
@ -11,9 +11,9 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -41,7 +41,7 @@
|
||||
#if PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32
|
||||
|
||||
#if !defined(PMIX_HAVE_ATOMIC_MIN_32)
|
||||
static inline int32_t pmix_atomic_fetch_min_32 (volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_fetch_min_32 (pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
int32_t old = *addr;
|
||||
do {
|
||||
@ -58,7 +58,7 @@ static inline int32_t pmix_atomic_fetch_min_32 (volatile int32_t *addr, int32_t
|
||||
#endif /* PMIX_HAVE_ATOMIC_MIN_32 */
|
||||
|
||||
#if !defined(PMIX_HAVE_ATOMIC_MAX_32)
|
||||
static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_fetch_max_32 (pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
int32_t old = *addr;
|
||||
do {
|
||||
@ -74,7 +74,7 @@ static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t
|
||||
#endif /* PMIX_HAVE_ATOMIC_MAX_32 */
|
||||
|
||||
#define PMIX_ATOMIC_DEFINE_CMPXCG_OP(type, bits, operation, name) \
|
||||
static inline type pmix_atomic_fetch_ ## name ## _ ## bits (volatile type *addr, type value) \
|
||||
static inline type pmix_atomic_fetch_ ## name ## _ ## bits (pmix_atomic_ ## type *addr, type value) \
|
||||
{ \
|
||||
type oldval; \
|
||||
do { \
|
||||
@ -86,7 +86,7 @@ static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t
|
||||
|
||||
#if !defined(PMIX_HAVE_ATOMIC_SWAP_32)
|
||||
#define PMIX_HAVE_ATOMIC_SWAP_32 1
|
||||
static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr,
|
||||
static inline int32_t pmix_atomic_swap_32(pmix_atomic_int32_t *addr,
|
||||
int32_t newval)
|
||||
{
|
||||
int32_t old = *addr;
|
||||
@ -139,7 +139,7 @@ PMIX_ATOMIC_DEFINE_CMPXCG_OP(int32_t, 32, -, sub)
|
||||
#if PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64
|
||||
|
||||
#if !defined(PMIX_HAVE_ATOMIC_MIN_64)
|
||||
static inline int64_t pmix_atomic_fetch_min_64 (volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_fetch_min_64 (pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
int64_t old = *addr;
|
||||
do {
|
||||
@ -156,7 +156,7 @@ static inline int64_t pmix_atomic_fetch_min_64 (volatile int64_t *addr, int64_t
|
||||
#endif /* PMIX_HAVE_ATOMIC_MIN_64 */
|
||||
|
||||
#if !defined(PMIX_HAVE_ATOMIC_MAX_64)
|
||||
static inline int64_t pmix_atomic_fetch_max_64 (volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_fetch_max_64 (pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
int64_t old = *addr;
|
||||
do {
|
||||
@ -173,7 +173,7 @@ static inline int64_t pmix_atomic_fetch_max_64 (volatile int64_t *addr, int64_t
|
||||
|
||||
#if !defined(PMIX_HAVE_ATOMIC_SWAP_64)
|
||||
#define PMIX_HAVE_ATOMIC_SWAP_64 1
|
||||
static inline int64_t pmix_atomic_swap_64(volatile int64_t *addr,
|
||||
static inline int64_t pmix_atomic_swap_64(pmix_atomic_int64_t *addr,
|
||||
int64_t newval)
|
||||
{
|
||||
int64_t old = *addr;
|
||||
@ -236,15 +236,15 @@ PMIX_ATOMIC_DEFINE_CMPXCG_OP(int64_t, 64, -, sub)
|
||||
#if PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 && PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64
|
||||
#define PMIX_ATOMIC_DEFINE_CMPXCG_XX(semantics) \
|
||||
static inline bool \
|
||||
pmix_atomic_compare_exchange_strong ## semantics ## xx (volatile void* addr, void *oldval, \
|
||||
pmix_atomic_compare_exchange_strong ## semantics ## xx (pmix_atomic_intptr_t* addr, intptr_t *oldval, \
|
||||
int64_t newval, const size_t length) \
|
||||
{ \
|
||||
switch (length) { \
|
||||
case 4: \
|
||||
return pmix_atomic_compare_exchange_strong_32 ((volatile int32_t *) addr, \
|
||||
return pmix_atomic_compare_exchange_strong_32 ((pmix_atomic_int32_t *) addr, \
|
||||
(int32_t *) oldval, (int32_t) newval); \
|
||||
case 8: \
|
||||
return pmix_atomic_compare_exchange_strong_64 ((volatile int64_t *) addr, \
|
||||
return pmix_atomic_compare_exchange_strong_64 ((pmix_atomic_int64_t *) addr, \
|
||||
(int64_t *) oldval, (int64_t) newval); \
|
||||
} \
|
||||
abort(); \
|
||||
@ -252,12 +252,12 @@ PMIX_ATOMIC_DEFINE_CMPXCG_OP(int64_t, 64, -, sub)
|
||||
#elif PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32
|
||||
#define PMIX_ATOMIC_DEFINE_CMPXCG_XX(semantics) \
|
||||
static inline bool \
|
||||
pmix_atomic_compare_exchange_strong ## semantics ## xx (volatile void* addr, void *oldval, \
|
||||
pmix_atomic_compare_exchange_strong ## semantics ## xx (pmix_atomic_intptr_t* addr, intptr_t *oldval, \
|
||||
int64_t newval, const size_t length) \
|
||||
{ \
|
||||
switch (length) { \
|
||||
case 4: \
|
||||
return pmix_atomic_compare_exchange_strong_32 ((volatile int32_t *) addr, \
|
||||
return pmix_atomic_compare_exchange_strong_32 ((pmix_atomic_int32_t *) addr, \
|
||||
(int32_t *) oldval, (int32_t) newval); \
|
||||
} \
|
||||
abort(); \
|
||||
@ -273,16 +273,16 @@ PMIX_ATOMIC_DEFINE_CMPXCG_XX(_rel_)
|
||||
#if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32
|
||||
#define PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(semantics) \
|
||||
static inline bool \
|
||||
pmix_atomic_compare_exchange_strong ## semantics ## ptr (volatile void* addr, void *oldval, void *newval) \
|
||||
pmix_atomic_compare_exchange_strong ## semantics ## ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval, intptr_t newval) \
|
||||
{ \
|
||||
return pmix_atomic_compare_exchange_strong_32 ((volatile int32_t *) addr, (int32_t *) oldval, (int32_t) newval); \
|
||||
return pmix_atomic_compare_exchange_strong_32 ((pmix_atomic_int32_t *) addr, (int32_t *) oldval, (int32_t) newval); \
|
||||
}
|
||||
#elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64
|
||||
#define PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(semantics) \
|
||||
static inline bool \
|
||||
pmix_atomic_compare_exchange_strong ## semantics ## ptr (volatile void* addr, void *oldval, void *newval) \
|
||||
pmix_atomic_compare_exchange_strong ## semantics ## ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval, intptr_t newval) \
|
||||
{ \
|
||||
return pmix_atomic_compare_exchange_strong_64 ((volatile int64_t *) addr, (int64_t *) oldval, (int64_t) newval); \
|
||||
return pmix_atomic_compare_exchange_strong_64 ((pmix_atomic_int64_t *) addr, (int64_t *) oldval, (int64_t) newval); \
|
||||
}
|
||||
#else
|
||||
#error "Can not define pmix_atomic_compare_exchange_strong_ptr with existing atomics"
|
||||
@ -298,9 +298,9 @@ PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(_rel_)
|
||||
#if (PMIX_HAVE_ATOMIC_SWAP_32 || PMIX_HAVE_ATOMIC_SWAP_64)
|
||||
|
||||
#if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_SWAP_32
|
||||
#define pmix_atomic_swap_ptr(addr, value) (void *) pmix_atomic_swap_32((int32_t *) addr, (int32_t) value)
|
||||
#define pmix_atomic_swap_ptr(addr, value) (intptr_t) pmix_atomic_swap_32((pmix_atomic_int32_t *) addr, (int32_t) value)
|
||||
#elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_SWAP_64
|
||||
#define pmix_atomic_swap_ptr(addr, value) (void *) pmix_atomic_swap_64((int64_t *) addr, (int64_t) value)
|
||||
#define pmix_atomic_swap_ptr(addr, value) (intptr_t) pmix_atomic_swap_64((pmix_atomic_int64_t *) addr, (int64_t) value)
|
||||
#endif
|
||||
|
||||
#endif /* (PMIX_HAVE_ATOMIC_SWAP_32 || PMIX_HAVE_ATOMIC_SWAP_64) */
|
||||
@ -309,15 +309,15 @@ PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(_rel_)
|
||||
|
||||
#if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_LLSC_32
|
||||
|
||||
#define pmix_atomic_ll_ptr(addr, ret) pmix_atomic_ll_32((volatile int32_t *) (addr), ret)
|
||||
#define pmix_atomic_sc_ptr(addr, value, ret) pmix_atomic_sc_32((volatile int32_t *) (addr), (intptr_t) (value), ret)
|
||||
#define pmix_atomic_ll_ptr(addr, ret) pmix_atomic_ll_32((pmix_atomic_int32_t *) (addr), ret)
|
||||
#define pmix_atomic_sc_ptr(addr, value, ret) pmix_atomic_sc_32((pmix_atomic_int32_t *) (addr), (intptr_t) (value), ret)
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_LLSC_PTR 1
|
||||
|
||||
#elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_LLSC_64
|
||||
|
||||
#define pmix_atomic_ll_ptr(addr, ret) pmix_atomic_ll_64((volatile int64_t *) (addr), ret)
|
||||
#define pmix_atomic_sc_ptr(addr, value, ret) pmix_atomic_sc_64((volatile int64_t *) (addr), (intptr_t) (value), ret)
|
||||
#define pmix_atomic_ll_ptr(addr, ret) pmix_atomic_ll_64((pmix_atomic_int64_t *) (addr), ret)
|
||||
#define pmix_atomic_sc_ptr(addr, value, ret) pmix_atomic_sc_64((pmix_atomic_int64_t *) (addr), (intptr_t) (value), ret)
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_LLSC_PTR 1
|
||||
|
||||
@ -332,18 +332,18 @@ PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(_rel_)
|
||||
#if PMIX_HAVE_ATOMIC_MATH_32 || PMIX_HAVE_ATOMIC_MATH_64
|
||||
|
||||
static inline void
|
||||
pmix_atomic_add_xx(volatile void* addr, int32_t value, size_t length)
|
||||
pmix_atomic_add_xx(pmix_atomic_intptr_t* addr, int32_t value, size_t length)
|
||||
{
|
||||
switch( length ) {
|
||||
#if PMIX_HAVE_ATOMIC_ADD_32
|
||||
case 4:
|
||||
(void) pmix_atomic_fetch_add_32( (volatile int32_t*)addr, (int32_t)value );
|
||||
(void) pmix_atomic_fetch_add_32( (pmix_atomic_int32_t*)addr, (int32_t)value );
|
||||
break;
|
||||
#endif /* PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 */
|
||||
|
||||
#if PMIX_HAVE_ATOMIC_ADD_64
|
||||
case 8:
|
||||
(void) pmix_atomic_fetch_add_64( (volatile int64_t*)addr, (int64_t)value );
|
||||
(void) pmix_atomic_fetch_add_64( (pmix_atomic_int64_t*)addr, (int64_t)value );
|
||||
break;
|
||||
#endif /* PMIX_HAVE_ATOMIC_ADD_64 */
|
||||
default:
|
||||
@ -355,18 +355,18 @@ static inline void
|
||||
|
||||
|
||||
static inline void
|
||||
pmix_atomic_sub_xx(volatile void* addr, int32_t value, size_t length)
|
||||
pmix_atomic_sub_xx(pmix_atomic_intptr_t* addr, int32_t value, size_t length)
|
||||
{
|
||||
switch( length ) {
|
||||
#if PMIX_HAVE_ATOMIC_SUB_32
|
||||
case 4:
|
||||
(void) pmix_atomic_fetch_sub_32( (volatile int32_t*)addr, (int32_t)value );
|
||||
(void) pmix_atomic_fetch_sub_32( (pmix_atomic_int32_t*)addr, (int32_t)value );
|
||||
break;
|
||||
#endif /* PMIX_HAVE_ATOMIC_SUB_32 */
|
||||
|
||||
#if PMIX_HAVE_ATOMIC_SUB_64
|
||||
case 8:
|
||||
(void) pmix_atomic_fetch_sub_64( (volatile int64_t*)addr, (int64_t)value );
|
||||
(void) pmix_atomic_fetch_sub_64( (pmix_atomic_int64_t*)addr, (int64_t)value );
|
||||
break;
|
||||
#endif /* PMIX_HAVE_ATOMIC_SUB_64 */
|
||||
default:
|
||||
@ -377,7 +377,7 @@ pmix_atomic_sub_xx(volatile void* addr, int32_t value, size_t length)
|
||||
}
|
||||
|
||||
#define PMIX_ATOMIC_DEFINE_OP_FETCH(op, operation, type, ptr_type, suffix) \
|
||||
static inline type pmix_atomic_ ## op ## _fetch_ ## suffix (volatile ptr_type *addr, type value) \
|
||||
static inline type pmix_atomic_ ## op ## _fetch_ ## suffix (pmix_atomic_ ## ptr_type *addr, type value) \
|
||||
{ \
|
||||
return pmix_atomic_fetch_ ## op ## _ ## suffix (addr, value) operation value; \
|
||||
}
|
||||
@ -388,13 +388,13 @@ PMIX_ATOMIC_DEFINE_OP_FETCH(or, |, int32_t, int32_t, 32)
|
||||
PMIX_ATOMIC_DEFINE_OP_FETCH(xor, ^, int32_t, int32_t, 32)
|
||||
PMIX_ATOMIC_DEFINE_OP_FETCH(sub, -, int32_t, int32_t, 32)
|
||||
|
||||
static inline int32_t pmix_atomic_min_fetch_32 (volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_min_fetch_32 (pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
int32_t old = pmix_atomic_fetch_min_32 (addr, value);
|
||||
return old <= value ? old : value;
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_max_fetch_32 (volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_max_fetch_32 (pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
int32_t old = pmix_atomic_fetch_max_32 (addr, value);
|
||||
return old >= value ? old : value;
|
||||
@ -407,13 +407,13 @@ PMIX_ATOMIC_DEFINE_OP_FETCH(or, |, int64_t, int64_t, 64)
|
||||
PMIX_ATOMIC_DEFINE_OP_FETCH(xor, ^, int64_t, int64_t, 64)
|
||||
PMIX_ATOMIC_DEFINE_OP_FETCH(sub, -, int64_t, int64_t, 64)
|
||||
|
||||
static inline int64_t pmix_atomic_min_fetch_64 (volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_min_fetch_64 (pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
int64_t old = pmix_atomic_fetch_min_64 (addr, value);
|
||||
return old <= value ? old : value;
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_max_fetch_64 (volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_max_fetch_64 (pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
int64_t old = pmix_atomic_fetch_max_64 (addr, value);
|
||||
return old >= value ? old : value;
|
||||
@ -421,52 +421,52 @@ static inline int64_t pmix_atomic_max_fetch_64 (volatile int64_t *addr, int64_t
|
||||
|
||||
#endif
|
||||
|
||||
static inline intptr_t pmix_atomic_fetch_add_ptr( volatile void* addr,
|
||||
static inline intptr_t pmix_atomic_fetch_add_ptr( pmix_atomic_intptr_t* addr,
|
||||
void* delta )
|
||||
{
|
||||
#if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_ADD_32
|
||||
return pmix_atomic_fetch_add_32((int32_t*) addr, (unsigned long) delta);
|
||||
return pmix_atomic_fetch_add_32((pmix_atomic_int32_t*) addr, (unsigned long) delta);
|
||||
#elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_ADD_64
|
||||
return pmix_atomic_fetch_add_64((int64_t*) addr, (unsigned long) delta);
|
||||
return pmix_atomic_fetch_add_64((pmix_atomic_int64_t*) addr, (unsigned long) delta);
|
||||
#else
|
||||
abort ();
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline intptr_t pmix_atomic_add_fetch_ptr( volatile void* addr,
|
||||
static inline intptr_t pmix_atomic_add_fetch_ptr( pmix_atomic_intptr_t* addr,
|
||||
void* delta )
|
||||
{
|
||||
#if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_ADD_32
|
||||
return pmix_atomic_add_fetch_32((int32_t*) addr, (unsigned long) delta);
|
||||
return pmix_atomic_add_fetch_32((pmix_atomic_int32_t*) addr, (unsigned long) delta);
|
||||
#elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_ADD_64
|
||||
return pmix_atomic_add_fetch_64((int64_t*) addr, (unsigned long) delta);
|
||||
return pmix_atomic_add_fetch_64((pmix_atomic_int64_t*) addr, (unsigned long) delta);
|
||||
#else
|
||||
abort ();
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr,
|
||||
static inline intptr_t pmix_atomic_fetch_sub_ptr( pmix_atomic_intptr_t* addr,
|
||||
void* delta )
|
||||
{
|
||||
#if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_SUB_32
|
||||
return pmix_atomic_fetch_sub_32((int32_t*) addr, (unsigned long) delta);
|
||||
return pmix_atomic_fetch_sub_32((pmix_atomic_int32_t*) addr, (unsigned long) delta);
|
||||
#elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_SUB_32
|
||||
return pmix_atomic_fetch_sub_64((int64_t*) addr, (unsigned long) delta);
|
||||
return pmix_atomic_fetch_sub_64((pmix_atomic_int64_t*) addr, (unsigned long) delta);
|
||||
#else
|
||||
abort();
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline intptr_t pmix_atomic_sub_fetch_ptr( volatile void* addr,
|
||||
static inline intptr_t pmix_atomic_sub_fetch_ptr( pmix_atomic_intptr_t* addr,
|
||||
void* delta )
|
||||
{
|
||||
#if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_SUB_32
|
||||
return pmix_atomic_sub_fetch_32((int32_t*) addr, (unsigned long) delta);
|
||||
return pmix_atomic_sub_fetch_32((pmix_atomic_int32_t*) addr, (unsigned long) delta);
|
||||
#elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_SUB_32
|
||||
return pmix_atomic_sub_fetch_64((int64_t*) addr, (unsigned long) delta);
|
||||
return pmix_atomic_sub_fetch_64((pmix_atomic_int64_t*) addr, (unsigned long) delta);
|
||||
#else
|
||||
abort();
|
||||
return 0;
|
||||
|
262
opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h
Обычный файл
262
opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h
Обычный файл
@ -0,0 +1,262 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
/* This file provides shims between the pmix atomics interface and the C11 atomics interface. It
|
||||
* is intended as the first step in moving to using C11 atomics across the entire codebase. Once
|
||||
* all officially supported compilers offer C11 atomic (GCC 4.9.0+, icc 2018+, pgi, xlc, etc) then
|
||||
* this shim will go away and the codebase will be updated to use C11's atomic support
|
||||
* directly.
|
||||
* This shim contains some functions already present in atomic_impl.h because we do not include
|
||||
* atomic_impl.h when using C11 atomics. It would require alot of #ifdefs to avoid duplicate
|
||||
* definitions to be worthwhile. */
|
||||
|
||||
#if !defined(PMIX_ATOMIC_STDC_H)
|
||||
#define PMIX_ATOMIC_STDC_H
|
||||
|
||||
#include <stdatomic.h>
|
||||
#include <stdint.h>
|
||||
#include "src/include/pmix_stdint.h"
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_MEM_BARRIER 1
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1
|
||||
#define PMIX_HAVE_ATOMIC_SWAP_32 1
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_MATH_32 1
|
||||
#define PMIX_HAVE_ATOMIC_ADD_32 1
|
||||
#define PMIX_HAVE_ATOMIC_AND_32 1
|
||||
#define PMIX_HAVE_ATOMIC_OR_32 1
|
||||
#define PMIX_HAVE_ATOMIC_XOR_32 1
|
||||
#define PMIX_HAVE_ATOMIC_SUB_32 1
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1
|
||||
#define PMIX_HAVE_ATOMIC_SWAP_64 1
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_MATH_64 1
|
||||
#define PMIX_HAVE_ATOMIC_ADD_64 1
|
||||
#define PMIX_HAVE_ATOMIC_AND_64 1
|
||||
#define PMIX_HAVE_ATOMIC_OR_64 1
|
||||
#define PMIX_HAVE_ATOMIC_XOR_64 1
|
||||
#define PMIX_HAVE_ATOMIC_SUB_64 1
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_LLSC_32 0
|
||||
#define PMIX_HAVE_ATOMIC_LLSC_64 0
|
||||
#define PMIX_HAVE_ATOMIC_LLSC_PTR 0
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_MIN_32 1
|
||||
#define PMIX_HAVE_ATOMIC_MAX_32 1
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_MIN_64 1
|
||||
#define PMIX_HAVE_ATOMIC_MAX_64 1
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_SPINLOCKS 1
|
||||
|
||||
static inline void pmix_atomic_mb (void)
|
||||
{
|
||||
atomic_thread_fence (memory_order_seq_cst);
|
||||
}
|
||||
|
||||
static inline void pmix_atomic_wmb (void)
|
||||
{
|
||||
atomic_thread_fence (memory_order_release);
|
||||
}
|
||||
|
||||
static inline void pmix_atomic_rmb (void)
|
||||
{
|
||||
atomic_thread_fence (memory_order_acquire);
|
||||
}
|
||||
|
||||
#define pmix_atomic_compare_exchange_strong_32(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_relaxed, memory_order_relaxed)
|
||||
#define pmix_atomic_compare_exchange_strong_64(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_relaxed, memory_order_relaxed)
|
||||
#define pmix_atomic_compare_exchange_strong_ptr(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_relaxed, memory_order_relaxed)
|
||||
#define pmix_atomic_compare_exchange_strong_acq_32(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_acquire, memory_order_relaxed)
|
||||
#define pmix_atomic_compare_exchange_strong_acq_64(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_acquire, memory_order_relaxed)
|
||||
#define pmix_atomic_compare_exchange_strong_acq_ptr(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_acquire, memory_order_relaxed)
|
||||
|
||||
#define pmix_atomic_compare_exchange_strong_rel_32(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_release, memory_order_relaxed)
|
||||
#define pmix_atomic_compare_exchange_strong_rel_64(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_release, memory_order_relaxed)
|
||||
#define pmix_atomic_compare_exchange_strong_rel_ptr(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_release, memory_order_relaxed)
|
||||
|
||||
#define pmix_atomic_compare_exchange_strong(addr, oldval, newval) atomic_compare_exchange_strong_explicit (addr, oldval, newval, memory_order_relaxed, memory_order_relaxed)
|
||||
#define pmix_atomic_compare_exchange_strong_acq(addr, oldval, newval) atomic_compare_exchange_strong_explicit (addr, oldval, newval, memory_order_acquire, memory_order_relaxed)
|
||||
#define pmix_atomic_compare_exchange_strong_rel(addr, oldval, newval) atomic_compare_exchange_strong_explicit (addr, oldval, newval, memory_order_release, memory_order_relaxed)
|
||||
|
||||
#define pmix_atomic_swap_32(addr, value) atomic_exchange_explicit (addr, value, memory_order_relaxed)
|
||||
#define pmix_atomic_swap_64(addr, value) atomic_exchange_explicit (addr, value, memory_order_relaxed)
|
||||
#define pmix_atomic_swap_ptr(addr, value) atomic_exchange_explicit (addr, value, memory_order_relaxed)
|
||||
|
||||
#define PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(op, bits, type, operator) \
|
||||
static inline type pmix_atomic_fetch_ ## op ##_## bits (pmix_atomic_ ## type *addr, type value) \
|
||||
{ \
|
||||
return atomic_fetch_ ## op ## _explicit (addr, value, memory_order_relaxed); \
|
||||
} \
|
||||
\
|
||||
static inline type pmix_atomic_## op ## _fetch_ ## bits (pmix_atomic_ ## type *addr, type value) \
|
||||
{ \
|
||||
return atomic_fetch_ ## op ## _explicit (addr, value, memory_order_relaxed) operator value; \
|
||||
}
|
||||
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(add, 32, int32_t, +)
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(add, 64, int64_t, +)
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(add, size_t, size_t, +)
|
||||
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(sub, 32, int32_t, -)
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(sub, 64, int64_t, -)
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(sub, size_t, size_t, -)
|
||||
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(or, 32, int32_t, |)
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(or, 64, int64_t, |)
|
||||
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(xor, 32, int32_t, ^)
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(xor, 64, int64_t, ^)
|
||||
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(and, 32, int32_t, &)
|
||||
PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(and, 64, int64_t, &)
|
||||
|
||||
#define pmix_atomic_add(addr, value) (void) atomic_fetch_add_explicit (addr, value, memory_order_relaxed)
|
||||
|
||||
static inline int32_t pmix_atomic_fetch_min_32 (pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
int32_t old = *addr;
|
||||
do {
|
||||
if (old <= value) {
|
||||
break;
|
||||
}
|
||||
} while (!pmix_atomic_compare_exchange_strong_32 (addr, &old, value));
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_fetch_max_32 (pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
int32_t old = *addr;
|
||||
do {
|
||||
if (old >= value) {
|
||||
break;
|
||||
}
|
||||
} while (!pmix_atomic_compare_exchange_strong_32 (addr, &old, value));
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_fetch_min_64 (pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
int64_t old = *addr;
|
||||
do {
|
||||
if (old <= value) {
|
||||
break;
|
||||
}
|
||||
} while (!pmix_atomic_compare_exchange_strong_64 (addr, &old, value));
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_fetch_max_64 (pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
int64_t old = *addr;
|
||||
do {
|
||||
if (old >= value) {
|
||||
break;
|
||||
}
|
||||
} while (!pmix_atomic_compare_exchange_strong_64 (addr, &old, value));
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_min_fetch_32 (pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
int32_t old = pmix_atomic_fetch_min_32 (addr, value);
|
||||
return old <= value ? old : value;
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_max_fetch_32 (pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
int32_t old = pmix_atomic_fetch_max_32 (addr, value);
|
||||
return old >= value ? old : value;
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_min_fetch_64 (pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
int64_t old = pmix_atomic_fetch_min_64 (addr, value);
|
||||
return old <= value ? old : value;
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_max_fetch_64 (pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
int64_t old = pmix_atomic_fetch_max_64 (addr, value);
|
||||
return old >= value ? old : value;
|
||||
}
|
||||
|
||||
#define PMIX_ATOMIC_LOCK_UNLOCKED false
|
||||
#define PMIX_ATOMIC_LOCK_LOCKED true
|
||||
|
||||
#define PMIX_ATOMIC_LOCK_INIT ATOMIC_FLAG_INIT
|
||||
|
||||
typedef atomic_flag pmix_atomic_lock_t;
|
||||
|
||||
/*
|
||||
* Lock initialization function. It set the lock to UNLOCKED.
|
||||
*/
|
||||
static inline void pmix_atomic_lock_init (pmix_atomic_lock_t *lock, bool value)
|
||||
{
|
||||
atomic_flag_clear (lock);
|
||||
}
|
||||
|
||||
|
||||
static inline int pmix_atomic_trylock (pmix_atomic_lock_t *lock)
|
||||
{
|
||||
return (int) atomic_flag_test_and_set (lock);
|
||||
}
|
||||
|
||||
|
||||
static inline void pmix_atomic_lock(pmix_atomic_lock_t *lock)
|
||||
{
|
||||
while (pmix_atomic_trylock (lock)) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void pmix_atomic_unlock (pmix_atomic_lock_t *lock)
|
||||
{
|
||||
atomic_flag_clear (lock);
|
||||
}
|
||||
|
||||
|
||||
#if PMIX_HAVE_C11_CSWAP_INT128
|
||||
|
||||
/* the C11 atomic compare-exchange is lock free so use it */
|
||||
#define pmix_atomic_compare_exchange_strong_128 atomic_compare_exchange_strong
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 1
|
||||
|
||||
#elif PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128
|
||||
|
||||
/* fall back on the __sync builtin if available since it will emit the expected instruction on x86_64 (cmpxchng16b) */
|
||||
__pmix_attribute_always_inline__
|
||||
static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr,
|
||||
pmix_int128_t *oldval, pmix_int128_t newval)
|
||||
{
|
||||
pmix_int128_t prev = __sync_val_compare_and_swap (addr, *oldval, newval);
|
||||
bool ret = prev == *oldval;
|
||||
*oldval = prev;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 1
|
||||
|
||||
#else
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 0
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !defined(PMIX_ATOMIC_STDC_H) */
|
@ -4,7 +4,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*/
|
||||
|
||||
@ -85,13 +85,13 @@
|
||||
|
||||
#elif PMIX_ASSEMBLY_ARCH == PMIX_S390
|
||||
|
||||
#define __NR_process_vm_readv 340
|
||||
#define __NR_process_vm_writev 341
|
||||
#define __NR_process_vm_readv 340
|
||||
#define __NR_process_vm_writev 341
|
||||
|
||||
#elif PMIX_ASSEMBLY_ARCH == PMIX_S390X
|
||||
|
||||
#define __NR_process_vm_readv 340
|
||||
#define __NR_process_vm_writev 341
|
||||
#define __NR_process_vm_readv 340
|
||||
#define __NR_process_vm_writev 341
|
||||
|
||||
#else
|
||||
#error "Unsupported architecture for process_vm_readv and process_vm_writev syscalls"
|
||||
|
@ -11,13 +11,13 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2016-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Triad National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -86,103 +86,103 @@ static inline void pmix_atomic_wmb(void)
|
||||
/*
|
||||
* Suppress numerous (spurious ?) warnings from Oracle Studio compilers
|
||||
* see https://community.oracle.com/thread/3968347
|
||||
*/
|
||||
*/
|
||||
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
#pragma error_messages(off, E_ARG_INCOMPATIBLE_WITH_ARG_L)
|
||||
#endif
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_swap_32 (volatile int32_t *addr, int32_t newval)
|
||||
static inline int32_t pmix_atomic_swap_32 (pmix_atomic_int32_t *addr, int32_t newval)
|
||||
{
|
||||
int32_t oldval;
|
||||
__atomic_exchange (addr, &newval, &oldval, __ATOMIC_RELAXED);
|
||||
return oldval;
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t *addr, int32_t delta)
|
||||
static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t *addr, int32_t delta)
|
||||
{
|
||||
return __atomic_fetch_add (addr, delta, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_fetch_and_32(volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_fetch_and_32(pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
return __atomic_fetch_and (addr, value, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_fetch_or_32(volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_fetch_or_32(pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
return __atomic_fetch_or (addr, value, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_fetch_xor_32(volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_fetch_xor_32(pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
return __atomic_fetch_xor (addr, value, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t *addr, int32_t delta)
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t *addr, int32_t delta)
|
||||
{
|
||||
return __atomic_fetch_sub (addr, delta, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_swap_64 (volatile int64_t *addr, int64_t newval)
|
||||
static inline int64_t pmix_atomic_swap_64 (pmix_atomic_int64_t *addr, int64_t newval)
|
||||
{
|
||||
int64_t oldval;
|
||||
__atomic_exchange (addr, &newval, &oldval, __ATOMIC_RELAXED);
|
||||
return oldval;
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t *addr, int64_t delta)
|
||||
static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t *addr, int64_t delta)
|
||||
{
|
||||
return __atomic_fetch_add (addr, delta, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_fetch_and_64(volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_fetch_and_64(pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
return __atomic_fetch_and (addr, value, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_fetch_or_64(volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_fetch_or_64(pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
return __atomic_fetch_or (addr, value, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_fetch_xor_64(volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_fetch_xor_64(pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
return __atomic_fetch_xor (addr, value, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t delta)
|
||||
static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t *addr, int64_t delta)
|
||||
{
|
||||
return __atomic_fetch_sub (addr, delta, __ATOMIC_RELAXED);
|
||||
}
|
||||
@ -191,7 +191,7 @@ static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t d
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 1
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128_t *addr,
|
||||
static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr,
|
||||
pmix_int128_t *oldval, pmix_int128_t newval)
|
||||
{
|
||||
return __atomic_compare_exchange_n (addr, oldval, newval, false,
|
||||
@ -204,7 +204,7 @@ static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128
|
||||
|
||||
/* __atomic version is not lock-free so use legacy __sync version */
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128_t *addr,
|
||||
static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_pmix_int128_t *addr,
|
||||
pmix_int128_t *oldval, pmix_int128_t newval)
|
||||
{
|
||||
pmix_int128_t prev = __sync_val_compare_and_swap (addr, *oldval, newval);
|
||||
|
@ -13,9 +13,9 @@
|
||||
* Copyright (c) 2007-2010 Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -85,7 +85,7 @@ static inline void pmix_atomic_isync(void)
|
||||
*********************************************************************/
|
||||
#if PMIX_GCC_INLINE_ASSEMBLY
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
unsigned char ret;
|
||||
__asm__ __volatile__ (
|
||||
@ -107,15 +107,15 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_SWAP_32 1
|
||||
|
||||
static inline int32_t pmix_atomic_swap_32( volatile int32_t *addr,
|
||||
int32_t newval)
|
||||
static inline int32_t pmix_atomic_swap_32( pmix_atomic_int32_t *addr,
|
||||
int32_t newval)
|
||||
{
|
||||
int32_t oldval;
|
||||
|
||||
__asm__ __volatile__("xchg %1, %0" :
|
||||
"=r" (oldval), "=m" (*addr) :
|
||||
"0" (newval), "m" (*addr) :
|
||||
"memory");
|
||||
"=r" (oldval), "=m" (*addr) :
|
||||
"0" (newval), "m" (*addr) :
|
||||
"memory");
|
||||
return oldval;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ static inline int32_t pmix_atomic_swap_32( volatile int32_t *addr,
|
||||
*
|
||||
* Atomically adds @i to @v.
|
||||
*/
|
||||
static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int i)
|
||||
static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t* v, int i)
|
||||
{
|
||||
int ret = i;
|
||||
__asm__ __volatile__(
|
||||
@ -151,7 +151,7 @@ static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int i)
|
||||
*
|
||||
* Atomically subtracts @i from @v.
|
||||
*/
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t* v, int i)
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t* v, int i)
|
||||
{
|
||||
int ret = -i;
|
||||
__asm__ __volatile__(
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Copyright (c) 2010-2017 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -145,7 +145,7 @@ void pmix_atomic_isync(void)
|
||||
#define PMIX_ASM_VALUE64(x) x
|
||||
#endif
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
int32_t prev;
|
||||
bool ret;
|
||||
@ -171,7 +171,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add
|
||||
* load the arguments to/from the stack. This sequence may cause the ll reservation to be cancelled. */
|
||||
#define pmix_atomic_ll_32(addr, ret) \
|
||||
do { \
|
||||
volatile int32_t *_addr = (addr); \
|
||||
pmix_atomic_int32_t *_addr = (addr); \
|
||||
int32_t _ret; \
|
||||
__asm__ __volatile__ ("lwarx %0, 0, %1 \n\t" \
|
||||
: "=&r" (_ret) \
|
||||
@ -182,7 +182,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add
|
||||
|
||||
#define pmix_atomic_sc_32(addr, value, ret) \
|
||||
do { \
|
||||
volatile int32_t *_addr = (addr); \
|
||||
pmix_atomic_int32_t *_addr = (addr); \
|
||||
int32_t _ret, _foo, _newval = (int32_t) value; \
|
||||
\
|
||||
__asm__ __volatile__ (" stwcx. %4, 0, %3 \n\t" \
|
||||
@ -201,7 +201,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add
|
||||
atomic_?mb can be inlined). Instead, we "inline" them by hand in
|
||||
the assembly, meaning there is one function call overhead instead
|
||||
of two */
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
bool rc;
|
||||
|
||||
@ -212,13 +212,13 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
pmix_atomic_wmb();
|
||||
return pmix_atomic_compare_exchange_strong_32 (addr, oldval, newval);
|
||||
}
|
||||
|
||||
static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr, int32_t newval)
|
||||
static inline int32_t pmix_atomic_swap_32(pmix_atomic_int32_t *addr, int32_t newval)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
@ -240,7 +240,7 @@ static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr, int32_t newval
|
||||
#if PMIX_GCC_INLINE_ASSEMBLY
|
||||
|
||||
#define PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_64(type, instr) \
|
||||
static inline int64_t pmix_atomic_fetch_ ## type ## _64(volatile int64_t* v, int64_t val) \
|
||||
static inline int64_t pmix_atomic_fetch_ ## type ## _64(pmix_atomic_int64_t* v, int64_t val) \
|
||||
{ \
|
||||
int64_t t, old; \
|
||||
\
|
||||
@ -262,7 +262,7 @@ PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_64(or, or)
|
||||
PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_64(xor, xor)
|
||||
PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_64(sub, subf)
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
int64_t prev;
|
||||
bool ret;
|
||||
@ -285,7 +285,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
|
||||
#define pmix_atomic_ll_64(addr, ret) \
|
||||
do { \
|
||||
volatile int64_t *_addr = (addr); \
|
||||
pmix_atomic_int64_t *_addr = (addr); \
|
||||
int64_t _ret; \
|
||||
__asm__ __volatile__ ("ldarx %0, 0, %1 \n\t" \
|
||||
: "=&r" (_ret) \
|
||||
@ -296,7 +296,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
|
||||
#define pmix_atomic_sc_64(addr, value, ret) \
|
||||
do { \
|
||||
volatile int64_t *_addr = (addr); \
|
||||
pmix_atomic_int64_t *_addr = (addr); \
|
||||
int64_t _foo, _newval = (int64_t) value; \
|
||||
int32_t _ret; \
|
||||
\
|
||||
@ -311,7 +311,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
ret = _ret; \
|
||||
} while (0)
|
||||
|
||||
static inline int64_t pmix_atomic_swap_64(volatile int64_t *addr, int64_t newval)
|
||||
static inline int64_t pmix_atomic_swap_64(pmix_atomic_int64_t *addr, int64_t newval)
|
||||
{
|
||||
int64_t ret;
|
||||
|
||||
@ -336,7 +336,7 @@ static inline int64_t pmix_atomic_swap_64(volatile int64_t *addr, int64_t newval
|
||||
|
||||
#if PMIX_GCC_INLINE_ASSEMBLY
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
int64_t prev;
|
||||
int ret;
|
||||
@ -383,7 +383,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
atomic_?mb can be inlined). Instead, we "inline" them by hand in
|
||||
the assembly, meaning there is one function call overhead instead
|
||||
of two */
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
bool rc;
|
||||
|
||||
@ -394,7 +394,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
pmix_atomic_wmb();
|
||||
return pmix_atomic_compare_exchange_strong_64 (addr, oldval, newval);
|
||||
@ -402,7 +402,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t
|
||||
|
||||
|
||||
#define PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_32(type, instr) \
|
||||
static inline int32_t pmix_atomic_fetch_ ## type ## _32(volatile int32_t* v, int val) \
|
||||
static inline int32_t pmix_atomic_fetch_ ## type ## _32(pmix_atomic_int32_t* v, int val) \
|
||||
{ \
|
||||
int32_t t, old; \
|
||||
\
|
||||
|
@ -13,9 +13,9 @@
|
||||
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2017-2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#define ASI_P "0x80"
|
||||
|
||||
#define MEMBAR(type) __asm__ __volatile__ ("membar " type : : : "memory")
|
||||
#define MEPMIXMBAR(type) __asm__ __volatile__ ("membar " type : : : "memory")
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
@ -56,19 +56,19 @@
|
||||
|
||||
static inline void pmix_atomic_mb(void)
|
||||
{
|
||||
MEMBAR("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad");
|
||||
MEPMIXMBAR("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad");
|
||||
}
|
||||
|
||||
|
||||
static inline void pmix_atomic_rmb(void)
|
||||
{
|
||||
MEMBAR("#LoadLoad");
|
||||
MEPMIXMBAR("#LoadLoad");
|
||||
}
|
||||
|
||||
|
||||
static inline void pmix_atomic_wmb(void)
|
||||
{
|
||||
MEMBAR("#StoreStore");
|
||||
MEPMIXMBAR("#StoreStore");
|
||||
}
|
||||
|
||||
static inline void pmix_atomic_isync(void)
|
||||
@ -86,7 +86,7 @@ static inline void pmix_atomic_isync(void)
|
||||
*********************************************************************/
|
||||
#if PMIX_GCC_INLINE_ASSEMBLY
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
/* casa [reg(rs1)] %asi, reg(rs2), reg(rd)
|
||||
*
|
||||
@ -108,7 +108,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
bool rc;
|
||||
|
||||
@ -119,7 +119,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
pmix_atomic_wmb();
|
||||
return pmix_atomic_compare_exchange_strong_32 (addr, oldval, newval);
|
||||
@ -128,7 +128,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t
|
||||
|
||||
#if PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
/* casa [reg(rs1)] %asi, reg(rs2), reg(rd)
|
||||
*
|
||||
@ -150,7 +150,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
|
||||
#else /* PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 */
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
/* casa [reg(rs1)] %asi, reg(rs2), reg(rd)
|
||||
*
|
||||
@ -180,7 +180,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
|
||||
#endif /* PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 */
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
bool rc;
|
||||
|
||||
@ -191,7 +191,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t
|
||||
}
|
||||
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
pmix_atomic_wmb();
|
||||
return pmix_atomic_compare_exchange_strong_64 (addr, oldval, newval);
|
||||
|
@ -11,11 +11,11 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -58,7 +58,7 @@ static inline void pmix_atomic_wmb(void)
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
int32_t prev = __sync_val_compare_and_swap (addr, *oldval, newval);
|
||||
bool ret = prev == *oldval;
|
||||
@ -72,31 +72,31 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add
|
||||
#define PMIX_HAVE_ATOMIC_MATH_32 1
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_ADD_32 1
|
||||
static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t *addr, int32_t delta)
|
||||
static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t *addr, int32_t delta)
|
||||
{
|
||||
return __sync_fetch_and_add(addr, delta);
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_AND_32 1
|
||||
static inline int32_t pmix_atomic_fetch_and_32(volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_fetch_and_32(pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
return __sync_fetch_and_and(addr, value);
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_OR_32 1
|
||||
static inline int32_t pmix_atomic_fetch_or_32(volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_fetch_or_32(pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
return __sync_fetch_and_or(addr, value);
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_XOR_32 1
|
||||
static inline int32_t pmix_atomic_fetch_xor_32(volatile int32_t *addr, int32_t value)
|
||||
static inline int32_t pmix_atomic_fetch_xor_32(pmix_atomic_int32_t *addr, int32_t value)
|
||||
{
|
||||
return __sync_fetch_and_xor(addr, value);
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_SUB_32 1
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t *addr, int32_t delta)
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t *addr, int32_t delta)
|
||||
{
|
||||
return __sync_fetch_and_sub(addr, delta);
|
||||
}
|
||||
@ -105,7 +105,7 @@ static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t *addr, int32_t d
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
int64_t prev = __sync_val_compare_and_swap (addr, *oldval, newval);
|
||||
bool ret = prev == *oldval;
|
||||
@ -118,31 +118,31 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_MATH_64 1
|
||||
#define PMIX_HAVE_ATOMIC_ADD_64 1
|
||||
static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t *addr, int64_t delta)
|
||||
static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t *addr, int64_t delta)
|
||||
{
|
||||
return __sync_fetch_and_add(addr, delta);
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_AND_64 1
|
||||
static inline int64_t pmix_atomic_fetch_and_64(volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_fetch_and_64(pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
return __sync_fetch_and_and(addr, value);
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_OR_64 1
|
||||
static inline int64_t pmix_atomic_fetch_or_64(volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_fetch_or_64(pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
return __sync_fetch_and_or(addr, value);
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_XOR_64 1
|
||||
static inline int64_t pmix_atomic_fetch_xor_64(volatile int64_t *addr, int64_t value)
|
||||
static inline int64_t pmix_atomic_fetch_xor_64(pmix_atomic_int64_t *addr, int64_t value)
|
||||
{
|
||||
return __sync_fetch_and_xor(addr, value);
|
||||
}
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_SUB_64 1
|
||||
static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t delta)
|
||||
static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t *addr, int64_t delta)
|
||||
{
|
||||
return __sync_fetch_and_sub(addr, delta);
|
||||
}
|
||||
@ -150,7 +150,7 @@ static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t d
|
||||
#endif
|
||||
|
||||
#if PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128
|
||||
static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128_t *addr,
|
||||
static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr,
|
||||
pmix_int128_t *oldval, pmix_int128_t newval)
|
||||
{
|
||||
pmix_int128_t prev = __sync_val_compare_and_swap (addr, *oldval, newval);
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Copyright (c) 2016 Broadcom Limited. All rights reserved.
|
||||
* Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
|
@ -11,11 +11,11 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd.
|
||||
* Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2016-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -83,7 +83,7 @@ static inline void pmix_atomic_isync(void)
|
||||
*********************************************************************/
|
||||
#if PMIX_GCC_INLINE_ASSEMBLY
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval)
|
||||
{
|
||||
unsigned char ret;
|
||||
__asm__ __volatile__ (
|
||||
@ -103,13 +103,13 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add
|
||||
|
||||
#if PMIX_GCC_INLINE_ASSEMBLY
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval)
|
||||
{
|
||||
unsigned char ret;
|
||||
__asm__ __volatile__ (
|
||||
SMPLOCK "cmpxchgq %3,%2 \n\t"
|
||||
"sete %0 \n\t"
|
||||
: "=qm" (ret), "+a" (*oldval), "+m" (*((volatile long*)addr))
|
||||
: "=qm" (ret), "+a" (*oldval), "+m" (*((pmix_atomic_long_t *)addr))
|
||||
: "q"(newval)
|
||||
: "memory", "cc"
|
||||
);
|
||||
@ -124,7 +124,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add
|
||||
|
||||
#if PMIX_GCC_INLINE_ASSEMBLY && PMIX_HAVE_CMPXCHG16B && HAVE_PMIX_INT128_T
|
||||
|
||||
static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128_t *addr, pmix_int128_t *oldval, pmix_int128_t newval)
|
||||
static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr, pmix_int128_t *oldval, pmix_int128_t newval)
|
||||
{
|
||||
unsigned char ret;
|
||||
|
||||
@ -151,15 +151,15 @@ static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128
|
||||
|
||||
#define PMIX_HAVE_ATOMIC_SWAP_64 1
|
||||
|
||||
static inline int32_t pmix_atomic_swap_32( volatile int32_t *addr,
|
||||
int32_t newval)
|
||||
static inline int32_t pmix_atomic_swap_32( pmix_atomic_int32_t *addr,
|
||||
int32_t newval)
|
||||
{
|
||||
int32_t oldval;
|
||||
|
||||
__asm__ __volatile__("xchg %1, %0" :
|
||||
"=r" (oldval), "+m" (*addr) :
|
||||
"0" (newval) :
|
||||
"memory");
|
||||
"=r" (oldval), "+m" (*addr) :
|
||||
"0" (newval) :
|
||||
"memory");
|
||||
return oldval;
|
||||
}
|
||||
|
||||
@ -167,15 +167,15 @@ static inline int32_t pmix_atomic_swap_32( volatile int32_t *addr,
|
||||
|
||||
#if PMIX_GCC_INLINE_ASSEMBLY
|
||||
|
||||
static inline int64_t pmix_atomic_swap_64( volatile int64_t *addr,
|
||||
static inline int64_t pmix_atomic_swap_64( pmix_atomic_int64_t *addr,
|
||||
int64_t newval)
|
||||
{
|
||||
int64_t oldval;
|
||||
|
||||
__asm__ __volatile__("xchgq %1, %0" :
|
||||
"=r" (oldval), "+m" (*addr) :
|
||||
"0" (newval) :
|
||||
"memory");
|
||||
"=r" (oldval), "+m" (*addr) :
|
||||
"0" (newval) :
|
||||
"memory");
|
||||
return oldval;
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ static inline int64_t pmix_atomic_swap_64( volatile int64_t *addr,
|
||||
*
|
||||
* Atomically adds @i to @v.
|
||||
*/
|
||||
static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int i)
|
||||
static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t* v, int i)
|
||||
{
|
||||
int ret = i;
|
||||
__asm__ __volatile__(
|
||||
@ -218,7 +218,7 @@ static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int i)
|
||||
*
|
||||
* Atomically adds @i to @v.
|
||||
*/
|
||||
static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t* v, int64_t i)
|
||||
static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t* v, int64_t i)
|
||||
{
|
||||
int64_t ret = i;
|
||||
__asm__ __volatile__(
|
||||
@ -239,7 +239,7 @@ static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t* v, int64_t i)
|
||||
*
|
||||
* Atomically subtracts @i from @v.
|
||||
*/
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t* v, int i)
|
||||
static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t* v, int i)
|
||||
{
|
||||
int ret = -i;
|
||||
__asm__ __volatile__(
|
||||
@ -260,7 +260,7 @@ static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t* v, int i)
|
||||
*
|
||||
* Atomically subtracts @i from @v.
|
||||
*/
|
||||
static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t* v, int64_t i)
|
||||
static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t* v, int64_t i)
|
||||
{
|
||||
int64_t ret = -i;
|
||||
__asm__ __volatile__(
|
||||
|
@ -12,7 +12,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Los Alamos National Security, LLC. ALl rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved
|
||||
* Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -190,6 +190,7 @@ static inline pmix_status_t pmix_hotel_checkin(pmix_hotel_t *hotel,
|
||||
|
||||
/* Do we have any rooms available? */
|
||||
if (PMIX_UNLIKELY(hotel->last_unoccupied_room < 0)) {
|
||||
*room_num = -1;
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
@ -247,6 +248,10 @@ static inline void pmix_hotel_checkout(pmix_hotel_t *hotel, int room_num)
|
||||
|
||||
/* Bozo check */
|
||||
assert(room_num < hotel->num_rooms);
|
||||
if (0 > room_num) {
|
||||
/* occupant wasn't checked in */
|
||||
return;
|
||||
}
|
||||
|
||||
/* If there's an occupant in the room, check them out */
|
||||
room = &(hotel->rooms[room_num]);
|
||||
@ -285,6 +290,11 @@ static inline void pmix_hotel_checkout_and_return_occupant(pmix_hotel_t *hotel,
|
||||
|
||||
/* Bozo check */
|
||||
assert(room_num < hotel->num_rooms);
|
||||
if (0 > room_num) {
|
||||
/* occupant wasn't checked in */
|
||||
*occupant = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* If there's an occupant in the room, check them out */
|
||||
room = &(hotel->rooms[room_num]);
|
||||
@ -339,6 +349,10 @@ static inline void pmix_hotel_knock(pmix_hotel_t *hotel, int room_num, void **oc
|
||||
assert(room_num < hotel->num_rooms);
|
||||
|
||||
*occupant = NULL;
|
||||
if (0 > room_num) {
|
||||
/* occupant wasn't checked in */
|
||||
return;
|
||||
}
|
||||
|
||||
/* If there's an occupant in the room, have them come to the door */
|
||||
room = &(hotel->rooms[room_num]);
|
||||
|
@ -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-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -109,7 +109,7 @@ struct pmix_list_item_t
|
||||
|
||||
#if PMIX_ENABLE_DEBUG
|
||||
/** Atomic reference count for debugging */
|
||||
volatile int32_t pmix_list_item_refcount;
|
||||
pmix_atomic_int32_t pmix_list_item_refcount;
|
||||
/** The list this item belong to */
|
||||
volatile struct pmix_list_t* pmix_list_item_belong_to;
|
||||
#endif
|
||||
|
@ -192,7 +192,7 @@ struct pmix_object_t {
|
||||
uint64_t obj_magic_id;
|
||||
#endif
|
||||
pmix_class_t *obj_class; /**< class descriptor */
|
||||
volatile int32_t obj_reference_count; /**< reference count */
|
||||
pmix_atomic_int32_t obj_reference_count; /**< reference count */
|
||||
#if PMIX_ENABLE_DEBUG
|
||||
const char* cls_init_file_name; /**< In debug mode store the file where the object get contructed */
|
||||
int cls_init_lineno; /**< In debug mode store the line number where the object get contructed */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016 Mellanox Technologies, Inc.
|
||||
@ -75,7 +75,7 @@ PMIX_EXPORT int PMI_Init(int *spawned)
|
||||
*spawned = 0;
|
||||
}
|
||||
pmi_singleton = true;
|
||||
(void)strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN);
|
||||
myproc.rank = 0;
|
||||
pmi_init = 1;
|
||||
return PMI_SUCCESS;
|
||||
@ -242,7 +242,7 @@ PMIX_EXPORT int PMI_KVS_Get( const char kvsname[], const char key[], char value[
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
if (PMIX_SUCCESS == PMIx_Get(&proc, PMIX_ANL_MAP, NULL, 0, &val) &&
|
||||
(NULL != val) && (PMIX_STRING == val->type)) {
|
||||
strncpy(value, val->data.string, length);
|
||||
pmix_strncpy(value, val->data.string, length-1);
|
||||
PMIX_VALUE_FREE(val, 1);
|
||||
return PMI_SUCCESS;
|
||||
} else {
|
||||
@ -259,7 +259,7 @@ PMIX_EXPORT int PMI_KVS_Get( const char kvsname[], const char key[], char value[
|
||||
|
||||
/* retrieve the data from PMIx - since we don't have a rank,
|
||||
* we indicate that by passing the UNDEF value */
|
||||
(void)strncpy(proc.nspace, kvsname, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(proc.nspace, kvsname, PMIX_MAX_NSLEN);
|
||||
proc.rank = PMIX_RANK_UNDEF;
|
||||
|
||||
rc = PMIx_Get(&proc, key, NULL, 0, &val);
|
||||
@ -267,7 +267,7 @@ PMIX_EXPORT int PMI_KVS_Get( const char kvsname[], const char key[], char value[
|
||||
if (PMIX_STRING != val->type) {
|
||||
rc = PMIX_ERROR;
|
||||
} else if (NULL != val->data.string) {
|
||||
(void)strncpy(value, val->data.string, length);
|
||||
pmix_strncpy(value, val->data.string, length-1);
|
||||
}
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
}
|
||||
@ -445,7 +445,7 @@ PMIX_EXPORT int PMI_Publish_name(const char service_name[], const char port[])
|
||||
}
|
||||
|
||||
/* pass the service/port */
|
||||
(void) strncpy(info.key, service_name, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(info.key, service_name, PMIX_MAX_KEYLEN);
|
||||
info.value.type = PMIX_STRING;
|
||||
info.value.data.string = (char*) port;
|
||||
|
||||
@ -497,7 +497,7 @@ PMIX_EXPORT int PMI_Lookup_name(const char service_name[], char port[])
|
||||
PMIX_PDATA_CONSTRUCT(&pdata);
|
||||
|
||||
/* pass the service */
|
||||
(void) strncpy(pdata.key, service_name, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(pdata.key, service_name, PMIX_MAX_KEYLEN);
|
||||
|
||||
/* PMI-1 doesn't want the nspace back */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Lookup(&pdata, 1, NULL, 0))) {
|
||||
@ -514,7 +514,7 @@ PMIX_EXPORT int PMI_Lookup_name(const char service_name[], char port[])
|
||||
* potential we could overrun it. As this feature
|
||||
* isn't widely supported in PMI-1, try being
|
||||
* conservative */
|
||||
(void) strncpy(port, pdata.value.data.string, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(port, pdata.value.data.string, PMIX_MAX_KEYLEN);
|
||||
PMIX_PDATA_DESTRUCT(&pdata);
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
@ -535,7 +535,7 @@ PMIX_EXPORT int PMI_Get_id(char id_str[], int length)
|
||||
return PMI_ERR_INVALID_LENGTH;
|
||||
}
|
||||
|
||||
(void) strncpy(id_str, myproc.nspace, length);
|
||||
pmix_strncpy(id_str, myproc.nspace, length-1);
|
||||
return PMI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -742,7 +742,7 @@ PMIX_EXPORT int PMI_Spawn_multiple(int count,
|
||||
apps[i].info = (pmix_info_t*)malloc(apps[i].ninfo * sizeof(pmix_info_t));
|
||||
/* copy the info objects */
|
||||
for (j = 0; j < apps[i].ninfo; j++) {
|
||||
(void)strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN);
|
||||
apps[i].info[j].value.type = PMIX_STRING;
|
||||
apps[i].info[j].value.data.string = strdup(info_keyval_vectors[i][j].val);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ PMIX_EXPORT int PMI2_Init(int *spawned, int *size, int *rank, int *appnum)
|
||||
*appnum = 0;
|
||||
}
|
||||
pmi2_singleton = true;
|
||||
(void)strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN);
|
||||
myproc.rank = 0;
|
||||
pmi2_init = 1;
|
||||
return PMI2_SUCCESS;
|
||||
@ -227,7 +227,7 @@ PMIX_EXPORT int PMI2_Job_Spawn(int count, const char * cmds[],
|
||||
apps[i].info = (pmix_info_t*)malloc(apps[i].ninfo * sizeof(pmix_info_t));
|
||||
/* copy the info objects */
|
||||
for (j=0; j < apps[i].ninfo; j++) {
|
||||
(void)strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN);
|
||||
apps[i].info[j].value.type = PMIX_STRING;
|
||||
apps[i].info[j].value.data.string = strdup(info_keyval_vectors[i][j].val);
|
||||
}
|
||||
@ -271,7 +271,7 @@ PMIX_EXPORT int PMI2_Job_GetId(char jobid[], int jobid_size)
|
||||
if (NULL == jobid) {
|
||||
return PMI2_ERR_INVALID_ARGS;
|
||||
}
|
||||
(void)strncpy(jobid, myproc.nspace, jobid_size);
|
||||
pmix_strncpy(jobid, myproc.nspace, jobid_size-1);
|
||||
return PMI2_SUCCESS;
|
||||
}
|
||||
|
||||
@ -339,7 +339,7 @@ PMIX_EXPORT int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn)
|
||||
}
|
||||
|
||||
memset(proc.nspace, 0, sizeof(proc.nspace));
|
||||
(void)strncpy(proc.nspace, (jobid ? jobid : proc.nspace), sizeof(proc.nspace)-1);
|
||||
pmix_strncpy(proc.nspace, (jobid ? jobid : proc.nspace), PMIX_MAX_NSLEN);
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
rc = PMIx_Connect(&proc, 1, NULL, 0);
|
||||
return convert_err(rc);
|
||||
@ -357,7 +357,7 @@ PMIX_EXPORT int PMI2_Job_Disconnect(const char jobid[])
|
||||
}
|
||||
|
||||
memset(proc.nspace, 0, sizeof(proc.nspace));
|
||||
(void)strncpy(proc.nspace, (jobid ? jobid : proc.nspace), sizeof(proc.nspace)-1);
|
||||
pmix_strncpy(proc.nspace, (jobid ? jobid : proc.nspace), PMIX_MAX_NSLEN);
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
rc = PMIx_Disconnect(&proc, 1, NULL, 0);
|
||||
return convert_err(rc);
|
||||
@ -455,7 +455,7 @@ PMIX_EXPORT int PMI2_KVS_Get(const char *jobid, int src_pmi_id,
|
||||
pmix_output_verbose(3, pmix_globals.debug_output,
|
||||
"PMI2_KVS_Get: key=%s jobid=%s src_pmi_id=%d", key, (jobid ? jobid : "null"), src_pmi_id);
|
||||
|
||||
(void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), PMIX_MAX_NSLEN);
|
||||
if (src_pmi_id == PMI2_ID_NULL) {
|
||||
/* the rank is UNDEF */
|
||||
proc.rank = PMIX_RANK_UNDEF;
|
||||
@ -468,7 +468,7 @@ PMIX_EXPORT int PMI2_KVS_Get(const char *jobid, int src_pmi_id,
|
||||
if (PMIX_STRING != val->type) {
|
||||
rc = PMIX_ERROR;
|
||||
} else if (NULL != val->data.string) {
|
||||
(void)strncpy(value, val->data.string, maxvalue);
|
||||
pmix_strncpy(value, val->data.string, maxvalue-1);
|
||||
*vallen = strlen(val->data.string);
|
||||
}
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
@ -511,7 +511,7 @@ PMIX_EXPORT int PMI2_Info_GetNodeAttr(const char name[],
|
||||
if (PMIX_STRING != val->type) {
|
||||
rc = PMIX_ERROR;
|
||||
} else if (NULL != val->data.string) {
|
||||
(void)strncpy(value, val->data.string, valuelen);
|
||||
pmix_strncpy(value, val->data.string, valuelen-1);
|
||||
*found = 1;
|
||||
}
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
@ -586,7 +586,7 @@ PMIX_EXPORT int PMI2_Info_GetJobAttr(const char name[], char value[], int valuel
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
if (PMIX_SUCCESS == PMIx_Get(&proc, PMIX_ANL_MAP, NULL, 0, &val) &&
|
||||
(NULL != val) && (PMIX_STRING == val->type)) {
|
||||
strncpy(value, val->data.string, valuelen);
|
||||
pmix_strncpy(value, val->data.string, valuelen);
|
||||
PMIX_VALUE_FREE(val, 1);
|
||||
*found = 1;
|
||||
return PMI2_SUCCESS;
|
||||
@ -610,7 +610,7 @@ PMIX_EXPORT int PMI2_Info_GetJobAttr(const char name[], char value[], int valuel
|
||||
if (PMIX_STRING != val->type) {
|
||||
rc = PMIX_ERROR;
|
||||
} else if (NULL != val->data.string) {
|
||||
(void)strncpy(value, val->data.string, valuelen);
|
||||
pmix_strncpy(value, val->data.string, valuelen-1);
|
||||
*found = 1;
|
||||
}
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
@ -648,14 +648,14 @@ PMIX_EXPORT int PMI2_Nameserv_publish(const char service_name[],
|
||||
}
|
||||
|
||||
/* pass the service/port */
|
||||
(void)strncpy(info[0].key, service_name, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(info[0].key, service_name, PMIX_MAX_KEYLEN);
|
||||
info[0].value.type = PMIX_STRING;
|
||||
info[0].value.data.string = (char*)port;
|
||||
nvals = 1;
|
||||
|
||||
/* if provided, add any other value */
|
||||
if (NULL != info_ptr) {
|
||||
(void)strncpy(info[1].key, info_ptr->key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(info[1].key, info_ptr->key, PMIX_MAX_KEYLEN);
|
||||
info[1].value.type = PMIX_STRING;
|
||||
info[1].value.data.string = (char*)info_ptr->val;
|
||||
nvals = 2;
|
||||
@ -689,12 +689,12 @@ PMIX_EXPORT int PMI2_Nameserv_lookup(const char service_name[],
|
||||
PMIX_PDATA_CONSTRUCT(&pdata[1]);
|
||||
|
||||
/* pass the service */
|
||||
(void)strncpy(pdata[0].key, service_name, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(pdata[0].key, service_name, PMIX_MAX_KEYLEN);
|
||||
nvals = 1;
|
||||
|
||||
/* if provided, add any other value */
|
||||
if (NULL != info_ptr) {
|
||||
(void)strncpy(pdata[1].key, info_ptr->key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(pdata[1].key, info_ptr->key, PMIX_MAX_KEYLEN);
|
||||
pdata[1].value.type = PMIX_STRING;
|
||||
pdata[1].value.data.string = info_ptr->val;
|
||||
nvals = 2;
|
||||
@ -716,7 +716,7 @@ PMIX_EXPORT int PMI2_Nameserv_lookup(const char service_name[],
|
||||
}
|
||||
|
||||
/* return the port */
|
||||
(void)strncpy(port, pdata[0].value.data.string, portLen);
|
||||
pmix_strncpy(port, pdata[0].value.data.string, portLen-1);
|
||||
PMIX_PDATA_DESTRUCT(&pdata[0]);
|
||||
|
||||
if (NULL != info_ptr) {
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include PMIX_EVENT2_THREAD_HEADER
|
||||
|
||||
static const char pmix_version_string[] = PMIX_VERSION;
|
||||
|
||||
static pmix_status_t pmix_init_result = PMIX_ERR_INIT;
|
||||
|
||||
#include "src/class/pmix_list.h"
|
||||
#include "src/event/pmix_event.h"
|
||||
@ -268,6 +268,9 @@ static void notification_fn(size_t evhdlr_registration_id,
|
||||
char *name = NULL;
|
||||
size_t n;
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.base_output,
|
||||
"[%s:%d] DEBUGGER RELEASE RECVD",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank);
|
||||
if (NULL != info) {
|
||||
lock = NULL;
|
||||
for (n=0; n < ninfo; n++) {
|
||||
@ -439,7 +442,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
* rank should be known. So return them here if
|
||||
* requested */
|
||||
if (NULL != proc) {
|
||||
(void)strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
proc->rank = pmix_globals.myid.rank;
|
||||
}
|
||||
++pmix_globals.init_cntr;
|
||||
@ -450,10 +453,13 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
if (NULL != info) {
|
||||
_check_for_notify(info, ninfo);
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
return pmix_init_result;
|
||||
}
|
||||
++pmix_globals.init_cntr;
|
||||
|
||||
/* if we don't see the required info, then we cannot init */
|
||||
if (NULL == (evar = getenv("PMIX_NAMESPACE"))) {
|
||||
pmix_init_result = PMIX_ERR_INVALID_NAMESPACE;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_INVALID_NAMESPACE;
|
||||
}
|
||||
@ -463,6 +469,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
if (PMIX_SUCCESS != (rc = pmix_rte_init(PMIX_PROC_CLIENT, info, ninfo,
|
||||
pmix_client_notify_recv))) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
pmix_init_result = rc;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return rc;
|
||||
}
|
||||
@ -480,24 +487,25 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
pmix_pointer_array_init(&pmix_client_globals.peers, 1, INT_MAX, 1);
|
||||
pmix_client_globals.myserver = PMIX_NEW(pmix_peer_t);
|
||||
if (NULL == pmix_client_globals.myserver) {
|
||||
pmix_init_result = PMIX_ERR_NOMEM;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_nspace_t);
|
||||
pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_namespace_t);
|
||||
if (NULL == pmix_client_globals.myserver->nptr) {
|
||||
PMIX_RELEASE(pmix_client_globals.myserver);
|
||||
pmix_init_result = PMIX_ERR_NOMEM;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
pmix_client_globals.myserver->info = PMIX_NEW(pmix_rank_info_t);
|
||||
if (NULL == pmix_client_globals.myserver->info) {
|
||||
PMIX_RELEASE(pmix_client_globals.myserver);
|
||||
pmix_init_result = PMIX_ERR_NOMEM;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.base_output,
|
||||
"pmix: init called");
|
||||
/* setup the base verbosity */
|
||||
if (0 < pmix_client_globals.base_verbose) {
|
||||
/* set default output */
|
||||
@ -506,17 +514,21 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
pmix_client_globals.base_verbose);
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.base_output,
|
||||
"pmix: init called");
|
||||
|
||||
/* we require our nspace */
|
||||
if (NULL != proc) {
|
||||
(void)strncpy(proc->nspace, evar, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(proc->nspace, evar, PMIX_MAX_NSLEN);
|
||||
}
|
||||
(void)strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN);
|
||||
/* set the global pmix_nspace_t object for our peer */
|
||||
PMIX_LOAD_NSPACE(pmix_globals.myid.nspace, evar);
|
||||
/* set the global pmix_namespace_t object for our peer */
|
||||
pmix_globals.mypeer->nptr->nspace = strdup(evar);
|
||||
|
||||
/* we also require our rank */
|
||||
if (NULL == (evar = getenv("PMIX_RANK"))) {
|
||||
/* let the caller know that the server isn't available yet */
|
||||
pmix_init_result = PMIX_ERR_DATA_VALUE_NOT_FOUND;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_DATA_VALUE_NOT_FOUND;
|
||||
}
|
||||
@ -528,6 +540,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
/* setup a rank_info object for us */
|
||||
pmix_globals.mypeer->info = PMIX_NEW(pmix_rank_info_t);
|
||||
if (NULL == pmix_globals.mypeer->info) {
|
||||
pmix_init_result = PMIX_ERR_NOMEM;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
@ -540,6 +553,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
evar = getenv("PMIX_SECURITY_MODE");
|
||||
pmix_globals.mypeer->nptr->compat.psec = pmix_psec_base_assign_module(evar);
|
||||
if (NULL == pmix_globals.mypeer->nptr->compat.psec) {
|
||||
pmix_init_result = PMIX_ERR_INIT;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
@ -574,6 +588,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
pmix_client_globals.myserver->nptr->compat.gds = pmix_gds_base_assign_module(NULL, 0);
|
||||
}
|
||||
if (NULL == pmix_client_globals.myserver->nptr->compat.gds) {
|
||||
pmix_init_result = PMIX_ERR_INIT;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
@ -596,6 +611,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
pmix_globals.mypeer->nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1);
|
||||
if (NULL == pmix_globals.mypeer->nptr->compat.gds) {
|
||||
PMIX_INFO_DESTRUCT(&ginfo);
|
||||
pmix_init_result = PMIX_ERR_INIT;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
@ -604,6 +620,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
/* connect to the server */
|
||||
rc = pmix_ptl_base_connect_to_peer((struct pmix_peer_t*)pmix_client_globals.myserver, info, ninfo);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
pmix_init_result = rc;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return rc;
|
||||
}
|
||||
@ -619,6 +636,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
PMIX_RELEASE(req);
|
||||
pmix_init_result = rc;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return rc;
|
||||
}
|
||||
@ -627,6 +645,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
|
||||
req, job_data, (void*)&cb);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
pmix_init_result = rc;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return rc;
|
||||
}
|
||||
@ -636,15 +655,16 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
PMIX_DESTRUCT(&cb);
|
||||
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
pmix_globals.init_cntr++;
|
||||
pmix_init_result = PMIX_SUCCESS;
|
||||
} else {
|
||||
pmix_init_result = rc;
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return rc;
|
||||
}
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
|
||||
/* look for a debugger attach key */
|
||||
(void)strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
wildcard.rank = PMIX_RANK_WILDCARD;
|
||||
PMIX_INFO_LOAD(&ginfo, PMIX_OPTIONAL, NULL, PMIX_BOOL);
|
||||
if (PMIX_SUCCESS == PMIx_Get(&wildcard, PMIX_DEBUG_STOP_IN_INIT, &ginfo, 1, &val)) {
|
||||
@ -655,7 +675,9 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc,
|
||||
PMIX_CONSTRUCT_LOCK(&releaselock);
|
||||
PMIX_INFO_LOAD(&evinfo[0], PMIX_EVENT_RETURN_OBJECT, &releaselock, PMIX_POINTER);
|
||||
PMIX_INFO_LOAD(&evinfo[1], PMIX_EVENT_HDLR_NAME, "WAIT-FOR-DEBUGGER", PMIX_STRING);
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.base_output,
|
||||
"[%s:%d] WAITING IN INIT FOR DEBUGGER",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank);
|
||||
PMIx_Register_event_handler(&code, 1, evinfo, 2,
|
||||
notification_fn, evhandler_reg_callbk, (void*)®lock);
|
||||
/* wait for registration to complete */
|
||||
@ -1003,7 +1025,9 @@ static void _putfn(int sd, short args, void *cbdata)
|
||||
PMIX_WAKEUP_THREAD(&cb->lock);
|
||||
}
|
||||
|
||||
PMIX_EXPORT pmix_status_t PMIx_Put(pmix_scope_t scope, const char key[], pmix_value_t *val)
|
||||
PMIX_EXPORT pmix_status_t PMIx_Put(pmix_scope_t scope,
|
||||
const pmix_key_t key,
|
||||
pmix_value_t *val)
|
||||
{
|
||||
pmix_cb_t *cb;
|
||||
pmix_status_t rc;
|
||||
@ -1212,7 +1236,7 @@ static void _resolve_peers(int sd, short args, void *cbdata)
|
||||
|
||||
/* need to thread-shift this request */
|
||||
PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename,
|
||||
const char *nspace,
|
||||
const pmix_nspace_t nspace,
|
||||
pmix_proc_t **procs, size_t *nprocs)
|
||||
{
|
||||
pmix_cb_t *cb;
|
||||
@ -1239,7 +1263,7 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename,
|
||||
/* if the nspace wasn't found, then we need to
|
||||
* ask the server for that info */
|
||||
if (PMIX_ERR_INVALID_NAMESPACE == cb->status) {
|
||||
(void)strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN);
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
/* any key will suffice as it will bring down
|
||||
* the entire data blob */
|
||||
@ -1285,7 +1309,7 @@ static void _resolve_nodes(int fd, short args, void *cbdata)
|
||||
}
|
||||
|
||||
/* need to thread-shift this request */
|
||||
PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist)
|
||||
PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const pmix_nspace_t nspace, char **nodelist)
|
||||
{
|
||||
pmix_cb_t *cb;
|
||||
pmix_status_t rc;
|
||||
@ -1309,7 +1333,7 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist
|
||||
/* if the nspace wasn't found, then we need to
|
||||
* ask the server for that info */
|
||||
if (PMIX_ERR_INVALID_NAMESPACE == cb->status) {
|
||||
(void)strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN);
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
/* any key will suffice as it will bring down
|
||||
* the entire data blob */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>.
|
||||
@ -147,7 +147,7 @@ PMIX_EXPORT pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs
|
||||
/* if we are given a NULL proc, then the caller is referencing
|
||||
* all procs within our own nspace */
|
||||
if (NULL == procs) {
|
||||
(void)strncpy(rg.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(rg.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
rg.rank = PMIX_RANK_WILDCARD;
|
||||
rgs = &rg;
|
||||
nrg = 1;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Mellanox Technologies, Inc.
|
||||
* Copyright (c) 2016-2018 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -75,8 +75,15 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr,
|
||||
|
||||
static void _value_cbfunc(pmix_status_t status, pmix_value_t *kv, void *cbdata);
|
||||
|
||||
static pmix_status_t _getfn_fastpath(const pmix_proc_t *proc, const pmix_key_t key,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_value_t **val);
|
||||
|
||||
PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
|
||||
static pmix_status_t process_values(pmix_value_t **v, pmix_cb_t *cb);
|
||||
|
||||
|
||||
PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc,
|
||||
const pmix_key_t key,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_value_t **val)
|
||||
{
|
||||
@ -91,12 +98,17 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
|
||||
}
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(2, pmix_client_globals.get_output,
|
||||
"pmix:client get for %s:%d key %s",
|
||||
(NULL == proc) ? "NULL" : proc->nspace,
|
||||
(NULL == proc) ? PMIX_RANK_UNDEF : proc->rank,
|
||||
(NULL == key) ? "NULL" : key);
|
||||
|
||||
/* try to get data directly, without threadshift */
|
||||
if (PMIX_SUCCESS == (rc = _getfn_fastpath(proc, key, info, ninfo, val))) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create a callback object as we need to pass it to the
|
||||
* recv routine so we know which callback to use when
|
||||
* the return message is recvd */
|
||||
@ -115,13 +127,14 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
|
||||
}
|
||||
PMIX_RELEASE(cb);
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.get_verbose,
|
||||
done:
|
||||
pmix_output_verbose(2, pmix_client_globals.get_output,
|
||||
"pmix:client get completed");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key,
|
||||
PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t key,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_value_cbfunc_t cbfunc, void *cbdata)
|
||||
{
|
||||
@ -149,7 +162,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key,
|
||||
* Either case is supported. However, we don't currently
|
||||
* support the case where -both- values are NULL */
|
||||
if (NULL == proc && NULL == key) {
|
||||
pmix_output_verbose(2, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(2, pmix_client_globals.get_output,
|
||||
"pmix: get_nb value error - both proc and key are NULL");
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
}
|
||||
@ -157,7 +170,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key,
|
||||
/* if the key is NULL, the rank cannot be WILDCARD as
|
||||
* we cannot return all info from every rank */
|
||||
if (NULL != proc && PMIX_RANK_WILDCARD == proc->rank && NULL == key) {
|
||||
pmix_output_verbose(2, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(2, pmix_client_globals.get_output,
|
||||
"pmix: get_nb value error - WILDCARD rank and key is NULL");
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
}
|
||||
@ -179,7 +192,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key,
|
||||
rank = proc->rank;
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(2, pmix_client_globals.get_output,
|
||||
"pmix: get_nb value for proc %s:%u key %s",
|
||||
nm, rank, (NULL == key) ? "NULL" : key);
|
||||
|
||||
@ -284,7 +297,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr,
|
||||
pmix_proc_t proc;
|
||||
pmix_kval_t *kv;
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(2, pmix_client_globals.get_output,
|
||||
"pmix: get_nb callback recvd");
|
||||
|
||||
if (NULL == cb) {
|
||||
@ -294,7 +307,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr,
|
||||
}
|
||||
|
||||
/* cache the proc id */
|
||||
(void)strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
|
||||
proc.rank = cb->pname.rank;
|
||||
|
||||
/* a zero-byte buffer indicates that this recv is being
|
||||
@ -407,7 +420,7 @@ static pmix_status_t process_values(pmix_value_t **v, pmix_cb_t *cb)
|
||||
/* copy the list elements */
|
||||
n=0;
|
||||
PMIX_LIST_FOREACH(kv, kvs, pmix_kval_t) {
|
||||
(void)strncpy(info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(info[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix_value_xfer(&info[n].value, kv->value);
|
||||
++n;
|
||||
}
|
||||
@ -472,6 +485,55 @@ static void infocb(pmix_status_t status,
|
||||
}
|
||||
}
|
||||
|
||||
static pmix_status_t _getfn_fastpath(const pmix_proc_t *proc, const pmix_key_t key,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_value_t **val)
|
||||
{
|
||||
pmix_cb_t *cb = PMIX_NEW(pmix_cb_t);
|
||||
pmix_status_t rc = PMIX_SUCCESS;
|
||||
size_t n;
|
||||
|
||||
/* scan the incoming directives */
|
||||
if (NULL != info) {
|
||||
for (n=0; n < ninfo; n++) {
|
||||
if (0 == strncmp(info[n].key, PMIX_DATA_SCOPE, PMIX_MAX_KEYLEN)) {
|
||||
cb->scope = info[n].value.data.scope;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
cb->proc = (pmix_proc_t*)proc;
|
||||
cb->copy = true;
|
||||
cb->key = (char*)key;
|
||||
cb->info = (pmix_info_t*)info;
|
||||
cb->ninfo = ninfo;
|
||||
|
||||
PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_globals.mypeer);
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb);
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_client_globals.myserver);
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb);
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
PMIX_RELEASE(cb);
|
||||
return rc;
|
||||
|
||||
done:
|
||||
rc = process_values(val, cb);
|
||||
if (NULL != *val) {
|
||||
PMIX_VALUE_COMPRESSED_STRING_UNPACK(*val);
|
||||
}
|
||||
PMIX_RELEASE(cb);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
{
|
||||
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
|
||||
@ -480,7 +542,6 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
pmix_value_t *val = NULL;
|
||||
pmix_status_t rc;
|
||||
size_t n;
|
||||
char *tmp;
|
||||
pmix_proc_t proc;
|
||||
bool optional = false;
|
||||
bool immediate = false;
|
||||
@ -490,13 +551,13 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
/* cb was passed to us from another thread - acquire it */
|
||||
PMIX_ACQUIRE_OBJECT(cb);
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(2, pmix_client_globals.get_output,
|
||||
"pmix: getnbfn value for proc %s:%u key %s",
|
||||
cb->pname.nspace, cb->pname.rank,
|
||||
(NULL == cb->key) ? "NULL" : cb->key);
|
||||
|
||||
/* set the proc object identifier */
|
||||
(void)strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
|
||||
proc.rank = cb->pname.rank;
|
||||
|
||||
/* scan the incoming directives */
|
||||
@ -528,12 +589,12 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
cb->copy = true;
|
||||
PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb);
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
pmix_output_verbose(5, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(5, pmix_client_globals.get_output,
|
||||
"pmix:client data found in internal storage");
|
||||
rc = process_values(&val, cb);
|
||||
goto respond;
|
||||
}
|
||||
pmix_output_verbose(5, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(5, pmix_client_globals.get_output,
|
||||
"pmix:client data NOT found in internal storage");
|
||||
|
||||
/* if the key is NULL or starts with "pmix", then they are looking
|
||||
@ -545,7 +606,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
cb->copy = true;
|
||||
PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
pmix_output_verbose(5, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(5, pmix_client_globals.get_output,
|
||||
"pmix:client job-level data NOT found");
|
||||
if (0 != strncmp(cb->pname.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) {
|
||||
/* we are asking about the job-level info from another
|
||||
@ -559,7 +620,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
* job-level info. In some cases, a server may elect not
|
||||
* to provide info at init to save memory */
|
||||
if (immediate) {
|
||||
pmix_output_verbose(5, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(5, pmix_client_globals.get_output,
|
||||
"pmix:client IMMEDIATE given - querying data");
|
||||
/* the direct modex request doesn't pass a key as it
|
||||
* was intended to support non-job-level information.
|
||||
@ -579,16 +640,16 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
return;
|
||||
}
|
||||
/* we should have had this info, so respond with the error */
|
||||
pmix_output_verbose(5, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(5, pmix_client_globals.get_output,
|
||||
"pmix:client returning NOT FOUND error");
|
||||
goto respond;
|
||||
} else {
|
||||
pmix_output_verbose(5, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(5, pmix_client_globals.get_output,
|
||||
"pmix:client NULL KEY - returning error");
|
||||
goto respond;
|
||||
}
|
||||
}
|
||||
pmix_output_verbose(5, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(5, pmix_client_globals.get_output,
|
||||
"pmix:client job-level data NOT found");
|
||||
rc = process_values(&val, cb);
|
||||
goto respond;
|
||||
@ -608,19 +669,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
/* if a callback was provided, execute it */
|
||||
if (NULL != cb->cbfunc.valuefn) {
|
||||
if (NULL != val) {
|
||||
/* if this is a compressed string, then uncompress it */
|
||||
if (PMIX_COMPRESSED_STRING == val->type) {
|
||||
pmix_util_uncompress_string(&tmp, (uint8_t*)val->data.bo.bytes, val->data.bo.size);
|
||||
if (NULL == tmp) {
|
||||
PMIX_ERROR_LOG(PMIX_ERR_NOMEM);
|
||||
rc = PMIX_ERR_NOMEM;
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
val = NULL;
|
||||
} else {
|
||||
PMIX_VALUE_DESTRUCT(val);
|
||||
PMIX_VAL_ASSIGN(val, string, tmp);
|
||||
}
|
||||
}
|
||||
PMIX_VALUE_COMPRESSED_STRING_UNPACK(val);
|
||||
}
|
||||
cb->cbfunc.valuefn(rc, val, cb->cbdata);
|
||||
}
|
||||
@ -644,7 +693,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
* us to attempt to retrieve it from the server */
|
||||
if (optional) {
|
||||
/* they don't want us to try and retrieve it */
|
||||
pmix_output_verbose(2, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(2, pmix_client_globals.get_output,
|
||||
"PMIx_Get key=%s for rank = %u, namespace = %s was not found - request was optional",
|
||||
cb->key, cb->pname.rank, cb->pname.nspace);
|
||||
rc = PMIX_ERR_NOT_FOUND;
|
||||
@ -672,7 +721,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
|
||||
goto respond;
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.get_verbose,
|
||||
pmix_output_verbose(2, pmix_client_globals.get_output,
|
||||
"%s:%d REQUESTING DATA FROM SERVER FOR %s:%d KEY %s",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
cb->pname.nspace, cb->pname.rank, cb->key);
|
||||
|
@ -660,7 +660,7 @@ static void lookup_cbfunc(pmix_status_t status, pmix_pdata_t pdata[], size_t nda
|
||||
for (j=0; j < cb->nvals; j++) {
|
||||
if (0 == strcmp(pdata[i].key, tgt[j].key)) {
|
||||
/* transfer the publishing proc id */
|
||||
(void)strncpy(tgt[j].proc.nspace, pdata[i].proc.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(tgt[j].proc.nspace, pdata[i].proc.nspace, PMIX_MAX_NSLEN);
|
||||
tgt[j].proc.rank = pdata[i].proc.rank;
|
||||
/* transfer the value to the pmix_info_t */
|
||||
PMIX_BFROPS_VALUE_XFER(cb->status, pmix_client_globals.myserver, &tgt[j].value, &pdata[i].value);
|
||||
|
@ -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-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014 Artem Y. Polyakov <artpol84@gmail.com>.
|
||||
@ -49,6 +49,7 @@
|
||||
#include "src/class/pmix_list.h"
|
||||
#include "src/threads/threads.h"
|
||||
#include "src/mca/bfrops/bfrops.h"
|
||||
#include "src/mca/pnet/base/base.h"
|
||||
#include "src/util/argv.h"
|
||||
#include "src/util/error.h"
|
||||
#include "src/util/output.h"
|
||||
@ -64,7 +65,7 @@ static void spawn_cbfunc(pmix_status_t status, char nspace[], void *cbdata);
|
||||
|
||||
PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo,
|
||||
const pmix_app_t apps[], size_t napps,
|
||||
char nspace[])
|
||||
pmix_nspace_t nspace)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
pmix_cb_t *cb;
|
||||
@ -104,7 +105,7 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo,
|
||||
PMIX_WAIT_THREAD(&cb->lock);
|
||||
rc = cb->status;
|
||||
if (NULL != nspace) {
|
||||
(void)strncpy(nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(nspace, cb->pname.nspace, PMIX_MAX_NSLEN);
|
||||
}
|
||||
PMIX_RELEASE(cb);
|
||||
|
||||
@ -119,6 +120,12 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin
|
||||
pmix_cmd_t cmd = PMIX_SPAWNNB_CMD;
|
||||
pmix_status_t rc;
|
||||
pmix_cb_t *cb;
|
||||
size_t n, m;
|
||||
pmix_app_t *aptr;
|
||||
bool jobenvars = false;
|
||||
char *harvest[2] = {"PMIX_MCA_", NULL};
|
||||
pmix_kval_t *kv;
|
||||
pmix_list_t ilist;
|
||||
|
||||
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
|
||||
|
||||
@ -137,6 +144,70 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin
|
||||
}
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
|
||||
/* check job info for directives */
|
||||
if (NULL != job_info) {
|
||||
for (n=0; n < ninfo; n++) {
|
||||
if (PMIX_CHECK_KEY(&job_info[n], PMIX_SETUP_APP_ENVARS)) {
|
||||
PMIX_CONSTRUCT(&ilist, pmix_list_t);
|
||||
rc = pmix_pnet_base_harvest_envars(harvest, NULL, &ilist);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_LIST_DESTRUCT(&ilist);
|
||||
return rc;
|
||||
}
|
||||
PMIX_LIST_FOREACH(kv, &ilist, pmix_kval_t) {
|
||||
/* cycle across all the apps and set this envar */
|
||||
for (m=0; m < napps; m++) {
|
||||
aptr = (pmix_app_t*)&apps[m];
|
||||
pmix_setenv(kv->value->data.envar.envar,
|
||||
kv->value->data.envar.value,
|
||||
true, &aptr->env);
|
||||
}
|
||||
}
|
||||
jobenvars = true;
|
||||
PMIX_LIST_DESTRUCT(&ilist);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (n=0; n < napps; n++) {
|
||||
/* do a quick check of the apps directive array to ensure
|
||||
* the ninfo field has been set */
|
||||
aptr = (pmix_app_t*)&apps[n];
|
||||
if (NULL != aptr->info && 0 == aptr->ninfo) {
|
||||
/* look for the info marked as "end" */
|
||||
m = 0;
|
||||
while (!(PMIX_INFO_IS_END(&aptr->info[m])) && m < SIZE_MAX) {
|
||||
++m;
|
||||
}
|
||||
if (SIZE_MAX == m) {
|
||||
/* nothing we can do */
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
}
|
||||
aptr->ninfo = m;
|
||||
}
|
||||
if (!jobenvars) {
|
||||
for (m=0; m < aptr->ninfo; m++) {
|
||||
if (PMIX_CHECK_KEY(&aptr->info[m], PMIX_SETUP_APP_ENVARS)) {
|
||||
PMIX_CONSTRUCT(&ilist, pmix_list_t);
|
||||
rc = pmix_pnet_base_harvest_envars(harvest, NULL, &ilist);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_LIST_DESTRUCT(&ilist);
|
||||
return rc;
|
||||
}
|
||||
PMIX_LIST_FOREACH(kv, &ilist, pmix_kval_t) {
|
||||
pmix_setenv(kv->value->data.envar.envar,
|
||||
kv->value->data.envar.value,
|
||||
true, &aptr->env);
|
||||
}
|
||||
jobenvars = true;
|
||||
PMIX_LIST_DESTRUCT(&ilist);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
msg = PMIX_NEW(pmix_buffer_t);
|
||||
/* pack the cmd */
|
||||
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
|
||||
@ -240,27 +311,25 @@ static void wait_cbfunc(struct pmix_peer_t *pr,
|
||||
PMIX_ERROR_LOG(rc);
|
||||
ret = rc;
|
||||
}
|
||||
if (PMIX_SUCCESS == ret) {
|
||||
/* unpack the namespace */
|
||||
cnt = 1;
|
||||
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
|
||||
buf, &n2, &cnt, PMIX_STRING);
|
||||
/* unpack the namespace */
|
||||
cnt = 1;
|
||||
PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver,
|
||||
buf, &n2, &cnt, PMIX_STRING);
|
||||
if (PMIX_SUCCESS != rc && PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
ret = rc;
|
||||
}
|
||||
pmix_output_verbose(1, pmix_globals.debug_output,
|
||||
"pmix:client recv '%s'", n2);
|
||||
|
||||
if (NULL != n2) {
|
||||
/* protect length */
|
||||
pmix_strncpy(nspace, n2, PMIX_MAX_NSLEN);
|
||||
free(n2);
|
||||
PMIX_GDS_STORE_JOB_INFO(rc, pmix_globals.mypeer, nspace, buf);
|
||||
/* extract and process any job-related info for this nspace */
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
ret = rc;
|
||||
}
|
||||
pmix_output_verbose(1, pmix_globals.debug_output,
|
||||
"pmix:client recv '%s'", n2);
|
||||
|
||||
if (NULL != n2) {
|
||||
/* protect length */
|
||||
(void)strncpy(nspace, n2, PMIX_MAX_NSLEN);
|
||||
free(n2);
|
||||
PMIX_GDS_STORE_JOB_INFO(rc, pmix_globals.mypeer, nspace, buf);
|
||||
/* extract and process any job-related info for this nspace */
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
* Copyright (c) 2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2019 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -105,6 +107,8 @@ static void query_cbfunc(struct pmix_peer_t *peer,
|
||||
/* release the caller */
|
||||
if (NULL != cd->cbfunc) {
|
||||
cd->cbfunc(results->status, results->info, results->ninfo, cd->cbdata, relcbfunc, results);
|
||||
} else {
|
||||
PMIX_RELEASE(results);
|
||||
}
|
||||
PMIX_RELEASE(cd);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc)
|
||||
/* didn't find it, so try to get the library version of the target
|
||||
* from the host - the result will be cached, so we will only have
|
||||
* to retrieve it once */
|
||||
(void)strncpy(wildcard.nspace, proc->nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(wildcard.nspace, proc->nspace, PMIX_MAX_NSLEN);
|
||||
wildcard.rank = PMIX_RANK_WILDCARD;
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&wildcard, PMIX_BFROPS_MODULE, NULL, 0, &value))) {
|
||||
/* couldn't get it - nothing we can do */
|
||||
@ -110,7 +110,7 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc)
|
||||
PMIX_RELEASE(value);
|
||||
return NULL;
|
||||
}
|
||||
peer->nptr = PMIX_NEW(pmix_nspace_t);
|
||||
peer->nptr = PMIX_NEW(pmix_namespace_t);
|
||||
if (NULL == peer->nptr) {
|
||||
PMIX_RELEASE(peer);
|
||||
PMIX_RELEASE(value);
|
||||
@ -137,15 +137,9 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc)
|
||||
return pmix_client_globals.myserver;
|
||||
}
|
||||
|
||||
/* if the target is another member of my nspace, then
|
||||
* they must be using the same version */
|
||||
if (0 == strncmp(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) {
|
||||
return pmix_globals.mypeer;
|
||||
}
|
||||
|
||||
/* try to get the library version of this peer - the result will be
|
||||
* cached, so we will only have to retrieve it once */
|
||||
(void)strncpy(wildcard.nspace, proc->nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(wildcard.nspace, proc->nspace, PMIX_MAX_NSLEN);
|
||||
wildcard.rank = PMIX_RANK_WILDCARD;
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&wildcard, PMIX_BFROPS_MODULE, NULL, 0, &value))) {
|
||||
/* couldn't get it - nothing we can do */
|
||||
@ -157,7 +151,7 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc)
|
||||
PMIX_RELEASE(value);
|
||||
return NULL;
|
||||
}
|
||||
peer->nptr = PMIX_NEW(pmix_nspace_t);
|
||||
peer->nptr = PMIX_NEW(pmix_namespace_t);
|
||||
if (NULL == peer->nptr) {
|
||||
PMIX_RELEASE(peer);
|
||||
PMIX_RELEASE(value);
|
||||
|
@ -148,7 +148,7 @@ pmix_iof_fd_always_ready(int fd)
|
||||
"defining endpt: file %s line %d fd %d", \
|
||||
__FILE__, __LINE__, (fid))); \
|
||||
PMIX_CONSTRUCT((snk), pmix_iof_sink_t); \
|
||||
(void)strncpy((snk)->name.nspace, (nm)->nspace, PMIX_MAX_NSLEN); \
|
||||
pmix_strncpy((snk)->name.nspace, (nm)->nspace, PMIX_MAX_NSLEN); \
|
||||
(snk)->name.rank = (nm)->rank; \
|
||||
(snk)->tag = (tg); \
|
||||
if (0 <= (fid)) { \
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
@ -53,6 +53,8 @@ static void query_cbfunc(struct pmix_peer_t *peer,
|
||||
pmix_status_t rc;
|
||||
pmix_shift_caddy_t *results;
|
||||
int cnt;
|
||||
size_t n;
|
||||
pmix_kval_t *kv;
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
"pmix:query cback from server");
|
||||
@ -88,6 +90,19 @@ static void query_cbfunc(struct pmix_peer_t *peer,
|
||||
results->status = rc;
|
||||
goto complete;
|
||||
}
|
||||
/* locally cache the results */
|
||||
for (n=0; n < results->ninfo; n++) {
|
||||
kv = PMIX_NEW(pmix_kval_t);
|
||||
kv->key = strdup(results->info[n].key);
|
||||
PMIX_VALUE_CREATE(kv->value, 1);
|
||||
PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer,
|
||||
kv->value, &results->info[n].value);
|
||||
|
||||
PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer,
|
||||
&pmix_globals.myid, PMIX_INTERNAL,
|
||||
kv);
|
||||
PMIX_RELEASE(kv); // maintain accounting
|
||||
}
|
||||
}
|
||||
|
||||
complete:
|
||||
@ -100,6 +115,22 @@ static void query_cbfunc(struct pmix_peer_t *peer,
|
||||
PMIX_RELEASE(cd);
|
||||
}
|
||||
|
||||
static void _local_relcb(void *cbdata)
|
||||
{
|
||||
pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata;
|
||||
PMIX_RELEASE(cd);
|
||||
}
|
||||
|
||||
static void _local_cbfunc(int sd, short args, void *cbdata)
|
||||
{
|
||||
pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata;
|
||||
if (NULL != cd->cbfunc) {
|
||||
cd->cbfunc(cd->status, cd->info, cd->ninfo, cd->cbdata, _local_relcb, cd);
|
||||
return;
|
||||
}
|
||||
PMIX_RELEASE(cd);
|
||||
}
|
||||
|
||||
PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nqueries,
|
||||
pmix_info_cbfunc_t cbfunc, void *cbdata)
|
||||
|
||||
@ -108,6 +139,11 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
|
||||
pmix_cmd_t cmd = PMIX_QUERY_CMD;
|
||||
pmix_buffer_t *msg;
|
||||
pmix_status_t rc;
|
||||
pmix_cb_t cb;
|
||||
size_t n, p;
|
||||
pmix_list_t results;
|
||||
pmix_kval_t *kv, *kvnxt;
|
||||
pmix_proc_t proc;
|
||||
|
||||
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
|
||||
|
||||
@ -124,6 +160,128 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
/* do a quick check of the qualifiers array to ensure
|
||||
* the nqual field has been set */
|
||||
for (n=0; n < nqueries; n++) {
|
||||
if (NULL != queries[n].qualifiers && 0 == queries[n].nqual) {
|
||||
/* look for the info marked as "end" */
|
||||
p = 0;
|
||||
while (!(PMIX_INFO_IS_END(&queries[n].qualifiers[p])) && p < SIZE_MAX) {
|
||||
++p;
|
||||
}
|
||||
if (SIZE_MAX == p) {
|
||||
/* nothing we can do */
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_ERR_BAD_PARAM;
|
||||
}
|
||||
queries[n].nqual = p;
|
||||
}
|
||||
}
|
||||
|
||||
/* setup the list of local results */
|
||||
PMIX_CONSTRUCT(&results, pmix_list_t);
|
||||
|
||||
/* check the directives to see if they want us to refresh
|
||||
* the local cached results - if we wanted to optimize this
|
||||
* more, we would check each query and allow those that don't
|
||||
* want to be refreshed to be executed locally, and those that
|
||||
* did would be sent to the host. However, for now we simply
|
||||
* */
|
||||
memset(proc.nspace, 0, PMIX_MAX_NSLEN+1);
|
||||
proc.rank = PMIX_RANK_INVALID;
|
||||
for (n=0; n < nqueries; n++) {
|
||||
for (p=0; p < queries[n].nqual; p++) {
|
||||
if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_QUERY_REFRESH_CACHE)) {
|
||||
if (PMIX_INFO_TRUE(&queries[n].qualifiers[p])) {
|
||||
PMIX_LIST_DESTRUCT(&results);
|
||||
goto query;
|
||||
}
|
||||
} else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_PROCID)) {
|
||||
PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.proc->nspace);
|
||||
proc.rank = queries[n].qualifiers[p].value.data.proc->rank;
|
||||
} else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_NSPACE)) {
|
||||
PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.string);
|
||||
} else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_RANK)) {
|
||||
proc.rank = queries[n].qualifiers[p].value.data.rank;
|
||||
} else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_HOSTNAME)) {
|
||||
if (0 != strcmp(queries[n].qualifiers[p].value.data.string, pmix_globals.hostname)) {
|
||||
/* asking about a different host, so ask for the info */
|
||||
PMIX_LIST_DESTRUCT(&results);
|
||||
goto query;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* we get here if a refresh isn't required - first try a local
|
||||
* "get" on the data to see if we already have it */
|
||||
PMIX_CONSTRUCT(&cb, pmix_cb_t);
|
||||
cb.copy = false;
|
||||
/* set the proc */
|
||||
if (PMIX_RANK_INVALID == proc.rank &&
|
||||
0 == strlen(proc.nspace)) {
|
||||
/* use our id */
|
||||
cb.proc = &pmix_globals.myid;
|
||||
} else {
|
||||
if (0 == strlen(proc.nspace)) {
|
||||
/* use our nspace */
|
||||
PMIX_LOAD_NSPACE(cb.proc->nspace, pmix_globals.myid.nspace);
|
||||
}
|
||||
if (PMIX_RANK_INVALID == proc.rank) {
|
||||
/* user the wildcard rank */
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
}
|
||||
cb.proc = &proc;
|
||||
}
|
||||
for (p=0; NULL != queries[n].keys[p]; p++) {
|
||||
cb.key = queries[n].keys[p];
|
||||
PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
/* needs to be passed to the host */
|
||||
PMIX_LIST_DESTRUCT(&results);
|
||||
PMIX_DESTRUCT(&cb);
|
||||
goto query;
|
||||
}
|
||||
/* need to retain this result */
|
||||
PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &cb.kvs, pmix_kval_t) {
|
||||
pmix_list_remove_item(&cb.kvs, &kv->super);
|
||||
pmix_list_append(&results, &kv->super);
|
||||
}
|
||||
PMIX_DESTRUCT(&cb);
|
||||
}
|
||||
}
|
||||
|
||||
/* if we get here, then all queries were completely locally
|
||||
* resolved, so construct the results for return */
|
||||
cd = PMIX_NEW(pmix_query_caddy_t);
|
||||
cd->cbfunc = cbfunc;
|
||||
cd->cbdata = cbdata;
|
||||
cd->status = PMIX_SUCCESS;
|
||||
cd->ninfo = pmix_list_get_size(&results);
|
||||
PMIX_INFO_CREATE(cd->info, cd->ninfo);
|
||||
n = 0;
|
||||
PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &results, pmix_kval_t) {
|
||||
PMIX_LOAD_KEY(cd->info[n].key, kv->key);
|
||||
rc = pmix_value_xfer(&cd->info[n].value, kv->value);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
cd->status = rc;
|
||||
PMIX_INFO_FREE(cd->info, cd->ninfo);
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
/* done with the list of results */
|
||||
PMIX_LIST_DESTRUCT(&results);
|
||||
/* we need to thread-shift as we are not allowed to
|
||||
* execute the callback function prior to returning
|
||||
* from the API */
|
||||
PMIX_THREADSHIFT(cd, _local_cbfunc);
|
||||
/* regardless of the result of the query, we return
|
||||
* PMIX_SUCCESS here to indicate that the operation
|
||||
* was accepted for processing */
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
return PMIX_SUCCESS;
|
||||
|
||||
|
||||
query:
|
||||
/* if we are the server, then we just issue the query and
|
||||
* return the response */
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) &&
|
||||
@ -135,10 +293,10 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
|
||||
}
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
"pmix:query handed to RM");
|
||||
pmix_host_server.query(&pmix_globals.myid,
|
||||
queries, nqueries,
|
||||
cbfunc, cbdata);
|
||||
return PMIX_SUCCESS;
|
||||
rc = pmix_host_server.query(&pmix_globals.myid,
|
||||
queries, nqueries,
|
||||
cbfunc, cbdata);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* if we aren't connected, don't attempt to send */
|
||||
@ -177,6 +335,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque
|
||||
PMIX_RELEASE(cd);
|
||||
return rc;
|
||||
}
|
||||
|
||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||
"pmix:query sending to server");
|
||||
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
|
||||
|
@ -12,6 +12,8 @@
|
||||
* Copyright (c) 2007-2012 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -241,25 +243,24 @@ PMIX_EXPORT const char* PMIx_IOF_channel_string(pmix_iof_channel_t channel)
|
||||
{
|
||||
size_t cnt=0;
|
||||
|
||||
memset(answer, 0, sizeof(answer));
|
||||
if (PMIX_FWD_STDIN_CHANNEL & channel) {
|
||||
strncpy(&answer[cnt], "STDIN ", strlen("STDIN "));
|
||||
strcpy(&answer[cnt], "STDIN ");
|
||||
cnt += strlen("STDIN ");
|
||||
}
|
||||
if (PMIX_FWD_STDOUT_CHANNEL & channel) {
|
||||
strncpy(&answer[cnt], "STDOUT ", strlen("STDOUT "));
|
||||
strcpy(&answer[cnt], "STDOUT ");
|
||||
cnt += strlen("STDOUT ");
|
||||
}
|
||||
if (PMIX_FWD_STDERR_CHANNEL & channel) {
|
||||
strncpy(&answer[cnt], "STDERR ", strlen("STDERR "));
|
||||
strcpy(&answer[cnt], "STDERR ");
|
||||
cnt += strlen("STDERR ");
|
||||
}
|
||||
if (PMIX_FWD_STDDIAG_CHANNEL & channel) {
|
||||
strncpy(&answer[cnt], "STDDIAG ", strlen("STDDIAG "));
|
||||
strcpy(&answer[cnt], "STDDIAG ");
|
||||
cnt += strlen("STDDIAG ");
|
||||
}
|
||||
if (0 == cnt) {
|
||||
strncpy(&answer[cnt], "NONE", strlen("NONE"));
|
||||
strcpy(&answer[cnt], "NONE");
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
@ -172,63 +172,84 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status,
|
||||
|
||||
void pmix_event_timeout_cb(int fd, short flags, void *arg);
|
||||
|
||||
#define PMIX_REPORT_EVENT(e, p, r, f) \
|
||||
do { \
|
||||
pmix_event_chain_t *ch, *cp; \
|
||||
size_t n, ninfo; \
|
||||
pmix_info_t *info; \
|
||||
pmix_proc_t proc; \
|
||||
\
|
||||
ch = NULL; \
|
||||
/* see if we already have this event cached */ \
|
||||
PMIX_LIST_FOREACH(cp, &pmix_globals.cached_events, pmix_event_chain_t) { \
|
||||
if (cp->status == (e)) { \
|
||||
ch = cp; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
if (NULL == ch) { \
|
||||
/* nope - need to add it */ \
|
||||
ch = PMIX_NEW(pmix_event_chain_t); \
|
||||
ch->status = (e); \
|
||||
ch->range = (r); \
|
||||
(void)strncpy(ch->source.nspace, \
|
||||
(p)->nptr->nspace, \
|
||||
PMIX_MAX_NSLEN); \
|
||||
ch->source.rank = (p)->info->pname.rank; \
|
||||
ch->ninfo = 0; \
|
||||
ch->nallocated = 2; \
|
||||
ch->final_cbfunc = (f); \
|
||||
ch->final_cbdata = ch; \
|
||||
PMIX_INFO_CREATE(ch->info, ch->nallocated); \
|
||||
/* cache it */ \
|
||||
pmix_list_append(&pmix_globals.cached_events, &ch->super); \
|
||||
ch->timer_active = true; \
|
||||
pmix_event_assign(&ch->ev, pmix_globals.evbase, -1, 0, \
|
||||
pmix_event_timeout_cb, ch); \
|
||||
PMIX_POST_OBJECT(ch); \
|
||||
pmix_event_add(&ch->ev, &pmix_globals.event_window); \
|
||||
} else { \
|
||||
/* add this peer to the array of sources */ \
|
||||
(void)strncpy(proc.nspace, (p)->nptr->nspace, PMIX_MAX_NSLEN); \
|
||||
proc.rank = (p)->info->pname.rank; \
|
||||
ninfo = ch->nallocated + 1; \
|
||||
PMIX_INFO_CREATE(info, ninfo); \
|
||||
/* must keep the hdlr name and return object at the end, so prepend */ \
|
||||
PMIX_INFO_LOAD(&info[0], PMIX_PROCID, \
|
||||
&proc, PMIX_PROC); \
|
||||
for (n=0; n < ch->ninfo; n++) { \
|
||||
PMIX_INFO_XFER(&info[n+1], &ch->info[n]); \
|
||||
} \
|
||||
PMIX_INFO_FREE(ch->info, ch->nallocated); \
|
||||
ch->nallocated = ninfo; \
|
||||
ch->info = info; \
|
||||
ch->ninfo = ninfo - 2; \
|
||||
/* reset the timer */ \
|
||||
pmix_event_del(&ch->ev); \
|
||||
PMIX_POST_OBJECT(ch); \
|
||||
pmix_event_add(&ch->ev, &pmix_globals.event_window); \
|
||||
} \
|
||||
#define PMIX_REPORT_EVENT(e, p, r, f) \
|
||||
do { \
|
||||
pmix_event_chain_t *ch, *cp; \
|
||||
size_t n, ninfo; \
|
||||
pmix_info_t *info; \
|
||||
pmix_proc_t proc; \
|
||||
\
|
||||
ch = NULL; \
|
||||
/* see if we already have this event cached */ \
|
||||
PMIX_LIST_FOREACH(cp, &pmix_globals.cached_events, pmix_event_chain_t) { \
|
||||
if (cp->status == (e)) { \
|
||||
ch = cp; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
if (NULL == ch) { \
|
||||
/* nope - need to add it */ \
|
||||
ch = PMIX_NEW(pmix_event_chain_t); \
|
||||
ch->status = (e); \
|
||||
ch->range = (r); \
|
||||
PMIX_LOAD_PROCID(&ch->source, (p)->nptr->nspace, \
|
||||
(p)->info->pname.rank); \
|
||||
PMIX_PROC_CREATE(ch->affected, 1); \
|
||||
ch->naffected = 1; \
|
||||
PMIX_LOAD_PROCID(ch->affected, (p)->nptr->nspace, \
|
||||
(p)->info->pname.rank); \
|
||||
/* if I'm a client or tool and this is my server, then we don't */ \
|
||||
/* set the targets - otherwise, we do */ \
|
||||
if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && \
|
||||
!PMIX_CHECK_PROCID(&pmix_client_globals.myserver->info->pname, \
|
||||
&(p)->info->pname)) { \
|
||||
PMIX_PROC_CREATE(ch->targets, 1); \
|
||||
ch->ntargets = 1; \
|
||||
PMIX_LOAD_PROCID(ch->targets, (p)->nptr->nspace, PMIX_RANK_WILDCARD); \
|
||||
} \
|
||||
/* if this is lost-connection-to-server, then we let it go to */ \
|
||||
/* the default event handler - otherwise, we don't */ \
|
||||
if (PMIX_ERR_LOST_CONNECTION_TO_SERVER != (e) && \
|
||||
PMIX_ERR_UNREACH != (e)) { \
|
||||
ch->ninfo = 1; \
|
||||
ch->nallocated = 3; \
|
||||
PMIX_INFO_CREATE(ch->info, ch->nallocated); \
|
||||
/* mark for non-default handlers only */ \
|
||||
PMIX_INFO_LOAD(&ch->info[0], PMIX_EVENT_NON_DEFAULT, NULL, PMIX_BOOL); \
|
||||
} else { \
|
||||
ch->nallocated = 2; \
|
||||
PMIX_INFO_CREATE(ch->info, ch->nallocated); \
|
||||
} \
|
||||
ch->final_cbfunc = (f); \
|
||||
ch->final_cbdata = ch; \
|
||||
/* cache it */ \
|
||||
pmix_list_append(&pmix_globals.cached_events, &ch->super); \
|
||||
ch->timer_active = true; \
|
||||
pmix_event_assign(&ch->ev, pmix_globals.evbase, -1, 0, \
|
||||
pmix_event_timeout_cb, ch); \
|
||||
PMIX_POST_OBJECT(ch); \
|
||||
pmix_event_add(&ch->ev, &pmix_globals.event_window); \
|
||||
} else { \
|
||||
/* add this peer to the array of sources */ \
|
||||
pmix_strncpy(proc.nspace, (p)->nptr->nspace, PMIX_MAX_NSLEN); \
|
||||
proc.rank = (p)->info->pname.rank; \
|
||||
ninfo = ch->nallocated + 1; \
|
||||
PMIX_INFO_CREATE(info, ninfo); \
|
||||
/* must keep the hdlr name and return object at the end, so prepend */ \
|
||||
PMIX_INFO_LOAD(&info[0], PMIX_PROCID, \
|
||||
&proc, PMIX_PROC); \
|
||||
for (n=0; n < ch->ninfo; n++) { \
|
||||
PMIX_INFO_XFER(&info[n+1], &ch->info[n]); \
|
||||
} \
|
||||
PMIX_INFO_FREE(ch->info, ch->nallocated); \
|
||||
ch->nallocated = ninfo; \
|
||||
ch->info = info; \
|
||||
ch->ninfo = ninfo - 2; \
|
||||
/* reset the timer */ \
|
||||
pmix_event_del(&ch->ev); \
|
||||
PMIX_POST_OBJECT(ch); \
|
||||
pmix_event_add(&ch->ev, &pmix_globals.event_window); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017-2019 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
*
|
||||
* $COPYRIGHT$
|
||||
@ -39,7 +39,7 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
|
||||
PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status,
|
||||
const pmix_proc_t *source,
|
||||
pmix_data_range_t range,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata)
|
||||
{
|
||||
int rc;
|
||||
@ -51,18 +51,20 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status,
|
||||
return PMIX_ERR_INIT;
|
||||
}
|
||||
|
||||
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) &&
|
||||
!PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) {
|
||||
PMIX_RELEASE_THREAD(&pmix_global_lock);
|
||||
|
||||
pmix_output_verbose(2, pmix_server_globals.event_output,
|
||||
"pmix_server_notify_event source = %s:%d event_status = %d",
|
||||
"pmix_server_notify_event source = %s:%d event_status = %s",
|
||||
(NULL == source) ? "UNKNOWN" : source->nspace,
|
||||
(NULL == source) ? PMIX_RANK_WILDCARD : source->rank, status);
|
||||
(NULL == source) ? PMIX_RANK_WILDCARD : source->rank, PMIx_Error_string(status));
|
||||
|
||||
rc = pmix_server_notify_client_of_event(status, source, range,
|
||||
info, ninfo,
|
||||
cbfunc, cbdata);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
|
||||
if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
}
|
||||
return rc;
|
||||
@ -108,6 +110,49 @@ static void notify_event_cbfunc(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr,
|
||||
PMIX_RELEASE(cb);
|
||||
}
|
||||
|
||||
static pmix_status_t notify_event_cache(pmix_notify_caddy_t *cd)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
int j;
|
||||
pmix_notify_caddy_t *pk;
|
||||
int idx;
|
||||
time_t etime;
|
||||
|
||||
/* add to our cache */
|
||||
rc = pmix_hotel_checkin(&pmix_globals.notifications, cd, &cd->room);
|
||||
/* if there wasn't room, then search for the longest tenured
|
||||
* occupant and evict them */
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
etime = 0;
|
||||
idx = -1;
|
||||
for (j=0; j < pmix_globals.max_events; j++) {
|
||||
pmix_hotel_knock(&pmix_globals.notifications, j, (void**)&pk);
|
||||
if (NULL == pk) {
|
||||
/* hey, there is room! */
|
||||
pmix_hotel_checkin_with_res(&pmix_globals.notifications, cd, &cd->room);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
/* check the age */
|
||||
if (0 == j) {
|
||||
etime = pk->ts;
|
||||
idx = j;
|
||||
} else {
|
||||
if (difftime(pk->ts, etime) < 0) {
|
||||
etime = pk->ts;
|
||||
idx = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 <= idx) {
|
||||
/* we found the oldest occupant - evict it */
|
||||
pmix_hotel_checkout_and_return_occupant(&pmix_globals.notifications, idx, (void**)&pk);
|
||||
PMIX_RELEASE(pk);
|
||||
rc = pmix_hotel_checkin(&pmix_globals.notifications, cd, &cd->room);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* as a client, we pass the notification to our server */
|
||||
static pmix_status_t notify_server_of_event(pmix_status_t status,
|
||||
const pmix_proc_t *source,
|
||||
@ -121,11 +166,13 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
|
||||
pmix_cb_t *cb;
|
||||
pmix_event_chain_t *chain;
|
||||
size_t n;
|
||||
pmix_notify_caddy_t *cd, *rbout;
|
||||
pmix_notify_caddy_t *cd;
|
||||
|
||||
pmix_output_verbose(2, pmix_client_globals.event_output,
|
||||
"client: notifying server %s:%d of status %s for range %s",
|
||||
"[%s:%d] client: notifying server %s:%d of status %s for range %s",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
pmix_client_globals.myserver->info->pname.nspace,
|
||||
pmix_client_globals.myserver->info->pname.rank,
|
||||
PMIx_Error_string(status), PMIx_Data_range_string(range));
|
||||
|
||||
if (PMIX_RANGE_PROC_LOCAL != range) {
|
||||
@ -172,7 +219,7 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
|
||||
/* setup for our own local callbacks */
|
||||
chain = PMIX_NEW(pmix_event_chain_t);
|
||||
chain->status = status;
|
||||
(void)strncpy(chain->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(chain->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
chain->source.rank = pmix_globals.myid.rank;
|
||||
/* we always leave space for event hdlr name and a callback object */
|
||||
chain->nallocated = ninfo + 2;
|
||||
@ -185,10 +232,10 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
|
||||
cd = PMIX_NEW(pmix_notify_caddy_t);
|
||||
cd->status = status;
|
||||
if (NULL == source) {
|
||||
(void)strncpy(cd->source.nspace, "UNDEF", PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(cd->source.nspace, "UNDEF", PMIX_MAX_NSLEN);
|
||||
cd->source.rank = PMIX_RANK_UNDEF;
|
||||
} else {
|
||||
(void)strncpy(cd->source.nspace, source->nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(cd->source.nspace, source->nspace, PMIX_MAX_NSLEN);
|
||||
cd->source.rank = source->rank;
|
||||
}
|
||||
cd->range = range;
|
||||
@ -200,28 +247,28 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
|
||||
for (n=0; n < cd->ninfo; n++) {
|
||||
PMIX_INFO_XFER(&cd->info[n], &chain->info[n]);
|
||||
}
|
||||
if (NULL != chain->targets) {
|
||||
cd->ntargets = chain->ntargets;
|
||||
PMIX_PROC_CREATE(cd->targets, cd->ntargets);
|
||||
memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t));
|
||||
}
|
||||
if (NULL != chain->affected) {
|
||||
cd->naffected = chain->naffected;
|
||||
PMIX_PROC_CREATE(cd->affected, cd->naffected);
|
||||
if (NULL == cd->affected) {
|
||||
cd->naffected = 0;
|
||||
rc = PMIX_ERR_NOMEM;
|
||||
goto cleanup;
|
||||
}
|
||||
memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t));
|
||||
}
|
||||
}
|
||||
|
||||
/* add to our cache */
|
||||
rbout = pmix_ring_buffer_push(&pmix_globals.notifications, cd);
|
||||
/* if an older event was bumped, release it */
|
||||
if (NULL != rbout) {
|
||||
PMIX_RELEASE(rbout);
|
||||
if (NULL != chain->targets) {
|
||||
cd->ntargets = chain->ntargets;
|
||||
PMIX_PROC_CREATE(cd->targets, cd->ntargets);
|
||||
memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t));
|
||||
}
|
||||
if (NULL != chain->affected) {
|
||||
cd->naffected = chain->naffected;
|
||||
PMIX_PROC_CREATE(cd->affected, cd->naffected);
|
||||
if (NULL == cd->affected) {
|
||||
cd->naffected = 0;
|
||||
rc = PMIX_ERR_NOMEM;
|
||||
goto cleanup;
|
||||
}
|
||||
memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t));
|
||||
}
|
||||
/* cache it */
|
||||
rc = notify_event_cache(cd);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
PMIX_RELEASE(cd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (PMIX_RANGE_PROC_LOCAL != range && NULL != msg) {
|
||||
@ -235,8 +282,10 @@ static pmix_status_t notify_server_of_event(pmix_status_t status,
|
||||
cb->cbdata = cbdata;
|
||||
/* send to the server */
|
||||
pmix_output_verbose(2, pmix_client_globals.event_output,
|
||||
"client: notifying server %s:%d - sending",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank);
|
||||
"[%s:%d] client: notifying server %s:%d - sending",
|
||||
pmix_globals.myid.nspace, pmix_globals.myid.rank,
|
||||
pmix_client_globals.myserver->info->pname.nspace,
|
||||
pmix_client_globals.myserver->info->pname.rank);
|
||||
PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver,
|
||||
msg, notify_event_cbfunc, cb);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
@ -306,9 +355,9 @@ static void progress_local_event_hdlr(pmix_status_t status,
|
||||
|
||||
/* save this handler's returned status */
|
||||
if (NULL != chain->evhdlr->name) {
|
||||
(void)strncpy(newinfo[cnt].key, chain->evhdlr->name, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(newinfo[cnt].key, chain->evhdlr->name, PMIX_MAX_KEYLEN);
|
||||
} else {
|
||||
(void)strncpy(newinfo[cnt].key, "UNKNOWN", PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(newinfo[cnt].key, "UNKNOWN", PMIX_MAX_KEYLEN);
|
||||
}
|
||||
newinfo[cnt].value.type = PMIX_STATUS;
|
||||
newinfo[cnt].value.data.status = status;
|
||||
@ -710,6 +759,8 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain)
|
||||
/* we still have to call their final callback */
|
||||
if (NULL != chain->final_cbfunc) {
|
||||
chain->final_cbfunc(rc, chain->final_cbdata);
|
||||
} else {
|
||||
PMIX_RELEASE(chain);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -756,17 +807,19 @@ static void local_cbfunc(pmix_status_t status, void *cbdata)
|
||||
static void _notify_client_event(int sd, short args, void *cbdata)
|
||||
{
|
||||
pmix_notify_caddy_t *cd = (pmix_notify_caddy_t*)cbdata;
|
||||
pmix_notify_caddy_t *rbout;
|
||||
pmix_regevents_info_t *reginfoptr;
|
||||
pmix_peer_events_info_t *pr;
|
||||
pmix_event_chain_t *chain;
|
||||
size_t n;
|
||||
size_t n, nleft;
|
||||
bool matched, holdcd;
|
||||
pmix_buffer_t *bfr;
|
||||
pmix_cmd_t cmd = PMIX_NOTIFY_CMD;
|
||||
pmix_status_t rc;
|
||||
pmix_list_t trk;
|
||||
pmix_namelist_t *nm;
|
||||
pmix_namespace_t *nptr, *tmp;
|
||||
pmix_range_trkr_t rngtrk;
|
||||
pmix_proc_t proc;
|
||||
|
||||
/* need to acquire the object from its originating thread */
|
||||
PMIX_ACQUIRE_OBJECT(cd);
|
||||
@ -796,11 +849,9 @@ static void _notify_client_event(int sd, short args, void *cbdata)
|
||||
* the message until all local procs have received it, or it ages to
|
||||
* the point where it gets pushed out by more recent events */
|
||||
PMIX_RETAIN(cd);
|
||||
rbout = pmix_ring_buffer_push(&pmix_globals.notifications, cd);
|
||||
|
||||
/* if an older event was bumped, release it */
|
||||
if (NULL != rbout) {
|
||||
PMIX_RELEASE(rbout);
|
||||
rc = notify_event_cache(cd);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -808,7 +859,7 @@ static void _notify_client_event(int sd, short args, void *cbdata)
|
||||
* against our registrations */
|
||||
chain = PMIX_NEW(pmix_event_chain_t);
|
||||
chain->status = cd->status;
|
||||
(void)strncpy(chain->source.nspace, cd->source.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(chain->source.nspace, cd->source.nspace, PMIX_MAX_NSLEN);
|
||||
chain->source.rank = cd->source.rank;
|
||||
/* we always leave space for a callback object and
|
||||
* the evhandler name. */
|
||||
@ -817,29 +868,52 @@ static void _notify_client_event(int sd, short args, void *cbdata)
|
||||
/* prep the chain for processing */
|
||||
pmix_prep_event_chain(chain, cd->info, cd->ninfo, true);
|
||||
|
||||
if (0 < cd->ninfo) {
|
||||
/* copy setup to the cd object */
|
||||
cd->nondefault = chain->nondefault;
|
||||
if (NULL != chain->targets) {
|
||||
cd->ntargets = chain->ntargets;
|
||||
PMIX_PROC_CREATE(cd->targets, cd->ntargets);
|
||||
memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t));
|
||||
}
|
||||
if (NULL != chain->affected) {
|
||||
cd->naffected = chain->naffected;
|
||||
PMIX_PROC_CREATE(cd->affected, cd->naffected);
|
||||
if (NULL == cd->affected) {
|
||||
cd->naffected = 0;
|
||||
/* notify the caller */
|
||||
if (NULL != cd->cbfunc) {
|
||||
cd->cbfunc(PMIX_ERR_NOMEM, cd->cbdata);
|
||||
/* copy setup to the cd object */
|
||||
cd->nondefault = chain->nondefault;
|
||||
if (NULL != chain->targets) {
|
||||
cd->ntargets = chain->ntargets;
|
||||
PMIX_PROC_CREATE(cd->targets, cd->ntargets);
|
||||
memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t));
|
||||
/* compute the number of targets that need to be notified */
|
||||
nleft = 0;
|
||||
for (n=0; n < cd->ntargets; n++) {
|
||||
/* if this is a single proc, then increment by one */
|
||||
if (PMIX_RANK_VALID >= cd->targets[n].rank) {
|
||||
++nleft;
|
||||
} else {
|
||||
/* look up the nspace for this proc */
|
||||
nptr = NULL;
|
||||
PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) {
|
||||
if (PMIX_CHECK_NSPACE(tmp->nspace, cd->targets[n].nspace)) {
|
||||
nptr = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
PMIX_RELEASE(cd);
|
||||
PMIX_RELEASE(chain);
|
||||
return;
|
||||
/* if we don't yet know it, then nothing to do */
|
||||
if (NULL == nptr) {
|
||||
nleft = SIZE_MAX;
|
||||
break;
|
||||
}
|
||||
/* might notify all local members */
|
||||
nleft += nptr->nlocalprocs;
|
||||
}
|
||||
memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t));
|
||||
}
|
||||
cd->nleft = nleft;
|
||||
}
|
||||
if (NULL != chain->affected) {
|
||||
cd->naffected = chain->naffected;
|
||||
PMIX_PROC_CREATE(cd->affected, cd->naffected);
|
||||
if (NULL == cd->affected) {
|
||||
cd->naffected = 0;
|
||||
/* notify the caller */
|
||||
if (NULL != cd->cbfunc) {
|
||||
cd->cbfunc(PMIX_ERR_NOMEM, cd->cbdata);
|
||||
}
|
||||
PMIX_RELEASE(cd);
|
||||
PMIX_RELEASE(chain);
|
||||
return;
|
||||
}
|
||||
memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t));
|
||||
}
|
||||
|
||||
/* if they provided a PMIX_EVENT_CUSTOM_RANGE info object but
|
||||
@ -856,10 +930,11 @@ static void _notify_client_event(int sd, short args, void *cbdata)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
holdcd = false;
|
||||
if (PMIX_RANGE_PROC_LOCAL != cd->range) {
|
||||
PMIX_CONSTRUCT(&trk, pmix_list_t);
|
||||
rngtrk.procs = NULL;
|
||||
rngtrk.nprocs = 0;
|
||||
/* cycle across our registered events and send the message to
|
||||
* any client who registered for it */
|
||||
PMIX_LIST_FOREACH(reginfoptr, &pmix_server_globals.events, pmix_regevents_info_t) {
|
||||
@ -883,18 +958,33 @@ static void _notify_client_event(int sd, short args, void *cbdata)
|
||||
if (matched) {
|
||||
continue;
|
||||
}
|
||||
/* if we were given specific targets, check if this is one */
|
||||
/* check if the affected procs (if given) match those they
|
||||
* wanted to know about */
|
||||
if (!pmix_notify_check_affected(cd->affected, cd->naffected,
|
||||
pr->affected, pr->naffected)) {
|
||||
continue;
|
||||
}
|
||||
/* check the range */
|
||||
if (NULL == cd->targets) {
|
||||
rngtrk.procs = &cd->source;
|
||||
rngtrk.nprocs = 1;
|
||||
} else {
|
||||
rngtrk.procs = cd->targets;
|
||||
rngtrk.nprocs = cd->ntargets;
|
||||
}
|
||||
rngtrk.range = cd->range;
|
||||
PMIX_LOAD_PROCID(&proc, pr->peer->info->pname.nspace, pr->peer->info->pname.rank);
|
||||
if (!pmix_notify_check_range(&rngtrk, &proc)) {
|
||||
continue;
|
||||
}
|
||||
if (NULL != cd->targets) {
|
||||
matched = false;
|
||||
for (n=0; n < cd->ntargets; n++) {
|
||||
if (PMIX_CHECK_PROCID(&pr->peer->info->pname, &cd->targets[n])) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
/* do not notify this one */
|
||||
continue;
|
||||
/* track the number of targets we have left to notify */
|
||||
--cd->nleft;
|
||||
/* if the event was cached and this is the last one,
|
||||
* then evict this event from the cache */
|
||||
if (0 == cd->nleft) {
|
||||
pmix_hotel_checkout(&pmix_globals.notifications, cd->room);
|
||||
PMIX_RELEASE(cd);
|
||||
}
|
||||
}
|
||||
pmix_output_verbose(2, pmix_server_globals.event_output,
|
||||
@ -950,15 +1040,17 @@ static void _notify_client_event(int sd, short args, void *cbdata)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
PMIX_SERVER_QUEUE_REPLY(pr->peer, 0, bfr);
|
||||
PMIX_SERVER_QUEUE_REPLY(rc, pr->peer, 0, bfr);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_RELEASE(bfr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PMIX_LIST_DESTRUCT(&trk);
|
||||
if (PMIX_RANGE_LOCAL != cd->range && PMIX_CHECK_PROCID(&cd->source, &pmix_globals.myid)) {
|
||||
/* if we are the source, then we need to post this upwards as
|
||||
* well so the host RM can broadcast it as necessary - we rely
|
||||
* on the host RM to _not_ deliver this back to us! */
|
||||
* well so the host RM can broadcast it as necessary */
|
||||
if (NULL != pmix_host_server.notify_event) {
|
||||
/* mark that we sent it upstairs so we don't release
|
||||
* the caddy until we return from the host RM */
|
||||
@ -1002,23 +1094,27 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status,
|
||||
"pmix_server: notify client of event %s",
|
||||
PMIx_Error_string(status));
|
||||
|
||||
/* check for prior processing */
|
||||
if (NULL != info && PMIX_CHECK_KEY(&info[ninfo], PMIX_SERVER_INTERNAL_NOTIFY)) {
|
||||
return PMIX_OPERATION_SUCCEEDED;
|
||||
if (NULL != info) {
|
||||
for (n=0; n < ninfo; n++) {
|
||||
if (PMIX_CHECK_KEY(&info[n], PMIX_EVENT_PROXY) &&
|
||||
PMIX_CHECK_PROCID(info[n].value.data.proc, &pmix_globals.myid)) {
|
||||
return PMIX_OPERATION_SUCCEEDED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cd = PMIX_NEW(pmix_notify_caddy_t);
|
||||
cd->status = status;
|
||||
if (NULL == source) {
|
||||
(void)strncpy(cd->source.nspace, "UNDEF", PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(cd->source.nspace, "UNDEF", PMIX_MAX_NSLEN);
|
||||
cd->source.rank = PMIX_RANK_UNDEF;
|
||||
} else {
|
||||
(void)strncpy(cd->source.nspace, source->nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(cd->source.nspace, source->nspace, PMIX_MAX_NSLEN);
|
||||
cd->source.rank = source->rank;
|
||||
}
|
||||
cd->range = range;
|
||||
/* have to copy the info to preserve it for future when cached */
|
||||
if (0 < ninfo) {
|
||||
if (0 < ninfo && NULL != info) {
|
||||
cd->ninfo = ninfo;
|
||||
PMIX_INFO_CREATE(cd->info, cd->ninfo);
|
||||
/* need to copy the info */
|
||||
@ -1053,37 +1149,34 @@ bool pmix_notify_check_range(pmix_range_trkr_t *rng,
|
||||
return true;
|
||||
}
|
||||
if (PMIX_RANGE_NAMESPACE == rng->range) {
|
||||
if (0 == strncmp(pmix_globals.myid.nspace, proc->nspace, PMIX_MAX_NSLEN)) {
|
||||
return true;
|
||||
for (n=0; n < rng->nprocs; n++) {
|
||||
if (PMIX_CHECK_NSPACE(rng->procs[n].nspace, proc->nspace)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (PMIX_RANGE_PROC_LOCAL == rng->range) {
|
||||
if (0 == strncmp(pmix_globals.myid.nspace, proc->nspace, PMIX_MAX_NSLEN) &&
|
||||
pmix_globals.myid.rank == proc->rank) {
|
||||
return true;
|
||||
for (n=0; n < rng->nprocs; n++) {
|
||||
if (PMIX_CHECK_PROCID(&rng->procs[n], proc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (PMIX_RANGE_CUSTOM == rng->range) {
|
||||
if (NULL != rng->procs) {
|
||||
/* see if this proc was included */
|
||||
for (n=0; n < rng->nprocs; n++) {
|
||||
if (0 != strncmp(rng->procs[n].nspace, proc->nspace, PMIX_MAX_NSLEN)) {
|
||||
continue;
|
||||
}
|
||||
if (PMIX_RANK_WILDCARD == rng->procs[n].rank ||
|
||||
rng->procs[n].rank == proc->rank) {
|
||||
return true;
|
||||
}
|
||||
/* see if this proc was included */
|
||||
for (n=0; n < rng->nprocs; n++) {
|
||||
if (0 != strncmp(rng->procs[n].nspace, proc->nspace, PMIX_MAX_NSLEN)) {
|
||||
continue;
|
||||
}
|
||||
if (PMIX_RANK_WILDCARD == rng->procs[n].rank ||
|
||||
rng->procs[n].rank == proc->rank) {
|
||||
return true;
|
||||
}
|
||||
/* if we get here, then this proc isn't in range */
|
||||
return false;
|
||||
} else {
|
||||
/* if they didn't give us a list, then assume
|
||||
* everyone included */
|
||||
return true;
|
||||
}
|
||||
/* if we get here, then this proc isn't in range */
|
||||
return false;
|
||||
}
|
||||
|
||||
/* if it is anything else, then reject it */
|
||||
@ -1106,12 +1199,7 @@ bool pmix_notify_check_affected(pmix_proc_t *interested, size_t ninterested,
|
||||
/* check if the two overlap */
|
||||
for (n=0; n < naffected; n++) {
|
||||
for (m=0; m < ninterested; m++) {
|
||||
if (0 != strncmp(affected[n].nspace, interested[m].nspace, PMIX_MAX_NSLEN)) {
|
||||
continue;
|
||||
}
|
||||
if (PMIX_RANK_WILDCARD == interested[m].rank ||
|
||||
PMIX_RANK_WILDCARD == affected[n].rank ||
|
||||
affected[n].rank == interested[m].rank) {
|
||||
if (PMIX_CHECK_PROCID(&affected[n], &interested[m])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017-2018 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -95,7 +95,11 @@ static void regevents_cbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr,
|
||||
PMIX_BFROPS_UNPACK(rc, peer, buf, &ret, &cnt, PMIX_STATUS);
|
||||
if ((PMIX_SUCCESS != rc) ||
|
||||
(PMIX_SUCCESS != ret)) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
} else {
|
||||
PMIX_ERROR_LOG(ret);
|
||||
}
|
||||
/* remove the err handler and call the error handler reg completion callback fn.*/
|
||||
if (NULL == rb->list) {
|
||||
if (NULL != rb->hdlr) {
|
||||
@ -293,11 +297,7 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer)
|
||||
PMIX_INFO_CREATE(cd2->info, cd2->ninfo);
|
||||
n=0;
|
||||
PMIX_LIST_FOREACH(ixfer, xfer, pmix_info_caddy_t) {
|
||||
(void)strncpy(cd2->info[n].key, ixfer->info[n].key, PMIX_MAX_KEYLEN);
|
||||
PMIX_BFROPS_VALUE_LOAD(pmix_client_globals.myserver,
|
||||
&cd2->info[n].value,
|
||||
&ixfer->info[n].value.data,
|
||||
ixfer->info[n].value.type);
|
||||
PMIX_INFO_XFER(&cd2->info[n], ixfer->info);
|
||||
++n;
|
||||
}
|
||||
}
|
||||
@ -333,16 +333,17 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer)
|
||||
NULL != pmix_host_server.register_events) {
|
||||
pmix_output_verbose(2, pmix_client_globals.event_output,
|
||||
"pmix: _add_hdlr registering with server");
|
||||
if (PMIX_SUCCESS != (rc = pmix_host_server.register_events(cd->codes, cd->ncodes,
|
||||
cd2->info, cd2->ninfo,
|
||||
reg_cbfunc, cd2))) {
|
||||
rc = pmix_host_server.register_events(cd->codes, cd->ncodes,
|
||||
cd2->info, cd2->ninfo,
|
||||
reg_cbfunc, cd2);
|
||||
if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) {
|
||||
if (NULL != cd2->info) {
|
||||
PMIX_INFO_FREE(cd2->info, cd2->ninfo);
|
||||
}
|
||||
PMIX_RELEASE(cd2);
|
||||
return rc;
|
||||
}
|
||||
return PMIX_ERR_WOULD_BLOCK;
|
||||
return PMIX_SUCCESS;
|
||||
} else {
|
||||
if (NULL != cd2->info) {
|
||||
PMIX_INFO_FREE(cd2->info, cd2->ninfo);
|
||||
@ -355,13 +356,15 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer)
|
||||
|
||||
static void check_cached_events(pmix_rshift_caddy_t *cd)
|
||||
{
|
||||
size_t i, n;
|
||||
size_t n;
|
||||
pmix_notify_caddy_t *ncd;
|
||||
bool found, matched;
|
||||
pmix_event_chain_t *chain;
|
||||
int j;
|
||||
|
||||
for (i=0; i < (size_t)pmix_globals.notifications.size; i++) {
|
||||
if (NULL == (ncd = (pmix_notify_caddy_t*)pmix_ring_buffer_poke(&pmix_globals.notifications, i))) {
|
||||
for (j=0; j < pmix_globals.max_events; j++) {
|
||||
pmix_hotel_knock(&pmix_globals.notifications, j, (void**)&ncd);
|
||||
if (NULL == ncd) {
|
||||
continue;
|
||||
}
|
||||
found = false;
|
||||
@ -381,15 +384,11 @@ static void check_cached_events(pmix_rshift_caddy_t *cd)
|
||||
if (!found) {
|
||||
continue;
|
||||
}
|
||||
/* if we were given specific targets, check if we are one */
|
||||
/* if we were given specific targets, check if we are one */
|
||||
if (NULL != ncd->targets) {
|
||||
matched = false;
|
||||
for (n=0; n < ncd->ntargets; n++) {
|
||||
if (0 != strncmp(pmix_globals.myid.nspace, ncd->targets[n].nspace, PMIX_MAX_NSLEN)) {
|
||||
continue;
|
||||
}
|
||||
if (PMIX_RANK_WILDCARD == ncd->targets[n].rank ||
|
||||
pmix_globals.myid.rank == ncd->targets[n].rank) {
|
||||
if (PMIX_CHECK_PROCID(&pmix_globals.myid, &ncd->targets[n])) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
@ -407,7 +406,7 @@ static void check_cached_events(pmix_rshift_caddy_t *cd)
|
||||
/* create the chain */
|
||||
chain = PMIX_NEW(pmix_event_chain_t);
|
||||
chain->status = ncd->status;
|
||||
(void)strncpy(chain->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(chain->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
|
||||
chain->source.rank = pmix_globals.myid.rank;
|
||||
/* we always leave space for event hdlr name and a callback object */
|
||||
chain->nallocated = ncd->ninfo + 2;
|
||||
@ -439,6 +438,12 @@ static void check_cached_events(pmix_rshift_caddy_t *cd)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* check this event out of the cache since we
|
||||
* are processing it */
|
||||
pmix_hotel_checkout(&pmix_globals.notifications, ncd->room);
|
||||
/* release the storage */
|
||||
PMIX_RELEASE(ncd);
|
||||
|
||||
/* we don't want this chain to propagate, so indicate it
|
||||
* should only be run as a single-shot */
|
||||
chain->endchain = true;
|
||||
@ -493,8 +498,6 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
|
||||
}
|
||||
} else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_HDLR_NAME, PMIX_MAX_KEYLEN)) {
|
||||
name = cd->info[n].value.data.string;
|
||||
} else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_ENVIRO_LEVEL, PMIX_MAX_KEYLEN)) {
|
||||
cd->enviro = PMIX_INFO_TRUE(&cd->info[n]);
|
||||
} else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) {
|
||||
cbobject = cd->info[n].value.data.ptr;
|
||||
} else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_HDLR_FIRST_IN_CATEGORY, PMIX_MAX_KEYLEN)) {
|
||||
@ -519,17 +522,34 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
|
||||
} else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_AFFECTED_PROC, PMIX_MAX_KEYLEN)) {
|
||||
cd->affected = cd->info[n].value.data.proc;
|
||||
cd->naffected = 1;
|
||||
ixfer = PMIX_NEW(pmix_info_caddy_t);
|
||||
ixfer->info = &cd->info[n];
|
||||
ixfer->ninfo = 1;
|
||||
pmix_list_append(&xfer, &ixfer->super);
|
||||
} else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_AFFECTED_PROCS, PMIX_MAX_KEYLEN)) {
|
||||
cd->affected = (pmix_proc_t*)cd->info[n].value.data.darray->array;
|
||||
cd->naffected = cd->info[n].value.data.darray->size;
|
||||
ixfer = PMIX_NEW(pmix_info_caddy_t);
|
||||
ixfer->info = &cd->info[n];
|
||||
ixfer->ninfo = 1;
|
||||
pmix_list_append(&xfer, &ixfer->super);
|
||||
} else {
|
||||
ixfer = PMIX_NEW(pmix_info_caddy_t);
|
||||
ixfer->info = &cd->info[n];
|
||||
ixfer->ninfo = 1;
|
||||
pmix_list_append(&xfer, &ixfer->super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* check the codes for system events */
|
||||
for (n=0; n < cd->ncodes; n++) {
|
||||
if (PMIX_SYSTEM_EVENT(cd->codes[n])) {
|
||||
cd->enviro = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if they indicated this is to be the "first" or "last" event, then
|
||||
* first check to ensure they didn't already direct some
|
||||
* other event into the same cherished position */
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016-2019 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -22,7 +22,7 @@
|
||||
#include <pmix_common.h>
|
||||
|
||||
#if PMIX_HAVE_HWLOC
|
||||
#include <hwloc.h>
|
||||
#include PMIX_HWLOC_HEADER
|
||||
|
||||
#if HWLOC_API_VERSION < 0x00010b00
|
||||
#define HWLOC_OBJ_NUMANODE HWLOC_OBJ_NODE
|
||||
|
@ -82,7 +82,7 @@ static int set_flags(hwloc_topology_t topo, unsigned int flags)
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
#endif // have_hwloc
|
||||
|
||||
pmix_status_t pmix_hwloc_get_topology(pmix_info_t *info, size_t ninfo)
|
||||
{
|
||||
@ -493,7 +493,7 @@ pmix_status_t pmix_hwloc_get_topology(pmix_info_t *info, size_t ninfo)
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
#else // PMIX_HAVE_HWLOC
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
return PMIX_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2017 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
@ -41,7 +41,8 @@ headers += \
|
||||
include/pmix_config_top.h \
|
||||
include/pmix_config_bottom.h \
|
||||
include/pmix_portable_platform.h \
|
||||
include/frameworks.h
|
||||
include/frameworks.h \
|
||||
include/pmix_stdatomic.h
|
||||
|
||||
endif ! PMIX_EMBEDDED_MODE
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -573,4 +573,5 @@ typedef PMIX_PTRDIFF_TYPE ptrdiff_t;
|
||||
#undef HAVE_CONFIG_H
|
||||
|
||||
#endif /* PMIX_BUILDING */
|
||||
|
||||
#endif /* PMIX_CONFIG_BOTTOM_H */
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2015 Artem Y. Polyakov <artpol84@gmail.com>.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
@ -96,7 +96,7 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_cleanup_dir_t,
|
||||
pmix_list_item_t,
|
||||
cdcon, cddes);
|
||||
|
||||
static void nscon(pmix_nspace_t *p)
|
||||
static void nscon(pmix_namespace_t *p)
|
||||
{
|
||||
p->nspace = NULL;
|
||||
p->nprocs = 0;
|
||||
@ -113,7 +113,7 @@ static void nscon(pmix_nspace_t *p)
|
||||
PMIX_CONSTRUCT(&p->epilog.ignores, pmix_list_t);
|
||||
PMIX_CONSTRUCT(&p->setup_data, pmix_list_t);
|
||||
}
|
||||
static void nsdes(pmix_nspace_t *p)
|
||||
static void nsdes(pmix_namespace_t *p)
|
||||
{
|
||||
if (NULL != p->nspace) {
|
||||
free(p->nspace);
|
||||
@ -130,7 +130,7 @@ static void nsdes(pmix_nspace_t *p)
|
||||
PMIX_LIST_DESTRUCT(&p->epilog.ignores);
|
||||
PMIX_LIST_DESTRUCT(&p->setup_data);
|
||||
}
|
||||
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_nspace_t,
|
||||
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_namespace_t,
|
||||
pmix_list_item_t,
|
||||
nscon, nsdes);
|
||||
|
||||
@ -238,6 +238,9 @@ static void iofreqdes(pmix_iof_req_t *p)
|
||||
if (NULL != p->peer) {
|
||||
PMIX_RELEASE(p->peer);
|
||||
}
|
||||
if (NULL != p->pname.nspace) {
|
||||
free(p->pname.nspace);
|
||||
}
|
||||
}
|
||||
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_iof_req_t,
|
||||
pmix_list_item_t,
|
||||
@ -344,6 +347,8 @@ static void qdes(pmix_query_caddy_t *p)
|
||||
{
|
||||
PMIX_DESTRUCT_LOCK(&p->lock);
|
||||
PMIX_BYTE_OBJECT_DESTRUCT(&p->bo);
|
||||
PMIX_PROC_FREE(p->targets, p->ntargets);
|
||||
PMIX_INFO_FREE(p->info, p->ninfo);
|
||||
}
|
||||
PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_query_caddy_t,
|
||||
pmix_object_t,
|
||||
@ -355,32 +360,38 @@ void pmix_execute_epilog(pmix_epilog_t *epi)
|
||||
pmix_cleanup_dir_t *cd, *cdnext;
|
||||
struct stat statbuf;
|
||||
int rc;
|
||||
char **tmp;
|
||||
size_t n;
|
||||
|
||||
/* start with any specified files */
|
||||
PMIX_LIST_FOREACH_SAFE(cf, cfnext, &epi->cleanup_files, pmix_cleanup_file_t) {
|
||||
/* check the effective uid/gid of the file and ensure it
|
||||
* matches that of the peer - we do this to provide at least
|
||||
* some minimum level of protection */
|
||||
rc = stat(cf->path, &statbuf);
|
||||
if (0 != rc) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"File %s failed to stat: %d", cf->path, rc);
|
||||
continue;
|
||||
}
|
||||
if (statbuf.st_uid != epi->uid ||
|
||||
statbuf.st_gid != epi->gid) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"File %s uid/gid doesn't match: uid %lu(%lu) gid %lu(%lu)",
|
||||
cf->path,
|
||||
(unsigned long)statbuf.st_uid, (unsigned long)epi->uid,
|
||||
(unsigned long)statbuf.st_gid, (unsigned long)epi->gid);
|
||||
continue;
|
||||
}
|
||||
rc = unlink(cf->path);
|
||||
if (0 != rc) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"File %s failed to unlink: %d", cf->path, rc);
|
||||
tmp = pmix_argv_split(cf->path, ',');
|
||||
for (n=0; NULL != tmp[n]; n++) {
|
||||
rc = stat(tmp[n], &statbuf);
|
||||
if (0 != rc) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"File %s failed to stat: %d", tmp[n], rc);
|
||||
continue;
|
||||
}
|
||||
if (statbuf.st_uid != epi->uid ||
|
||||
statbuf.st_gid != epi->gid) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"File %s uid/gid doesn't match: uid %lu(%lu) gid %lu(%lu)",
|
||||
cf->path,
|
||||
(unsigned long)statbuf.st_uid, (unsigned long)epi->uid,
|
||||
(unsigned long)statbuf.st_gid, (unsigned long)epi->gid);
|
||||
continue;
|
||||
}
|
||||
rc = unlink(tmp[n]);
|
||||
if (0 != rc) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"File %s failed to unlink: %d", tmp[n], rc);
|
||||
}
|
||||
}
|
||||
pmix_argv_free(tmp);
|
||||
pmix_list_remove_item(&epi->cleanup_files, &cf->super);
|
||||
PMIX_RELEASE(cf);
|
||||
}
|
||||
@ -390,27 +401,31 @@ void pmix_execute_epilog(pmix_epilog_t *epi)
|
||||
/* check the effective uid/gid of the file and ensure it
|
||||
* matches that of the peer - we do this to provide at least
|
||||
* some minimum level of protection */
|
||||
rc = stat(cd->path, &statbuf);
|
||||
if (0 != rc) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"Directory %s failed to stat: %d", cd->path, rc);
|
||||
continue;
|
||||
}
|
||||
if (statbuf.st_uid != epi->uid ||
|
||||
statbuf.st_gid != epi->gid) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"Directory %s uid/gid doesn't match: uid %lu(%lu) gid %lu(%lu)",
|
||||
cd->path,
|
||||
(unsigned long)statbuf.st_uid, (unsigned long)epi->uid,
|
||||
(unsigned long)statbuf.st_gid, (unsigned long)epi->gid);
|
||||
continue;
|
||||
}
|
||||
if ((statbuf.st_mode & S_IRWXU) == S_IRWXU) {
|
||||
dirpath_destroy(cd->path, cd, epi);
|
||||
} else {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"Directory %s lacks permissions", cd->path);
|
||||
tmp = pmix_argv_split(cd->path, ',');
|
||||
for (n=0; NULL != tmp[n]; n++) {
|
||||
rc = stat(tmp[n], &statbuf);
|
||||
if (0 != rc) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"Directory %s failed to stat: %d", tmp[n], rc);
|
||||
continue;
|
||||
}
|
||||
if (statbuf.st_uid != epi->uid ||
|
||||
statbuf.st_gid != epi->gid) {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"Directory %s uid/gid doesn't match: uid %lu(%lu) gid %lu(%lu)",
|
||||
cd->path,
|
||||
(unsigned long)statbuf.st_uid, (unsigned long)epi->uid,
|
||||
(unsigned long)statbuf.st_gid, (unsigned long)epi->gid);
|
||||
continue;
|
||||
}
|
||||
if ((statbuf.st_mode & S_IRWXU) == S_IRWXU) {
|
||||
dirpath_destroy(tmp[n], cd, epi);
|
||||
} else {
|
||||
pmix_output_verbose(10, pmix_globals.debug_output,
|
||||
"Directory %s lacks permissions", tmp[n]);
|
||||
}
|
||||
}
|
||||
pmix_argv_free(tmp);
|
||||
pmix_list_remove_item(&epi->cleanup_dirs, &cd->super);
|
||||
PMIX_RELEASE(cd);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include "src/class/pmix_hash_table.h"
|
||||
#include "src/class/pmix_list.h"
|
||||
#include "src/class/pmix_ring_buffer.h"
|
||||
#include "src/class/pmix_hotel.h"
|
||||
#include "src/event/pmix_event.h"
|
||||
#include "src/threads/threads.h"
|
||||
|
||||
@ -178,14 +178,14 @@ typedef struct {
|
||||
// from this nspace
|
||||
pmix_list_t setup_data; // list of pmix_kval_t containing info structs having blobs
|
||||
// for setting up the local node for this nspace/application
|
||||
} pmix_nspace_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_nspace_t);
|
||||
} pmix_namespace_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_namespace_t);
|
||||
|
||||
/* define a caddy for quickly creating a list of pmix_nspace_t
|
||||
/* define a caddy for quickly creating a list of pmix_namespace_t
|
||||
* objects for local, dedicated purposes */
|
||||
typedef struct {
|
||||
pmix_list_item_t super;
|
||||
pmix_nspace_t *ns;
|
||||
pmix_namespace_t *ns;
|
||||
} pmix_nspace_caddy_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_nspace_caddy_t);
|
||||
|
||||
@ -219,7 +219,7 @@ PMIX_CLASS_DECLARATION(pmix_info_caddy_t);
|
||||
* by the socket, not the process nspace/rank */
|
||||
typedef struct pmix_peer_t {
|
||||
pmix_object_t super;
|
||||
pmix_nspace_t *nptr; // point to the nspace object for this process
|
||||
pmix_namespace_t *nptr; // point to the nspace object for this process
|
||||
pmix_rank_info_t *info;
|
||||
pmix_proc_type_t proc_type;
|
||||
pmix_listener_protocol_t protocol;
|
||||
@ -278,6 +278,11 @@ PMIX_CLASS_DECLARATION(pmix_query_caddy_t);
|
||||
* - instanced in pmix_server_ops.c */
|
||||
typedef struct {
|
||||
pmix_list_item_t super;
|
||||
pmix_event_t ev;
|
||||
bool event_active;
|
||||
bool lost_connection; // tracker went thru lost connection procedure
|
||||
bool local; // operation is strictly local
|
||||
char *id; // string identifier for the collective
|
||||
pmix_cmd_t type;
|
||||
pmix_proc_t pname;
|
||||
bool hybrid; // true if participating procs are from more than one nspace
|
||||
@ -295,6 +300,7 @@ typedef struct {
|
||||
pmix_collect_t collect_type; // whether or not data is to be returned at completion
|
||||
pmix_modex_cbfunc_t modexcbfunc;
|
||||
pmix_op_cbfunc_t op_cbfunc;
|
||||
void *cbdata;
|
||||
} pmix_server_trkr_t;
|
||||
PMIX_CLASS_DECLARATION(pmix_server_trkr_t);
|
||||
|
||||
@ -340,6 +346,7 @@ PMIX_CLASS_DECLARATION(pmix_server_caddy_t);
|
||||
pmix_release_cbfunc_t relfn;
|
||||
pmix_hdlr_reg_cbfunc_t hdlrregcbfn;
|
||||
pmix_op_cbfunc_t opcbfn;
|
||||
pmix_modex_cbfunc_t modexcbfunc;
|
||||
} cbfunc;
|
||||
void *cbdata;
|
||||
size_t ref;
|
||||
@ -394,6 +401,11 @@ typedef struct {
|
||||
pmix_object_t super;
|
||||
pmix_event_t ev;
|
||||
pmix_lock_t lock;
|
||||
/* timestamp receipt of the notification so we
|
||||
* can evict the oldest one if we get overwhelmed */
|
||||
time_t ts;
|
||||
/* what room of the hotel they are in */
|
||||
int room;
|
||||
pmix_status_t status;
|
||||
pmix_proc_t source;
|
||||
pmix_data_range_t range;
|
||||
@ -403,6 +415,7 @@ typedef struct {
|
||||
*/
|
||||
pmix_proc_t *targets;
|
||||
size_t ntargets;
|
||||
size_t nleft; // number of targets left to be notified
|
||||
/* When generating a notification, the originator can
|
||||
* specify the range of procs affected by this event.
|
||||
* For example, when creating a JOB_TERMINATED event,
|
||||
@ -438,6 +451,8 @@ typedef struct {
|
||||
pmix_peer_t *mypeer; // my own peer object
|
||||
uid_t uid; // my effective uid
|
||||
gid_t gid; // my effective gid
|
||||
char *hostname; // my hostname
|
||||
uint32_t nodeid; // my nodeid, if given
|
||||
int pindex;
|
||||
pmix_event_base_t *evbase;
|
||||
bool external_evbase;
|
||||
@ -448,7 +463,9 @@ typedef struct {
|
||||
struct timeval event_window;
|
||||
pmix_list_t cached_events; // events waiting in the window prior to processing
|
||||
pmix_list_t iof_requests; // list of pmix_iof_req_t IOF requests
|
||||
pmix_ring_buffer_t notifications; // ring buffer of pending notifications
|
||||
int max_events; // size of the notifications hotel
|
||||
int event_eviction_time; // max time to cache notifications
|
||||
pmix_hotel_t notifications; // hotel of pending notifications
|
||||
/* processes also need a place where they can store
|
||||
* their own internal data - e.g., data provided by
|
||||
* the user via the store_internal interface, as well
|
||||
|
67
opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdatomic.h
Обычный файл
67
opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdatomic.h
Обычный файл
@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2018 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#if !defined(PMIX_STDATOMIC_H)
|
||||
#define PMIX_STDATOMIC_H
|
||||
|
||||
#include "pmix_stdint.h"
|
||||
|
||||
#if PMIX_ASSEMBLY_BUILTIN != PMIX_BUILTIN_C11
|
||||
|
||||
typedef volatile int pmix_atomic_int_t;
|
||||
typedef volatile long pmix_atomic_long_t;
|
||||
|
||||
typedef volatile int32_t pmix_atomic_int32_t;
|
||||
typedef volatile uint32_t pmix_atomic_uint32_t;
|
||||
typedef volatile int64_t pmix_atomic_int64_t;
|
||||
typedef volatile uint64_t pmix_atomic_uint64_t;
|
||||
|
||||
typedef volatile size_t pmix_atomic_size_t;
|
||||
typedef volatile ssize_t pmix_atomic_ssize_t;
|
||||
typedef volatile intptr_t pmix_atomic_intptr_t;
|
||||
typedef volatile uintptr_t pmix_atomic_uintptr_t;
|
||||
|
||||
#else /* PMIX_HAVE_C__ATOMIC */
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
typedef atomic_int pmix_atomic_int_t;
|
||||
typedef atomic_long pmix_atomic_long_t;
|
||||
|
||||
typedef _Atomic int32_t pmix_atomic_int32_t;
|
||||
typedef _Atomic uint32_t pmix_atomic_uint32_t;
|
||||
typedef _Atomic int64_t pmix_atomic_int64_t;
|
||||
typedef _Atomic uint64_t pmix_atomic_uint64_t;
|
||||
|
||||
typedef _Atomic size_t pmix_atomic_size_t;
|
||||
typedef _Atomic ssize_t pmix_atomic_ssize_t;
|
||||
typedef _Atomic intptr_t pmix_atomic_intptr_t;
|
||||
typedef _Atomic uintptr_t pmix_atomic_uintptr_t;
|
||||
|
||||
#endif /* PMIX_HAVE_C__ATOMIC */
|
||||
|
||||
#if HAVE_PMIX_INT128_T
|
||||
|
||||
/* do not use C11 atomics for __int128 if they are not lock free */
|
||||
#if PMIX_HAVE_C11_CSWAP_INT128
|
||||
|
||||
typedef _Atomic pmix_int128_t pmix_atomic_int128_t;
|
||||
|
||||
#else
|
||||
|
||||
typedef volatile pmix_int128_t pmix_atomic_int128_t;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !defined(PMIX_STDATOMIC_H) */
|
@ -14,7 +14,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -29,6 +29,8 @@
|
||||
#ifndef PMIX_STDINT_H
|
||||
#define PMIX_STDINT_H 1
|
||||
|
||||
#include "pmix_config.h"
|
||||
|
||||
/*
|
||||
* Include what we can and define what is missing.
|
||||
*/
|
||||
@ -125,3 +127,4 @@ typedef unsigned long long uintptr_t;
|
||||
#endif
|
||||
|
||||
#endif /* PMIX_STDINT_H */
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -164,12 +164,12 @@ static int process_repository_item (const char *filename, void *data)
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/* strncpy does not guarantee a \0 */
|
||||
/* pmix_strncpy does not guarantee a \0 */
|
||||
ri->ri_type[PMIX_MCA_BASE_MAX_TYPE_NAME_LEN] = '\0';
|
||||
strncpy (ri->ri_type, type, PMIX_MCA_BASE_MAX_TYPE_NAME_LEN);
|
||||
pmix_strncpy (ri->ri_type, type, PMIX_MCA_BASE_MAX_TYPE_NAME_LEN);
|
||||
|
||||
ri->ri_name[PMIX_MCA_BASE_MAX_TYPE_NAME_LEN] = '\0';
|
||||
strncpy (ri->ri_name, name, PMIX_MCA_BASE_MAX_COMPONENT_NAME_LEN);
|
||||
pmix_strncpy (ri->ri_name, name, PMIX_MCA_BASE_MAX_COMPONENT_NAME_LEN);
|
||||
|
||||
pmix_list_append (component_list, &ri->super);
|
||||
|
||||
|
@ -205,6 +205,12 @@ PMIX_EXPORT extern pmix_bfrops_globals_t pmix_bfrops_globals;
|
||||
free(tmpbuf); \
|
||||
} while (0)
|
||||
|
||||
/* for backwards compatibility */
|
||||
typedef struct pmix_info_array {
|
||||
size_t size;
|
||||
pmix_info_t *array;
|
||||
} pmix_info_array_t;
|
||||
|
||||
|
||||
/**
|
||||
* Internal struct used for holding registered bfrop functions
|
||||
@ -268,7 +274,7 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_stub_copy_payload(struct pmix_peer_t *peer
|
||||
pmix_buffer_t *src);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_stub_value_xfer(struct pmix_peer_t *peer,
|
||||
pmix_value_t *dest,
|
||||
pmix_value_t *src);
|
||||
const pmix_value_t *src);
|
||||
PMIX_EXPORT void pmix_bfrops_stub_value_load(struct pmix_peer_t *peer,
|
||||
pmix_value_t *v, void *data,
|
||||
pmix_data_type_t type);
|
||||
@ -496,9 +502,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_string(char **dest, char *src,
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_value(pmix_value_t **dest,
|
||||
pmix_value_t *src,
|
||||
pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest,
|
||||
pmix_info_array_t *src,
|
||||
pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_proc(pmix_proc_t **dest,
|
||||
pmix_proc_t *src,
|
||||
pmix_data_type_t type);
|
||||
@ -514,9 +517,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_buf(pmix_buffer_t **dest,
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_kval(pmix_kval_t **dest,
|
||||
pmix_kval_t *src,
|
||||
pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_modex(pmix_modex_data_t **dest,
|
||||
pmix_modex_data_t *src,
|
||||
pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrop_base_copy_persist(pmix_persistence_t **dest,
|
||||
pmix_persistence_t *src,
|
||||
pmix_data_type_t type);
|
||||
@ -538,10 +538,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_query(pmix_query_t **dest,
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_envar(pmix_envar_t **dest,
|
||||
pmix_envar_t *src,
|
||||
pmix_data_type_t type);
|
||||
/**** DEPRECATED ****/
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest,
|
||||
pmix_info_array_t *src,
|
||||
pmix_data_type_t type);
|
||||
|
||||
/*
|
||||
* "Standard" print functions
|
||||
@ -596,8 +592,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_status(char **output, char *pre
|
||||
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_value(char **output, char *prefix,
|
||||
pmix_value_t *src, pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_array(char **output, char *prefix,
|
||||
pmix_info_array_t *src, pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_proc(char **output, char *prefix,
|
||||
pmix_proc_t *src, pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_app(char **output, char *prefix,
|
||||
@ -608,8 +602,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_buf(char **output, char *prefix
|
||||
pmix_buffer_t *src, pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_kval(char **output, char *prefix,
|
||||
pmix_kval_t *src, pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_modex(char **output, char *prefix,
|
||||
pmix_modex_data_t *src, pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_persist(char **output, char *prefix,
|
||||
pmix_persistence_t *src, pmix_data_type_t type);
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_bo(char **output, char *prefix,
|
||||
@ -678,7 +670,7 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_value_unload(pmix_value_t *kv,
|
||||
size_t *sz);
|
||||
|
||||
PMIX_EXPORT pmix_status_t pmix_bfrops_base_value_xfer(pmix_value_t *p,
|
||||
pmix_value_t *src);
|
||||
const pmix_value_t *src);
|
||||
|
||||
PMIX_EXPORT pmix_value_cmp_t pmix_bfrops_base_value_cmp(pmix_value_t *p,
|
||||
pmix_value_t *p1);
|
||||
|
@ -236,7 +236,7 @@ pmix_status_t pmix_bfrops_base_copy_info(pmix_info_t **dest,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_info_t*)malloc(sizeof(pmix_info_t));
|
||||
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
(*dest)->flags = src->flags;
|
||||
return pmix_bfrops_base_value_xfer(&(*dest)->value, &src->value);
|
||||
}
|
||||
@ -267,7 +267,7 @@ pmix_status_t pmix_bfrops_base_copy_app(pmix_app_t **dest,
|
||||
(*dest)->ninfo = src->ninfo;
|
||||
(*dest)->info = (pmix_info_t*)malloc(src->ninfo * sizeof(pmix_info_t));
|
||||
for (j=0; j < src->ninfo; j++) {
|
||||
(void)strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN);
|
||||
pmix_value_xfer(&(*dest)->info[j].value, &src->info[j].value);
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
@ -300,32 +300,11 @@ pmix_status_t pmix_bfrops_base_copy_proc(pmix_proc_t **dest,
|
||||
if (NULL == *dest) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
(void)strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN);
|
||||
(*dest)->rank = src->rank;
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix_bfrops_base_copy_modex(pmix_modex_data_t **dest,
|
||||
pmix_modex_data_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_modex_data_t*)malloc(sizeof(pmix_modex_data_t));
|
||||
if (NULL == *dest) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
(*dest)->blob = NULL;
|
||||
(*dest)->size = 0;
|
||||
if (NULL != src->blob) {
|
||||
(*dest)->blob = (uint8_t*)malloc(src->size * sizeof(uint8_t));
|
||||
if (NULL == (*dest)->blob) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
memcpy((*dest)->blob, src->blob, src->size * sizeof(uint8_t));
|
||||
(*dest)->size = src->size;
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix_bfrop_base_copy_persist(pmix_persistence_t **dest,
|
||||
pmix_persistence_t *src,
|
||||
pmix_data_type_t type)
|
||||
@ -357,9 +336,9 @@ pmix_status_t pmix_bfrops_base_copy_pdata(pmix_pdata_t **dest,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t));
|
||||
(void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN);
|
||||
(*dest)->proc.rank = src->proc.rank;
|
||||
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
return pmix_bfrops_base_value_xfer(&(*dest)->value, &src->value);
|
||||
}
|
||||
|
||||
@ -405,7 +384,6 @@ pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest,
|
||||
pmix_buffer_t *pb, *sb;
|
||||
pmix_byte_object_t *pbo, *sbo;
|
||||
pmix_kval_t *pk, *sk;
|
||||
pmix_modex_data_t *pm, *sm;
|
||||
pmix_proc_info_t *pi, *si;
|
||||
pmix_query_t *pq, *sq;
|
||||
pmix_envar_t *pe, *se;
|
||||
@ -699,31 +677,6 @@ pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest,
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PMIX_MODEX:
|
||||
PMIX_MODEX_CREATE(p->array, src->size);
|
||||
if (NULL == p->array) {
|
||||
free(p);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
pm = (pmix_modex_data_t*)p->array;
|
||||
sm = (pmix_modex_data_t*)src->array;
|
||||
for (n=0; n < src->size; n++) {
|
||||
memcpy(&pm[n], &sm[n], sizeof(pmix_modex_data_t));
|
||||
if (NULL != sm[n].blob && 0 < sm[n].size) {
|
||||
pm[n].blob = (uint8_t*)malloc(sm[n].size);
|
||||
if (NULL == pm[n].blob) {
|
||||
PMIX_MODEX_FREE(pm, src->size);
|
||||
free(p);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
memcpy(pm[n].blob, sm[n].blob, sm[n].size);
|
||||
pm[n].size = sm[n].size;
|
||||
} else {
|
||||
pm[n].blob = NULL;
|
||||
pm[n].size = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PMIX_PERSIST:
|
||||
p->array = (pmix_persistence_t*)malloc(src->size * sizeof(pmix_persistence_t));
|
||||
if (NULL == p->array) {
|
||||
@ -876,32 +829,6 @@ pmix_status_t pmix_bfrops_base_copy_query(pmix_query_t **dest,
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest,
|
||||
pmix_info_array_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
pmix_info_t *d1, *s1;
|
||||
|
||||
*dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
|
||||
if (NULL == (*dest)) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
(*dest)->size = src->size;
|
||||
if (0 < src->size) {
|
||||
(*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t));
|
||||
if (NULL == (*dest)->array) {
|
||||
free(*dest);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
d1 = (pmix_info_t*)(*dest)->array;
|
||||
s1 = (pmix_info_t*)src->array;
|
||||
memcpy(d1, s1, src->size * sizeof(pmix_info_t));
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
/*******************/
|
||||
|
||||
pmix_status_t pmix_bfrops_base_copy_envar(pmix_envar_t **dest,
|
||||
pmix_envar_t *src,
|
||||
pmix_data_type_t type)
|
||||
|
@ -46,7 +46,7 @@ PMIX_EXPORT pmix_status_t pmix_value_unload(pmix_value_t *kv,
|
||||
}
|
||||
|
||||
PMIX_EXPORT pmix_status_t pmix_value_xfer(pmix_value_t *dest,
|
||||
pmix_value_t *src)
|
||||
const pmix_value_t *src)
|
||||
{
|
||||
return pmix_bfrops_base_value_xfer(dest, src);
|
||||
}
|
||||
@ -509,11 +509,8 @@ pmix_value_cmp_t pmix_bfrops_base_value_cmp(pmix_value_t *p,
|
||||
|
||||
/* Xfer FUNCTIONS FOR GENERIC PMIX TYPES */
|
||||
pmix_status_t pmix_bfrops_base_value_xfer(pmix_value_t *p,
|
||||
pmix_value_t *src)
|
||||
const pmix_value_t *src)
|
||||
{
|
||||
size_t n;
|
||||
pmix_info_t *p1, *s1;
|
||||
|
||||
/* copy the right field */
|
||||
p->type = src->type;
|
||||
switch (src->type) {
|
||||
@ -643,22 +640,6 @@ pmix_status_t pmix_bfrops_base_value_xfer(pmix_value_t *p,
|
||||
p->data.envar.separator = src->data.envar.separator;
|
||||
break;
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
case PMIX_INFO_ARRAY:
|
||||
p->data.array->size = src->data.array->size;
|
||||
if (0 < src->data.array->size) {
|
||||
p->data.array->array = (pmix_info_t*)malloc(src->data.array->size * sizeof(pmix_info_t));
|
||||
if (NULL == p->data.array->array) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
p1 = (pmix_info_t*)p->data.array->array;
|
||||
s1 = (pmix_info_t*)src->data.array->array;
|
||||
for (n=0; n < src->data.darray->size; n++) {
|
||||
PMIX_INFO_XFER(&p1[n], &s1[n]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
/********************/
|
||||
default:
|
||||
pmix_output(0, "PMIX-XFER-VALUE: UNSUPPORTED TYPE %d", (int)src->type);
|
||||
return PMIX_ERROR;
|
||||
|
@ -703,28 +703,6 @@ pmix_status_t pmix_bfrops_base_pack_kval(pmix_buffer_t *buffer, const void *src,
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix_bfrops_base_pack_modex(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_modex_data_t *ptr;
|
||||
int32_t i;
|
||||
int ret;
|
||||
|
||||
ptr = (pmix_modex_data_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
if( 0 < ptr[i].size){
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix_bfrops_base_pack_persist(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
@ -1007,13 +985,6 @@ pmix_status_t pmix_bfrops_base_pack_darray(pmix_buffer_t *buffer, const void *sr
|
||||
}
|
||||
break;
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
case PMIX_INFO_ARRAY:
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_array(buffer, p[i].array, p[i].size, PMIX_INFO_ARRAY))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
/********************/
|
||||
default:
|
||||
pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d",
|
||||
__FILE__, __LINE__, (int)p[i].type);
|
||||
@ -1236,17 +1207,10 @@ pmix_status_t pmix_bfrops_base_pack_val(pmix_buffer_t *buffer,
|
||||
}
|
||||
break;
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
case PMIX_INFO_ARRAY:
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_array(buffer, p->data.array, 1, PMIX_INFO_ARRAY))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
/********************/
|
||||
default:
|
||||
pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d",
|
||||
__FILE__, __LINE__, (int)p->type);
|
||||
return PMIX_ERROR;
|
||||
pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d",
|
||||
__FILE__, __LINE__, (int)p->type);
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
@ -1257,33 +1221,6 @@ pmix_status_t pmix_bfrops_base_pack_alloc_directive(pmix_buffer_t *buffer, const
|
||||
return pmix_bfrops_base_pack_byte(buffer, src, num_vals, PMIX_UINT8);
|
||||
}
|
||||
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
pmix_status_t pmix_bfrops_base_pack_array(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_info_array_t *ptr;
|
||||
int32_t i;
|
||||
pmix_status_t ret;
|
||||
|
||||
ptr = (pmix_info_array_t *) src;
|
||||
|
||||
for (i = 0; i < num_vals; ++i) {
|
||||
/* pack the size */
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
if (0 < ptr[i].size) {
|
||||
/* pack the values */
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix_bfrops_base_pack_iof_channel(pmix_buffer_t *buffer, const void *src,
|
||||
int32_t num_vals, pmix_data_type_t type)
|
||||
{
|
||||
|
@ -1021,12 +1021,6 @@ int pmix_bfrops_base_print_status(char **output, char *prefix,
|
||||
src->data.envar.separator);
|
||||
break;
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
case PMIX_INFO_ARRAY:
|
||||
rc = asprintf(output, "%sPMIX_VALUE: Data type: INFO_ARRAY\tARRAY SIZE: %ld",
|
||||
prefx, (long)src->data.array->size);
|
||||
break;
|
||||
/********************/
|
||||
default:
|
||||
rc = asprintf(output, "%sPMIX_VALUE: Data type: UNKNOWN\tValue: UNPRINTABLE", prefx);
|
||||
break;
|
||||
@ -1143,12 +1137,6 @@ int pmix_bfrops_base_print_kval(char **output, char *prefix,
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix_bfrops_base_print_modex(char **output, char *prefix,
|
||||
pmix_modex_data_t *src, pmix_data_type_t type)
|
||||
{
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
int pmix_bfrops_base_print_persist(char **output, char *prefix,
|
||||
pmix_persistence_t *src, pmix_data_type_t type)
|
||||
{
|
||||
@ -1702,37 +1690,3 @@ pmix_status_t pmix_bfrops_base_print_envar(char **output, char *prefix,
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
pmix_status_t pmix_bfrops_base_print_array(char **output, char *prefix,
|
||||
pmix_info_array_t *src, pmix_data_type_t type)
|
||||
{
|
||||
size_t j;
|
||||
char *tmp, *tmp2, *tmp3, *pfx;
|
||||
pmix_info_t *s1;
|
||||
|
||||
if (0 > asprintf(&tmp, "%sARRAY SIZE: %ld", prefix, (long)src->size)) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
if (0 > asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix)) {
|
||||
free(tmp);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
s1 = (pmix_info_t*)src->array;
|
||||
|
||||
for (j=0; j < src->size; j++) {
|
||||
pmix_bfrops_base_print_info(&tmp2, pfx, &s1[j], PMIX_INFO);
|
||||
if (0 > asprintf(&tmp3, "%s%s", tmp, tmp2)) {
|
||||
free(tmp);
|
||||
free(tmp2);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
free(tmp);
|
||||
free(tmp2);
|
||||
tmp = tmp3;
|
||||
}
|
||||
*output = tmp;
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
/********************/
|
||||
|
@ -764,21 +764,9 @@ pmix_status_t pmix_bfrops_base_unpack_val(pmix_buffer_t *buffer,
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
/**** DEPRECATED ****/
|
||||
case PMIX_INFO_ARRAY:
|
||||
/* this field is now a pointer, so we must allocate storage for it */
|
||||
val->data.array = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
|
||||
if (NULL == val->data.array) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_array(buffer, val->data.array, &m, PMIX_INFO_ARRAY))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
/********************/
|
||||
default:
|
||||
pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type);
|
||||
return PMIX_ERROR;
|
||||
pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type);
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
@ -836,7 +824,7 @@ pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest,
|
||||
if (NULL == tmp) {
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
(void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
|
||||
free(tmp);
|
||||
/* unpack the directives */
|
||||
m=1;
|
||||
@ -890,7 +878,7 @@ pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest,
|
||||
PMIX_ERROR_LOG(PMIX_ERROR);
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
(void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
|
||||
free(tmp);
|
||||
/* unpack value - since the value structure is statically-defined
|
||||
* instead of a pointer in this struct, we directly unpack it to
|
||||
@ -982,7 +970,7 @@ pmix_status_t pmix_bfrops_base_unpack_proc(pmix_buffer_t *buffer, void *dest,
|
||||
PMIX_ERROR_LOG(PMIX_ERROR);
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
(void)strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN);
|
||||
free(tmp);
|
||||
/* unpack the rank */
|
||||
m=1;
|
||||
@ -1111,38 +1099,6 @@ pmix_status_t pmix_bfrops_base_unpack_kval(pmix_buffer_t *buffer, void *dest,
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
pmix_status_t pmix_bfrops_base_unpack_modex(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_modex_data_t *ptr;
|
||||
int32_t i, n, m;
|
||||
pmix_status_t ret;
|
||||
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d modex", *num_vals);
|
||||
|
||||
ptr = (pmix_modex_data_t *) dest;
|
||||
n = *num_vals;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
memset(&ptr[i], 0, sizeof(pmix_modex_data_t));
|
||||
/* unpack the number of bytes */
|
||||
m=1;
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
if (0 < ptr[i].size) {
|
||||
ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t));
|
||||
m=ptr[i].size;
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, ptr[i].blob, &m, PMIX_UINT8))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
pmix_status_t pmix_bfrops_base_unpack_persist(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type)
|
||||
{
|
||||
@ -1539,17 +1495,6 @@ pmix_status_t pmix_bfrops_base_unpack_darray(pmix_buffer_t *buffer, void *dest,
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
/**** DEPRECATED ****/
|
||||
case PMIX_INFO_ARRAY:
|
||||
ptr[i].array = (pmix_info_array_t*)malloc(m * sizeof(pmix_info_array_t));
|
||||
if (NULL == ptr[i].array) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_array(buffer, ptr[i].array, &m, ptr[i].type))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
/********************/
|
||||
default:
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
@ -1657,37 +1602,3 @@ pmix_status_t pmix_bfrops_base_unpack_envar(pmix_buffer_t *buffer, void *dest,
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/**** DEPRECATED ****/
|
||||
pmix_status_t pmix_bfrops_base_unpack_array(pmix_buffer_t *buffer, void *dest,
|
||||
int32_t *num_vals, pmix_data_type_t type)
|
||||
{
|
||||
pmix_info_array_t *ptr;
|
||||
int32_t i, n, m;
|
||||
pmix_status_t ret;
|
||||
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: %d info arrays", *num_vals);
|
||||
|
||||
ptr = (pmix_info_array_t*) dest;
|
||||
n = *num_vals;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
|
||||
"pmix_bfrop_unpack: init array[%d]", i);
|
||||
memset(&ptr[i], 0, sizeof(pmix_info_array_t));
|
||||
/* unpack the size of this array */
|
||||
m=1;
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) {
|
||||
return ret;
|
||||
}
|
||||
if (0 < ptr[i].size) {
|
||||
ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t));
|
||||
m=ptr[i].size;
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ typedef pmix_status_t (*pmix_bfrop_print_fn_t)(char **output, char *prefix,
|
||||
* @retval PMIX_ERROR(s) An appropriate error code
|
||||
*/
|
||||
typedef pmix_status_t (*pmix_bfrop_value_xfer_fn_t)(pmix_value_t *dest,
|
||||
pmix_value_t *src);
|
||||
const pmix_value_t *src);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -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-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
@ -225,10 +225,8 @@ pmix_value_cmp_t pmix12_bfrop_value_cmp(pmix_value_t *p, pmix_value_t *p1)
|
||||
return PMIX_VALUE1_GREATER;
|
||||
}
|
||||
/* COPY FUNCTIONS FOR GENERIC PMIX TYPES */
|
||||
pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src)
|
||||
pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src)
|
||||
{
|
||||
pmix_info_t *p1, *s1;
|
||||
|
||||
/* copy the right field */
|
||||
p->type = src->type;
|
||||
switch (src->type) {
|
||||
@ -300,22 +298,7 @@ pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src)
|
||||
p->data.tv.tv_usec = src->data.tv.tv_usec;
|
||||
break;
|
||||
case PMIX_INFO_ARRAY:
|
||||
p->data.array = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t));
|
||||
if (NULL == p->data.array) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
p->data.array->size = src->data.array->size;
|
||||
if (0 < src->data.array->size) {
|
||||
p->data.array->array = (pmix_info_t*)malloc(src->data.array->size * sizeof(pmix_info_t));
|
||||
if (NULL == p->data.array->array) {
|
||||
free(p->data.array);
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
p1 = (pmix_info_t*)p->data.array->array;
|
||||
s1 = (pmix_info_t*)src->data.array->array;
|
||||
memcpy(p1, s1, src->data.array->size * sizeof(pmix_info_t));
|
||||
}
|
||||
break;
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
case PMIX_BYTE_OBJECT:
|
||||
if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) {
|
||||
p->data.bo.bytes = malloc(src->data.bo.size);
|
||||
@ -356,7 +339,7 @@ pmix_status_t pmix12_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_info_t*)malloc(sizeof(pmix_info_t));
|
||||
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
return pmix_value_xfer(&(*dest)->value, &src->value);
|
||||
}
|
||||
|
||||
@ -381,7 +364,7 @@ pmix_status_t pmix12_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
|
||||
(*dest)->ninfo = src->ninfo;
|
||||
(*dest)->info = (pmix_info_t*)malloc(src->ninfo * sizeof(pmix_info_t));
|
||||
for (j=0; j < src->ninfo; j++) {
|
||||
(void)strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN);
|
||||
pmix_value_xfer(&(*dest)->info[j].value, &src->info[j].value);
|
||||
}
|
||||
return PMIX_SUCCESS;
|
||||
@ -427,7 +410,7 @@ pmix_status_t pmix12_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src,
|
||||
if (NULL == *dest) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
(void)strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN);
|
||||
(*dest)->rank = src->rank;
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
@ -484,9 +467,9 @@ pmix_status_t pmix12_bfrop_copy_pdata(pmix_pdata_t **dest,
|
||||
pmix_data_type_t type)
|
||||
{
|
||||
*dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t));
|
||||
(void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN);
|
||||
pmix_strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN);
|
||||
(*dest)->proc.rank = src->proc.rank;
|
||||
(void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN);
|
||||
return pmix_value_xfer(&(*dest)->value, &src->value);
|
||||
}
|
||||
|
||||
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
x
Ссылка в новой задаче
Block a user