Commit f944c98d authored by Dave Goodell's avatar Dave Goodell
Browse files

Merge commit 'db40bb8a' as 'src/openpa'

parents 3a53d084 db40bb8a
OpenPA v1.0.3
Major Changes:
* Libtool shared library support for OPA, avoiding shared/static mixed linking problems on some platforms.
* The build system should now work more portably with broken/exotic shells.
* pkg-config support
* Emulated atomics can now be detected by the presence of an OPA_EXPLICIT_EMULATION #define in opa_config.h.
* PPC types are now correctly aligned to 8 bytes instead of 16 bytes.
* many more tests for "make check", fixed missing memory barriers in one test
Individual Change Summary By Developer:
balaji (2):
* Shared-library support for OPA.
* Initial draft of shared library versioning support for OPA.
buntinas (1):
* added svn:ignores
fortnern (3):
* Added tests for OPA_swap_int and OPA_swap_ptr. Other minor cleanup in the test suite.
* Added tests for queue, and fixed bugs in queue implementation. Other misc cleanup.
* Add tests for OPA_LL_int, OPA_SC_int, OPA_LL_ptr and OPA_SC_ptr (skipped test 4 from plan).
goodell (16):
* Fix const usage in OPA_load_xxx
* Change PPC type sizes back to 8-bytes.
* Add pkg-config support.
* Add configure check for stddef.h, fixes ticket #15.
* AC_DEFINE OPA_EXPLICIT_EMULATION upon --with-atomic-primitives=no
* remove nonsense "bit" word in configure message
* fix AX_PREFIX_CONFIG_H to work with dash
* redo r113 with printf to be more portable
* fix AX_PREFIX_CONFIG sed issue with AS_ECHO this time
* include VERSION in EXTRA_DIST to avoid "make distcheck" errors
* add "color-tests" option for automake
* use "silent rules" by default, like other MPICH2 projects
* ensure that config.status has a dependency on the VERSION file
* make the age=0 field explicit in the VERSION file
* update CHANGELOG, etc. for the upcoming 1.0.3 release
* add missing memory barriers to test_primitive.c's stack tests
jayesh (1):
* Fixing the type casts of atomic func params for 64-bit builds on windows
OpenPA v1.0.2
Major Changes:
* Add support for 64-bit PPC.
* Static initializer macros for OPA types.
Individual Change Summary By Developer:
balaji (1):
* Fix pthread_mutex usage for inter-process shared memory regions.
buntinas (1):
* added OPA typedef for pthread_mutex_t
fortnern (4):
* Add more tests for compare-and-swap.
* Add integer compare-and-swap fairness test.
* Add pointer version of compare-and-swap fairness test.
* Added configure test for pthread_yield.
goodell (6):
* Fix bad include guard in the opa_by_lock.h header.
* Add new "unsafe" primitives. Also minor updates to the docs.
* Add support for 64-bit PPC.
* Update README to reflect 64-bit PPC support.
* Add static initializer macros for OPA_int_t/OPA_ptr_t.
* Actually include the COPYRIGHT and CHANGELOG files in the distribution.
jayesh (1):
* Fixed compiler warnings in NT intrinsics. Now type casting the arguments to NT intrinsics correctly
OpenPA v1.0.1
Major Changes:
* Fix for x86/x86_64 machines that don't support SSE2 and therefore lfence/mfence.
* Fix major bug in SC on PPC. Fixes ticket #8.
Individual Change Summary By Developer:
buntinas (2):
* Work around PGI compiler bug by rearranging input parameters
* check for pre-Pentium 4 machines which don't support mfence and lfence
fortnern (2):
* Add/improve tests for fetch_and_{incr,decr}_int and fetch_and_add_int.
* Add some tests for OPA_cas_int. Also fix a bug in the fetch and * tests.
goodell (6):
* Remove erroneous "C" mode from some emacs modelines.
* Fix Darius' email address in the COPYRIGHT file.
* Update the README version number to match
* Add an "all-executable" target to support parallel make in MPICH2.
* Fix major bug in SC on PPC. Fixes ticket #8.
* Add new header files to the appropriate automake variables.
OpenPA v1.0.0
* This is the initial release of OpenPA.
* support for GCC + x86/x86_64
* support for GCC + IA64
* support for GCC intrinsic atomic operations
* support for GCC + PPC450 (IBM Blue Gene/P compute nodes)
* support for GCC + MIPS (specifically, SiCortex compute nodes)
* support for SUN Solaris' atomic operations library
* support for Windows NT intrinsic atomic operations
* Includes a partially completed test suite covering a substantial portion of the API.
The following is a notice of limited availability of the code, and disclaimer
which must be included in the prologue of the code and in all source listings
of the code.
Copyright Notice
+ 2008 University of Chicago
Permission is hereby granted to use, reproduce, prepare derivative works, and
to redistribute to others. This software was authored by:
Argonne National Laboratory Group
D. Goodell: (630) 252-6082; FAX: (630) 252-5986; e-mail:
D. Buntinas: (630) 252-7928; FAX: (630) 252-5986; e-mail:
Mathematics and Computer Science Division
Argonne National Laboratory, Argonne IL 60439
Portions of this material resulted from work developed under a U.S.
Government Contract and are subject to the following license: the Government
is granted for itself and others acting on its behalf a paid-up, nonexclusive,
irrevocable worldwide license in this computer software to reproduce, prepare
derivative works, and perform publicly and display publicly.
This computer code material was prepared, in part, as an account of work
sponsored by an agency of the United States Government. Neither the United
States, nor the University of Chicago, nor any of their employees, makes any
warranty express or implied, or assumes any legal liability or responsibility
for the accuracy, completeness, or usefulness of any information, apparatus,
product, or process disclosed, or represents that its use would not infringe
privately owned rights.
# -*- Mode: c-basic-offset:4 ; indent-tabs-mode:nil ; -*-
# (C) 2008 by Argonne National Laboratory.
# See COPYRIGHT in top-level directory.
SUBDIRS = src test
noinst_DATA = README
# opa_config.h was generated by the AX_PREFIX_CONFIG_H macro in
DISTCLEANFILES = _configs.sed
# files that automake doesn't know about by default that should be included in
# the distribution
# uses the highlight utility to color code the test output
$(MAKE) check | highlight --color=green 'PASS(ED)?' \
| highlight --color=red 'FAIL(ED)?' \
| highlight --color=yellow 'WARN(ING)?' \
| highlight --color=cyan -- '-SKIP-'
# This target exists to smooth the integration with MPICH2's upcoming build
# system changes to support parallel make (i.e. "make -j 4"). It serves no
# other purpose, but should _not_ be removed unless you know what you are doing.
# pkgconfig files
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = openpa.pc
$(pkgconfig_DATA): config.status
# make MPICH2 happy
.PHONY: prettycheck all-executable coverage
OpenPA v1.0.3
The goal of this project is to provide an open source, highly-portable
library that provides atomic primitives (and related constructs) for
high performance, concurrent software. This project is a collaboration
between the Mathematics and Computer Science (MCS) division at Argonne
National Laboratory (ANL) and the HDF Group. The code was originally
derived from work on the MPICH2 project.
Project documentation and bug tracking can be found at:
If you would like to email questions or discuss topics related to OpenPA
you can send mail to
If you checked out the project from source control then you will need to
generate configure files and makefiles with
% ./
Otherwise, the build procedure is basically the same as any other
autoconfiscated software:
% ./configure [configure_args]
% make
% make install
OpenPA does support Microsoft Windows but the build system
infrastructure is unfortunately not yet in place for general use.
Supported Platforms
The following header files in the src/primitives directory support the
listed platforms:
opa_gcc_ia64.h - GCC on Intel's IA64 (Itanium) architecture
opa_gcc_intel_32_64.h - GCC (and some GCC-like compilers) on x86 and
x86_64 architectures
opa_gcc_intrinsics.h - GCC on many other platforms. These use compiler
intrinsics which are not always implemented on
every platform
opa_gcc_ppc.h - GCC and IBM's XLC on PowerPC 4xx and 970 systems.
Specifically, this supports the modified-PPC440
processor in IBM's Blue Gene/P supercomputers and most
64-bit PPC machines such as BG/P login nodes and G5
opa_gcc_sicortex.h - GCC on SiCortex machines. This is a MIPS 5K based
architecture, so it may work on similar platforms.
opa_nt_intrinsics.h - Windows support. These use compiler intrinsics
available in Microsoft's Visual Studio compiler.
opa_sun_atomic_ops.h - Solaris support. This uses Solaris' built-in
atomic operations library. Tested on a Niagara
(T5240) machine with Solaris (s10s_u4wos_12b).
We also support two pseudo-platforms:
opa_by_lock.h - Used when you specify "--with-atomic-primitives=no" or when
auto-detecting the primitive implementation and lock-based fall
back is selected. This uses pthread mutexes to emulate the
atomic behavior. This option typically has dramatically slower
performance on most platforms where native primitives are
available. You should usually only use it for testing or on
platforms where pthreads are available but no native primitives
are currently implemented. The library initialization function
*must* be called when using this primitives implementation.
opa_unsafe.h - Used when you specify "--with-atomic-primitives=unsafe". This
can be used to improve performance in code that uses OPA already
and is conditionally compiled to be single-threaded without
having to modify said code. It is also potentially useful for
meta-testing to ensure that any threading tests you might have
will catch bugs when you have a broken atomics implementation.
The OPA test suite itself fails spectacularly when compiled this
way. This header can also be used by defining the preprocessor
macro OPA_USE_UNSAFE_PRIMITIVES prior to including
Known Issues
* One known issue is that the gcc atomic intrinsics aren't supported by
compilers prior to GCC 4.1. In particular the default Mac OS X compiler is
gcc 4.0.1 so these result in a linker error when using this set of
primitives. The good news is that on OSX/Intel we use native inline
assembly anyway, so this isn't a big problem.
* The PGI compilers currently are not supported. There is at least one known
bug in the PGI compiler's handling of of inline assembly for which we are
awaiting a fix from PGI. Once a fixed version of the compiler is available
this issue should be rectified in an upcoming release.
* As mentioned earlier, Windows is supported but the build system is not
yet present.
* We've had reports of trouble with older IA64 machines running GCC 3.2.2.
Unfortunately we don't have access to a machine with this configuration so we
have been unable to debug and fix the problem. Patches and detailed bug
reports on this issue are very welcome.
# -*- Mode: c-basic-offset:4 ; indent-tabs-mode:nil ; -*-
# (C) 2008 by Argonne National Laboratory.
# See COPYRIGHT in top-level directory.
# For libtool ABI versioning rules see:
# 1. If the library source code has changed at all since the last
# update, then increment revision (`c:r:a' becomes `c:r+1:a').
# 2. If any interfaces have been added, removed, or changed since
# the last update, increment current, and set revision to 0.
# 3. If any interfaces have been added since the last public
# release, then increment age.
# 4. If any interfaces have been removed since the last public
# release, then set age to 0.
if [ -n "$MPICH2_AUTOTOOLS_DIR" ] ; then
$autoreconf ${autoreconf_args:-"-vif"} || exit 1
# ===========================================================================
# ===========================================================================
# This is a new variant from ac_prefix_config_ this one will use a
# lowercase-prefix if the config-define was starting with a
# lowercase-char, e.g. "#define const", "#define restrict", or "#define
# off_t", (and this one can live in another directory, e.g.
# testpkg/config.h therefore I decided to move the output-header to be the
# first arg)
# takes the usual config.h generated header file; looks for each of the
# generated "#define SOMEDEF" lines, and prefixes the defined name (ie.
# makes it "#define PREFIX_SOMEDEF". The result is written to the output
# config.header file. The PREFIX is converted to uppercase for the
# conversions.
# Defaults:
# Your script should contain both macros in this order, and
# unlike the earlier variations of this prefix-macro it is okay to place
# the AX_PREFIX_CONFIG_H call before the AC_OUTPUT invokation.
# Example:
# AC_INIT( # as created by "autoheader"
# AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE
# AM_CONFIG_HEADER(config.h) # prep config.h from
# AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it..
# AC_MEMORY_H # makes "#undef NEED_MEMORY_H"
# AC_C_CONST_H # makes "#undef const"
# AC_OUTPUT(Makefile) # creates the "config.h" now
# # and also mylib/_config.h
# if the argument to AX_PREFIX_CONFIG_H would have been omitted then the
# default outputfile would have been called simply "testpkg-config.h", but
# even under the name "mylib/_config.h" it contains prefix-defines like
# #define TESTPKG_VERSION "0.1.1"
# #endif
# #endif
# #ifndef _testpkg_const
# #define _testpkg_const _const
# #endif
# and this "mylib/_config.h" can be installed along with other
# header-files, which is most convenient when creating a shared library
# (that has some headers) where some functionality is dependent on the
# OS-features detected at compile-time. No need to invent some
# "" manually. :-)
# Note that some AC_DEFINEs that end up in the config.h file are actually
# self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the AC_TYPE_OFF_T
# say that they "will define inline|const|off_t if the system does not do
# it by itself". You might want to clean up about these - consider an
# extra mylib/conf.h that reads something like:
# #include <mylib/_config.h>
# #ifndef _testpkg_const
# #define _testpkg_const const
# #endif
# and then start using _testpkg_const in the header files. That is also a
# good thing to differentiate whether some library-user has starting to
# take up with a different compiler, so perhaps it could read something
# like this:
# #ifdef _MSC_VER
# #include <mylib/_msvc.h>
# #else
# #include <mylib/_config.h>
# #endif
# #ifndef _testpkg_const
# #define _testpkg_const const
# #endif
# 2008-04-12
# Copyright (c) 2008 Guido U. Draheim <>
# Copyright (c) 2008 Marten Svantesson
# Copyright (c) 2008 Gerald Point <>
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <>.
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Macro Archive. When you make and
# distribute a modified version of the Autoconf Macro, you may extend this
# special exception to the GPL to apply to your modified version as well.
_OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)`
_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
_PKG=`echo ifelse($2, , $PACKAGE, $2)`
_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
_INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'`
if test ".$_INP" = "."; then
for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
case "$ac_file" in
*.h) _INP=$ac_file ;;
test ".$_INP" != "." && break
if test ".$_INP" = "."; then
case "$_OUT" in
*/*) _INP=`basename "$_OUT"`
*-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
*) _INP=config.h
if test -z "$_PKG" ; then
if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
fi fi
AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines)
# ANL modification: the original version of the following "echo" commands
# caused problems under dash because its echo interprets an arg of |\1| as an
# a request to print the character with a numeric value of 0x01, or ^A.
# Switching to AS_ECHO fixes the problem for both dash and other shells.
if test -f $_INP ; then
AS_ECHO("s/^@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/") > _script
AS_ECHO("s/^@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/") >> _script
AS_ECHO("s/^@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\") >> _script
AS_ECHO("@%:@def[]ine $_UPP""_\\1 \\2 \\") >> _script
AS_ECHO("@%:@endif/") >>_script
AS_ECHO("s/^@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\") >> _script
AS_ECHO("@%:@define $_LOW""_\\1 \\2 \\") >> _script
AS_ECHO("@%:@endif/") >> _script
# now executing _script on _DEF input to create _OUT output file
AS_ECHO("@%:@ifndef $_DEF") >$tmp/pconfig.h
AS_ECHO("@%:@def[]ine $_DEF 1") >>$tmp/pconfig.h
AS_ECHO(' ') >>$tmp/pconfig.h
AS_ECHO("/* $_OUT. Generated automatically at end of configure. */") >>$tmp/pconfig.h
sed -f _script $_INP >>$tmp/pconfig.h
echo ' ' >>$tmp/pconfig.h
echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h
echo "@%:@endif" >>$tmp/pconfig.h
if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
AC_MSG_NOTICE([$_OUT is unchanged])
rm -f "$_OUT"
mv $tmp/pconfig.h "$_OUT"
cp _script _configs.sed
AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
rm -f conftest.*
dnl implementation note: a bug report (31.5.2005) from Marten Svantesson points
dnl out a problem where `echo "\1"` results in a Control-A. The unix standard
dnl defines all backslash-sequences to be inherently non-portable asking
dnl for replacement mit printf. Some old systems had problems with that
dnl one either. However, the latest libtool (!) release does export an $ECHO
dnl (and $echo) that does the right thing - just one question is left: what
dnl was the first version to have it? Is it greater 2.58 ?
# -*- Mode: c-basic-offset:4 ; indent-tabs-mode:nil ; -*-
# (C) 2008 by Argonne National Laboratory.
# See COPYRIGHT in top-level directory.
AC_INIT([OpenPA], [1.0.3], [])
dnl Set the directory that contains support scripts such as install-sh and
dnl config.guess. It also contains autoconf macro files.
AM_INIT_AUTOMAKE([-Wall -Werror foreign color-tests 1.12.3])
# automake 1.12 seems to require this, but automake 1.11 doesn't recognize it
# must come before LT_INIT
# Bug in libtool adds -O2 and -g by default
if test -s "$srcdir/VERSION" ; then
. $srcdir/VERSION
AC_MSG_ERROR([Version information not found. Configuration aborted.])
dnl force configure to be re-run if $top_srcdir/VERSION changes
# FIXME this header needs to end up in the installation include directory in some form,
# so we probably need to change its name to something that won't collide in the
# global namespace. [goodell@ 2009-02-19]
AH_TOP([/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
* (C) 2008 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
dnl Preps an opa_config.h with prefixed macros from config.h for output at
dnl AC_OUTPUT time. This way we can safely include opa_config.h in the