config-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UPC 19/22] libgupc - Make, Configure


From: Gary Funck
Subject: [UPC 19/22] libgupc - Make, Configure
Date: Mon, 30 Nov 2015 22:02:41 -0800
User-agent: Mutt/1.5.23 (2014-03-12)

Background
----------

An overview email, describing the UPC-related changes is here:
  https://gcc.gnu.org/ml/gcc-patches/2015-12/msg00005.html

The GUPC branch is described here:
  http://gcc.gnu.org/projects/gupc.html

The UPC-related source code differences are summarized here:
  http://gccupc.org/gupc-changes

All languages (c, c++, fortran, go, lto, objc, obj-c++) have been
bootstrapped; no test suite regressions were introduced,
relative to the GCC trunk.

If you are on the cc-list, your name was chosen either
because you are listed as a maintainer for the area that
applies to the patches described in this email, or you
were a frequent contributor of patches made to files listed
in this email.

In the change log entries included in each patch, the directory
containing the affected files is listed, followed by the files.
When the patches are applied, the change log entries will be
distributed to the appropriate ChangeLog file.

Overview
--------

The libgupc configuration and makefile related changes are shown below.
This is all new code.  Somme key files are:

configure.tgt: This implements target-specific checks.
It is called from the configure script.  It is also called from
the top-level configure script to determine whether
a particular target triple is supported.

gen-inline-libgupc.pl: A unique feature of the libgupc
runtime is that some of the runtime functions are implemented
as inline procedures which are included via a pre-include
at optimization levels above -O0.  This script scans various
runtime source files and extracts code that will be inlined.
It processes the following template files to produce the
final gcc-upc-lib.h file, based upon whether the runtime
is configured for 'smp' or 'portals4' support.

    portals4/gcc-upc-lib.in
    smp/gcc-upc-lib.in

The 'smp' runtime is the default runtime.  The 'portals4'
runtime is experimental; it supports multi-node operation
using the Portals4 communications library.

gen-upc-ld-script.pl: UPC shared variables are located
in a separate linker section.  On some target platforms,
this linker section can be designated as a "no load" section
via a special linker directives file.  This script checks
that the linker script installed on the system has a form
that will support this "no load" capability and then generates
the appropriate script.  This script is called from gcc/configure
as well to check if the "UPC link script" option can be enabled.

These files are processed by configure to create .spec files
which augment the GCC spec files when the -fupc compilation
switch is present.  Libgomp and libgo use a similar technique
for extending the GCC specs.

    libgupc.spec.in
    upc-crtbegin.spec.in
    upc-crtend.spec.in

These files control the composition of the 
upc-crtbegin*.o and upc-crtend*.o files, which
define start/end labels as needed for UPC-related
linker sections.

    upc-crtbegin.spec.in
    upc-crtend.spec.in
    config/darwin/upc-crt-config.h
    config/default/upc-crt-config.h

The following files are used as templates that are
expanded to create certain runtime source files and
standard UPC header files.  Many of these template files are
expanded only in "maintainer mode".

    collectives/
      gen-upc-coll-reduce.pl
      upc_coll_prefix_reduce.in
      upc_coll_reduce.in
    include/
      upc_ops.def
      upc_types.def
    portals4/
      gupcr_coll_reduce.in
    smp/
      upc_atomic.def
      upc_atomic.tpl

These files add support for doxygen generated internal
documentation (which is present only in the portals4 runtime).

    ax_prog_doxygen.m4
    dox-filter-config-h
    doxygen-include.am
    doxygen.sty.in
    header.tex.in
    portals4/doxygen.cfg.in

2015-11-30  Gary Funck  <address@hidden>

        libgupc/
        * Makefile.am: New.
        * Makefile.in: New.
        * acinclude.m4: New.
        * aclocal.m4: New.
        * ax_prog_doxygen.m4: New.
        * config.h.in: New.
        * configure: New.
        * configure.ac: New.
        * configure.tgt: New.
        * dox-filter-config-h: New.
        * doxygen-include.am: New.
        * doxygen.sty.in: New.
        * gen-inline-libgupc.pl: New.
        * gen-upc-ld-script.pl: New.
        * header.tex.in: New.
        * libgupc.spec.in: New.
        * upc-crtbegin.spec.in: New.
        * upc-crtend.spec.in: New.
        libgupc/collectives/
        * gen-upc-coll-reduce.pl: New.
        * upc_coll_prefix_reduce.in: New.
        * upc_coll_reduce.in: New.
        libgupc/config/darwin/
        * upc-crt-config.h: New.
        libgupc/config/default/
        * upc-crt-begin-end.h: New.
        * upc-crt-config.h: New.
        libgupc/include/
        * upc_ops.def: New.
        * upc_types.def: New.
        libgupc/portals4/
        * doxygen.cfg.in: New.
        * gcc-upc-lib.in: New.
        * gupcr_coll_reduce.in: New.
        libgupc/smp/
        * gcc-upc-lib.in: New.
        * upc_atomic.def: New.
        * upc_atomic.tpl: New.

Index: libgupc/Makefile.am
===================================================================
--- libgupc/Makefile.am (.../trunk)     (revision 0)
+++ libgupc/Makefile.am (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,404 @@
+# Process this file with automake to produce Makefile.in
+
+ WARN_CFLAGS =
+if LIBGUPC_SMP_RUNTIME
+  targ_runtime_dir = smp
+  WARN_CFLAGS += -W -Wall -Wwrite-strings -Wstrict-prototypes -Werror
+  INC_CFLAGS =
+endif
+if LIBGUPC_PORTALS4_RUNTIME
+  targ_runtime_dir = portals4
+  WARN_CFLAGS += -W -Wall -Wwrite-strings -Wstrict-prototypes -Werror
+  PORTALS4_IFLAG  = @portals4inc@
+  INC_CFLAGS = $(PORTALS4_IFLAG)
+endif
+
+ACLOCAL_AMFLAGS = -I . -I .. -I ../config
+
+## May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+
+config_path = @config_path@
+
+libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
+
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+
+LINK = $(LIBTOOL) --tag CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+        $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LTLDFLAGS) -o $@
+
+
+UPC_HDRS = include/upc_atomic.h include/upc_castable.h \
+           include/gasp.h include/gasp_upc.h include/gcc-upc.h \
+           include/pupc.h include/upc_collective.h include/upc.h \
+           include/upc_nb.h \
+           include/upc_relaxed.h include/upc_strict.h \
+           include/upc_tick.h include/upc_types.h
+
+libsubinclude_HEADERS = $(UPC_HDRS)
+nodist_noinst_HEADERS =
+nodist_libsubinclude_HEADERS =
+
+
+IN_LIB_CPPFLAGS  = -DIN_GCC -DIN_TARGET_LIBS
+AM_CPPFLAGS = $(IN_LIB_CPPFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(INC_CFLAGS)
+AM_UPCFLAGS = $(WARN_CFLAGS) $(INC_CFLAGS) -fno-strict-aliasing
+
+
+SUBDIRS = testsuite
+
+
+if LIBGUPC_GENERIC_COLLECTIVES
+  collectives_dir = $(addprefix $(top_srcdir)/, collectives)
+else
+  collectives_dir =
+endif
+
+search_path =   $(addprefix $(top_srcdir)/config/, $(config_path)) \
+                $(addprefix $(top_srcdir)/, $(targ_runtime_dir)) \
+               $(collectives_dir) \
+                $(addprefix $(top_srcdir)/, include) \
+                $(top_srcdir)
+
+vpath % $(strip $(search_path))
+
+AM_CPPFLAGS += $(addprefix -I, $(search_path))
+AM_CPPFLAGS += $(addprefix -isystem, '.')
+AM_CPPFLAGS += @bfdinc@
+AM_CFLAGS += $(XCFLAGS)
+AM_UPCFLAGS += $(XCFLAGS)
+AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
+
+### Explicit build rules
+
+LIBGUPC_SRCDIR = $(top_srcdir)/$(targ_runtime_dir)
+
+MOSTLYCLEANFILES =
+UPC_RUNTIME_SRC =
+
+EXTRA_DIST = gen-inline-libgupc.pl gen-upc-ld-script.pl
+
+LIBGUPC_COLL_SRCDIR = $(top_srcdir)/collectives
+LIBGUPC_INC_SRCDIR = $(top_srcdir)/include
+LIBGUPC_PORTALS4_SRCDIR = $(top_srcdir)/portals4
+LIBGUPC_SMP_SRCDIR = $(top_srcdir)/smp
+UPC_OPS_DEF = $(LIBGUPC_INC_SRCDIR)/upc_ops.def
+UPC_TYPES_DEF = $(LIBGUPC_INC_SRCDIR)/upc_types.def
+
+EXTRA_DIST += $(UPC_OPS_DEFS) $(UPC_TYPES_DEF)
+
+AUTOGEN = autogen
+
+UPC_BACKTRACE_SUP =
+if LIBGUPC_BACKTRACE
+if LIBGUPC_PORTALS4_RUNTIME
+    UPC_BACKTRACE_SUP += portals4/gupcr_backtrace.h portals4/gupcr_backtrace.c
+else
+    UPC_BACKTRACE_SUP += smp/upc_backtrace.h smp/upc_backtrace.c
+endif
+endif
+if LIBGUPC_SMP_RUNTIME
+
+EXTRA_DIST += smp/gcc-upc-lib.in
+
+if LIBGUPC_PTHREADS
+libgupc_pt = libgupc_pt.la
+else
+libgupc_pt =
+endif
+
+# Even though we're using vpath, we have to qualify the
+# filenames with "smp/", because the libgupc_pt.la rules
+# won't find the dependents because the name of the target
+# doesn't match (ie, upc_access.c compiles into pt_upc_access_pt.lo)
+
+if LIBGUPC_AFFINITY
+  UPC_AFFINITY_SUP = smp/upc_affinity.c
+else
+  UPC_AFFINITY_SUP = smp/upc_affinity_stub.c
+endif
+if LIBGUPC_GUM
+  UPC_GUM_SUP = smp/upc_gum.c
+else
+  UPC_GUM_SUP =
+endif
+if LIBGUPC_NUMA
+  UPC_NUMA_SUP = smp/upc_numa.c
+else
+  UPC_NUMA_SUP = smp/upc_numa_stub.c
+endif
+
+if MAINTAINER_MODE
+
+UPC_ATOMIC_DEF = $(LIBGUPC_SMP_SRCDIR)/upc_atomic.def
+UPC_ATOMIC_TPL = $(LIBGUPC_SMP_SRCDIR)/upc_atomic.tpl
+UPC_ATOMIC_UPC = $(LIBGUPC_SMP_SRCDIR)/upc_atomic.upc
+
+EXTRA_DIST += $(UPC_ATOMIC_DEF) $(UPC_ATOMIC_TPL)
+
+$(UPC_ATOMIC_UPC): $(UPC_ATOMIC_DEF) $(UPC_ATOMIC_TPL) \
+                       $(UPC_OP_DEF) $(UPC_TYPE_DEF)
+       cd $(LIBGUPC_SMP_SRCDIR); \
+       $(AUTOGEN) -L ../include upc_atomic.def
+endif
+
+UPC_RUNTIME_SRC += smp/upc_access.c smp/upc_accessg.c smp/upc_access.h \
+       smp/upc_addr.c smp/upc_affinity.h $(UPC_AFFINITY_SUP) \
+       smp/upc_allocg.upc smp/upc_alloc.upc \
+       smp/upc_atomic.upc \
+       $(UPC_BACKTRACE_SUP) \
+       smp/upc_barrier.upc smp/upc_castable.upc smp/upc_config.h \
+       smp/upc_debug.h smp/upc_debug.c \
+       smp/upc_defs.h smp/upc_gasp.c $(UPC_GUM_SUP) \
+       smp/upc_libat_lock.c smp/upc_libat_lock.h \
+       smp/upc_libg.c smp/upc_lib.h \
+       smp/upc_lock.upc smp/upc_lock.h \
+       smp/upc_lock_sup.h smp/upc_lock_sup.c \
+       smp/upc_main.c smp/upc_mem.c smp/upc_mem.h \
+       smp/upc_nb.upc smp/upc_numa.h $(UPC_NUMA_SUP) \
+       smp/upc_pgm_info.c smp/upc_pts.h smp/upc_pupc.c \
+       smp/upc_pupc.h smp/upc_sup.h smp/upc_sync.h smp/upc_sysdep.c \
+       smp/upc_sysdep.h smp/upc_tick.c smp/upc_vm.c
+
+UPC_RUNTIME_SRC_INLINE = config.h smp/upc_access.c smp/upc_access.h \
+        smp/upc_config.h smp/upc_defs.h smp/upc_mem.h smp/upc_pts.h \
+        smp/upc_sup.h smp/upc_sync.h
+
+endif   ### LIBGUPC_SMP_RUNTIME ####
+
+if LIBGUPC_PORTALS4_RUNTIME
+
+EXTRA_DIST += portals4/gcc-upc-lib.in
+
+UPC_RUNTIME_SRC += portals4/gupcr_access.c portals4/gupcr_access.h \
+       portals4/gupcr_addr.c \
+       portals4/gupcr_alloc.upc portals4/gupcr_alloc.h \
+       portals4/gupcr_atomic.upc \
+       portals4/gupcr_atomic_sup.h portals4/gupcr_atomic_sup.c \
+       $(UPC_BACKTRACE_SUP) \
+       portals4/gupcr_barrier.h portals4/gupcr_barrier.c \
+       portals4/gupcr_broadcast.h portals4/gupcr_broadcast.c \
+       portals4/gupcr_castable.upc \
+       portals4/gupcr_clock.c \
+       portals4/gupcr_coll_sup.h portals4/gupcr_coll_sup.c \
+       portals4/gupcr_config.h portals4/gupcr_defs.h \
+       portals4/gupcr_env.c portals4/gupcr_gmem.h portals4/gupcr_gmem.c \
+       portals4/gupcr_lib.h \
+       portals4/gupcr_lock.upc portals4/gupcr_lock.h \
+       portals4/gupcr_lock_sup.c portals4/gupcr_lock_sup.h \
+       portals4/gupcr_main.c \
+       portals4/gupcr_nb.upc \
+       portals4/gupcr_nb_sup.c portals4/gupcr_nb_sup.h \
+       portals4/gupcr_node.c portals4/gupcr_node.h \
+       portals4/gupcr_mem.c portals4/gupcr_portals.c \
+       portals4/gupcr_pgm_info.c portals4/gupcr_pts.h \
+       portals4/gupcr_runtime.h portals4/gupcr_runtime.c \
+       portals4/gupcr_shutdown.h portals4/gupcr_shutdown.c \
+       portals4/gupcr_sup.h portals4/gupcr_sync.h \
+       portals4/gupcr_tick.c \
+       portals4/gupcr_utils.h portals4/gupcr_utils.c
+
+UPC_RUNTIME_SRC_INLINE = config.h portals4/gupcr_access.c \
+       portals4/gupcr_access.h portals4/gupcr_config.h \
+       portals4/gupcr_defs.h portals4/gupcr_gmem.h \
+       portals4/gupcr_node.h \
+       portals4/gupcr_portals.h portals4/gupcr_pts.h \
+       portals4/gupcr_sup.h portals4/gupcr_sync.h \
+       portals4/gupcr_utils.h
+
+if LIBGUPC_NODE_LOCAL_MEM_POSIX
+  UPC_RUNTIME_SRC += portals4/gupcr_node_mem_posix.c
+endif
+if LIBGUPC_NODE_LOCAL_MEM_MMAP
+  UPC_RUNTIME_SRC += portals4/gupcr_node_mem_mmap.c
+endif
+
+include doxygen-include.am
+MOSTLYCLEANFILES += $(DX_CLEANFILES)
+EXTRA_DIST += $(DX_CONFIG)
+
+# Portals runtime only partially uses generic collectives
+
+# We need full pathnames here, because vpath won't find
+# the files if they don't exist yet.
+UPC_COLL_PREFIX_REDUCE_UPC = $(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+UPC_COLL_REDUCE_UPC = $(LIBGUPC_PORTALS4_SRCDIR)/gupcr_coll_reduce.upc
+
+if MAINTAINER_MODE
+$(UPC_COLL_PREFIX_REDUCE_UPC): gen-upc-coll-reduce.pl \
+                               upc_coll_prefix_reduce.in
+       $(PERL) $+ > $@
+
+$(UPC_COLL_REDUCE_UPC): gen-upc-coll-reduce.pl gupcr_coll_reduce.in
+       $(PERL) $+ > $@
+endif
+
+UPC_RUNTIME_SRC += \
+       portals4/upc_coll.h portals4/gupcr_coll_broadcast.upc \
+       portals4/gupcr_coll_init.upc $(UPC_COLL_REDUCE_UPC)
+
+UPC_COLLECTIVES_SRC = \
+       collectives/upc_coll_err.upc collectives/upc_coll_exchange.upc \
+       collectives/upc_coll_gather_all.upc collectives/upc_coll_gather.upc \
+       collectives/upc_coll_permute.upc $(UPC_COLL_PREFIX_REDUCE_UPC) \
+       collectives/upc_coll_scatter.upc collectives/upc_coll_sort.upc
+
+UPC_RUNTIME_SRC += $(UPC_COLLECTIVES_SRC)
+
+EXTRA_DIST += gen-upc-coll-reduce.pl \
+             upc_coll_prefix_reduce.in \
+             gupcr_coll_reduce.in
+
+endif   ### LIBGUPC_PORTALS_RUNTIME ####
+
+if LIBGUPC_GENERIC_COLLECTIVES
+
+# We need full pathnames here, because vpath won't find
+# the files if they don't exist yet.
+UPC_COLL_PREFIX_REDUCE_UPC = $(LIBGUPC_COLL_SRCDIR)/upc_coll_prefix_reduce.upc
+UPC_COLL_REDUCE_UPC = $(LIBGUPC_COLL_SRCDIR)/upc_coll_reduce.upc
+
+if MAINTAINER_MODE
+$(UPC_COLL_PREFIX_REDUCE_UPC): gen-upc-coll-reduce.pl \
+                               upc_coll_prefix_reduce.in
+       $(PERL) $+ > $@
+
+$(UPC_COLL_REDUCE_UPC): gen-upc-coll-reduce.pl upc_coll_reduce.in
+       $(PERL) $+ > $@
+endif
+
+UPC_COLLECTIVES_SRC = collectives/upc_coll_broadcast.upc \
+       collectives/upc_coll_err.upc collectives/upc_coll_exchange.upc \
+       collectives/upc_coll_gather_all.upc collectives/upc_coll_gather.upc \
+       collectives/upc_coll.h collectives/upc_coll_init.upc \
+       collectives/upc_coll_permute.upc $(UPC_COLL_PREFIX_REDUCE_UPC) \
+       $(UPC_COLL_REDUCE_UPC) collectives/upc_coll_scatter.upc \
+       collectives/upc_coll_sort.upc
+
+UPC_RUNTIME_SRC += $(UPC_COLLECTIVES_SRC)
+
+EXTRA_DIST += gen-upc-coll-reduce.pl \
+             upc_coll_prefix_reduce.in \
+             upc_coll_reduce.in
+
+endif
+
+toolexeclib_LTLIBRARIES = libgupc.la $(libgupc_pt)
+nodist_toolexeclib_HEADERS = upc-crtbegin.spec libgupc.spec upc-crtend.spec
+
+gcc-upc-lib.h: gen-inline-libgupc.pl gcc-upc-lib.in \
+               $(UPC_RUNTIME_SRC_INLINE)
+       $(PERL) $+ > $@
+
+libsubinclude_HEADERS += gcc-upc-lib.h
+
+BUILT_SOURCES = gcc-upc-lib.h
+
+if LIBGUPC_LINK_SCRIPT
+UPC_LINK_SCRIPT = gupc.ld
+$(UPC_LINK_SCRIPT): gen-upc-ld-script.pl
+       -echo "int main(){}" | $(CC) $(LDFLAGS) -Xlinker --verbose \
+       -o /dev/null -xc - | $(PERL) $+ > $@
+BUILT_SOURCES += $(UPC_LINK_SCRIPT)
+else
+UPC_LINK_SCRIPT =
+endif
+nodist_toolexeclib_HEADERS += $(UPC_LINK_SCRIPT)
+
+libgupc_la_SOURCES = $(UPC_RUNTIME_SRC)
+libgupc_version_info = -version-info $(libtool_VERSION)
+libgupc_la_LDFLAGS = $(libgupc_version_info)
+libgupc_la_LINK = $(LINK) $(libgupc_la_LDFLAGS)
+libgupc_la_LIBADD = \
+       ../libatomic/libatomic_convenience_no_lock.la
+libgupc_la_DEPENDENCIES = $(libgupc_la_LIBADD)
+
+if LIBGUPC_PTHREADS
+nodist_libgupc_pt_la_SOURCES = $(UPC_RUNTIME_SRC)
+libgupc_pt_la_LIBADD = \
+       ../libatomic/libatomic_convenience_no_lock.la
+libgupc_pt_la_DEPENDENCIES = $(libgupc_pt_la_LIBADD)
+libgupc_pt_la_CPPFLAGS = $(AM_CPPFLAGS) -DGUPCR_USE_PTHREADS=1
+libgupc_pt_la_UPCFLAGS = $(AM_UPCFLAGS) -fupc-pthreads-model-tls
+libgupc_pt_la_LINK = $(libgupc_la_LINK)
+endif
+
+if LIBGUPC_CRTSTUFF
+
+toolexeclib_DATA = @upc_crtstuff_objs@
+
+ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(UPC_CRTSTUFF_CFLAGS)
+
+crt_compile = $(CC) $(ALL_CRT_CFLAGS) $(AM_CPPFLAGS)
+
+upc_crtstuff_src = $(top_srcdir)/upc-crtstuff.c
+
+#
+# UPC related begin/end files
+# Note: at the moment, $(CRTSTUFF_T_CFLAGS*) is empty.
+# Given that upc-crtstuff.c declares only data items,
+# there is no need for options such as -fpic.
+#
+upc-crtbegin.$(OBJEXT): $(upc_crtstuff_src)
+       $(crt_compile) -DCRT_BEGIN $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+upc-crtend.$(OBJEXT): $(upc_crtstuff_src)
+       $(crt_compile) -DCRT_END $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+# upc-crtbegin and upc-crtend for shared libraries
+upc-crtbeginS.$(OBJEXT): $(upc_crtstuff_src)
+       $(crt_compile) -DCRT_BEGIN $(CRTSTUFF_T_CFLAGS_S) -c $< -o $@
+
+upc-crtendS.$(OBJEXT): $(upc_crtstuff_src)
+       $(crt_compile) -DCRT_END $(CRTSTUFF_T_CFLAGS_S) -c $< -o $@
+
+# upc-crtbegin and upc-crtend for -static links
+upc-crtbeginT.$(OBJEXT): $(upc_crtstuff_src)
+       $(crt_compile) -DCRT_BEGIN $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+upc-crtendT.$(OBJEXT): $(upc_crtstuff_src)
+       $(crt_compile) -DCRT_END $(CRTSTUFF_T_CFLAGS) -c $< -o $@
+
+endif
+
+# Automake Documentation:
+# If your package has Texinfo files in many directories, you can use the
+# variable TEXINFO_TEX to tell Automake where to find the canonical
+# `texinfo.tex' for your package. The value of this variable should be
+# the relative path from the current `Makefile.am' to `texinfo.tex'.
+TEXINFO_TEX   = ../../gcc/doc/include/texinfo.tex
+
+# Defines info, dvi, pdf and html targets
+MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include
+info_TEXINFOS = libgupc.texi
+
+# AM_CONDITIONAL on configure option --generated-files-in-srcdir
+if GENINSRC
+STAMP_GENINSRC = stamp-geninsrc
+else
+STAMP_GENINSRC =
+endif
+
+# AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO])
+if BUILD_INFO
+STAMP_BUILD_INFO = stamp-build-info
+else
+STAMP_BUILD_INFO =
+endif
+
+all-local: $(STAMP_GENINSRC)
+
+stamp-geninsrc: libgupc.info
+       cp -p $(top_builddir)/libgupc.info $(srcdir)/libgupc.info
+       @touch $@
+
+libgupc.info: $(STAMP_BUILD_INFO)
+
+stamp-build-info: libgupc.texi
+       $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -o 
libgupc.info $(srcdir)/libgupc.texi
+       @touch $@
+
+CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) libgupc.info \
+       $(nodist_toolexeclib_HEADERS) gupc.ld gcc-upc-lib.h
+MAINTAINERCLEANFILES = $(srcdir)/libgupc.info
Index: libgupc/acinclude.m4
===================================================================
--- libgupc/acinclude.m4        (.../trunk)     (revision 0)
+++ libgupc/acinclude.m4        (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,409 @@
+dnl Copyright (C) 1994-2015 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl
+dnl LIBGUPC_GCC_TLS_SUPPORTED
+dnl
+AC_DEFUN([LIBGUPC_GCC_TLS_SUPPORTED], [
+AC_CACHE_CHECK([whether the GCC __threads extension is supported.],
+               upc_cv_gcc_tls_supported,
+[SAVE_LIBS="$LIBS"
+LIBS="$LIBS -lpthread"
+AC_TRY_RUN(
+changequote(<<,>>)dnl
+<<#include <stdio.h>
+#include <stddef.h>
+#include <malloc.h>
+#include <errno.h>
+#include <pthread.h>
+
+#define NTHREADS 5
+
+pthread_t p[NTHREADS];
+
+pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+
+__thread long tlocal = 0;
+
+void *
+thread_start (void *arg)
+{
+  int id = *((int *)arg);
+  int *return_val = malloc(sizeof(int));
+  if (pthread_mutex_lock (&lock))
+    { exit (2); }
+  /* if the value is truly thread-local, this assignment
+     will yield the value 1, for each thread. If tlocal
+     is instead a process global static value then tlocal
+     will be incremented by each thread, and its final
+     value will be the number of threads. */
+  tlocal += 1;
+  if (pthread_mutex_unlock (&lock))
+    { exit (2); }
+  *return_val = tlocal;
+  return return_val;
+}
+
+int
+main()
+{
+  int i;
+  for (i = 0; i < NTHREADS; ++i)
+    {
+      int *id = (int *)malloc(sizeof(int));
+      *id = i;
+      if (pthread_create(&p[i], NULL, thread_start, id))
+        { exit (2); }
+    }
+  for (i = 0; i < NTHREADS; ++i)
+    {
+      int *rc;
+      if (pthread_join (p[i], (void **)&rc))
+        { exit (2); }
+      if (*rc != 1)
+        { exit (1); }
+    }
+  return 0;
+}
+>>,
+changequote([, ])dnl
+  [upc_cv_gcc_tls_supported="yes"],
+  [upc_cv_gcc_tls_supported="no"],
+  [upc_cv_gcc_tls_supported="no"])
+  LIBS="$SAVE_LIBS"]
+)
+dnl if test "$upc_cv_gcc_tls_supported"x = "yes"x ; then
+dnl   AC_DEFINE([HAVE_GCC_TLS_SUPPORT], 1)
+dnl fi
+])
+
+dnl ----------------------------------------------------------------------
+dnl The following (to the end of file) is copied from libgomp.
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libgfortran.
+
+dnl Check whether the target supports __sync_*_compare_and_swap.
+AC_DEFUN([LIBGUPC_CHECK_SYNC_BUILTINS], [
+  AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
+                libgupc_cv_have_sync_builtins, [
+  AC_TRY_LINK([], [int foo; (void) __sync_val_compare_and_swap(&foo, 0, 1);],
+             libgupc_cv_have_sync_builtins=yes,
+             libgupc_cv_have_sync_builtins=no)])
+  if test $libgupc_cv_have_sync_builtins = yes; then
+    AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
+             [Define to 1 if the target supports __sync_*_compare_and_swap.])
+  fi])
+
+dnl Check whether the target supports hidden visibility.
+AC_DEFUN([LIBGUPC_CHECK_ATTRIBUTE_VISIBILITY], [
+  AC_CACHE_CHECK([whether the target supports hidden visibility],
+                libgupc_cv_have_attribute_visibility, [
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -Werror"
+  AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
+                [], libgupc_cv_have_attribute_visibility=yes,
+                libgupc_cv_have_attribute_visibility=no)
+  CFLAGS="$save_CFLAGS"])
+  if test $libgupc_cv_have_attribute_visibility = yes; then
+    AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
+      [Define to 1 if the target supports __attribute__((visibility(...))).])
+  fi])
+
+dnl Check whether the target supports dllexport
+AC_DEFUN([LIBGUPC_CHECK_ATTRIBUTE_DLLEXPORT], [
+  AC_CACHE_CHECK([whether the target supports dllexport],
+                libgupc_cv_have_attribute_dllexport, [
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -Werror"
+  AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
+                [], libgupc_cv_have_attribute_dllexport=yes,
+                libgupc_cv_have_attribute_dllexport=no)
+  CFLAGS="$save_CFLAGS"])
+  if test $libgupc_cv_have_attribute_dllexport = yes; then
+    AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
+      [Define to 1 if the target supports __attribute__((dllexport)).])
+  fi])
+
+dnl Check whether the target supports symbol aliases.
+AC_DEFUN([LIBGUPC_CHECK_ATTRIBUTE_ALIAS], [
+  AC_CACHE_CHECK([whether the target supports symbol aliases],
+                libgupc_cv_have_attribute_alias, [
+  AC_TRY_LINK([
+void foo(void) { }
+extern void bar(void) __attribute__((alias("foo")));],
+    [bar();], libgupc_cv_have_attribute_alias=yes, 
libgupc_cv_have_attribute_alias=no)])
+  if test $libgupc_cv_have_attribute_alias = yes; then
+    AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
+      [Define to 1 if the target supports __attribute__((alias(...))).])
+  fi])
+
+sinclude(../libtool.m4)
+dnl The lines below arrange for aclocal not to bring an installed
+dnl libtool.m4 into aclocal.m4, while still arranging for automake to
+dnl add a definition of LIBTOOL to Makefile.in.
+ifelse(,,,[AC_SUBST(LIBTOOL)
+AC_DEFUN([AM_PROG_LIBTOOL])
+AC_DEFUN([AC_LIBTOOL_DLOPEN])
+AC_DEFUN([AC_PROG_LD])
+])
+
+dnl ----------------------------------------------------------------------
+dnl This whole bit snagged from libstdc++-v3.
+
+dnl
+dnl LIBGUPC_ENABLE
+dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
+dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
+dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
+dnl
+dnl See docs/html/17_intro/configury.html#enable for documentation.
+dnl
+m4_define([LIBGUPC_ENABLE],[dnl
+m4_define([_g_switch],[--enable-$1])dnl
+m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
+ AC_ARG_ENABLE($1,_g_help,
+  m4_bmatch([$5],
+   [^permit ],
+     [[
+      case "$enableval" in
+       m4_bpatsubst([$5],[permit ])) ;;
+       *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
+          dnl Idea for future:  generate a URL pointing to
+          dnl "onlinedocs/configopts.html#whatever"
+      esac
+     ]],
+   [^$],
+     [[
+      case "$enableval" in
+       yes|no) ;;
+       *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
+      esac
+     ]],
+   [[$5]]),
+  [enable_]m4_bpatsubst([$1],-,_)[=][$2])
+m4_undefine([_g_switch])dnl
+m4_undefine([_g_help])dnl
+])
+
+
+dnl
+dnl If GNU ld is in use, check to see if tricky linker opts can be used.  If
+dnl the native linker is in use, all variables will be defined to something
+dnl safe (like an empty string).
+dnl
+dnl Defines:
+dnl  SECTION_LDFLAGS='-Wl,--gc-sections' if possible
+dnl  OPT_LDFLAGS='-Wl,-O1' if possible
+dnl  LD (as a side effect of testing)
+dnl Sets:
+dnl  with_gnu_ld
+dnl  libgupc_ld_is_gold (possibly)
+dnl  libgupc_gnu_ld_version (possibly)
+dnl
+dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
+dnl set libgupc_gnu_ld_version to 12345.  Zeros cause problems.
+dnl
+AC_DEFUN([LIBGUPC_CHECK_LINKER_FEATURES], [
+  # If we're not using GNU ld, then there's no point in even trying these
+  # tests.  Check for that first.  We should have already tested for gld
+  # by now (in libtool), but require it now just to be safe...
+  test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
+  test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
+  AC_REQUIRE([AC_PROG_LD])
+  AC_REQUIRE([AC_PROG_AWK])
+
+  # The name set by libtool depends on the version of libtool.  Shame on us
+  # for depending on an impl detail, but c'est la vie.  Older versions used
+  # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
+  # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
+  # makes sense).  We'll test with_gnu_ld everywhere else, so if that isn't
+  # set (hence we're using an older libtool), then set it.
+  if test x${with_gnu_ld+set} != xset; then
+    if test x${ac_cv_prog_gnu_ld+set} != xset; then
+      # We got through "ac_require(ac_prog_ld)" and still not set?  Huh?
+      with_gnu_ld=no
+    else
+      with_gnu_ld=$ac_cv_prog_gnu_ld
+    fi
+  fi
+
+  # Start by getting the version number.  I think the libtool test already
+  # does some of this, but throws away the result.
+  libgupc_ld_is_gold=no
+  if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
+    libgupc_ld_is_gold=yes
+  fi
+  changequote(,)
+  ldver=`$LD --version 2>/dev/null |
+         sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld 
([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+  changequote([,])
+  libgupc_gnu_ld_version=`echo $ldver | \
+         $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
+
+  # Set --gc-sections.
+  if test "$with_gnu_ld" = "notbroken"; then
+    # GNU ld it is!  Joy and bunny rabbits!
+
+    # All these tests are for C++; save the language and the compiler flags.
+    # Need to do this so that g++ won't try to link in libstdc++
+    ac_test_CFLAGS="${CFLAGS+set}"
+    ac_save_CFLAGS="$CFLAGS"
+    CFLAGS='-x c++  -Wl,--gc-sections'
+
+    # Check for -Wl,--gc-sections
+    # XXX This test is broken at the moment, as symbols required for linking
+    # are now in libsupc++ (not built yet).  In addition, this test has
+    # cored on solaris in the past.  In addition, --gc-sections doesn't
+    # really work at the moment (keeps on discarding used sections, first
+    # .eh_frame and now some of the glibc sections for iconv).
+    # Bzzzzt.  Thanks for playing, maybe next time.
+    AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
+    AC_TRY_RUN([
+     int main(void)
+     {
+       try { throw 1; }
+       catch (...) { };
+       return 0;
+     }
+    ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
+    if test "$ac_test_CFLAGS" = set; then
+      CFLAGS="$ac_save_CFLAGS"
+    else
+      # this is the suspicious part
+      CFLAGS=''
+    fi
+    if test "$ac_sectionLDflags" = "yes"; then
+      SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+    fi
+    AC_MSG_RESULT($ac_sectionLDflags)
+  fi
+
+  # Set linker optimization flags.
+  if test x"$with_gnu_ld" = x"yes"; then
+    OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
+  fi
+
+  AC_SUBST(SECTION_LDFLAGS)
+  AC_SUBST(OPT_LDFLAGS)
+])
+
+
+dnl
+dnl Add version tags to symbols in shared library (or not), additionally
+dnl marking other symbols as private/local (or not).
+dnl
+dnl --enable-symvers=style adds a version script to the linker call when
+dnl       creating the shared library.  The choice of version script is
+dnl       controlled by 'style'.
+dnl --disable-symvers does not.
+dnl  +  Usage:  LIBGUPC_ENABLE_SYMVERS[(DEFAULT)]
+dnl       Where DEFAULT is either 'yes' or 'no'.  Passing `yes' tries to
+dnl       choose a default style based on linker characteristics.  Passing
+dnl       'no' disables versioning.
+dnl
+AC_DEFUN([LIBGUPC_ENABLE_SYMVERS], [
+
+LIBGUPC_ENABLE(symvers,yes,[=STYLE],
+  [enables symbol versioning of the shared library],
+  [permit yes|no|gnu])
+
+# If we never went through the LIBGUPC_CHECK_LINKER_FEATURES macro, then we
+# don't know enough about $LD to do tricks...
+AC_REQUIRE([LIBGUPC_CHECK_LINKER_FEATURES])
+# FIXME  The following test is too strict, in theory.
+if test $enable_shared = no ||
+        test "x$LD" = x ||
+        test x$libgupc_gnu_ld_version = x; then
+  enable_symvers=no
+fi
+
+# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
+if test $enable_symvers != no; then
+  AC_MSG_CHECKING([for shared libgcc])
+  ac_save_CFLAGS="$CFLAGS"
+  CFLAGS=' -lgcc_s'
+  AC_TRY_LINK(, [return 0;], libgupc_shared_libgcc=yes, 
libgupc_shared_libgcc=no)
+  CFLAGS="$ac_save_CFLAGS"
+  if test $libgupc_shared_libgcc = no; then
+    cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+changequote(,)dnl
+    libgupc_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+                            -shared -shared-libgcc -o conftest.so \
+                            conftest.c -v 2>&1 >/dev/null \
+                            | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
+changequote([,])dnl
+    rm -f conftest.c conftest.so
+    if test x${libgupc_libgcc_s_suffix+set} = xset; then
+      CFLAGS=" -lgcc_s$libgupc_libgcc_s_suffix"
+      AC_TRY_LINK(, [return 0;], libgupc_shared_libgcc=yes)
+      CFLAGS="$ac_save_CFLAGS"
+    fi
+  fi
+  AC_MSG_RESULT($libgupc_shared_libgcc)
+fi
+
+# For GNU ld, we need at least this version.  The format is described in
+# LIBGUPC_CHECK_LINKER_FEATURES above.
+libgupc_min_gnu_ld_version=21400
+# XXXXXXXXXXX libgupc_gnu_ld_version=21390
+
+# Check to see if unspecified "yes" value can win, given results above.
+# Change "yes" into either "no" or a style name.
+if test $enable_symvers = yes; then
+  if test $with_gnu_ld = yes &&
+     test $libgupc_shared_libgcc = yes;
+  then
+    if test $libgupc_gnu_ld_version -ge $libgupc_min_gnu_ld_version ; then
+      enable_symvers=gnu
+    elif test $libgupc_ld_is_gold = yes ; then
+      enable_symvers=gnu
+    else
+      # The right tools, the right setup, but too old.  Fallbacks?
+      AC_MSG_WARN(=== Linker version $libgupc_gnu_ld_version is too old for)
+      AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
+      AC_MSG_WARN(=== You would need to upgrade your binutils to version)
+      AC_MSG_WARN(=== $libgupc_min_gnu_ld_version or later and rebuild GCC.)
+      if test $libgupc_gnu_ld_version -ge 21200 ; then
+        # Globbing fix is present, proper block support is not.
+        dnl AC_MSG_WARN([=== Dude, you are soooo close.  Maybe we can fake 
it.])
+        dnl enable_symvers=???
+        AC_MSG_WARN([=== Symbol versioning will be disabled.])
+        enable_symvers=no
+      else
+        # 2.11 or older.
+        AC_MSG_WARN([=== Symbol versioning will be disabled.])
+        enable_symvers=no
+      fi
+    fi
+  else
+    # just fail for now
+    AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
+    AC_MSG_WARN([=== either you are not using a supported linker, or you are])
+    AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
+    AC_MSG_WARN([=== Symbol versioning will be disabled.])
+    enable_symvers=no
+  fi
+fi
+
+AC_CACHE_CHECK([whether the target supports .symver directive],
+              libgupc_cv_have_as_symver_directive, [
+  AC_TRY_COMPILE([void foo (void); __asm (".symver foo, address@hidden");],
+                [], libgupc_cv_have_as_symver_directive=yes,
+                libgupc_cv_have_as_symver_directive=no)])
+if test $libgupc_cv_have_as_symver_directive = yes; then
+  AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
+    [Define to 1 if the target assembler supports .symver directive.])
+fi
+
+AM_CONDITIONAL(LIBGUPC_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
+AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
+])
Index: libgupc/ax_prog_doxygen.m4
===================================================================
--- libgupc/ax_prog_doxygen.m4  (.../trunk)     (revision 0)
+++ libgupc/ax_prog_doxygen.m4  (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,583 @@
+# ===========================================================================
+#      http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   DX_INIT_DOXYGEN(PROJECT-NAME, DOXYFILE-PATH, [OUTPUT-DIR])
+#   DX_DOXYGEN_FEATURE(ON|OFF)
+#   DX_DOT_FEATURE(ON|OFF)
+#   DX_HTML_FEATURE(ON|OFF)
+#   DX_CHM_FEATURE(ON|OFF)
+#   DX_CHI_FEATURE(ON|OFF)
+#   DX_MAN_FEATURE(ON|OFF)
+#   DX_RTF_FEATURE(ON|OFF)
+#   DX_XML_FEATURE(ON|OFF)
+#   DX_PDF_FEATURE(ON|OFF)
+#   DX_PS_FEATURE(ON|OFF)
+#
+# DESCRIPTION
+#
+#   The DX_*_FEATURE macros control the default setting for the given
+#   Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for
+#   generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML
+#   help (for MS users), 'CHI' for generating a separate .chi file by the
+#   .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate
+#   output formats. The environment variable DOXYGEN_PAPER_SIZE may be
+#   specified to override the default 'a4wide' paper size.
+#
+#   By default, HTML, PDF and PS documentation is generated as this seems to
+#   be the most popular and portable combination. MAN pages created by
+#   Doxygen are usually problematic, though by picking an appropriate subset
+#   and doing some massaging they might be better than nothing. CHM and RTF
+#   are specific for MS (note that you can't generate both HTML and CHM at
+#   the same time). The XML is rather useless unless you apply specialized
+#   post-processing to it.
+#
+#   The macros mainly control the default state of the feature. The use can
+#   override the default by specifying --enable or --disable. The macros
+#   ensure that contradictory flags are not given (e.g.,
+#   --enable-doxygen-html and --enable-doxygen-chm,
+#   --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each
+#   feature will be automatically disabled (with a warning) if the required
+#   programs are missing.
+#
+#   Once all the feature defaults have been specified, call DX_INIT_DOXYGEN
+#   with the following parameters: a one-word name for the project for use
+#   as a filename base etc., an optional configuration file name (the
+#   default is 'Doxyfile', the same as Doxygen's default), and an optional
+#   output directory name (the default is 'doxygen-doc').
+#
+#   Automake Support
+#
+#   The following is a template aminclude.am file for use with Automake.
+#   Make targets and variables values are controlled by the various
+#   DX_COND_* conditionals set by autoconf.
+#
+#   The provided targets are:
+#
+#     doxygen-doc: Generate all doxygen documentation.
+#
+#     doxygen-run: Run doxygen, which will generate some of the
+#                  documentation (HTML, CHM, CHI, MAN, RTF, XML)
+#                  but will not do the post processing required
+#                  for the rest of it (PS, PDF, and some MAN).
+#
+#     doxygen-man: Rename some doxygen generated man pages.
+#
+#     doxygen-ps:  Generate doxygen PostScript documentation.
+#
+#     doxygen-pdf: Generate doxygen PDF documentation.
+#
+#   Note that by default these are not integrated into the automake targets.
+#   If doxygen is used to generate man pages, you can achieve this
+#   integration by setting man3_MANS to the list of man pages generated and
+#   then adding the dependency:
+#
+#     $(man3_MANS): doxygen-doc
+#
+#   This will cause make to run doxygen and generate all the documentation.
+#
+#   The following variable is intended for use in Makefile.am:
+#
+#     DX_CLEANFILES = everything to clean.
+#
+#   Then add this variable to MOSTLYCLEANFILES.
+#
+#     ----- begin aminclude.am -------------------------------------
+#
+#     ## --------------------------------- ##
+#     ## Format-independent Doxygen rules. ##
+#     ## --------------------------------- ##
+#
+#     if DX_COND_doc
+#
+#     ## ------------------------------- ##
+#     ## Rules specific for HTML output. ##
+#     ## ------------------------------- ##
+#
+#     if DX_COND_html
+#
+#     DX_CLEAN_HTML = @DX_DOCDIR@/html
+#
+#     endif DX_COND_html
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for CHM output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_chm
+#
+#     DX_CLEAN_CHM = @DX_DOCDIR@/chm
+#
+#     if DX_COND_chi
+#
+#     DX_CLEAN_CHI = @DX_DOCDIR@/@address@hidden
+#
+#     endif DX_COND_chi
+#
+#     endif DX_COND_chm
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for MAN output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_man
+#
+#     DX_CLEAN_MAN = @DX_DOCDIR@/man
+#
+#     endif DX_COND_man
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for RTF output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_rtf
+#
+#     DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+#
+#     endif DX_COND_rtf
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for XML output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_xml
+#
+#     DX_CLEAN_XML = @DX_DOCDIR@/xml
+#
+#     endif DX_COND_xml
+#
+#     ## ----------------------------- ##
+#     ## Rules specific for PS output. ##
+#     ## ----------------------------- ##
+#
+#     if DX_COND_ps
+#
+#     DX_CLEAN_PS = @DX_DOCDIR@/@address@hidden
+#
+#     DX_PS_GOAL = doxygen-ps
+#
+#     doxygen-ps: @DX_DOCDIR@/@address@hidden
+#
+#     @DX_DOCDIR@/@address@hidden: @DX_DOCDIR@/@address@hidden
+#         cd @DX_DOCDIR@/latex; \
+#         rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+#         $(DX_LATEX) refman.tex; \
+#         $(MAKEINDEX_PATH) refman.idx; \
+#         $(DX_LATEX) refman.tex; \
+#         countdown=5; \
+#         while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+#                           refman.log > /dev/null 2>&1 \
+#            && test $$countdown -gt 0; do \
+#             $(DX_LATEX) refman.tex; \
+#             countdown=`expr $$countdown - 1`; \
+#         done; \
+#         $(DX_DVIPS) -o ../@address@hidden refman.dvi
+#
+#     endif DX_COND_ps
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for PDF output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_pdf
+#
+#     DX_CLEAN_PDF = @DX_DOCDIR@/@address@hidden
+#
+#     DX_PDF_GOAL = doxygen-pdf
+#
+#     doxygen-pdf: @DX_DOCDIR@/@address@hidden
+#
+#     @DX_DOCDIR@/@address@hidden: @DX_DOCDIR@/@address@hidden
+#         cd @DX_DOCDIR@/latex; \
+#         rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+#         $(DX_PDFLATEX) refman.tex; \
+#         $(DX_MAKEINDEX) refman.idx; \
+#         $(DX_PDFLATEX) refman.tex; \
+#         countdown=5; \
+#         while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+#                           refman.log > /dev/null 2>&1 \
+#            && test $$countdown -gt 0; do \
+#             $(DX_PDFLATEX) refman.tex; \
+#             countdown=`expr $$countdown - 1`; \
+#         done; \
+#         mv refman.pdf ../@address@hidden
+#
+#     endif DX_COND_pdf
+#
+#     ## ------------------------------------------------- ##
+#     ## Rules specific for LaTeX (shared for PS and PDF). ##
+#     ## ------------------------------------------------- ##
+#
+#     if DX_COND_latex
+#
+#     DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+#
+#     endif DX_COND_latex
+#
+#     .PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+#     .INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+#     doxygen-run: @DX_DOCDIR@/@address@hidden
+#
+#     doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+#     @DX_DOCDIR@/@address@hidden: $(DX_CONFIG) $(pkginclude_HEADERS)
+#         rm -rf @DX_DOCDIR@
+#         $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
+#
+#     DX_CLEANFILES = \
+#         @DX_DOCDIR@/@address@hidden \
+#         -r \
+#         $(DX_CLEAN_HTML) \
+#         $(DX_CLEAN_CHM) \
+#         $(DX_CLEAN_CHI) \
+#         $(DX_CLEAN_MAN) \
+#         $(DX_CLEAN_RTF) \
+#         $(DX_CLEAN_XML) \
+#         $(DX_CLEAN_PS) \
+#         $(DX_CLEAN_PDF) \
+#         $(DX_CLEAN_LATEX)
+#
+#     endif DX_COND_doc
+#
+#     ----- end aminclude.am ---------------------------------------
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Oren Ben-Kiki <address@hidden>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 11
+
+## ----------##
+## Defaults. ##
+## ----------##
+
+DX_ENV=""
+AC_DEFUN([DX_FEATURE_doc],  ON)
+AC_DEFUN([DX_FEATURE_dot],  OFF)
+AC_DEFUN([DX_FEATURE_man],  OFF)
+AC_DEFUN([DX_FEATURE_html], ON)
+AC_DEFUN([DX_FEATURE_chm],  OFF)
+AC_DEFUN([DX_FEATURE_chi],  OFF)
+AC_DEFUN([DX_FEATURE_rtf],  OFF)
+AC_DEFUN([DX_FEATURE_xml],  OFF)
+AC_DEFUN([DX_FEATURE_pdf],  ON)
+AC_DEFUN([DX_FEATURE_ps],   ON)
+
+## --------------- ##
+## Private macros. ##
+## --------------- ##
+
+# DX_ENV_APPEND(VARIABLE, VALUE)
+# ------------------------------
+# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
+AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
+
+# DX_DIRNAME_EXPR
+# ---------------
+# Expand into a shell expression prints the directory part of a path.
+AC_DEFUN([DX_DIRNAME_EXPR],
+         [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
+
+# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
+# -------------------------------------
+# Expands according to the M4 (static) status of the feature.
+AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
+
+# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
+# ----------------------------------
+# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
+AC_DEFUN([DX_REQUIRE_PROG], [
+AC_PATH_TOOL([$1], [$2])
+if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
+    AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
+    AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
+fi
+])
+
+# DX_TEST_FEATURE(FEATURE)
+# ------------------------
+# Expand to a shell expression testing whether the feature is active.
+AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
+
+# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
+# -------------------------------------------------
+# Verify that a required features has the right state before trying to turn on
+# the DX_CURRENT_FEATURE.
+AC_DEFUN([DX_CHECK_DEPEND], [
+test "$DX_FLAG_$1" = "$2" \
+|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
+                            requires, contradicts) doxygen-DX_CURRENT_FEATURE])
+])
+
+# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
+# ----------------------------------------------------------
+# Turn off the DX_CURRENT_FEATURE if the required feature is off.
+AC_DEFUN([DX_CLEAR_DEPEND], [
+test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
+])
+
+# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
+#                CHECK_DEPEND, CLEAR_DEPEND,
+#                REQUIRE, DO-IF-ON, DO-IF-OFF)
+# --------------------------------------------
+# Parse the command-line option controlling a feature. CHECK_DEPEND is called
+# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
+# otherwise CLEAR_DEPEND is called to turn off the default state if a required
+# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
+# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
+# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
+AC_DEFUN([DX_ARG_ABLE], [
+    AC_DEFUN([DX_CURRENT_FEATURE], [$1])
+    AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
+    AC_ARG_ENABLE(doxygen-$1,
+                  [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
+                                                      [--enable-doxygen-$1]),
+                                  DX_IF_FEATURE([$1], [don't $2], [$2]))],
+                  [
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    AC_SUBST([DX_FLAG_$1], 1)
+    $3
+;; #(
+n|N|no|No|NO)
+    AC_SUBST([DX_FLAG_$1], 0)
+;; #(
+*)
+    AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
+;;
+esac
+], [
+AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
+$4
+])
+if DX_TEST_FEATURE([$1]); then
+    $5
+    :
+fi
+if DX_TEST_FEATURE([$1]); then
+    AM_CONDITIONAL(DX_COND_$1, :)
+    $6
+    :
+else
+    AM_CONDITIONAL(DX_COND_$1, false)
+    $7
+    :
+fi
+])
+
+## -------------- ##
+## Public macros. ##
+## -------------- ##
+
+# DX_XXX_FEATURE(DEFAULT_STATE)
+# -----------------------------
+AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc],  [$1])])
+AC_DEFUN([DX_DOT_FEATURE],     [AC_DEFUN([DX_FEATURE_dot], [$1])])
+AC_DEFUN([DX_MAN_FEATURE],     [AC_DEFUN([DX_FEATURE_man],  [$1])])
+AC_DEFUN([DX_HTML_FEATURE],    [AC_DEFUN([DX_FEATURE_html], [$1])])
+AC_DEFUN([DX_CHM_FEATURE],     [AC_DEFUN([DX_FEATURE_chm],  [$1])])
+AC_DEFUN([DX_CHI_FEATURE],     [AC_DEFUN([DX_FEATURE_chi],  [$1])])
+AC_DEFUN([DX_RTF_FEATURE],     [AC_DEFUN([DX_FEATURE_rtf],  [$1])])
+AC_DEFUN([DX_XML_FEATURE],     [AC_DEFUN([DX_FEATURE_xml],  [$1])])
+AC_DEFUN([DX_XML_FEATURE],     [AC_DEFUN([DX_FEATURE_xml],  [$1])])
+AC_DEFUN([DX_PDF_FEATURE],     [AC_DEFUN([DX_FEATURE_pdf],  [$1])])
+AC_DEFUN([DX_PS_FEATURE],      [AC_DEFUN([DX_FEATURE_ps],   [$1])])
+
+# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
+# ---------------------------------------------------------
+# PROJECT also serves as the base name for the documentation files.
+# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
+AC_DEFUN([DX_INIT_DOXYGEN], [
+
+#Variables:
+AC_SUBST([DX_PROJECT], [$1])
+
+# Files:
+AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
+AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
+
+# Environment variables used inside doxygen.cfg:
+DX_ENV_APPEND(SRCDIR, $srcdir)
+DX_ENV_APPEND(PROJECT, $DX_PROJECT)
+DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
+DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
+
+# Doxygen itself:
+DX_ARG_ABLE(doc, [generate any doxygen documentation],
+            [],
+            [],
+            [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
+             DX_REQUIRE_PROG([DX_PERL], perl)
+             DX_REQUIRE_PROG([DX_FILE], file)],
+            [DX_ENV_APPEND(PERL_PATH, $DX_PERL)
+            AC_SUBST(DOXYGEN_VERSION, [`${DX_DOXYGEN} --version`])],
+           [AC_SUBST(DOXYGEN_VERSION)])
+
+# Dot for graphics:
+DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [DX_REQUIRE_PROG([DX_DOT], dot)],
+            [DX_ENV_APPEND(HAVE_DOT, YES)
+             AC_SUBST(HAVE_DOT, YES)
+             DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
+            [AC_SUBST(HAVE_DOT, NO)
+            DX_ENV_APPEND(HAVE_DOT, NO)])
+
+# Man pages generation:
+DX_ARG_ABLE(man, [generate doxygen manual pages],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [],
+            [DX_ENV_APPEND(GENERATE_MAN, YES)],
+            [DX_ENV_APPEND(GENERATE_MAN, NO)])
+
+# RTF file generation:
+DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [],
+            [DX_ENV_APPEND(GENERATE_RTF, YES)],
+            [DX_ENV_APPEND(GENERATE_RTF, NO)])
+
+# XML file generation:
+DX_ARG_ABLE(xml, [generate doxygen XML documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [],
+            [DX_ENV_APPEND(GENERATE_XML, YES)],
+            [DX_ENV_APPEND(GENERATE_XML, NO)])
+
+# (Compressed) HTML help generation:
+DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [DX_REQUIRE_PROG([DX_HHC], hhc)],
+            [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
+             DX_ENV_APPEND(GENERATE_HTML, YES)
+             DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
+            [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
+
+# Seperate CHI file generation.
+DX_ARG_ABLE(chi, [generate doxygen separate compressed HTML help index file],
+            [DX_CHECK_DEPEND(chm, 1)],
+            [DX_CLEAR_DEPEND(chm, 1)],
+            [],
+            [DX_ENV_APPEND(GENERATE_CHI, YES)],
+            [DX_ENV_APPEND(GENERATE_CHI, NO)])
+
+# Plain HTML pages generation:
+DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
+            [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
+            [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
+            [],
+            [DX_ENV_APPEND(GENERATE_HTML, YES)],
+            [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
+
+# PostScript file generation:
+DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [DX_REQUIRE_PROG([DX_LATEX], latex)
+             DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
+             DX_REQUIRE_PROG([DX_DVIPS], dvips)
+             DX_REQUIRE_PROG([DX_EGREP], egrep)])
+
+# PDF file generation:
+DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
+             DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
+             DX_REQUIRE_PROG([DX_EGREP], egrep)])
+
+# LaTeX generation for PS and/or PDF:
+if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
+    AM_CONDITIONAL(DX_COND_latex, :)
+    DX_ENV_APPEND(GENERATE_LATEX, YES)
+else
+    AM_CONDITIONAL(DX_COND_latex, false)
+    DX_ENV_APPEND(GENERATE_LATEX, NO)
+fi
+
+# Paper size for PS and/or PDF:
+AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
+           [letter (default), a4, a4wide, legal or executive])
+case "$DOXYGEN_PAPER_SIZE" in
+#(
+"")
+    DOXYGEN_PAPER_SIZE="letter"
+;; #(
+a4wide|a4|letter|legal|executive)
+    DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
+;; #(
+*)
+    AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
+    DOXYGEN_PAPER_SIZE="letter"
+;;
+esac
+DX_ENV_APPEND(PAPER_SIZE, "$DOXYGEN_PAPER_SIZE")
+
+AC_ARG_VAR(DOXYGEN_HTML_LOGO,
+           [Location of small logo graphic (for HTML)])
+if test -n "$DOXYGEN_HTML_LOGO"; then
+    if ! test -f "$DOXYGEN_HTML_LOGO"; then
+      AC_MSG_ERROR([not a file: "$DOXYGEN_HTML_LOGO"])
+    fi
+fi
+
+AC_ARG_VAR(DOXYGEN_LOGO,
+           [Location of larger logo graphic (for PDF)])
+if test -n "$DOXYGEN_LOGO"; then
+  if ! test -f "$DOXYGEN_LOGO"; then
+    AC_MSG_ERROR([not a file: "$DOXYGEN_LOGO"])
+  fi
+fi
+
+AC_ARG_VAR(DOXYGEN_TITLE,
+           [Doxygen document title])
+if test -z "$DOXYGEN_TITLE"; then
+  DOXYGEN_TITLE="${PACKAGE_NAME}"
+fi
+
+AC_ARG_VAR(DOXYGEN_AUTHOR,
+           [Doxygen document author])
+if test -z "$DOXYGEN_AUTHOR"; then
+  DOXYGEN_AUTHOR="Generated by doxygen ${DOXYGEN_VERSION}"
+fi
+
+AC_ARG_VAR(DOXYGEN_DATETIME,
+           [Doxygen date and time value])
+if test -z "$DOXYGEN_DATETIME"; then
+  DOXYGEN_DATETIME=`date +'%D %T'`
+fi
+
+AC_ARG_VAR(DOXYGEN_DATE,
+           [Doxygen date value])
+if test -z "$DOXYGEN_DATE"; then
+  DOXYGEN_DATE=`date +%D`
+fi
+
+#For debugging:
+#echo DX_FLAG_doc=$DX_FLAG_doc
+#echo DX_FLAG_dot=$DX_FLAG_dot
+#echo DX_FLAG_man=$DX_FLAG_man
+#echo DX_FLAG_html=$DX_FLAG_html
+#echo DX_FLAG_chm=$DX_FLAG_chm
+#echo DX_FLAG_chi=$DX_FLAG_chi
+#echo DX_FLAG_rtf=$DX_FLAG_rtf
+#echo DX_FLAG_xml=$DX_FLAG_xml
+#echo DX_FLAG_pdf=$DX_FLAG_pdf
+#echo DX_FLAG_ps=$DX_FLAG_ps
+#echo DX_ENV=$DX_ENV
+])
Index: libgupc/config.h.in
===================================================================
--- libgupc/config.h.in (.../trunk)     (revision 0)
+++ libgupc/config.h.in (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,457 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Copyright (C) 2008-2015 Free Software Foundation, Inc.
+   This file is part of the UPC runtime Library.
+   Written by Gary Funck <address@hidden>
+   and Nenad Vukicevic <address@hidden>
+
+   This library 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, or (at
+   your option) any later version.
+
+   This library is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this library; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.
+
+   As a special exception, if you link this library with files
+   compiled with a GNU compiler to produce an executable, this does
+   not cause the resulting executable to be covered by the GNU General
+   Public License.  This exception does not however invalidate any
+   other reasons why the executable file might be covered by the GNU
+   General Public License.  */
+#ifndef __CONFIG_H__
+#define __CONFIG_H__ 1
+
+
+//begin gupcr_config_h
+
+/* Define path to preferred addr2line for backtrace */
+#undef GUPCR_BACKTRACE_ADDR2LINE
+
+/* Define path to preferred GDB for backtrace */
+#undef GUPCR_BACKTRACE_GDB
+
+/* Define to preferred signal for UPC backtrace. */
+#undef GUPCR_BACKTRACE_SIGNAL
+
+/* Size of get/put bounce buffer */
+#undef GUPCR_BOUNCE_BUFFER_SIZE
+
+/* upc_global_exit() timeout in seconds. */
+#undef GUPCR_GLOBAL_EXIT_TIMEOUT
+
+/* Define to 1 if UPC runtime checks are supported. */
+#undef GUPCR_HAVE_CHECKS
+
+/* Define to 1 if UPC runtime debugging mode is enabled. */
+#undef GUPCR_HAVE_DEBUG
+
+/* Define if UPC GUM debug server is supported. */
+#undef GUPCR_HAVE_GUM_DEBUG
+
+/* Define to 1 if UPC runtime statistics collection is supported. */
+#undef GUPCR_HAVE_STATS
+
+/* Define to 1 if UPC runtime tracing is supported. */
+#undef GUPCR_HAVE_TRACE
+
+/* Name of section that holds an array of addresses that points to the UPC
+   initialization routines. */
+#undef GUPCR_INIT_ARRAY_SECTION_NAME
+
+/* Use SLURM for UPC Portals4 job launcher */
+#undef GUPCR_JOB_LAUNCHER_SLURM
+
+/* Use YOD for UPC Portals4 job launcher */
+#undef GUPCR_JOB_LAUNCHER_YOD
+
+/* Maximum number of locks held per thread */
+#undef GUPCR_MAX_LOCKS
+
+/* Maximum number of outstanding remote puts */
+#undef GUPCR_MAX_OUTSTANDING_PUTS
+
+/* Target system memory page size. */
+#undef GUPCR_MEMORY_PAGE_SIZE
+
+/* Define to 1 if UPC runtime will use node local memory accesses. */
+#undef GUPCR_NODE_LOCAL_MEM
+
+/* Define to 1 if UPC node local access uses mmap-ed file. */
+#undef GUPCR_NODE_LOCAL_MEM_MMAP
+
+/* Define to 1 if UPC node local access uses Posix shared memory. */
+#undef GUPCR_NODE_LOCAL_MEM_POSIX
+
+/* Name of section used to hold information describing how a UPC source file
+   was compiled. */
+#undef GUPCR_PGM_INFO_SECTION_NAME
+
+/* Define to 1 if UPC runtime is based on Portals4. */
+#undef GUPCR_PORTALS_RUNTIME
+
+/* Portals4 PTE base index. */
+#undef GUPCR_PTE_BASE
+
+/* The required alignment for the UPC struct shared pointer representation. */
+#undef GUPCR_PTS_ALIGN
+
+/* Whether UPC pointers-to-shared use the 'packed' representation */
+#undef GUPCR_PTS_PACKED_REP
+
+/* Size of shared pointer's phase field (in bits) */
+#undef GUPCR_PTS_PHASE_SIZE
+
+/* The data type of the 'phase' field in a UPC shared pointer */
+#undef GUPCR_PTS_PHASE_TYPE
+
+/* Whether UPC shared pointers use the 'struct' representation */
+#undef GUPCR_PTS_STRUCT_REP
+
+/* Size of shared pointer's thread field (in bits) */
+#undef GUPCR_PTS_THREAD_SIZE
+
+/* The data type of the 'thread' field in a UPC shared pointer */
+#undef GUPCR_PTS_THREAD_TYPE
+
+/* Whether the 'vaddr' field comes first (ie, [[vaddr,thread,phase]]) */
+#undef GUPCR_PTS_VADDR_FIRST
+
+/* Size of shared pointer's vaddr field (in bits) */
+#undef GUPCR_PTS_VADDR_SIZE
+
+/* The data type of the 'vaddr' field in a UPC shared pointer */
+#undef GUPCR_PTS_VADDR_TYPE
+
+/* Name of section used to assign addresses to UPC shared data items. */
+#undef GUPCR_SHARED_SECTION_NAME
+
+/* Maximum number of children at each level of a collective operation tree. */
+#undef GUPCR_TREE_FANOUT
+
+/* Define to 1 if UPC runtime will use Portals4 triggered operations. */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+
+//end gupcr_config_h
+
+/* Define to 1 if the target assembler supports .symver directive. */
+#undef HAVE_AS_SYMVER_DIRECTIVE
+
+/* Define to 1 if the target supports __attribute__((alias(...))). */
+#undef HAVE_ATTRIBUTE_ALIAS
+
+/* Define to 1 if the target supports __attribute__((dllexport)). */
+#undef HAVE_ATTRIBUTE_DLLEXPORT
+
+/* Define to 1 if the target supports __attribute__((visibility(...))). */
+#undef HAVE_ATTRIBUTE_VISIBILITY
+
+/* Define to 1 if you have the `backtrace' function. */
+#undef HAVE_BACKTRACE
+
+/* Define to 1 if you have the `backtrace_symbols' function. */
+#undef HAVE_BACKTRACE_SYMBOLS
+
+/* Define to 1 if you have the `backtrace_symbols_fd' function. */
+#undef HAVE_BACKTRACE_SYMBOLS_FD
+
+/* Define if the POSIX Semaphores do not work on your system. */
+#undef HAVE_BROKEN_POSIX_SEMAPHORES
+
+/* Define to 1 if the target assembler supports thread-local storage. */
+#undef HAVE_CC_TLS
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+   don't. */
+#undef HAVE_DECL_SYS_SIGLIST
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#undef HAVE_EXECINFO_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `ftruncate' function. */
+#undef HAVE_FTRUNCATE
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `gethostbyname' function. */
+#undef HAVE_GETHOSTBYNAME
+
+/* Define to 1 if you have the `gethostname' function. */
+#undef HAVE_GETHOSTNAME
+
+/* Define to 1 if you have the `getloadavg' function. */
+#undef HAVE_GETLOADAVG
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define if the compiler has a thread header that is non single. */
+#undef HAVE_GTHR_DEFAULT
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `mkdir' function. */
+#undef HAVE_MKDIR
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the `munmap' function. */
+#undef HAVE_MUNMAP
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define to 1 if pthread_{,attr_}{g,s}etaffinity_np is supported. */
+#undef HAVE_PTHREAD_AFFINITY_NP
+
+/* Define to 1 if the system has the type `ptrdiff_t'. */
+#undef HAVE_PTRDIFF_T
+
+/* Define to 1 if you have the <sched.h> header file. */
+#undef HAVE_SCHED_H
+
+/* Define to 1 if you have the <semaphore.h> header file. */
+#undef HAVE_SEMAPHORE_H
+
+/* Define to 1 if you have the 'shm_open' function. */
+#undef HAVE_SHM_OPEN
+
+/* Define to 1 if you have the `socket' function. */
+#undef HAVE_SOCKET
+
+/* Define to 1 if `stat' has the bug that it succeeds when given the
+   zero-length file name argument. */
+#undef HAVE_STAT_EMPTY_STRING_BUG
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the `strtoull' function. */
+#undef HAVE_STRTOULL
+
+/* Define to 1 if the target supports __sync_*_compare_and_swap. */
+#undef HAVE_SYNC_BUILTINS
+
+/* Define to 1 if the compiler provides the __sync_fetch_and_add function for
+   uint32 */
+#undef HAVE_SYNC_FETCH_AND_ADD_4
+
+/* Define to 1 if the compiler provides the __sync_fetch_and_add function for
+   uint64 */
+#undef HAVE_SYNC_FETCH_AND_ADD_8
+
+/* Define to 1 if you have the <sys/loadavg.h> header file. */
+#undef HAVE_SYS_LOADAVG_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if the target supports thread-local storage. */
+#undef HAVE_TLS
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if UPC backtrace is enabled. */
+#undef HAVE_UPC_BACKTRACE
+
+/* Define to 1 if UPC backtrace with ADDR2LINE is enabled. */
+#undef HAVE_UPC_BACKTRACE_ADDR2LINE
+
+/* Define to 1 if UPC backtrace with GDB is enabled. */
+#undef HAVE_UPC_BACKTRACE_GDB
+
+/* Define to 1 if UPC backtrace signal is enabled. */
+#undef HAVE_UPC_BACKTRACE_SIGNAL
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* Define to 1 if GNU symbol versioning is used for libgupc. */
+#undef LIBGUPC_GNU_SYMBOL_VERSIONING
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+   slash. */
+#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `char', as computed by sizeof. */
+#undef SIZEOF_CHAR
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
+
+/* The size of `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if you can safely include both <string.h> and <strings.h>. */
+#undef STRING_WITH_STRINGS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `long int' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to 1 if UPC link script is supported. */
+#undef use_upc_link_script
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
+
+/* Define to empty if the keyword `volatile' does not work. Warning: valid
+   code using `volatile' can become incorrect without. Disable with care. */
+#undef volatile
+
+
+#ifndef ARG_UNUSED
+# define ARG_UNUSED(NAME) NAME __attribute__ ((__unused__))
+#endif
+
+
+
+#endif /* __CONFIG_H__ */
+
Index: libgupc/configure.ac
===================================================================
--- libgupc/configure.ac        (.../trunk)     (revision 0)
+++ libgupc/configure.ac        (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,1382 @@
+# Process this file with autoconf to produce a configure script, like so:
+# aclocal -I . -I .. -I ../config && autoconf && autoheader && automake
+#
+#   Copyright (C) 2001-2015 Free Software Foundation, Inc.
+#   Contributed by Gary Funck <address@hidden>
+#   Derived from libgomp/configure.ac
+#
+#This file is part of GNU UPC.
+#
+#GNU UPC 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, or (at your option)
+#any later version.
+#
+#GNU UPC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU General Public License
+#along with GNU UPC; see the file COPYING.  If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+#02111-1307, USA.
+
+AC_PREREQ(2.64)
+AC_INIT([GNU UPC Runtime Library], 1.0,,[libgupc])
+AC_CONFIG_SRCDIR([include/upc.h])
+AC_CONFIG_HEADERS([config.h])
+
+# -------
+# Options
+# -------
+
+AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+LIBGUPC_ENABLE(version-specific-runtime-libs, no, ,
+   [specify that runtime libraries should be installed
+   in a compiler-specific directory],
+   permit yes|no)
+AC_MSG_RESULT($enable_version_specific_runtime_libs)
+
+# We would like our source tree to be readonly. However when releases or
+# pre-releases are generated, the flex/bison generated files as well as the
+# various formats of manuals need to be included along with the rest of the
+# sources.  Therefore we have --enable-generated-files-in-srcdir to do
+# just that.
+AC_MSG_CHECKING([for --enable-generated-files-in-srcdir])
+LIBGUPC_ENABLE(generated-files-in-srcdir, no, ,
+   [put copies of generated files in source dir intended for creating source
+    tarballs for users without texinfo bison or flex],
+   permit yes|no)
+AC_MSG_RESULT($enable_generated_files_in_srcdir)
+AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
+
+
+# -------
+# Get build environment
+# -------
+
+# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
+#
+# You will slowly go insane if you do not grok the following fact:  when
+# building this library, the top-level /target/ becomes the library's /host/.
+#
+# configure then causes --target to default to --host, exactly like any
+# other package using autoconf.  Therefore, 'target' and 'host' will
+# always be the same.  This makes sense both for native and cross compilers
+# just think about it for a little while.  :-)
+#
+# Also, if this library is being configured as part of a cross compiler, the
+# top-level configure script will pass the "real" host as $with_cross_host.
+#
+# Do not delete or change the following two lines.  For why, see
+# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+
+# Sets up automake.  Must come after AC_CANONICAL_SYSTEM.  Each of the
+# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
+#  1.11.1:  minimum required version
+#  no-define:  PACKAGE and VERSION will not be #define'd in config.h (a bunch
+#              of other PACKAGE_* variables will, however, and there's nothing
+#              we can do about that; they come from AC_INIT).
+#  foreign:  we don't follow the normal rules for GNU packages (no COPYING
+#            file in the top srcdir, etc, etc), so stop complaining.
+#  -Wall:  turns on all automake warnings...
+#  -Wno-portability:  ...except this one, since GNU make is required.
+#  -Wno-override: ... and this one, since we do want this in testsuite.
+AM_INIT_AUTOMAKE([1.11.6 foreign -Wall -Wno-portability -Wno-override])
+
+# UPC disables multilib for portals4 runtime
+if echo "${with_upc_runtime}" | grep -v -i '^portals4$' 2>&1 >/dev/null; then
+  AM_ENABLE_MULTILIB(, ..)
+fi
+
+# Calculate toolexeclibdir
+# Also toolexecdir, though it's only used in toolexeclibdir
+case ${enable_version_specific_runtime_libs} in
+  yes)
+    # Need the gcc compiler version to know where to install libraries
+    # and header files if --enable-version-specific-runtime-libs option
+    # is selected.
+    toolexecdir='$(libdir)/gcc/$(target_alias)'
+    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+    ;;
+  no)
+    if test -n "$with_cross_host" &&
+       test x"$with_cross_host" != x"no"; then
+      # Install a library built with a cross compiler in tooldir, not libdir.
+      toolexecdir='$(exec_prefix)/$(target_alias)'
+      toolexeclibdir='$(toolexecdir)/lib'
+    else
+      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+      toolexeclibdir='$(libdir)'
+    fi
+    multi_os_directory=`$CC -print-multi-os-directory`
+    case $multi_os_directory in
+      .) ;; # Avoid trailing /.
+      *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
+    esac
+    ;;
+  *)
+    AC_MSG_ERROR(['$enable_version_specific_runtime_libs' is not set])
+    ;;
+esac
+AC_SUBST(toolexecdir)
+AC_SUBST(toolexeclibdir)
+
+# If the language specific driver does not exist, we do not build anything.
+# Note, $r is set by the top-level Makefile.
+rm -f skip-this-dir
+AC_MSG_CHECKING([if UPC driver 'gupc' has been built])
+AC_CACHE_VAL(upc_cv_driver_exists,
+[
+  upc_cv_driver_exists=yes
+  if test -n "$r"; then
+    if test -d "$r"/gcc; then
+      if (test -f "$r"/gcc/gupc && test -x "$r"/gcc/gupc); then
+       true
+      else
+       upc_cv_driver_exists=no
+      fi
+    fi
+  fi
+])
+AC_MSG_RESULT($upc_cv_driver_exists)
+if test x$upc_cv_driver_exists = xno
+then
+  echo "rm -f config.cache config.log multilib.out" > skip-this-dir
+  rm -f Makefile conftest* confdefs* core
+  exit 0
+fi
+
+# Check the compiler.
+# The same as in boehm-gc and libstdc++. Have to borrow it from there.
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+
+m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
+m4_define([_AC_ARG_VAR_PRECIOUS],[])
+AC_PROG_CC
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+
+AC_SUBST(CFLAGS)
+
+#
+# If UPCFLAGS hasn't been set explicitly then default to "$CFLAGS".
+#
+if test x"$UPCFLAGS" = "x"; then
+  UPCFLAGS="$CFLAGS"
+fi
+
+AC_SUBST(UPCFLAGS)
+
+# In order to override CFLAGS_FOR_TARGET, all of our special flags go
+# in XCFLAGS.  But we need them in CFLAGS during configury.  So put them
+# in both places for now and restore CFLAGS at the end of config.
+save_CFLAGS="$CFLAGS"
+
+# Add -Wall -Werror if we are using GCC.
+if test "x$GCC" = "xyes"; then
+  XCFLAGS="$XCFLAGS -Wall -Werror"
+fi
+
+dnl The UPC compiler is used to compile some parts of the runtime
+dnl This hack makes sure that we pick up the multiflags that
+dnl may have been tacked onto the $CC command.
+if echo "$CC" | grep '/xgcc ' >/dev/null 2>&1; then
+  UPC=`echo "$CC" | sed -e 's=/xgcc =/gupc ='`
+else
+  AC_MSG_ERROR([cannot create UPC from CC because it does not contain the
+  string '/xgcc '; the value of CC is: "$CC"])
+fi
+# The just built UPC compiler is not fully functional as it is
+# unable to auto pre-include "gcc-upc.h" and "gcc-upc-lib.h".
+# Make sure that "upc-pre-include" feature is disabled for any of the
+# UPC program checks (e.g. checking for dependency options).
+saved_UPC="$UPC"
+UPC="$UPC -fno-upc-pre-include"
+AM_PROG_UPC()
+UPC="$saved_UPC"
+
+# Find other programs we need.
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
+AC_PATH_PROG(PERL, perl, perl-not-found-in-path-error)
+AC_PATH_PROG(ADDR2LINE, addr2line, addr2line-not-found-in-path-error)
+AC_PROG_MAKE_SET
+AC_PROG_INSTALL
+
+# See if makeinfo has been installed and is modern enough
+# that we can use it.
+ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
+                   [GNU texinfo.* \([0-9][0-9.]*\)],
+                   [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
+AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
+
+
+# libgupc cannot be built as shared library
+enable_shared=no
+# Configure libtool
+AC_DISABLE_SHARED
+AM_PROG_LIBTOOL
+
+AM_MAINTAINER_MODE
+
+# For libtool versioning info, format is CURRENT:REVISION:AGE
+libtool_VERSION=1:0:0
+AC_SUBST(libtool_VERSION)
+
+# Check header files.
+AC_STDC_HEADERS
+ACX_HEADER_STRING
+GCC_HEADER_STDINT(gstdint.h)
+AC_HEADER_TIME
+AC_HEADER_SYS_WAIT
+
+AC_CHECK_HEADERS([execinfo.h fcntl.h limits.h netdb.h netinet/in.h])
+AC_CHECK_HEADERS([sched.h semaphore.h stddef.h stdlib.h sys/loadavg.h])
+AC_CHECK_HEADERS([sys/socket.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_MODE_T
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_CHECK_DECLS([sys_siglist])
+AC_C_VOLATILE
+AC_CHECK_TYPES([ptrdiff_t])
+
+# Check to see if -pthread or -lpthread is needed.  Prefer the former.
+# In case the pthread.h system header is not found, this test will fail.
+XPCFLAGS=""
+CFLAGS="$CFLAGS -pthread"
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+  [#include <pthread.h>
+   void *g(void *d) { return NULL; }],
+  [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+ [XPCFLAGS=" -Wc,-pthread"],
+ [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
+  AC_LINK_IFELSE(
+   [AC_LANG_PROGRAM(
+    [#include <pthread.h>
+     void *g(void *d) { return NULL; }],
+    [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+   [],
+   [AC_MSG_NOTICE([Pthreads are not supported in this libgupc build])])])
+
+# Check for functions needed.
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_MMAP
+AC_FUNC_STAT
+AC_CHECK_FUNCS([clock_gettime ftruncate getcwd gethostbyname gethostname])
+AC_CHECK_FUNCS([getloadavg memset mkdir munmap socket])
+AC_CHECK_FUNCS([strcasecmp strdup strerror strtol strtoull])
+AC_CHECK_FUNCS([backtrace backtrace_symbols backtrace_symbols_fd])
+AC_SYS_LARGEFILE
+
+# Check for broken semaphore implementation on darwin.
+# sem_init returns: sem_init error: Function not implemented.
+case "$host" in
+  *-darwin*)
+    AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
+       Define if the POSIX Semaphores do not work on your system.)
+    ;;
+esac
+
+GCC_LINUX_FUTEX(:)
+
+# Check for pthread_{,attr_}[sg]etaffinity_np.
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+  [#define _GNU_SOURCE
+   #include <pthread.h>],
+  [cpu_set_t cpuset;
+   pthread_attr_t attr;
+   pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+   if (CPU_ISSET (0, &cpuset))
+     CPU_SET (1, &cpuset);
+   else
+     CPU_ZERO (&cpuset);
+   pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+   pthread_attr_init (&attr);
+   pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
+   pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);])],
+  AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1,
+    [Define  to 1 if pthread_{,attr_}{g,s}etaffinity_np is supported.]))
+
+# At least for glibc, clock_gettime is in librt.  But don't pull that
+# in if it still doesn't give us the function we want.
+if test $ac_cv_func_clock_gettime = no; then
+  AC_CHECK_LIB(rt, clock_gettime,[ac_cv_func_clock_gettime="yes"])
+  if test $ac_cv_func_clock_gettime = yes; then
+    LIBS="-lrt $LIBS"
+    AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
+             [Define to 1 if you have the `clock_gettime' function.])
+  fi
+fi
+
+# See if we support thread-local storage.
+GCC_CHECK_TLS
+
+# See what sort of export controls are available.
+LIBGUPC_CHECK_ATTRIBUTE_VISIBILITY
+LIBGUPC_CHECK_ATTRIBUTE_DLLEXPORT
+LIBGUPC_CHECK_ATTRIBUTE_ALIAS
+LIBGUPC_ENABLE_SYMVERS
+
+if test $enable_symvers = gnu; then
+  AC_DEFINE(LIBGUPC_GNU_SYMBOL_VERSIONING, 1,
+           [Define to 1 if GNU symbol versioning is used for libgupc.])
+fi
+
+CFLAGS="$save_CFLAGS $XCFLAGS"
+
+# Check for __sync_val_compare_and_swap, but only after the target has
+# had a chance to set XCFLAGS.
+LIBGUPC_CHECK_SYNC_BUILTINS
+
+# Check for __sync_fetch_and_add
+AC_CACHE_CHECK([for __sync_fetch_and_add_4],
+[upc_cv_sync_fetch_and_add_4],
+[AC_LINK_IFELSE([
+typedef unsigned int uint32  __attribute__ ((mode (SI)));
+uint32 i;
+int main() { return __sync_fetch_and_add (&i, 1); }
+],
+[upc_cv_sync_fetch_and_add_4=yes],
+[upc_cv_sync_fetch_and_add_4=no])])
+if test "$upc_cv_sync_fetch_and_add_4" = "yes"; then
+  AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD_4, 1,
+    [Define to 1 if the compiler provides the
+    __sync_fetch_and_add function for uint32])
+fi
+
+AC_CACHE_CHECK([for __sync_fetch_and_add_8],
+[upc_cv_sync_fetch_and_add_8],
+[AC_LINK_IFELSE([
+typedef unsigned int uint64  __attribute__ ((mode (DI)));
+uint64 i;
+int main() { return __sync_fetch_and_add (&i, 1); }
+],
+[upc_cv_sync_fetch_and_add_8=yes],
+[upc_cv_sync_fetch_and_add_8=no])])
+if test "$upc_cv_sync_fetch_and_add_8" = "yes"; then
+  AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD_8, 1,
+    [Define to 1 if the compiler provides the
+    __sync_fetch_and_add function for uint64])
+fi
+
+XCFLAGS="$XCFLAGS"
+
+
+# Cleanup and exit.
+CFLAGS="$save_CFLAGS"
+AC_CACHE_SAVE
+
+if test "x${multilib}" = xyes; then
+  multilib_arg="--enable-multilib"
+else
+  multilib_arg=
+fi
+
+AC_MSG_CHECKING([for thread model used by GCC])
+target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+AC_MSG_RESULT([$target_thread_file])
+
+if test $target_thread_file != single; then
+  AC_DEFINE(HAVE_GTHR_DEFAULT, 1,
+        [Define if the compiler has a thread header that is non single.])
+fi
+
+AC_MSG_CHECKING([UPC shared pointer representation])
+cat > conftest.upc << _ACEOF
+#define _XSTR(X) #X
+#define _STR(S) _XSTR(S)
+#ifdef __UPC_LINK_SCRIPT__
+  GUPCR_LINK_SCRIPT=1
+#else
+  GUPCR_LINK_SCRIPT=0
+#endif
+#ifdef __UPC_VADDR_FIRST__
+  GUPCR_PTS_VADDR_FIRST=1
+#else
+  GUPCR_PTS_VADDR_FIRST=0
+#endif
+GUPCR_PTS_VADDR_SIZE=_STR(__UPC_VADDR_SIZE__)
+GUPCR_PTS_PHASE_SIZE=_STR(__UPC_PHASE_SIZE__)
+GUPCR_PTS_THREAD_SIZE=_STR(__UPC_THREAD_SIZE__)
+#if __UPC_PTS_STRUCT_REP__
+  GUPCR_PTS_REP="struct"
+  GUPCR_PTS_STRUCT_REP=1
+  GUPCR_PTS_VADDR_TYPE=_STR(__UPC_VADDR_TYPE__)
+  GUPCR_PTS_PHASE_TYPE=_STR(__UPC_PHASE_TYPE__)
+  GUPCR_PTS_THREAD_TYPE=_STR(__UPC_THREAD_TYPE__)
+  #if __UPC_PTS_ALIGN__
+    GUPCR_PTS_ALIGN=_STR(__UPC_PTS_ALIGN__)
+  #endif
+#else
+  GUPCR_PTS_REP="packed"
+  GUPCR_PTS_PACKED_REP=1
+#endif
+_ACEOF
+eval `$UPC -fno-upc-pre-include -DNO_GCC_UPC_LIB=1 -E conftest.upc | \
+  grep '^ *GUPCR_[[A-Z0-9_]]*='`
+rm -f conftest.upc
+AC_MSG_RESULT($GUPCR_PTS_REP)
+if test -z "$GUPCR_PTS_REP"; then
+  AC_MSG_ERROR([can't determine UPC sptr representation])
+fi
+for cfg in \
+     GUPCR_PTS_PACKED_REP \
+     GUPCR_PTS_PHASE_SIZE \
+     GUPCR_PTS_PHASE_TYPE \
+     GUPCR_PTS_REP \
+     GUPCR_PTS_STRUCT_REP \
+     GUPCR_PTS_ALIGN \
+     GUPCR_PTS_THREAD_SIZE \
+     GUPCR_PTS_THREAD_TYPE \
+     GUPCR_PTS_VADDR_FIRST \
+     GUPCR_PTS_VADDR_SIZE \
+     GUPCR_PTS_VADDR_TYPE \
+     GUPCR_LINK_SCRIPT; do
+  eval "cval=\$$cfg"
+  if test -n "$cval"; then
+    AC_MSG_CHECKING([value of $cfg])
+    AC_MSG_RESULT($cval)
+  fi
+done
+if test -n "$with_upc_pts" \
+   && test "$with_upc_pts" != "$GUPCR_PTS_REP" ; then
+  AC_MSG_ERROR([--with-upc-pts=$with_upc_pts is incompatible with the
+UPC compiler's supported pointer-to-shared representation ($GUPCR_PTS_REP)])
+fi
+AC_DEFINE_UNQUOTED(GUPCR_PTS_VADDR_SIZE,[$GUPCR_PTS_VADDR_SIZE],
+  [Size of shared pointer's vaddr field (in bits)])
+AC_DEFINE_UNQUOTED(GUPCR_PTS_THREAD_SIZE,[$GUPCR_PTS_THREAD_SIZE],
+  [Size of shared pointer's thread field (in bits)])
+AC_DEFINE_UNQUOTED(GUPCR_PTS_PHASE_SIZE,[$GUPCR_PTS_PHASE_SIZE],
+  [Size of shared pointer's phase field (in bits)])
+if test "$GUPCR_PTS_REP" = "struct"; then
+  AC_DEFINE(GUPCR_PTS_STRUCT_REP,[1],
+    [Whether UPC shared pointers use the 'struct' representation])
+  AC_DEFINE_UNQUOTED(GUPCR_PTS_VADDR_TYPE,[$GUPCR_PTS_VADDR_TYPE],
+    [The data type of the 'vaddr' field in a UPC shared pointer])
+  AC_DEFINE_UNQUOTED(GUPCR_PTS_THREAD_TYPE,[$GUPCR_PTS_THREAD_TYPE],
+    [The data type of the 'thread' field in a UPC shared pointer])
+  AC_DEFINE_UNQUOTED(GUPCR_PTS_PHASE_TYPE,[$GUPCR_PTS_PHASE_TYPE],
+    [The data type of the 'phase' field in a UPC shared pointer])
+  if test -n "$GUPCR_PTS_ALIGN"; then
+    AC_DEFINE_UNQUOTED(GUPCR_PTS_ALIGN,[$GUPCR_PTS_ALIGN],
+      [The required alignment for the UPC struct shared pointer
+      representation.])
+  fi
+else
+  AC_DEFINE(GUPCR_PTS_PACKED_REP,[1],
+    [Whether UPC pointers-to-shared use the 'packed' representation])
+fi
+if test "$GUPCR_PTS_VADDR_FIRST" -eq 1; then
+  AC_DEFINE(GUPCR_PTS_VADDR_FIRST,[1],
+    [Whether the 'vaddr' field comes first (ie, [[vaddr,thread,phase]])])
+fi
+
+AC_MSG_NOTICE([determine UPC target-dependent section names])
+cat > conftest.upc << _ACEOF
+#define _XSTR(X) #X
+#define _STR(S) _XSTR(S)
+
+#ifdef __UPC_INIT_ARRAY_SECTION_NAME__
+  GUPCR_INIT_ARRAY_SECTION_NAME=_STR(__UPC_INIT_ARRAY_SECTION_NAME__)
+#endif
+#ifdef __UPC_PGM_INFO_SECTION_NAME__
+  GUPCR_PGM_INFO_SECTION_NAME=_STR(__UPC_PGM_INFO_SECTION_NAME__)
+#endif
+#ifdef __UPC_SHARED_SECTION_NAME__
+  GUPCR_SHARED_SECTION_NAME=_STR(__UPC_SHARED_SECTION_NAME__)
+#endif
+_ACEOF
+eval `$UPC -fno-upc-pre-include -DNO_GCC_UPC_LIB=1 -E conftest.upc | \
+  grep '^ *GUPCR_[[A-Z0-9_]]*='`
+rm -f conftest.upc
+for cfg in \
+    GUPCR_INIT_ARRAY_SECTION_NAME \
+    GUPCR_PGM_INFO_SECTION_NAME \
+    GUPCR_SHARED_SECTION_NAME; do
+  eval "cval=\$$cfg"
+  if test -n "$cval"; then
+    AC_MSG_CHECKING([value of $cfg])
+    AC_MSG_RESULT($cval)
+  fi
+done
+if test -n "$GUPCR_INIT_ARRAY_SECTION_NAME"; then
+  AC_DEFINE_UNQUOTED(GUPCR_INIT_ARRAY_SECTION_NAME,
+  [$GUPCR_INIT_ARRAY_SECTION_NAME],
+  [Name of section that holds an array of addresses that points to
+  the UPC initialization routines.])
+fi
+if test -n "$GUPCR_PGM_INFO_SECTION_NAME"; then
+  AC_DEFINE_UNQUOTED(GUPCR_PGM_INFO_SECTION_NAME,
+  [$GUPCR_PGM_INFO_SECTION_NAME],
+  [Name of section used to hold information describing how
+  a UPC source file was compiled.])
+fi
+if test -n "$GUPCR_SHARED_SECTION_NAME"; then
+  AC_DEFINE_UNQUOTED(GUPCR_SHARED_SECTION_NAME,
+  [$GUPCR_SHARED_SECTION_NAME],
+  [Name of section used to assign addresses to UPC shared data items.])
+fi
+
+dnl Select target specific runtime implementation.
+
+AC_MSG_CHECKING([for UPC runtime model])
+AC_ARG_WITH(upc-runtime,
+[AS_HELP_STRING([--with-upc-runtime=MODEL],
+               [specify the runtime implementation model for UPC,
+                where MODEL may be: 'SMP' (Symmetric Multiprocessing)
+                or 'Portals4'.  [default='SMP']])],
+[
+  case "$withval" in
+changequote(,)dnl
+    [Ss][Mm][Pp])
+      upc_runtime_model=smp
+      ;;
+    [Pp][Oo][Rr][Tt][Aa][Ll][Ss]4)
+      upc_runtime_model=portals4
+      ;;
+changequote([,])dnl
+    *)
+      AC_MSG_ERROR([$withval is an invalid runtime model for
+      --with-upc-runtime])
+      ;;
+  esac
+],
+[
+  upc_runtime_model=smp
+])
+AC_MSG_RESULT([$upc_runtime_model])
+
+AC_MSG_CHECKING([for UPC runtime checking support])
+AC_ARG_ENABLE(upc-runtime-checks,
+[AS_HELP_STRING([--enable-upc-runtime-checks],
+               [enable internal UPC runtime checks that validate
+                arguments, and check for inconsistent runtime state.
+                [default=no]])],
+[
+  case $enableval in
+  yes | no) ;;
+  *)
+    AC_MSG_ERROR([--enable-upc-runtime-checks accepts only yes or no.])
+  esac
+],
+[
+  enable_upc_runtime_checks=no
+])
+AC_MSG_RESULT($enable_upc_runtime_checks)
+if test "$enable_upc_runtime_checks" = "yes"; then
+  AC_DEFINE(GUPCR_HAVE_CHECKS, 1,
+            [Define to 1 if UPC runtime checks are supported.])
+fi
+
+AC_MSG_CHECKING([for UPC runtime statistics support])
+AC_ARG_ENABLE(upc-runtime-stats,
+[AS_HELP_STRING([--enable-upc-runtime-stats],
+               [enable internal UPC runtime statistics collection support;
+                these statistics count the number of various significant
+                internal operations, and dump those counts into a
+                per-process statistics file.
+                [default=no]])],
+[
+  case $enableval in
+  yes | no) ;;
+  *)
+    AC_MSG_ERROR([--enable-upc-runtime-stats accepts only yes or no.])
+  esac
+],
+[
+  enable_upc_runtime_stats=no
+])
+AC_MSG_RESULT($enable_upc_runtime_stats)
+if test "$enable_upc_runtime_stats" = "yes"; then
+  AC_DEFINE(GUPCR_HAVE_STATS, 1,
+            [Define to 1 if UPC runtime statistics collection is supported.])
+fi
+
+AC_MSG_CHECKING([for UPC runtime trace support])
+AC_ARG_ENABLE(upc-runtime-trace,
+[AS_HELP_STRING([--enable-upc-runtime-trace],
+               [enable internal UPC runtime trace collection support;
+                a runtime trace is a time stamped log that records
+                various significant internal events; this trace
+                is written to a per-process log file.
+                [default=no]])],
+[
+  case $enableval in
+  yes | no) ;;
+  *)
+    AC_MSG_ERROR([--enable-upc-runtime-trace accepts only yes or no.])
+  esac
+],
+[
+  enable_upc_runtime_trace=no
+])
+AC_MSG_RESULT($enable_upc_runtime_trace)
+if test "$enable_upc_runtime_trace" = "yes"; then
+  AC_DEFINE(GUPCR_HAVE_TRACE, 1,
+            [Define to 1 if UPC runtime tracing is supported.])
+fi
+
+AC_MSG_CHECKING([for UPC runtime debug configuration])
+AC_ARG_ENABLE(upc-runtime-debug,
+[AS_HELP_STRING([--enable-upc-runtime-debug],
+               [enable UPC runtime debugging mode,
+                where more expensive internal checks are implemented,
+                and conservative algorithms are used that
+                reduce the degree of parallelism, and that
+                exercise less complex/sophisticated operations
+                provided by the operating system and/or the
+                network communication packages called by the UPC runtime.
+                In addition, conservative compilation options will
+                be used to build the runtime, and debugging symbols
+                will be generated.
+                [default=no]])],
+[
+  case $enableval in
+  yes | no) ;;
+  *)
+    AC_MSG_ERROR([--enable-upc-runtime-debug accepts only yes or no.])
+  esac
+],
+[
+  enable_upc_runtime_debug=no
+])
+AC_MSG_RESULT($enable_upc_runtime_debug)
+if test "$enable_upc_runtime_debug" = "yes"; then
+  AC_DEFINE(GUPCR_HAVE_DEBUG, 1,
+            [Define to 1 if UPC runtime debugging mode is enabled.])
+fi
+AC_SUBST(enable_upc_runtime_debug)
+
+
+AC_MSG_CHECKING([for UPC link script support])
+if test -n "$GUPCR_LINK_SCRIPT" \
+   && test "$GUPCR_LINK_SCRIPT" -eq 1; then
+  upc_link_script=yes
+else
+  upc_link_script=no
+fi
+if test x"$upc_link_script" = xyes; then
+  gen_ld_script=${srcdir}/gen-upc-ld-script.pl
+  if ! ${LD} --verbose | ${PERL} $gen_ld_script 1>/dev/null ; then
+    # if gen-upc-ld-script did not accept the output of the linker
+    # then disable UPC link script support.
+    AC_MSG_ERROR([selected linker does not support linker scripts])
+  fi
+fi
+AC_MSG_RESULT($upc_link_script)
+if test x"$upc_link_script" = xyes; then
+  AC_DEFINE(use_upc_link_script, 1,
+    [Define to 1 if UPC link script is supported.])
+fi
+
+AC_MSG_CHECKING([for UPC runtime tree fanout])
+AC_ARG_WITH(upc-runtime-tree-fanout,
+[AS_HELP_STRING([--with-upc-runtime-tree-fanout=WIDTH],
+               [specify the maximum number of children in each
+                sub-tree used to implement UPC collectives operations
+                (e. g. upc_barrier)
+                [default=4]])],
+[
+  # $withval must be a decimal integer
+  if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+    AC_MSG_ERROR([$withval is an invalid option to
+    --with-upc-runtime-tree-fanout])
+  fi
+  upc_runtime_tree_fanout="$withval"
+],
+[
+  upc_runtime_tree_fanout=4
+])
+AC_MSG_RESULT([$upc_runtime_tree_fanout])
+AC_DEFINE_UNQUOTED(GUPCR_TREE_FANOUT, [$upc_runtime_tree_fanout],
+  [Maximum number of children at each level of a collective operation tree.])
+
+AC_MSG_CHECKING([for UPC backtrace support])
+AC_ARG_ENABLE(upc-backtrace,
+[AS_HELP_STRING([--enable-upc-backtrace],
+               [enable UPC backtrace;
+                enable stack frame backtrace report
+                when UPC run-time fatal errors occur
+                or by user request (via signal)])],
+[
+  case $enableval in
+    yes | no) ;;
+    *)
+      AC_MSG_ERROR([--enable-upc-backtrace accepts only yes or no])
+  esac
+],
+[
+  enable_upc_backtrace=yes
+])
+# Check for execinfo library (needed on BSD systems for UPC backtracing)
+case "${target}" in
+  *-*-freebsd* | *-*-openbsd* | *-*-netbsd* )
+    AC_CHECK_LIB(execinfo,backtrace,[execinfo_lib="yes"])
+    if test "x$execinfo_lib" = xyes; then
+      enable_execinfo_lib=yes
+    else
+      enable_upc_backtrace=no
+    fi
+  ;;
+  *) ;;
+esac
+if test "$enable_upc_backtrace" = yes; then
+  AC_DEFINE(HAVE_UPC_BACKTRACE, 1,
+    [Define to 1 if UPC backtrace is enabled.])
+fi
+AC_MSG_RESULT($enable_upc_backtrace)
+
+# Check for user specified GDB
+AC_ARG_WITH(upc-backtrace-gdb,
+  [AS_HELP_STRING([--with-upc-backtrace-gdb=GDB],
+  [specify which GDB to use for UPC backtrace support
+  [default='gdb']])],
+[
+  upc_backtrace_gdb=$withval
+],
+[
+  upc_backtrace_gdb=gdb
+])
+AC_PATH_PROGS(PATH_TO_GDB, $GDB $upc_backtrace_gdb, , /usr/bin:${PATH})
+AC_MSG_CHECKING([for UPC backtrace GDB to use])
+if test -n "$PATH_TO_GDB"; then
+  AC_DEFINE_UNQUOTED(GUPCR_BACKTRACE_GDB, "$PATH_TO_GDB",
+    [Define path to preferred GDB for backtrace])
+  AC_MSG_RESULT([$PATH_TO_GDB])
+  upc_backtrace_gdb_available=yes
+else
+  upc_backtrace_gdb_available=no
+  AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING([for UPC backtrace GDB support])
+AC_ARG_ENABLE(upc-backtrace-gdb,
+[AS_HELP_STRING([--enable-upc-backtrace-gdb],
+               [enable the use of GDB for UPC stack backtrace
+               [default='yes']])],
+[
+  case "$enableval" in
+    yes | no)
+      if test "$enableval" = yes &&
+         test "$upc_backtrace_gdb_available" = no; then
+        AC_MSG_ERROR(
+          [Cannot find gdb. Set the correct gdb path with
+           --with-upc-backtrace-gdb option or disable gdb backtrace with
+           --disable-upc-backtrace-gdb option.])
+      fi
+      ;;
+    *)
+      AC_MSG_ERROR([--enable-upc-backtrace-gdb accepts only yes or no])
+  esac
+],
+[
+  enable_upc_backtrace_gdb=$upc_backtrace_gdb_available
+])
+AC_MSG_RESULT([$enable_upc_backtrace_gdb])
+if test "$enable_upc_backtrace_gdb" = yes; then
+  AC_DEFINE(HAVE_UPC_BACKTRACE_GDB, 1,
+    [Define to 1 if UPC backtrace with GDB is enabled.])
+fi
+
+AC_MSG_CHECKING([for UPC backtrace signal support])
+AC_ARG_ENABLE(upc-backtrace-signal,
+[AS_HELP_STRING([--enable-upc-backtrace-signal],
+               [enable signal support for UPC stack backtrace
+               [default='yes']])],
+[
+  case "$enableval" in
+  yes | no) ;;
+  *)
+    AC_MSG_ERROR([--enable-upc-backtrace-signal accepts only yes or no])
+  esac
+  ],
+[
+  enable_upc_backtrace_signal=yes
+])
+AC_MSG_RESULT([$enable_upc_backtrace_signal])
+if test "$enable_upc_backtrace_signal" = yes; then
+  AC_DEFINE(HAVE_UPC_BACKTRACE_SIGNAL, 1,
+    [Define to 1 if UPC backtrace signal is enabled.])
+
+  # Check for user specified signal name/number
+  AC_MSG_CHECKING([for UPC backtrace signal name/number])
+  AC_ARG_WITH(upc-backtrace-signal,
+    [AS_HELP_STRING([--with-upc-backtrace-signal=SIGNAL],
+    [specify the signal to be used for UPC stack backtrace
+    [default='SIGUSR1']])],
+    [
+      upc_backtrace_signal=$withval
+    ],
+    [
+      upc_backtrace_signal=SIGUSR1
+    ])
+  AC_DEFINE_UNQUOTED(GUPCR_BACKTRACE_SIGNAL, $upc_backtrace_signal,
+    [Define to preferred signal for UPC backtrace.])
+  AC_MSG_RESULT([$upc_backtrace_signal])
+fi
+
+if test "$enable_upc_backtrace" = yes; then
+  # Check if backtrace can use addr2line
+  if test x"$ADDR2LINE" != x""; then
+    AC_DEFINE(HAVE_UPC_BACKTRACE_ADDR2LINE, 1,
+      [Define to 1 if UPC backtrace with ADDR2LINE is enabled.])
+    AC_DEFINE_UNQUOTED(GUPCR_BACKTRACE_ADDR2LINE, "$ADDR2LINE",
+      [Define path to preferred addr2line for backtrace])
+  fi
+fi
+
+if test "$upc_runtime_model" = "smp"; then
+
+  targ_runtime_pthreads=
+  LIBGUPC_GCC_TLS_SUPPORTED
+  if test "$upc_cv_gcc_tls_supported"x = "yes"x ; then
+    targ_runtime_pthreads=yes
+  fi
+  AC_MSG_CHECKING(for Linux scheduling affinity)
+  AC_TRY_RUN(
+  changequote(<<,>>)dnl
+  <<#define _GNU_SOURCE
+  #include <sched.h>
+  cpu_set_t mask;
+  main ()
+  {
+  unsigned int len = sizeof(mask);
+  if (sched_getaffinity(0, len, &mask) < 0) {
+      return 1;
+      }
+  return 0;
+  }
+  >>,
+  changequote([, ])dnl
+      [upc_affinity=yes],
+      [upc_affinity=no],
+      [upc_affinity=no]
+  )
+  if test "x$enable_upc_affinity" = "xyes" &&
+    test "x$upc_affinity" = "xno"; then
+      AC_MSG_ERROR([scheduling affinity enabled but not supported
+      - use --disable-upc-affinity])
+  fi
+  if test "x$enable_upc_affinity" = "xno"; then
+    upc_affinity=no;
+  fi
+  AC_MSG_RESULT([$upc_affinity])
+  dnl Check if NUMA available
+  AC_MSG_CHECKING(if NUMA available)
+  save_LIBS="$LIBS"
+  LIBS="-lnuma"
+  AC_TRY_RUN(
+  changequote(<<,>>)dnl
+  <<#include <numa.h>
+  int
+  main ()
+  {
+    if (numa_available() < 0) return 1;
+    else return 0;
+  }
+  >>,
+  changequote([, ])dnl
+      [upc_numa=yes],
+      [upc_numa=no],
+      [upc_numa=no],
+  )
+  LIBS="$save_LIBS"
+  if test "x$enable_upc_numa" = "xyes" &&
+    test "x$upc_numa" = "xno"; then
+      AC_MSG_ERROR([NUMA enabled but not supported - use --disable-upc-numa])
+  fi
+  if test "x$enable_upc_numa" = "xno" \
+         -o "x$enable_upc_affinity" = "xno"; then
+    upc_numa=no;
+  fi
+  AC_MSG_RESULT([$upc_numa])
+  AC_MSG_CHECKING([for UPC GUM debugging support])
+  AC_ARG_ENABLE(upc-gum-debug,
+  [AS_HELP_STRING([--enable-upc-gum-debug],
+                  [enable UPC's source level debugging with GDB and GUM
+                   support (requires UPC aware GDB)])],
+  [
+    case $enableval in
+      yes | no) ;;
+      *)
+        AC_MSG_ERROR([--enable-upc-gum-debug accepts only yes or no])
+    esac
+    upc_gum_debug=$enableval
+  ],
+  [
+    upc_gum_debug=no
+  ])
+  AC_MSG_RESULT([$upc_gum_debug])
+  if test "x${upc_gum_debug}" = "xyes"; then
+    AC_DEFINE_UNQUOTED(GUPCR_HAVE_GUM_DEBUG,[1],
+    [Define if UPC GUM debug server is supported.])
+  fi
+  # Use the generic (reference implementation)
+  use_generic_collectives="yes"
+
+  DX_DOXYGEN_FEATURE(OFF)
+  DX_INIT_DOXYGEN(${PACKAGE}, doxygen.cfg, doc)
+
+  AC_MSG_CHECKING([for UPC runtime maximum number of locks held per thread])
+  AC_ARG_WITH(upc-runtime-max-locks,
+  [AS_HELP_STRING([--with-upc-runtime-max-locks=MAX_LOCKS],
+                  [specify the maximum number of locks that can be held by
+                   a single UPC thread [default=1024]])],
+  [
+    # $withval must be a decimal integer
+    if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+      AC_MSG_ERROR([$withval is an invalid option to
+      --with-upc-runtime-max-locks])
+    fi
+    upc_runtime_max_locks="$withval"
+  ],
+  [
+    upc_runtime_max_locks=1024
+  ])
+  AC_MSG_RESULT([$upc_runtime_max_locks])
+  AC_DEFINE_UNQUOTED(GUPCR_MAX_LOCKS,[$upc_runtime_max_locks],
+    [Maximum number of locks held per thread])
+
+fi #### End: SMP runtime configuration
+
+if test "$upc_runtime_model" = "portals4"; then
+
+  #### Portals4 runtime library configuration ####
+
+  # Use the generic (reference implementation)
+  use_generic_collectives="no"
+
+  # Check for Portals4 libs
+  portals4libs="-lportals"
+  portals4inc=
+  have_portals4=no
+  AC_ARG_WITH(portals4,
+  [AS_HELP_STRING([--with-portals4=PATH],
+                 [specify prefix directory for installed portals4 package.
+                  Equivalent to --with-portals4-include=PATH/include
+                  plus --with-portals4-lib=PATH/lib])])
+  AC_ARG_WITH(portals4-include,
+  [AS_HELP_STRING([--with-portals4-include=PATH],
+                 [specify directory for installed portals4 include files])])
+  AC_ARG_WITH(portals4-lib,
+  [AS_HELP_STRING([--with-portals4-lib=PATH],
+                 [specify directory for the installed portals4 library])])
+
+  if test "x$with_portals4" != x; then
+    portals4libs="-L$with_portals4/lib $portals4libs"
+    portals4inc="-I$with_portals4/include $portals4inc"
+  fi
+  if test "x$with_portals4_include" != x; then
+    portals4inc="-I$with_portals4_include $portals4inc"
+  fi
+  if test "x$with_portals4_lib" != x; then
+    portals4libs="-L$with_portals4_lib $portals4libs"
+  fi
+  if test "x$with_portals4$with_portals4_include$with_portals4_lib" = x \
+     && test -d ${srcdir}/portals4; then
+    portals4libs='-L$$r/$(HOST_SUBDIR)/portals4/ '"$lt_cv_objdir $portals4libs"
+    portals4inc='-I$$r/$(HOST_SUBDIR)/portals4 -I$$s/portals4 '"$portals4inc"
+    # Do not test the portals4 version.  Assume that it is sufficient, since
+    # it is in the source tree, and the library has not been built yet
+    # but it would be included on the link line in the version check below
+    # hence making the test fail.
+    have_portals4=yes
+  fi
+  AC_SUBST(portals4libs)
+  AC_SUBST(portals4inc)
+
+  AC_DEFINE(GUPCR_PORTALS_RUNTIME, 1,
+  [Define to 1 if UPC runtime is based on Portals4.])
+
+  AC_MSG_CHECKING([for UPC runtime Portals4 PTE base index])
+  AC_ARG_WITH(upc-runtime-pte-base,
+  [AS_HELP_STRING([--with-upc-runtime-pte-base=BASE],
+                 [specify the base index of the first Portals4 PTE used
+                  by the UPC runtime [default=16]])],
+  [
+    # $withval must be a decimal integer
+    if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+      AC_MSG_ERROR([$withval is an invalid option to 
--with-upc-runtime-pte-base])
+    fi
+    upc_runtime_pte_base="$withval"
+  ],
+  [
+    upc_runtime_pte_base=16
+  ])
+  AC_MSG_RESULT([$upc_runtime_pte_base])
+  AC_DEFINE_UNQUOTED(GUPCR_PTE_BASE,[$upc_runtime_pte_base],
+    [Portals4 PTE base index.])
+
+  AC_MSG_CHECKING([for UPC runtime maximum number of locks held per thread])
+  AC_ARG_WITH(upc-runtime-max-locks,
+  [AS_HELP_STRING([--with-upc-runtime-max-locks=MAX_LOCKS],
+                 [specify the maximum number of locks that can be held by
+                  a single UPC thread [default=1024]])],
+  [
+    # $withval must be a decimal integer
+    if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+      AC_MSG_ERROR([$withval is an invalid option to
+      --with-upc-runtime-max-locks])
+    fi
+    upc_runtime_max_locks="$withval"
+  ],
+  [
+    upc_runtime_max_locks=1024
+  ])
+  AC_MSG_RESULT([$upc_runtime_max_locks])
+  AC_DEFINE_UNQUOTED(GUPCR_MAX_LOCKS,[$upc_runtime_max_locks],
+    [Maximum number of locks held per thread])
+
+  AC_MSG_CHECKING([for UPC runtime bounce buffer size])
+  AC_ARG_WITH(upc-runtime-bounce-buffer-size,
+  [AS_HELP_STRING([--with-upc-runtime-bounce-buffer-size=SIZE],
+                 [specify the size (in bytes) of the bounce buffer
+                  that is used by the UPC runtime to buffer
+                  network data [default=256K]])],
+  [
+    # $withval must be a decimal integer
+    if ! echo "$withval" | egrep -i '^[[0-9]]+[[kmg]]?$' >/dev/null 2>&1; then
+      AC_MSG_ERROR([$withval is an invalid option to
+                       --with-upc-runtime-bounce-buffer-size])
+    fi
+    bb_size="$withval"
+  ],
+  [
+    bb_size="256K"
+  ])
+  bb_size_expr=`echo "$bb_size" | \
+    sed -e 's/[[gG]]$/*1024M/;s/[[mM]]$/*1024K/;s/[[kK]]$/*1024/;s/\\*/ \\\\* 
/g'`
+  upc_runtime_bounce_buffer_size=`eval expr $bb_size_expr`
+  AC_MSG_RESULT([$upc_runtime_bounce_buffer_size])
+  
AC_DEFINE_UNQUOTED(GUPCR_BOUNCE_BUFFER_SIZE,[$upc_runtime_bounce_buffer_size],
+    [Size of get/put bounce buffer])
+
+  AC_MSG_CHECKING([for UPC maximum number of outstanding remote puts])
+  AC_ARG_WITH(upc-max-outstanding-puts,
+  [AS_HELP_STRING([--with-upc-max-outstanding-puts=SIZE],
+                 [specify the maximum number of outstanding
+                  remote put requests. [default=256]])],
+  [
+    # $withval must be a decimal integer
+    if ! echo "$withval" | grep '^[[0-9]]*$' >/dev/null 2>&1; then
+      AC_MSG_ERROR([$withval is an invalid option to
+                       --with-upc-max-outstanding-puts])
+    fi
+    upc_max_puts_count="$withval"
+  ],
+  [
+    upc_max_puts_count="256"
+  ])
+  AC_MSG_RESULT([$upc_max_puts_count])
+  AC_DEFINE_UNQUOTED(GUPCR_MAX_OUTSTANDING_PUTS,[$upc_max_puts_count],
+    [Maximum number of outstanding remote puts])
+
+  AC_MSG_CHECKING([for UPC runtime collectives tree fanout])
+  AC_ARG_WITH(upc-runtime-tree-fanout,
+  [AS_HELP_STRING([--with-upc-runtime-tree-fanout=WIDTH],
+                 [specify the maximum number of children in each
+                  sub-tree used to implement UPC collective operations
+                  (e. g., upc_barrier and upc_global_alloc).
+                  [default=4]])],
+  [
+    # $withval must be a decimal integer
+    if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+      AC_MSG_ERROR([$withval is an invalid option to
+                       --with-upc-runtime-tree-fanout])
+    fi
+    upc_runtime_tree_fanout="$withval"
+  ],
+  [
+    upc_runtime_tree_fanout=4
+  ])
+  AC_MSG_RESULT([$upc_runtime_tree_fanout])
+  AC_DEFINE_UNQUOTED(GUPCR_TREE_FANOUT, [$upc_runtime_tree_fanout],
+    [Maximum number of children at each level of a collective operation tree.])
+
+  AC_MSG_CHECKING([for UPC runtime Portals4 triggered operation support])
+  AC_ARG_ENABLE(upc-runtime-triggered-ops,
+  [AS_HELP_STRING([--enable-upc-runtime-triggered-ops],
+                 [enable UPC runtime support for Portals4 triggered
+                  operations.  [default=yes]])],
+  [
+    case $enableval in
+    yes | no) ;;
+    *)
+      AC_MSG_ERROR([--enable-upc-runtime-triggered-ops accepts only yes or 
no.])
+    esac
+  ],
+  [
+    enable_upc_runtime_triggered_ops=yes
+  ])
+  AC_MSG_RESULT($enable_upc_runtime_triggered_ops)
+  if test "$enable_upc_runtime_triggered_ops" = "yes"; then
+    AC_DEFINE(GUPCR_USE_PORTALS4_TRIGGERED_OPS, 1,
+      [Define to 1 if UPC runtime will use Portals4 triggered operations.])
+  fi
+
+# Portals4 node local memory optimization
+
+  AC_MSG_CHECKING([for UPC runtime node local memory access])
+  AC_ARG_ENABLE(upc-node-local-mem,
+  [AS_HELP_STRING([--enable-upc-node-local-mem],
+                 [enable UPC runtime support for accessing shared
+                  memory of the node local threads.  [default=yes]])],
+  [
+    case $enableval in
+    yes | no) ;;
+    *)
+      AC_MSG_ERROR([--enable-upc-node-local-mem accepts only yes or no.])
+    esac
+  ],
+  [
+    enable_upc_node_local_mem=yes
+  ])
+  AC_MSG_RESULT($enable_upc_node_local_mem)
+  if test "$enable_upc_node_local_mem" = "yes"; then
+    AC_DEFINE(GUPCR_NODE_LOCAL_MEM, 1,
+      [Define to 1 if UPC runtime will use node local memory accesses.])
+  fi
+
+  if test "$enable_upc_node_local_mem" = "yes"; then
+    # START - check for shared memory type
+    # Check for Posix based shm
+    AC_MSG_CHECKING([for UPC node local memory type])
+    AC_ARG_WITH(upc-node-local-mem,
+    [AS_HELP_STRING([--with-upc-node-local-mem=SHMEM],
+                   [specify type of shared memory used for node local
+                    memory accesses (posix or mmap).
+                   [default=posix]])],
+    [
+      case $withval in
+        posix | mmap)
+         upc_node_local=$withval
+         ;;
+        *)
+          AC_MSG_ERROR([--with-upc-node-local-mem accepts only posix or mmap.])
+      esac
+    ],
+    [
+      upc_node_local=posix
+    ])
+    AC_MSG_RESULT($upc_node_local);
+
+    # Check if POSIX shm is available
+    if test "$upc_node_local" = "posix"; then
+      # Check if it is part of librt
+      have_shm_open=no
+      AC_CHECK_LIB(rt, shm_open,
+         [LIBS="-lrt $LIBS"
+         have_shm_open=yes
+          AC_DEFINE(HAVE_SHM_OPEN, 1,
+            [Define to 1 if you have the 'shm_open' function.])])
+      if test "$have_shm_open" = "no"; then
+        # Must probe for Posix shmem
+        AC_MSG_CHECKING([for the shm_open])
+        AC_TRY_LINK([
+          #include <sys/types.h>
+          #include <sys/stat.h>
+          #include <sys/mman.h>
+          #include <unistd.h>
+          #include <fcntl.h>
+          #include <stdlib.h>
+          int size = 4096;
+          int fd;
+          void * addr;],[
+
+          fd = shm_open("shm-config-test", O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
+          (void)shm_unlink("shm-config-test");
+          if (fd < 0) return 1;
+          if (ftruncate(fd, size) < 0) return 1;
+          addr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+          (void)close(fd);
+          if (!addr || (addr == MAP_FAILED)) return 1;
+          (void)munmap(addr, size);
+          return 0;
+          ],[AC_MSG_RESULT(yes); have_shm_open=yes ],
+           [AC_MSG_RESULT(no); have_shm_open=no ])
+      fi
+
+      if test "$have_shm_open" = "yes"; then
+        AC_DEFINE(GUPCR_NODE_LOCAL_MEM_POSIX, 1,
+          [Define to 1 if UPC node local access uses Posix shared memory.])
+      else
+        AC_MSG_ERROR([Posix shared memory is not available])
+      fi
+    else
+      # mmap is always available
+      AC_DEFINE(GUPCR_NODE_LOCAL_MEM_MMAP, 1,
+        [Define to 1 if UPC node local access uses mmap-ed file.])
+    fi
+    # END - check for shared memory type
+  fi
+
+  # Check for portals job launcher
+  AC_CHECK_HEADER([slurm/slurm.h],[have_slurm=yes],[have_slurm=no])
+  AC_MSG_CHECKING([for UPC runtime Portals4 job launcher])
+  AC_ARG_WITH(upc-job-launcher,
+  [AS_HELP_STRING([--with-upc-job-launcher],
+                 [Select UPC Portals4 job launcher.
+                  [default=slurm]])],
+  [
+    case $withval in
+    slurm | yod)
+      upc_job_launcher=$withval
+      ;;
+    *)
+      AC_MSG_ERROR([--with-upc-job-launcher accepts only slurm or yod.])
+    esac
+  ],
+  [
+    if test "$have_slurm" = "yes"; then
+      upc_job_launcher=slurm
+    else
+      upc_job_launcher=yod
+    fi
+  ])
+  AC_MSG_RESULT($upc_job_launcher)
+
+  if test "$upc_job_launcher" = "slurm"; then
+    if test "$have_slurm" = "yes"; then
+      AC_DEFINE(GUPCR_JOB_LAUNCHER_SLURM, 1,
+      [Use SLURM for UPC Portals4 job launcher])
+      portals4libs="$portals4libs -lpmi"
+    else
+      AC_MSG_ERROR([--with-upc-job-launcher specified slurm,
+                    but slurm is not available.])
+    fi
+  else
+    AC_DEFINE(GUPCR_JOB_LAUNCHER_YOD, 1,
+    [Use YOD for UPC Portals4 job launcher])
+    portals4libs="$portals4libs -lportals_runtime"
+  fi
+
+  # Check for target memory page size
+  AC_MSG_CHECKING([for memory page size])
+  AC_ARG_WITH(upc-memory-page-size,
+  [AS_HELP_STRING([--with-upc-memory-page-size],
+                 [Select target memory page size.
+                  [default=4096]])],
+  [
+    # $withval must be a decimal integer
+    if ! echo "$withval" | grep '^[[0-9]][[0-9]]*$' >/dev/null 2>&1; then
+      AC_MSG_ERROR([$withval is an invalid option to 
--with-upc-memory-page-size])
+    fi
+    memory_page_size="$withval"
+  ],
+  [
+    memory_page_size="4096"
+  ])
+  AC_MSG_RESULT($memory_page_size)
+  AC_DEFINE_UNQUOTED(GUPCR_MEMORY_PAGE_SIZE, [$memory_page_size],
+    [Target system memory page size.])
+
+  AC_DEFINE(GUPCR_GLOBAL_EXIT_TIMEOUT, [2],
+    [upc_global_exit() timeout in seconds.])
+
+  DX_DOXYGEN_FEATURE(ON)
+  DX_HTML_FEATURE(ON)
+  DX_PDF_FEATURE(ON)
+  DX_DOT_FEATURE(ON)
+  DX_PS_FEATURE(OFF)
+  DX_INIT_DOXYGEN(${PACKAGE}, doxygen.cfg, doc)
+  AC_CONFIG_FILES([header.tex doxygen.sty])
+  AC_CONFIG_FILES([doxygen.cfg:portals4/doxygen.cfg.in])
+
+fi #### End: Portals4 runtime configuration
+
+# Get target configury.
+. ${srcdir}/configure.tgt
+
+# configure.tgt sets these substitution variables.
+# It also sets 'upc_crtstuff=yes' if upc-crtstuff needs
+# to be compiled.
+AC_SUBST(config_path)
+AC_SUBST(bfdinc)
+AC_SUBST(XCFLAGS)
+AC_SUBST(XLDFLAGS)
+AC_SUBST(link_upc_spec)
+AC_SUBST(upc_crtstuff_cflags)
+AC_SUBST(upc_crtbegin_spec)
+AC_SUBST(upc_crtend_spec)
+AC_SUBST(upc_crtstuff_objs)
+
+dnl Define ARG_UNUSED macro
+AH_BOTTOM([
+#ifndef ARG_UNUSED
+# define ARG_UNUSED(NAME) NAME __attribute__ ((__unused__))
+#endif
+])
+
+dnl Build the runtime, based upon the --with-upc-runtime setting.
+AM_CONDITIONAL(LIBGUPC_SMP_RUNTIME, [test "$upc_runtime_model" = "smp"])
+AM_CONDITIONAL(LIBGUPC_PORTALS4_RUNTIME, [test "$upc_runtime_model" = 
"portals4"])
+AM_CONDITIONAL(LIBGUPC_RUNTIME_DEBUG, [test "$enable_upc_runtime_debug" = 
"yes"])
+
+AM_CONDITIONAL(LIBGUPC_CRTSTUFF, [test "$upc_crtstuff" = "yes"])
+AM_CONDITIONAL(LIBGUPC_LINK_SCRIPT, [test "$use_upc_link_script" = "yes"])
+AM_CONDITIONAL(LIBGUPC_GENERIC_COLLECTIVES,
+               [test "$use_generic_collectives" = "yes"])
+AM_CONDITIONAL(LIBGUPC_BACKTRACE, [test "$enable_upc_backtrace" = "yes"])
+
+dnl 'smp' runtime specific settings
+AM_CONDITIONAL(LIBGUPC_PTHREADS, [test "$targ_runtime_pthreads" = "yes"])
+AM_CONDITIONAL(LIBGUPC_AFFINITY, [test "$upc_affinity" = "yes"])
+AM_CONDITIONAL(LIBGUPC_NUMA, [test "$upc_numa" = "yes"])
+AM_CONDITIONAL(LIBGUPC_GUM, [test "$upc_gum_debug" = "yes"])
+AM_CONDITIONAL(LIBGUPC_NODE_LOCAL_MEM_POSIX, [test "$upc_node_local" = 
"posix"])
+AM_CONDITIONAL(LIBGUPC_NODE_LOCAL_MEM_MMAP, [test "$upc_node_local" = "mmap"])
+
+AH_TOP(
+[/* Copyright (C) 2008-2015 Free Software Foundation, Inc.
+   This file is part of the UPC runtime Library.
+   Written by Gary Funck <address@hidden>
+   and Nenad Vukicevic <address@hidden>
+
+   This library 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, or (at
+   your option) any later version.
+
+   This library is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this library; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.
+
+   As a special exception, if you link this library with files
+   compiled with a GNU compiler to produce an executable, this does
+   not cause the resulting executable to be covered by the GNU General
+   Public License.  This exception does not however invalidate any
+   other reasons why the executable file might be covered by the GNU
+   General Public License.  */
+#ifndef __CONFIG_H__
+#define __CONFIG_H__ 1
+])
+AH_VERBATIM(GUPCR_AAA_BEGIN_CFG,[//begin gupcr_config_h])
+AH_VERBATIM(GUPCR_ZZZ_END_CFG,[//end gupcr_config_h])
+AH_BOTTOM(
+[
+#endif /* __CONFIG_H__ */
+])
+
+AC_CONFIG_FILES([Makefile testsuite/Makefile])
+AC_CONFIG_FILES([upc-crtbegin.spec libgupc.spec upc-crtend.spec])
+AC_OUTPUT
Index: libgupc/configure.tgt
===================================================================
--- libgupc/configure.tgt       (.../trunk)     (revision 0)
+++ libgupc/configure.tgt       (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,125 @@
+# This is the target specific configuration file.  This is invoked by the
+# autoconf generated configure script.  Putting it in a separate shell file
+# lets us skip running autoconf when modifying target specific information.
+#
+# This file is adapted from the libgomp implementation.
+
+# This file switches on the shell variable ${target}, and sets the
+# following shell variables:
+#  config_path         An ordered list of directories to search for
+#                      sources and headers.  This is relative to the
+#                      config subdirectory of the source tree.
+#  XCFLAGS             Add extra compile flags to use.
+#  XLDFLAGS            Add extra link flags to use.
+
+
+# Set defaults
+config_path="posix default"
+
+case "${target}" in
+
+  *-*-hpux*)
+       case "${target}" in
+         *-*-hpux11*)
+            # HPUX v11.x requires -lrt to resolve sem_init in libgupc.la
+            XLDFLAGS="${XLDFLAGS} -lrt"
+            ;;
+       esac
+       case "${target}" in
+         hppa[12]*-*-hpux*)
+           # PA 32 HP-UX needs -frandom-seed for bootstrap compare.
+           XCFLAGS="${XCFLAGS} -frandom-seed=fixed-seed"
+           ;;
+       esac
+       ;;
+
+  *-*-mingw32*)
+       config_path="mingw32 ${config_path}"
+       ;;
+
+  *-*-darwin*)
+       config_path="darwin bsd ${config_path}"
+       ;;
+
+  mips-sgi-irix6*)
+       # Need to link with -lpthread so libgupc.so is self-contained.
+       XLDFLAGS="${XLDFLAGS} -lpthread"
+       ;;
+
+  *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
+       ;;
+
+  *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
+       ;;
+
+  *-*-solaris2* | *-*-hpux11*)
+       ;;
+
+  *-*-aix*)
+       ;;
+
+  *)
+        UNSUPPORTED=1
+       ;;
+
+esac
+
+#
+#  The logic above sets configuration directories that may
+#  be currently unsupported.  Remove non-existent directories
+#  from the 'config_path' variable.  It is assumed that higher
+#  level logic will check for valid libgupc targets.
+#
+_config_path=
+for cfg_dir in ${config_path}; do
+  if test -d ${srcdir}/config/$cfg_dir; then
+    _config_path="${_config_path} $cfg_dir"
+  fi
+done
+config_path="${_config_path}"
+
+upc_crtstuff=yes
+upc_crtbegin_spec=\
+"%{static:upc-crtbeginT%O%s; shared|pie:upc-crtbeginS%O%s; :upc-crtbegin%O%s}"
+upc_crtend_spec=\
+"%{static:upc-crtendT%O%s; shared|pie:upc-crtendS%O%s; :upc-crtend%O%s}"
+upc_crtstuff_objs=\
+"upc-crtbeginT.o upc-crtbeginS.o upc-crtbegin.o upc-crtendT.o upc-crtendS.o 
upc-crtend.o"
+
+# The following empty alternatives are kept as place holders
+# that will be filled in with target-specific settings as needed.
+case "${target}" in
+  *-*-darwin*)
+    ;;
+  mips-sgi-irix6*)
+    ;;
+  *)
+    ;;
+esac
+
+# For UPC, always add the math library
+LIBS="-lm $LIBS"
+if test "${upc_numa}" = "yes"; then
+  LIBS="-lnuma $LIBS"
+fi
+if test "$upc_runtime_model" = "portals4"; then
+  LIBS="-lpthread $LIBS"
+  if test x"$portals4libs" != "x"; then
+    LIBS="$portals4libs $LIBS"
+  fi
+fi
+if test "x$enable_execinfo_lib" = "xyes"; then
+  LIBS="-lexecinfo $LIBS"
+fi
+libgupc_spec="%{!fupc-pthreads*:-lgupc;:-lgupc_pt -lpthread}"
+if test "$enable_upc_backtrace" = yes &&
+   test -n "$export_dynamic_flag_spec"; then
+  dynamic_spec=`echo "$export_dynamic_flag_spec" | sed -e 's/${wl}//'`
+  libgupc_spec="$dynamic_spec ${libgupc_spec}"
+fi
+if test "$enable_upc_link_script" = yes; then
+  libgupc_spec="-T gupc.ld%s ${libgupc_spec}"
+fi
+# Set up the set of libraries that we need to link against for libgupc.
+# 
+link_upc_spec="${libgupc_spec} $LIBS"
Index: libgupc/dox-filter-config-h
===================================================================
--- libgupc/dox-filter-config-h (.../trunk)     (revision 0)
+++ libgupc/dox-filter-config-h (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,29 @@
+#!/bin/env perl
+use strict;
+use warnings;
+use File::Slurp qw(slurp);
+
+die "usage: $0 <input_file>" unless @ARGV;
+my $file = $ARGV[0];
+die "file not found: $file\n" unless -f $file;
+die "open failed: $file\n" unless open IN, "<$file";
+
+my $input = slurp(\*IN);
+
+my ($before, $gupcr_cfg, $after) = 
+  ($input =~ m{(.*//begin\ gupcr_config_h\n)(.*)
+               (//end\ gupcr_config_h.*)}xs);
+
+die "could not match the gupcr_config_h file markers\n"
+  unless defined($before)
+         && defined($gupcr_cfg)
+        && defined($after);
+
+$gupcr_cfg =~ s{^/\*\s*((?:(?!/\*).)*?)\s*?\*/\n
+                \#(?:define|undef)\s+(\w+)(.*?)$}
+               {/**\ address@hidden ${1}\ */\n\#define\ ${2}${3}}xgms;
+
+my $result = $before . $gupcr_cfg . $after;
+print $result;
+
+exit 0;
Index: libgupc/doxygen-include.am
===================================================================
--- libgupc/doxygen-include.am  (.../trunk)     (revision 0)
+++ libgupc/doxygen-include.am  (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,123 @@
+# ===========================================================================
+#      http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html
+# ===========================================================================
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Oren Ben-Kiki <address@hidden>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+#
+## --------------------------------- ##
+## Format-independent Doxygen rules. ##
+## --------------------------------- ##
+#
+if DX_COND_doc
+## ------------------------------- ##
+## Rules specific for HTML output. ##
+## ------------------------------- ##
+if DX_COND_html
+DX_CLEAN_HTML = @DX_DOCDIR@/html
+endif DX_COND_html
+## ------------------------------ ##
+## Rules specific for CHM output. ##
+## ------------------------------ ##
+if DX_COND_chm
+DX_CLEAN_CHM = @DX_DOCDIR@/chm
+if DX_COND_chi
+DX_CLEAN_CHI = @DX_DOCDIR@/@address@hidden
+endif DX_COND_chi
+endif DX_COND_chm
+## ------------------------------ ##
+## Rules specific for MAN output. ##
+## ------------------------------ ##
+if DX_COND_man
+DX_CLEAN_MAN = @DX_DOCDIR@/man
+endif DX_COND_man
+## ------------------------------ ##
+## Rules specific for RTF output. ##
+## ------------------------------ ##
+if DX_COND_rtf
+DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+endif DX_COND_rtf
+## ------------------------------ ##
+## Rules specific for XML output. ##
+## ------------------------------ ##
+if DX_COND_xml
+DX_CLEAN_XML = @DX_DOCDIR@/xml
+endif DX_COND_xml
+## ----------------------------- ##
+## Rules specific for PS output. ##
+## ----------------------------- ##
+if DX_COND_ps
+DX_CLEAN_PS = @DX_DOCDIR@/@address@hidden
+DX_PS_GOAL = doxygen-ps
+doxygen-ps: @DX_DOCDIR@/@address@hidden
address@hidden@/@address@hidden: @DX_DOCDIR@/@address@hidden
+       cd @DX_DOCDIR@/latex; \
+       rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+       $(DX_LATEX) refman.tex; \
+       $(MAKEINDEX_PATH) refman.idx; \
+       $(DX_LATEX) refman.tex; \
+       countdown=5; \
+       while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+       refman.log > /dev/null 2>&1 \
+       && test $$countdown -gt 0; do \
+       $(DX_LATEX) refman.tex; \
+       countdown=`expr $$countdown - 1`; \
+       done; \
+       $(DX_DVIPS) -o ../@address@hidden refman.dvi
+endif DX_COND_ps
+## ------------------------------ ##
+## Rules specific for PDF output. ##
+## ------------------------------ ##
+if DX_COND_pdf
+DX_CLEAN_PDF = @DX_DOCDIR@/@address@hidden
+DX_PDF_GOAL = doxygen-pdf
+doxygen-pdf: @DX_DOCDIR@/@address@hidden
address@hidden@/@address@hidden: @DX_DOCDIR@/@address@hidden
+       TEXINPUTS="`pwd`:.:${TEXINPUTS}"; \
+       export  TEXINPUTS; \
+       cd @DX_DOCDIR@/latex; \
+       rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+       $(DX_PDFLATEX) refman.tex; \
+       $(DX_MAKEINDEX) refman.idx; \
+       $(DX_PDFLATEX) refman.tex; \
+       countdown=5; \
+       while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+                         refman.log > /dev/null 2>&1 \
+          && test $$countdown -gt 0; do \
+           $(DX_PDFLATEX) refman.tex; \
+           countdown=`expr $$countdown - 1`; \
+       done; \
+       mv refman.pdf ../@address@hidden
+endif DX_COND_pdf
+## ------------------------------------------------- ##
+## Rules specific for LaTeX (shared for PS and PDF). ##
+## ------------------------------------------------- ##
+if DX_COND_latex
+DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+endif DX_COND_latex
+.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+doxygen-run: @DX_DOCDIR@/@address@hidden
+doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
address@hidden@/@address@hidden: $(DX_CONFIG) $(pkginclude_HEADERS)
+       rm -rf @DX_DOCDIR@
+       $(DX_ENV) $(DX_DOXYGEN) $(DX_CONFIG)
+DX_CLEANFILES = \
+    @DX_DOCDIR@/@address@hidden \
+    -r \
+    $(DX_CLEAN_HTML) \
+    $(DX_CLEAN_CHM) \
+    $(DX_CLEAN_CHI) \
+    $(DX_CLEAN_MAN) \
+    $(DX_CLEAN_RTF) \
+    $(DX_CLEAN_XML) \
+    $(DX_CLEAN_PS) \
+    $(DX_CLEAN_PDF) \
+    $(DX_CLEAN_LATEX)
+endif DX_COND_doc
Index: libgupc/doxygen.sty.in
===================================================================
--- libgupc/doxygen.sty.in      (.../trunk)     (revision 0)
+++ libgupc/doxygen.sty.in      (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,441 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{doxygen}
+
+% Packages used by this style file
+% See: http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Standard_page_styles
+\RequirePackage{alltt}
+\RequirePackage{array}
+\RequirePackage{calc}
+\RequirePackage{color}
+\RequirePackage{fancyhdr}
+\RequirePackage{longtable}
+\RequirePackage{verbatim}
+\RequirePackage{ifthen}
+\RequirePackage[table]{xcolor}
+
+% Use helvetica font instead of times roman
+\RequirePackage{helvet}
+\RequirePackage{sectsty}
+\RequirePackage{tocloft}
+\providecommand{\rmdefault}{phv}
+\providecommand{\bfdefault}{bc}
+
+
+% Setup fancy headings
+\pagestyle{fancyplain}
+\newcommand{\clearemptydoublepage}{%
+  \newpage{\pagestyle{empty}\cleardoublepage}%
+}
+\renewcommand{\chaptermark}[1]{%
+  \markboth{#1}{}%
+}
+\renewcommand{\sectionmark}[1]{%
+  \markright{\thesection\ #1}%
+}
+
+\fancyhead[RE]{\fancyplain{}{\bfseries\leftmark}}
+\fancyhead[CE]{\fancyplain{}{}}
+\fancyhead[LE]{\fancyplain{}{\bfseries\thepage}}
+\fancyhead[RO]{\fancyplain{}{\bfseries\rightmark}}
+\fancyhead[CO]{\fancyplain{}{}}
+\fancyhead[LO]{\fancyplain{}{\bfseries\thepage}}
+\fancyfoot[RE]{\fancyplain{}{\bfseries\scriptsize @address@hidden
+\fancyfoot[LE]{\fancyplain{}
address@hidden@}{}}{}
address@hidden@}}}}
+\fancyfoot[CE]{\fancyplain{}{\bfseries\scriptsize @address@hidden
+\fancyfoot[RO]{\fancyplain{}{\bfseries\scriptsize @address@hidden
+\fancyfoot[LO]{\fancyplain{}
address@hidden@}{}}{}
address@hidden@}}}}
+\fancyfoot[CO]{\fancyplain{}{\bfseries\scriptsize @address@hidden
+
+\fancypagestyle{plain}{
+\fancyhead[RE]{\fancyplain{}{\bfseries\leftmark}}
+\fancyhead[CE]{\fancyplain{}{}}
+\fancyhead[LE]{\fancyplain{}{\bfseries\thepage}}
+\fancyhead[RO]{\fancyplain{}{\bfseries\rightmark}}
+\fancyhead[CO]{\fancyplain{}{}}
+\fancyhead[LO]{\fancyplain{}{\bfseries\thepage}}
+\fancyfoot[RE]{\fancyplain{}{\bfseries\scriptsize @address@hidden
+\fancyfoot[LE]{\fancyplain{}
address@hidden@}{}}{}
address@hidden@}}}}
+\fancyfoot[CE]{\fancyplain{}{\bfseries\scriptsize @address@hidden
+\fancyfoot[RO]{\fancyplain{}{\bfseries\scriptsize @address@hidden
+\fancyfoot[LO]{\fancyplain{}
address@hidden@}{}}{}
address@hidden@}}}}
+\fancyfoot[CO]{\fancyplain{}{\bfseries\scriptsize @address@hidden
+
+%---------- Internal commands used in this style file ----------------
+
+% Generic environment used by all paragraph-based environments defined
+% below. Note that the command \title{...} needs to be defined inside
+% those environments!
+\newenvironment{DoxyDesc}[1]{%
+  \begin{list}{}%
+  {%
+    \settowidth{\labelwidth}{40pt}%
+    \setlength{\leftmargin}{\labelwidth}%
+    \setlength{\parsep}{0pt}%
+    \setlength{\itemsep}{-4pt}%
+    \renewcommand{\makelabel}{\entrylabel}%
+  }%
+  \item[#1]%
+}{%
+  \end{list}%
+}
+
+%---------- Commands used by doxygen LaTeX output generator ----------
+
+% Used by <pre> ... </pre>
+\newenvironment{DoxyPre}{%
+  \small%
+  \begin{alltt}%
+}{%
+  \end{alltt}%
+  \normalsize%
+}
+
+% Used by @code ... @endcode
+\newenvironment{DoxyCode}{%
+  \footnotesize%
+  \verbatim%
+}{%
+  \endverbatim%
+  \normalsize%
+}
+
+% Used by @example, @include, @includelineno and @dontinclude
+\newenvironment{DoxyCodeInclude}{%
+  \DoxyCode%
+}{%
+  \endDoxyCode%
+}
+
+% Used by @verbatim ... @endverbatim
+\newenvironment{DoxyVerb}{%
+  \footnotesize%
+  \verbatim%
+}{%
+  \endverbatim%
+  \normalsize%
+}
+
+% Used by @verbinclude
+\newenvironment{DoxyVerbInclude}{%
+  \DoxyVerb%
+}{%
+  \endDoxyVerb%
+}
+
+% Used by numbered lists (using '-#' or <ol> ... </ol>)
+\newenvironment{DoxyEnumerate}{%
+  \enumerate%
+}{%
+  \endenumerate%
+}
+
+% Used by bullet lists (using '-', @li, @arg, or <ul> ... </ul>)
+\newenvironment{DoxyItemize}{%
+  \itemize%
+}{%
+  \enditemize%
+}
+
+% Used by description lists (using <dl> ... </dl>)
+\newenvironment{DoxyDescription}{%
+  \description%
+}{%
+  \enddescription%
+}
+
+% Used by @image, @dotfile, and @dot ... @enddot
+% (only if caption is specified)
+\newenvironment{DoxyImage}{%
+  \begin{figure}[H]%
+  \begin{center}%
+}{%
+  \end{center}%
+  \end{figure}%
+}
+
+% Used by @image, @dotfile, @dot ... @enddot, and @msc ... @endmsc
+% (only if no caption is specified)
+\newenvironment{DoxyImageNoCaption}{%
+}{%
+}
+
+% Used by @attention
+\newenvironment{DoxyAttention}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @author and @authors
+\newenvironment{DoxyAuthor}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @date
+\newenvironment{DoxyDate}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @invariant
+\newenvironment{DoxyInvariant}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @note
+\newenvironment{DoxyNote}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @post
+\newenvironment{DoxyPostcond}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @pre
+\newenvironment{DoxyPrecond}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @remark
+\newenvironment{DoxyRemark}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @return
+\newenvironment{DoxyReturn}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @since
+\newenvironment{DoxySince}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @see
+\newenvironment{DoxySeeAlso}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @version
+\newenvironment{DoxyVersion}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @warning
+\newenvironment{DoxyWarning}[1]{%
+  \begin{DoxyDesc}{#1}%
+}{%
+  \end{DoxyDesc}%
+}
+
+% Used by @internal
+\newenvironment{DoxyInternal}[1]{%
+  \paragraph*{#1}%
+}{%
+}
+
+% Used by @par and @paragraph
+\newenvironment{DoxyParagraph}[1]{%
+  \begin{list}{}%
+  {%
+    \settowidth{\labelwidth}{40pt}%
+    \setlength{\leftmargin}{\labelwidth}%
+    \setlength{\parsep}{0pt}%
+    \setlength{\itemsep}{-4pt}%
+    \renewcommand{\makelabel}{\entrylabel}%
+  }%
+  \item[#1]%
+}{%
+  \end{list}%
+}
+
+% Used by parameter lists
+\newenvironment{DoxyParams}[2][]{%
+  \begin{DoxyDesc}{#2}%
+    \begin{description}%
+      \item[] \hspace{\fill} \vspace{-25pt}%
+      \definecolor{tableShade}{HTML}{F8F8F8}%
+      \rowcolors{1}{white}{tableShade}%
+      \arrayrulecolor{gray}%
+      \setlength{\tabcolsep}{0.01\textwidth}%
+      \ifthenelse{\equal{#1}{}}
+      {\begin{longtable}{|>{\raggedleft\hspace{0pt}}p{0.15\textwidth}|%
+                          p{0.79\textwidth}|}}%
+      {\ifthenelse{\equal{#1}{1}}%
+       {\begin{longtable}{|>{\centering}p{0.10\textwidth}|%
+                          >{\raggedleft\hspace{0pt}}p{0.15\textwidth}|%
+                          p{0.68\textwidth}|}}%
+       {\begin{longtable}{|>{\centering}p{0.10\textwidth}|%
+                          >{\centering\hspace{0pt}}p{0.15\textwidth}|%
+                          >{\raggedleft\hspace{0pt}}p{0.15\textwidth}|%
+                          p{0.50\textwidth}|}}%
+       }\hline%
+}{%
+      \end{longtable}%
+    \end{description}%
+  \end{DoxyDesc}%
+}
+
+% is used for parameters within a detailed function description
+\newenvironment{DoxyParamCaption}{%
+  \renewcommand{\item}[2][]{##1 {\em ##2}}%
+  }{%
+}
+
+% Used by return value lists
+\newenvironment{DoxyRetVals}[1]{%
+  \begin{DoxyDesc}{#1}%
+    \begin{description}%
+      \item[] \hspace{\fill} \vspace{-25pt}%
+      \definecolor{tableShade}{HTML}{F8F8F8}%
+      \rowcolors{1}{white}{tableShade}%
+      \arrayrulecolor{gray}%
+      \setlength{\tabcolsep}{0.01\textwidth}%
+      \begin{longtable}{|>{\raggedleft\hspace{0pt}}p{0.25\textwidth}|%
+                          p{0.70\textwidth}|}%
+      \hline%
+}{%
+      \end{longtable}%
+    \end{description}%
+  \end{DoxyDesc}%
+}
+
+% Used by exception lists
+\newenvironment{DoxyExceptions}[1]{%
+  \begin{DoxyDesc}{#1}%
+    \begin{description}%
+      \item[] \hspace{\fill} \vspace{-25pt}%
+      \definecolor{tableShade}{HTML}{F8F8F8}%
+      \rowcolors{1}{white}{tableShade}%
+      \arrayrulecolor{gray}%
+      \setlength{\tabcolsep}{0.01\textwidth}%
+      \begin{longtable}{|>{\raggedleft\hspace{0pt}}p{0.25\textwidth}|%
+                          p{0.70\textwidth}|}%
+      \hline%
+}{%
+      \end{longtable}%
+    \end{description}%
+  \end{DoxyDesc}%
+}
+
+% Used by template parameter lists
+\newenvironment{DoxyTemplParams}[1]{%
+  \begin{DoxyDesc}{#1}%
+    \begin{description}%
+      \item[] \hspace{\fill} \vspace{-25pt}%
+      \definecolor{tableShade}{HTML}{F8F8F8}%
+      \rowcolors{1}{white}{tableShade}%
+      \arrayrulecolor{gray}%
+      \setlength{\tabcolsep}{0.01\textwidth}%
+      \begin{longtable}{|>{\raggedleft\hspace{0pt}}p{0.25\textwidth}|%
+                          p{0.70\textwidth}|}%
+      \hline%
+}{%
+      \end{longtable}%
+    \end{description}%
+  \end{DoxyDesc}%
+}
+
+\newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})}
+\newenvironment{DoxyCompactList}
+{\begin{list}{}{
+  \setlength{\leftmargin}{0.5cm}
+  \setlength{\itemsep}{0pt}
+  \setlength{\parsep}{0pt}
+  \setlength{\topsep}{0pt}
+  \renewcommand{\makelabel}{\hfill}}}
+{\end{list}}
+\newenvironment{DoxyCompactItemize}
+{
+  \begin{itemize}
+  \setlength{\itemsep}{-3pt}
+  \setlength{\parsep}{0pt}
+  \setlength{\topsep}{0pt}
+  \setlength{\partopsep}{0pt}
+}
+{\end{itemize}}
+\newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp}
+\newlength{\tmplength}
+\newenvironment{TabularC}[1]
+{
+\setlength{\tmplength}
+     {\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)}
+      \par\begin{tabular*}{\linewidth}
+             {*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|}
+}
+{\end{tabular*}\par}
+\newcommand{\entrylabel}[1]{
+   
{\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\vspace{1.5\baselineskip}}}}
+\newenvironment{Desc}
+{\begin{list}{}
+  {
+    \settowidth{\labelwidth}{40pt}
+    \setlength{\leftmargin}{\labelwidth}
+    \setlength{\parsep}{0pt}
+    \setlength{\itemsep}{-4pt}
+    \renewcommand{\makelabel}{\entrylabel}
+  }
+}
+{\end{list}}
+\newenvironment{Indent}
+  {\begin{list}{}{\setlength{\leftmargin}{0.5cm}}
+      \item[]\ignorespaces}
+  {\unskip\end{list}}
+\setlength{\parindent}{0cm}
+\setlength{\parskip}{0.2cm}
+\addtocounter{secnumdepth}{2}
+\usepackage[T1]{fontenc}
+\makeatletter
address@hidden
+   {-1.0ex}%
+   {1.0ex}%
+   {\usefont{OT1}{phv}{bc}{n}\color{darkgray}}}
address@hidden
+   {-1.0ex}%
+   {1.0ex}%
+   {\usefont{OT1}{phv}{bc}{n}\color{darkgray}}}
+\makeatother
+\allsectionsfont{\usefont{OT1}{phv}{bc}{n}\selectfont\color{darkgray}}
+\stepcounter{secnumdepth}
+\stepcounter{tocdepth}
+\definecolor{comment}{rgb}{0.5,0.0,0.0}
+\definecolor{keyword}{rgb}{0.0,0.5,0.0}
+\definecolor{keywordtype}{rgb}{0.38,0.25,0.125}
+\definecolor{keywordflow}{rgb}{0.88,0.5,0.0}
+\definecolor{preprocessor}{rgb}{0.5,0.38,0.125}
+\definecolor{stringliteral}{rgb}{0.0,0.125,0.25}
+\definecolor{charliteral}{rgb}{0.0,0.5,0.5}
+\definecolor{vhdldigit}{rgb}{1.0,0.0,1.0}
+\definecolor{vhdlkeyword}{rgb}{0.43,0.0,0.43}
+\definecolor{vhdllogic}{rgb}{1.0,0.0,0.0}
+\definecolor{vhdlchar}{rgb}{0.0,0.0,0.0}
Index: libgupc/gen-inline-libgupc.pl
===================================================================
--- libgupc/gen-inline-libgupc.pl       (.../trunk)     (revision 0)
+++ libgupc/gen-inline-libgupc.pl       (.../branches/gupc)     (revision 
231080)
@@ -0,0 +1,99 @@
+#!/usr/bin/perl -w
+use strict;
+#
+#
+# usage: gen-gupc-inline-lib template.in [input-file ...]
+#
+# Create a file from template.in that implements selectively inline'd
+# GUPC runtime routines.
+#
+# The files are read first.  This processes lines with the
+# following syntax.  Note, the '//' sequence must begin in column one.
+#
+# The following lines are processed in the input files.
+#
+# //begin <name>       Collect the following lines up to the matching 'end'
+#                      and append them to an internal buffer named <name>
+#                      Nested Begin ... end brackets are _not_ supported.
+#
+# //end <name>         End the collection of items into the buffer named 
<name>.
+#
+# The following lines are processed in the template file.
+#
+# //include <name>     Expands into the contents of the buffer named <name>.
+#
+# //inline             Expands into:
+#                       "__attribute__((__always_inline__)) static inline".
+#                      May appear inside a begin ... end bracket.
+#
+# The expanded text is written to stdout.
+#
+my $nargs = scalar @ARGV;
+die "missing first (template file) arg" if $nargs < 1;
+for (@ARGV)
+{
+  die "file not found: $_" if ! -f;
+}
+my $tfile = shift @ARGV;
+open TEMPLATE, "<$tfile" or die "can't open template file: $tfile";
+my %bufs = ();
+my $buf;
+my $input_file = '';
+# Read the input files listed in @ARGV
+while (<>)
+{
+  if ($input_file ne $ARGV)
+    {
+      !defined ($buf)
+        or die "missing '//end ${buf}': $input_file\n";
+      $input_file = $ARGV;
+    }
+  chomp;
+  if (m{^//begin\s+(\w+)\s*$})
+    {
+      die "nested buffers not supported,"
+          . " last buffer is '$buf': $input_file\n"
+          if defined ($buf);
+      $buf = $1;
+      next;
+    }
+  elsif (m{^//end\s+(\w+)\s*$})
+    {
+      my $endbuf = $1;
+      die "no matching begin for buffer '$endbuf': $input_file\n"
+          if !defined($buf);
+      die "buffer mismatch, '$buf' != '$endbuf': $input_file\n"
+          if $buf ne $endbuf;
+      $buf = undef;
+      next;
+    }
+  if (defined ($buf))
+    {
+      $bufs{$buf} .= "$_\n";
+    }
+}
+!defined ($buf)
+  or die "missing '//end ${buf}': $input_file\n";
+my $inline_attr = "__attribute__((__always_inline__))\nstatic inline";
+for $buf (keys %bufs)
+{
+  $bufs{$buf} =~ s{^//inline\s*$}{$inline_attr}mg;
+}
+while (<TEMPLATE>)
+{
+  chomp;
+  if (m{^//include\s+(\w+)\s*$})
+    {
+      $buf = $1;
+      die "unknown buffer: $buf" if !exists ($bufs{$buf});
+      print $bufs{$buf};
+      next;
+    }
+  elsif (m{^//inline\s*$})
+    {
+      print "$inline_attr\n";
+      next;
+    }
+  print "$_\n";
+}
+close TEMPLATE;
Index: libgupc/gen-upc-ld-script.pl
===================================================================
--- libgupc/gen-upc-ld-script.pl        (.../trunk)     (revision 0)
+++ libgupc/gen-upc-ld-script.pl        (.../branches/gupc)     (revision 
231080)
@@ -0,0 +1,65 @@
+#!/usr/bin/perl -w
+#
+# Define linkage sections required by GUPC by editing
+# the default GNU ld script.
+#
+use strict;
+my $before_ctors = <<EOD;
+  .upc_alloc_array     :
+  {
+     PROVIDE (__upc_alloc_array_start = .);
+     KEEP (*(SORT(upc_alloc_array.*)))
+     KEEP (*(upc_alloc_array))
+     PROVIDE (__upc_alloc_array_end = .);
+  }
+  .upc_alloc :  { KEEP(*(upc_alloc)) }
+  .upc_init_array     :
+  {
+     PROVIDE (__upc_init_array_start = .);
+     KEEP (*(SORT(upc_init_array.*)))
+     KEEP (*(upc_init_array))
+     PROVIDE (__upc_init_array_end = .);
+  }
+  .upc_init :  { KEEP(*(upc_init)) }
+  /* UPC Program Info - compilation-related data */
+  .upc_pgm_info : 
+  {
+    PROVIDE (__upc_pgm_info_start = .);
+    KEEP (*(upc_pgm_info));
+    PROVIDE (__upc_pgm_info_end = .);
+  }
+EOD
+my $after_end_dot = <<EOD;
+  /* UPC shared section - used to layout shared data only */
+  .upc_shared 0x4000 (NOLOAD):
+  {
+    PROVIDE (__upc_shared_start = .);
+    *(upc_shared);
+    PROVIDE (__upc_shared_end = .);
+  }
+EOD
+my $ld_script = do {local $/ = undef; <>};
+for ($ld_script)
+  {
+    m{^GNU ld} or die "Not a GNU ld script?";
+    my $is_ia64 = /OUTPUT_ARCH\s*\(\s*ia64\s*\)/s;
+    if ($is_ia64)
+      {
+        # The linker on the IA64 (SuSE) can't handle the
+       # additional "nolaod" attribute.  Drop it.
+       $after_end_dot =~ s/\s*\(NOLOAD\)//s;
+      }
+    s/^.*?\n=+\n//s;
+    s/\n(?:\s*\n)*=+\n.*$/\n/s;
+    s/^(.*\n)(\s*\.ctors.*?\n)/$1$before_ctors$2/s
+      or die "No match on .ctors line";
+    m{(\n\s*\.\s*\=\s*ALIGN\s*\(\s*\d+\s*/\s*8\s*\)\s*;[^\n]*\n)}s;
+    my $align = defined($1) ? "$1" : '';
+    s{\n((?:\s*\.\s*\=\s*ALIGN\s*\(\s*\d+\s*/\s*\d+\s*\)\s*;[^\n]*\n)*?
+        \s*_end\s*=\s*\.\s*;
+        \s*PROVIDE\s*\(\s*end\s*=\s*\.\s*\)\s*;[^\n]*\n
+        (?:\s*\.\s*\=\s*DATA_SEGMENT_END\s*\(\s*\.\s*\)\s*;[^\n]*\n)?)}
+     {$1$after_end_dot}sx
+      or die "No match on '_end = .;' line";
+  }
+print $ld_script;
Index: libgupc/header.tex.in
===================================================================
--- libgupc/header.tex.in       (.../trunk)     (revision 0)
+++ libgupc/header.tex.in       (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,66 @@
address@hidden@]{report}
+\usepackage[top=1in, bottom=1in,
+            left=1in, right=1in,
+           textwidth=6.5in]{geometry}
+\usepackage{makeidx}
+\usepackage{graphicx}
+\usepackage{multicol}
+\usepackage{float}
+\usepackage{listings}
+\usepackage{color}
+\usepackage{ifthen}
+\usepackage[table]{xcolor}
+\usepackage{textcomp}
+\usepackage{alltt}
+\usepackage{ifpdf}
+\ifpdf
+\usepackage[pdftex,
+            pagebackref=true,
+            colorlinks=true,
+            linkcolor=blue,
+            unicode
+           ]{hyperref}
+\else
+\usepackage[ps2pdf,
+            pagebackref=true,
+            colorlinks=true,
+            linkcolor=blue,
+            unicode
+           ]{hyperref}
+\usepackage{pspicture}
+\fi
+\usepackage[utf8]{inputenc}
+\usepackage{mathptmx}
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+\usepackage{sectsty}
+\usepackage[titles]{tocloft}
+\usepackage{doxygen}
+\lstset{language=C,inputencoding=utf8,
+        basicstyle=\footnotesize,breaklines=true,breakatwhitespace=true,
+       tabsize=8,numbers=left}
+\makeindex
+\setcounter{tocdepth}{3}
+\renewcommand{\footrulewidth}{0.4pt}
+\renewcommand{\familydefault}{\sfdefault}
+\begin{document}
+\hypersetup{pageanchor=false}
+\begin{titlepage}
+\vspace*{7cm}
+\begin{center}
address@hidden@}{}}{}
address@hidden@}\\
+\vspace*{1cm}}
+{\large @address@hidden
+\vspace*{1cm}
+{\large @address@hidden
+\vspace*{0.5cm}
+{\small @address@hidden
+\end{center}
+\end{titlepage}
+\clearemptydoublepage
+\pagenumbering{roman}
+\tableofcontents
+\clearemptydoublepage
+\pagenumbering{arabic}
+\hypersetup{pageanchor=true}
Index: libgupc/libgupc.spec.in
===================================================================
--- libgupc/libgupc.spec.in     (.../trunk)     (revision 0)
+++ libgupc/libgupc.spec.in     (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,3 @@
+# This spec file is read by gcc when linking.  It is used to specify the
+# standard libraries we need in order to link with -fupc.
+*link_upc: @link_upc_spec@
Index: libgupc/upc-crtbegin.spec.in
===================================================================
--- libgupc/upc-crtbegin.spec.in        (.../trunk)     (revision 0)
+++ libgupc/upc-crtbegin.spec.in        (.../branches/gupc)     (revision 
231080)
@@ -0,0 +1,3 @@
+# This spec file is read by gcc when linking.  It is used to specify the
+# standard libraries we need in order to link with -fupc.
+*upc_crtbegin: @upc_crtbegin_spec@
Index: libgupc/upc-crtend.spec.in
===================================================================
--- libgupc/upc-crtend.spec.in  (.../trunk)     (revision 0)
+++ libgupc/upc-crtend.spec.in  (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,3 @@
+# This spec file is read by gcc when linking.  It is used to specify the
+# standard libraries we need in order to link with -fupc.
+*upc_crtend: @upc_crtend_spec@
Index: libgupc/collectives/gen-upc-coll-reduce.pl
===================================================================
--- libgupc/collectives/gen-upc-coll-reduce.pl  (.../trunk)     (revision 0)
+++ libgupc/collectives/gen-upc-coll-reduce.pl  (.../branches/gupc)     
(revision 231080)
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+#
+# usage:
+#
+# $PERL gen-upc-coll-reduce.pl upc_coll_all_reduce.in >
+#                              upc_coll_all_reduce.upc
+#
+# $PERL gen-upc-coll-reduce.pl upc_coll_all_prefix_reduce.in >
+#                              upc_coll_all_prefix_reduce.upc
+#
+# This script reads 'upc_coll_reduce.in' as a template file,
+# and generates a new source file, upc_coll_reduce.upc,
+# which customizes the "upc_all_reduce_GENERIC" for each
+# data type that the procedure operates on.  The following
+# steps are performed:
+# 1. GENERIC is replaced with a one/two character type suffix
+#    where the suffix encodes the type that the procedure
+#    operates on.
+# 2. _UPC_RED_T is replaced with the full C type name
+#    of the type that the procedure operates on.
+# 3. For floating point types, the code between
+#    "#ifndef _UPC_NONINT_T" and "#endif" is removed.
+# 4. _UPC_TO_PTL_TYPECVT is replaced with a proper define
+#    to convert UPC to PTL data types.
+#
+use strict;
+use warnings;
+my @type_config = (
+    ['signed char', 'C', 1, "UPC_COLL_TO_PTL_CHAR"],
+    ['unsigned char', 'UC', 1, "UPC_COLL_TO_PTL_UCHAR"],
+    ['signed short', 'S', 1, "UPC_COLL_TO_PTL_SHORT"],
+    ['unsigned short', 'US', 1, "UPC_COLL_TO_PTL_USHORT"],
+    ['signed int', 'I', 1, "UPC_COLL_TO_PTL_INT"],
+    ['unsigned int', 'UI', 1, "UPC_COLL_TO_PTL_UINT"],
+    ['signed long', 'L', 1, "UPC_COLL_TO_PTL_LONG"],
+    ['unsigned long', 'UL', 1, "UPC_COLL_TO_PTL_ULONG"],
+    ['float', 'F', 0, "UPC_COLL_TO_PTL_FLOAT"],
+    ['double', 'D', 0, "UPC_COLL_TO_PTL_DOUBLE"],
+    ['long double', 'LD', 0, "UPC_COLL_TO_PTL_LONG_DOUBLE"]
+  );
+my $src;
+{
+  local $/ = undef;
+  $src = <>;
+}
+my ($hdr,$body) =
+   ($src =~ /(.*)PREPROCESS_BEGIN(.*)/ms);
+print $hdr;
+for my $t (@type_config) {
+  my ($name, $chars, $is_int, $data_type) = @$t;
+  my $out = $body;
+  for ($out) {
+    s/_GENERIC/$chars/smg;
+    s/_UPC_RED_T/$name/smg;
+    s/_UPC_TO_PTL_TYPECVT/$data_type/smg;
+    if ($is_int)
+      {
+        s/^#ifndef\s+_UPC_NONINT_T.*?\n(.*?)^#endif.*?\n/$1/smg;
+        s/^#ifdef\s+_UPC_NONINT_T.*?\n(.*?)^#endif.*?\n//smg;
+      }
+    else
+      {
+        s/^#ifndef\s+_UPC_NONINT_T.*?\n.*?^#endif.*?\n//smg;
+        s/^#ifdef\s+_UPC_NONINT_T.*?\n(.*?)^#endif.*?\n/$1/smg;
+      }
+  }
+  print $out;
+}
Index: libgupc/collectives/upc_coll_prefix_reduce.in
===================================================================
--- libgupc/collectives/upc_coll_prefix_reduce.in       (.../trunk)     
(revision 0)
+++ libgupc/collectives/upc_coll_prefix_reduce.in       (.../branches/gupc)     
(revision 231080)
@@ -0,0 +1,623 @@
+/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
+   This file is part of the UPC runtime library.
+   Written by Gary Funck <address@hidden>
+   and Nenad Vukicevic <address@hidden>
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/*****************************************************************************/
+/*                                                                           */
+/*  Copyright (c) 2004, Michigan Technological University                    */
+/*  All rights reserved.                                                     */
+/*                                                                           */
+/*  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 in the documentation and/or other materials provided          */
+/*  with the distribution.                                                   */
+/*  * Neither the name of the Michigan Technological University              */
+/*  nor the names of its contributors may be used to endorse or promote      */
+/*  products derived from this software without specific prior written       */
+/*  permission.                                                              */
+/*                                                                           */
+/*  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.             */
+/*                                                                           */
+/*****************************************************************************/
+
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/*                                                                           */
+/*        UPC collective function library, reference implementation          */
+/*                                                                           */
+/*   Steve Seidel, Dept. of Computer Science, Michigan Technological Univ.   */
+/*   address@hidden                                        March 1, 2004      
*/
+/*                                                                           */
+/*****************************************************************************/
+
+// NOTE: Contrary to the spec, this implementation assumes that the phases
+//       of the src and dst arguments agree.
+
+/* The true set of function names is in upc_all_collectives.c */
+
+PREPROCESS_BEGIN
+void upc_all_prefix_reduce_GENERIC
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ _UPC_RED_T (*func) (_UPC_RED_T, _UPC_RED_T), upc_flag_t sync_mode)
+{
+
+/*
+       This prefix reduce algorithm is linear in the number of array 
elements/THREADS.
+       The prefixes are calculated in a loop that iterates as many times+1
+       as the src array wraps from thread THREADS-1 to thread 0.  The cost of
+       computing prefixes of an array with a small block size (that wraps many
+       times) is likely to be much higher than the cost of computing prefixes
+       of an array of the same size but with block size [*].  This code favors
+       the affinity of the src array.  Thus, if the affinities of the src and 
dst
+       arrays are different, there will many off-thread references (i.e. 
writes,
+       that is, "pushes") to the dst array.
+
+       Each iteration contains two internal barriers and about THREADS 
off-thread
+       reads and writes in the best case.  The pref pointer switches between 
the
+       first and second halves of the array so that one thread can be working
+       an iteration ahead (or behind) of another without interference.  
Otherwise,
+       an additional barrier would be needed.
+
+       Allocate pref[2*THREADS]
+       Determine the number of times the array "wraps".
+       Compute the offset address and number of local elements for 1st pass.
+       for (w=0; w<=wraps; ++w)
+               Initialize local prefix "sum"
+               Compute local prefixes
+               if (MYTHREAD < THREADS-1)
+                       Write rightmost local prefix to pref[MYTHREAD+1]
+               barrier
+               if (MYTHREAD == THREADS-1)
+                       if (w>0)
+                               pref[0] = last "sum" from previous iteration
+                       Compute prefixes in pref[]
+               barrier
+               "Add" pref[MYTHREAD] to each prefix computed at top of loop
+               if (wraps > w)
+                       Swap pointer to first or last half of pref[]
+                       Increment offset address and compute n_local for next 
pass
+       barrier
+       free pref[]
+
+       Thread THREADS-1 was chosen to handle pref[] simply to avoid giving
+       thread 0 more work.  "push" and "pull" versions of this collective
+       function are not distinguished.  As it stands, the writes to pref[]
+       are "pushes" and the reads from pref[] are "pulls".  If the affinities
+       of src and dst differ, this function can be regarded as a "push"
+       because the affinity of the src array is favored.
+*/
+
+  int                          // constant over all iterations
+    src_thr,                   // source thread
+    dst_thr,                   // destination thread
+    phase,                     // phase of src and dst array must be identical
+    wraps,                     // number of times src array properly wraps 
around
+    // first iteration only
+    leaders,                   // number of vacant positions to left of src
+    // modified on each iteration
+    i, j, k,                   // addressing indices
+    w,                         // main loop index for "wraps"
+    src_offset,                        // offset from src of first local 
element
+    dst_offset,                        // offset from dst of first element
+    first_thr,                 // first thread that contains local src elements
+    last_thr,                  // last thread that contains local src elements
+    row_elems,                 // number of src elements in the row processed
+    n_local,                   // number of local src elements
+    rem_elems;                 // number of elements remaining to be processed
+
+  shared _UPC_RED_T *pref;     // shared array to hold local prefixes
+
+  if (!upc_coll_init_flag)
+    upc_coll_init ();
+
+  if (blk_size == 0)
+    blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+  upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_PRED);
+#endif
+
+  // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+  if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+    upc_barrier;
+
+  // This array is used to share local prefixes.
+
+  pref = upc_all_alloc (2 * THREADS, sizeof (_UPC_RED_T));
+
+  src_thr = upc_threadof ((shared void *) src);
+  phase = upc_phaseof ((shared void *) src);
+  dst_thr = upc_threadof ((shared void *) dst);
+
+  // Total number of elements remaining to be processed.
+
+  rem_elems = nelems;
+
+  // Determine offsets in all threads as if there really are elements in all
+  // threads.  Addresses will be src + offset.  (If MYTHREAD < src_thr, 
MYTHREAD
+  // has no elements for this iteration but it might have elements for next
+  // iteration.)  Note: offset is sometimes negative because src is addressed
+  // here as if its block size is 1.  Similar comments apply to dst.
+
+  if (MYTHREAD != src_thr)
+    {
+      src_offset = MYTHREAD - src_thr - phase * THREADS;
+      dst_offset = src_offset;
+
+      // The following arithmetic is undocumentable.
+      if (MYTHREAD >= THREADS + src_thr - dst_thr)
+       dst_offset += (blk_size - 1) * THREADS;
+      if (MYTHREAD < src_thr - dst_thr)
+       dst_offset -= (blk_size - 1) * THREADS;
+    }
+  else
+    {
+      src_offset = 0;
+      dst_offset = 0;
+    }
+
+  // first_thr .. last_thr is range of threads that contains src elements of 
current row
+
+  first_thr = src_thr;
+
+  // Compute n_local, the number of src elements local to this thread,
+
+  if (blk_size == 0 || phase + nelems <= blk_size)
+    {                          // All elements are on the src_thr.
+
+      leaders = 0;             // (Not needed here.  Initialize for debugging 
output.)
+      row_elems = nelems;
+      wraps = 0;
+
+      if (MYTHREAD == src_thr)
+       n_local = nelems;
+      else
+       n_local = 0;
+      last_thr = src_thr;
+    }
+  else                         // At least two threads contain elements.
+    {
+      // Determine how many elements are in the first row.
+      leaders = src_thr * blk_size + phase;
+      if ((leaders + nelems) / (blk_size * THREADS) > 0)       //first row is 
"full"
+       row_elems = blk_size * THREADS - leaders;
+      else
+       row_elems = nelems;
+
+      // Determine how many rows wrap back around to thread 0.
+
+      wraps = (leaders + nelems - 1) / (blk_size * THREADS);
+
+      // Assume most likely situation; modify if necessary
+
+      last_thr = THREADS - 1;
+      n_local = blk_size;
+
+      if (MYTHREAD == src_thr)
+       n_local = blk_size - phase;
+      if (MYTHREAD < src_thr)
+       n_local = 0;
+      if (leaders + nelems < blk_size * THREADS)
+       {
+         // There are not enough elements to fill the
+         // end of the first row.  Assert: wraps = 0
+         last_thr = (leaders + nelems - 1) / blk_size;
+         if ((MYTHREAD == last_thr) && (last_thr > src_thr))
+           n_local = (leaders + nelems) - (MYTHREAD * blk_size);
+         else if (MYTHREAD > last_thr)
+           n_local = 0;
+       }
+    }
+
+
+//////// Main loop.
+
+  for (w = 0; w <= wraps; ++w)
+    {
+
+      if (n_local > 0)
+       {
+         // Initialize first element.
+
+         *((shared _UPC_RED_T *) dst + dst_offset)
+           = *((shared const _UPC_RED_T *) src + src_offset);
+
+         // Compute local prefixes.
+
+         switch (op)
+           {
+           case UPC_ADD:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + j)
+                   = *((shared const _UPC_RED_T *) dst + i)
+                   + *((shared const _UPC_RED_T *) src + k);
+               }
+             break;
+           case UPC_MULT:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + j)
+                   = *((shared const _UPC_RED_T *) dst + i)
+                   * *((shared const _UPC_RED_T *) src + k);
+               }
+             break;
+#ifndef _UPC_NONINT_T
+             // Skip if not integral type, per spec 4.3.1.1
+             // (See additional comments in upc_collective.c)
+           case UPC_AND:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + j)
+                   = *((shared const _UPC_RED_T *) dst + i)
+                   & *((shared const _UPC_RED_T *) src + k);
+               }
+             break;
+           case UPC_OR:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + j)
+                   = *((shared const _UPC_RED_T *) dst + i)
+                   | *((shared const _UPC_RED_T *) src + k);
+               }
+             break;
+           case UPC_XOR:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + j)
+                   = *((shared const _UPC_RED_T *) dst + i)
+                   ^ *((shared const _UPC_RED_T *) src + k);
+               }
+             break;
+#endif // _UPC_NOINT_T
+           case UPC_LOGAND:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + j)
+                   = *((shared const _UPC_RED_T *) dst + i)
+                   && *((shared const _UPC_RED_T *) src + k);
+               }
+             break;
+           case UPC_LOGOR:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + j)
+                   = *((shared const _UPC_RED_T *) dst + i)
+                   || *((shared const _UPC_RED_T *) src + k);
+               }
+             break;
+           case UPC_MIN:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 if (*((shared const _UPC_RED_T *) dst + i)
+                     < *((shared const _UPC_RED_T *) src + k))
+                   *((shared _UPC_RED_T *) dst + j)
+                     = *((shared const _UPC_RED_T *) dst + i);
+                 else
+                   *((shared _UPC_RED_T *) dst + j)
+                     = *((shared const _UPC_RED_T *) src + k);
+               }
+             break;
+           case UPC_MAX:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 if (*((shared const _UPC_RED_T *) dst + i)
+                     > *((shared const _UPC_RED_T *) src + k))
+                   *((shared _UPC_RED_T *) dst + j)
+                     = *((shared const _UPC_RED_T *) dst + i);
+                 else
+                   *((shared _UPC_RED_T *) dst + j)
+                     = *((shared const _UPC_RED_T *) src + k);
+               }
+             break;
+           case UPC_FUNC:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + j)
+                   = func (*((shared const _UPC_RED_T *) dst + i),
+                           *((shared const _UPC_RED_T *) src + k));
+               }
+             break;
+           case UPC_NONCOMM_FUNC:
+             for (i = dst_offset, j = i + THREADS, k = src_offset + THREADS;
+                  k < (src_offset + n_local * THREADS);
+                  i = j, j += THREADS, k += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + j)
+                   = func (*((shared const _UPC_RED_T *) dst + i),
+                           *((shared const _UPC_RED_T *) src + k));
+               }
+             break;
+           }
+
+         if (MYTHREAD < THREADS - 1)
+           // Write last prefix to shared array.  (This is spurious,
+           // e.g., sometimes when n_local < blk_size.)
+
+           pref[MYTHREAD + 1] = *((shared const _UPC_RED_T *) dst
+                                  + dst_offset + (n_local - 1) * THREADS);
+       }
+
+      upc_barrier;
+
+      // Now thread THREADS-1 computes prefixes of pref[first_thr..last_thr]
+      // even if it doesn't contain any elements itself.
+
+      if (MYTHREAD == THREADS - 1)
+       {
+         if (w > 0)            // (first_thr is always 0 in this case)
+
+           // Write the last prefix computed on the *previous* iteration.
+
+           pref[0] =
+             *((shared const _UPC_RED_T *) dst + dst_offset - THREADS);
+
+         else                  // On the first iteration the source thread has 
no left neighbor.
+
+           ++first_thr;
+
+         // Compute prefixes in pref[first_thr..last_thr].
+
+         switch (op)
+           {
+           case UPC_ADD:
+             {
+               for (i = first_thr + 1; i <= last_thr; ++i)
+                 pref[i] += pref[i - 1];
+             }
+             break;
+           case UPC_MULT:
+             {
+               for (i = first_thr + 1; i <= last_thr; ++i)
+                 pref[i] *= pref[i - 1];
+             }
+             break;
+#ifndef _UPC_NONINT_T
+             // Skip if not integral type, per spec 4.3.1.1
+             // (See additional comments in upc_collective.c)
+           case UPC_AND:
+             for (i = first_thr + 1; i <= last_thr; ++i)
+               pref[i] &= pref[i - 1];
+             break;
+           case UPC_OR:
+             for (i = first_thr + 1; i <= last_thr; ++i)
+               pref[i] |= pref[i - 1];
+             break;
+           case UPC_XOR:
+             for (i = first_thr + 1; i <= last_thr; ++i)
+               pref[i] ^= pref[i - 1];
+             break;
+#endif // _UPC_NOINT_T
+           case UPC_LOGAND:
+             for (i = first_thr + 1; i <= last_thr; ++i)
+               pref[i] = pref[i - 1] && pref[i];
+             break;
+           case UPC_LOGOR:
+             for (i = first_thr + 1; i <= last_thr; ++i)
+               pref[i] = pref[i - 1] || pref[i];
+             break;
+           case UPC_MIN:
+             for (i = first_thr + 1; i <= last_thr; ++i)
+               if (pref[i - 1] < pref[i])
+                 pref[i] = pref[i - 1];
+             break;
+           case UPC_MAX:
+             for (i = first_thr + 1; i <= last_thr; ++i)
+               if (pref[i - 1] > pref[i])
+                 pref[i] = pref[i - 1];
+             break;
+           case UPC_FUNC:
+             for (i = first_thr + 1; i <= last_thr; ++i)
+               pref[i] = func (pref[i - 1], pref[i]);
+             break;
+           case UPC_NONCOMM_FUNC:
+             for (i = first_thr + 1; i <= last_thr; ++i)
+               pref[i] = func (pref[i - 1], pref[i]);
+             break;
+           }
+       }                       // THREAD-1 is done doing it's special job.
+
+      upc_barrier;
+
+      if ((n_local > 0) && ((w > 0) || (MYTHREAD > src_thr)))
+       {
+         // "Add" pref[MYTHREAD] to local prefixes.  (On the first
+         // iteration, only threads beyond src_thr should do this.)
+
+         switch (op)
+           {
+           case UPC_ADD:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + i) += pref[MYTHREAD];
+               }
+             break;
+           case UPC_MULT:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               {
+                 *((shared _UPC_RED_T *) dst + i) *= pref[MYTHREAD];
+               }
+             break;
+#ifndef _UPC_NONINT_T
+             // Skip if not integral type, per spec 4.3.1.1
+             // (See additional comments in upc_collective.c)
+           case UPC_AND:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               *((shared _UPC_RED_T *) dst + i) &= pref[MYTHREAD];
+             break;
+           case UPC_OR:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               *((shared _UPC_RED_T *) dst + i) |= pref[MYTHREAD];
+             break;
+           case UPC_XOR:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               *((shared _UPC_RED_T *) dst + i) *= pref[MYTHREAD];
+             break;
+#endif // _UPC_NOINT_T
+           case UPC_LOGAND:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               *((shared _UPC_RED_T *) dst + i) =
+                 *((shared _UPC_RED_T *) dst + i) && pref[MYTHREAD];
+             break;
+           case UPC_LOGOR:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               *((shared _UPC_RED_T *) dst + i) =
+                 *((shared _UPC_RED_T *) dst + i) || pref[MYTHREAD];
+             break;
+           case UPC_MIN:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               if (pref[MYTHREAD] < *((shared _UPC_RED_T *) dst + i))
+                 *((shared _UPC_RED_T *) dst + i) = pref[MYTHREAD];
+             break;
+           case UPC_MAX:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               if (pref[MYTHREAD] > *((shared _UPC_RED_T *) dst + i))
+                 *((shared _UPC_RED_T *) dst + i) = pref[MYTHREAD];
+             break;
+           case UPC_FUNC:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               *((shared _UPC_RED_T *) dst + i) =
+                 func (pref[MYTHREAD], *((shared _UPC_RED_T *) dst + i));
+             break;
+           case UPC_NONCOMM_FUNC:
+             for (i = dst_offset; i < (dst_offset + n_local * THREADS);
+                  i += THREADS)
+               *((shared _UPC_RED_T *) dst + i) =
+                 func (pref[MYTHREAD], *((shared _UPC_RED_T *) dst + i));
+             break;
+           }
+       }
+
+      if (wraps > w)           // Set up for the next iteration.
+       {
+         // swap between two halves of pref array
+         if (w % 2 == 0)
+           pref = pref + THREADS;
+         else
+           pref = pref - THREADS;
+
+         rem_elems -= row_elems;
+
+         if (rem_elems / (blk_size * THREADS) > 0)     // next row is "full"
+           row_elems = blk_size * THREADS;
+         else
+           row_elems = rem_elems;
+
+         first_thr = 0;
+         last_thr = (row_elems - 1) / blk_size;
+
+         n_local = blk_size;
+         if ((MYTHREAD == last_thr) && (row_elems % blk_size > 0))
+           n_local = row_elems % blk_size;
+         else if (MYTHREAD > last_thr)
+           n_local = 0;
+
+         // Handle phase > 0 on first iteration
+
+         if ((w == 0) && (MYTHREAD == src_thr))
+           {
+             src_offset -= phase * THREADS;
+             dst_offset -= phase * THREADS;
+           }
+
+         // All the preceding work makes this easy:
+
+         src_offset += blk_size * THREADS;
+         dst_offset += blk_size * THREADS;
+       }
+
+    }                          // End of main "wrap" loop
+
+  // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+  if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+    upc_barrier;
+  else
+    // we have to synchronize anyway to free the pref array
+    upc_barrier;
+
+  if (MYTHREAD == THREADS - 1)
+    {
+      if (w % 2 == 0)
+       pref -= THREADS;        /* DOB: be sure we free the original pointer! */
+      upc_free (pref);
+    }
+}
Index: libgupc/collectives/upc_coll_reduce.in
===================================================================
--- libgupc/collectives/upc_coll_reduce.in      (.../trunk)     (revision 0)
+++ libgupc/collectives/upc_coll_reduce.in      (.../branches/gupc)     
(revision 231080)
@@ -0,0 +1,476 @@
+/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
+   This file is part of the UPC runtime library.
+   Written by Gary Funck <address@hidden>
+   and Nenad Vukicevic <address@hidden>
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/*****************************************************************************/
+/*                                                                           */
+/*  Copyright (c) 2004, Michigan Technological University                    */
+/*  All rights reserved.                                                     */
+/*                                                                           */
+/*  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 in the documentation and/or other materials provided          */
+/*  with the distribution.                                                   */
+/*  * Neither the name of the Michigan Technological University              */
+/*  nor the names of its contributors may be used to endorse or promote      */
+/*  products derived from this software without specific prior written       */
+/*  permission.                                                              */
+/*                                                                           */
+/*  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.             */
+/*                                                                           */
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+
+/*****************************************************************************/
+/*                                                                           */
+/*        UPC collective function library, reference implementation          */
+/*                                                                           */
+/*   Steve Seidel, Dept. of Computer Science, Michigan Technological Univ.   */
+/*   address@hidden                                        March 1, 2004      
*/
+/*                                                                           */
+/*****************************************************************************/
+
+/* The true set of function names is in upc_all_collectives.c */
+
+PREPROCESS_BEGIN
+void upc_all_reduce_GENERIC
+(shared void *dst,
+ shared const void *src,
+ upc_op_t op,
+ size_t nelems,
+ size_t blk_size,
+ _UPC_RED_T (*func) (_UPC_RED_T, _UPC_RED_T), upc_flag_t sync_mode)
+{
+
+/*
+
+Besides the optional, caller specified beginning and ending barriers,
+this function contains one barrier separating the completion of the local
+reductions in each thread and the cross-thread reduction of those results.
+
+The PULL version of upc_all_reduceT:
+
+       Determine how many src elements are contained on each thread.
+       Reduce the elements local to this thread.
+       Allocate a shared vector and copy the local result to that vector.
+       barrier
+       The dst thread reduces the elements in the vector.
+
+The PUSH version of upc_all_reduceT:
+
+       Determine how many src elements are contained on each thread.
+       Reduce the elements local to this thread.
+       Allocate a shared lock and a shared counter to control access to dst.
+       barrier
+       Each thread contributes its local result to dst.
+*/
+
+// PULL is the default
+#ifndef PULL
+#ifndef PUSH
+#define PULL TRUE
+#endif
+#endif
+
+#ifdef PULL
+  // pointer to shared vector of local results
+  shared _UPC_RED_T *shared_result;
+#endif
+#ifdef PUSH
+  // lock for controlling access to dst
+  upc_lock_t *dst_lock;
+  shared int *dst_lock_cnt;
+#endif
+
+  int i,
+    n_local,
+    full_rows,
+    last_row,
+    num_thr, tail_thr, extras, ph, src_thr, dst_thr, thr, velems, start;
+
+  int *elem_cnt_on_thr;
+
+  _UPC_RED_T local_result = 0;
+
+  if (!upc_coll_init_flag)
+    upc_coll_init ();
+
+  if (blk_size == 0)
+    blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+  upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+  // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+  if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+
+    upc_barrier;
+
+  // Compute n_local, the number of elements local to this thread.
+  // Also compute start, the starting index of src for each thread.
+
+  src_thr = upc_threadof ((shared void *) src);
+  dst_thr = upc_threadof ((shared void *) dst);
+  ph = upc_phaseof ((shared void *) src);
+
+  // We need to figure out which threads contain src elements.
+  // The most complex case to deal with is the one in which only a proper
+  // subset of threads contains src elements and the dst thread is not
+  // among them.  Each thread can locally determine how many src
+  // elements are on all threads so this is computed locally to
+  // avoid an exchange of data among threads.
+
+  elem_cnt_on_thr = (int *) malloc (THREADS * sizeof (int));
+
+  // The number of threads with at least one local element.
+  num_thr = 0;
+
+  // nelems plus the number of virtual elements in first row
+  velems = nelems + src_thr * blk_size + ph;
+
+  // Include virtual elements when computing num of local elems
+  full_rows = velems / (blk_size * THREADS);
+  last_row = velems % (blk_size * THREADS);
+  tail_thr = last_row / blk_size;
+
+  for (thr = 0; thr < THREADS; ++thr)
+    {
+      if (blk_size > 0)
+       {
+         if (thr <= tail_thr)
+           if (thr == tail_thr)
+             extras = last_row % blk_size;
+           else
+             extras = blk_size;
+         else
+           extras = 0;
+
+         n_local = blk_size * full_rows + extras;
+
+         // Adjust the number of elements in this thread, if necessary.
+         if (thr < src_thr)
+           n_local -= blk_size;
+         else if (thr == src_thr)
+           n_local -= ph;
+       }
+      else                     // blk_size == 0
+       {
+         n_local = 0;
+         if (src_thr == thr)   // revise the number of local elements
+           n_local = nelems;
+       }
+
+      if (n_local > 0)
+       ++num_thr;
+
+      elem_cnt_on_thr[thr] = n_local;
+    }
+
+  n_local = elem_cnt_on_thr[MYTHREAD];
+
+  // Starting index for this thread
+  // Note: start is sometimes negative because src is
+  // addressed here as if its block size is 1.
+
+  if (blk_size > 0)
+    if (MYTHREAD > src_thr)
+      start = MYTHREAD - src_thr - ph * THREADS;
+    else if (MYTHREAD < src_thr)
+      start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+    else                       // This is the source thread
+      start = 0;
+  else                         // blk_size == 0
+    start = 0;
+
+  // Reduce the elements local to this thread.
+
+  if (n_local > 0)
+    local_result = *((shared const _UPC_RED_T *) src + start);
+
+  switch (op)
+    {
+    case UPC_ADD:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       {
+         local_result += *((shared const _UPC_RED_T *) src + i);
+       }
+      break;
+
+    case UPC_MULT:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       {
+         local_result *= *((shared const _UPC_RED_T *) src + i);
+       }
+      break;
+
+#ifndef _UPC_NONINT_T
+      // Skip if not integral type, per spec 4.3.1.1
+      // (See additional comments in upc_collective.c)
+    case UPC_AND:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       local_result &= *((shared const _UPC_RED_T *) src + i);
+      break;
+
+    case UPC_OR:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       local_result |= *((shared const _UPC_RED_T *) src + i);
+      break;
+
+    case UPC_XOR:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       local_result ^= *((shared const _UPC_RED_T *) src + i);
+      break;
+#endif // _UPC_NOINT_T
+
+    case UPC_LOGAND:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       local_result = local_result && *((shared const _UPC_RED_T *) src + i);
+      break;
+
+    case UPC_LOGOR:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       local_result = local_result || *((shared const _UPC_RED_T *) src + i);
+      break;
+
+    case UPC_MIN:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       if (local_result > *((shared const _UPC_RED_T *) src + i))
+         local_result = *((shared const _UPC_RED_T *) src + i);
+      break;
+
+    case UPC_MAX:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       if (local_result < *((shared const _UPC_RED_T *) src + i))
+         local_result = *((shared const _UPC_RED_T *) src + i);
+      break;
+
+    case UPC_FUNC:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       local_result = func (local_result,
+                            *((shared const _UPC_RED_T *) src + i));
+      break;
+
+    case UPC_NONCOMM_FUNC:
+      for (i = start + THREADS; i < (start + n_local * THREADS); i += THREADS)
+       local_result = func (local_result,
+                            *((shared const _UPC_RED_T *) src + i));
+      break;
+    }
+
+// Note: local_result is undefined if n_local == 0.
+// Note: Only a proper subset of threads might have a meaningful local_result
+// Note: dst might be on a thread that does not have a local result
+
+#ifdef PULL
+  // Allocate shared vector to store local results;
+  shared_result = upc_all_alloc (THREADS, sizeof (_UPC_RED_T));
+  if (n_local > 0)
+    shared_result[MYTHREAD] = local_result;
+
+#endif // PULL
+
+#ifdef PUSH
+  dst_lock = upc_all_lock_alloc ();
+  dst_lock_cnt = upc_all_alloc (1, sizeof (int));
+  if (MYTHREAD == dst_thr)
+    *dst_lock_cnt = 0;
+#endif // PUSH
+
+  // Make sure all threads are ready to combine their results.
+
+  upc_barrier;
+
+#ifdef PUSH
+
+  if (n_local > 0)
+    {
+      upc_lock (dst_lock);
+
+      if (*dst_lock_cnt == 0)
+       // initialize dst
+       *((shared _UPC_RED_T *) dst) = local_result;
+      else
+       switch (op)
+         {
+         case UPC_ADD:
+           *((shared _UPC_RED_T *) dst) += local_result;
+           break;
+         case UPC_MULT:
+           *((shared _UPC_RED_T *) dst) *= local_result;
+           break;
+#ifndef _UPC_NONINT_T
+           // Skip if not integral type, per spec 4.3.1.1
+           // (See additional comments in upc_collective.c)
+         case UPC_AND:
+           *((shared _UPC_RED_T *) dst) &= local_result;
+           break;
+         case UPC_OR:
+           *((shared _UPC_RED_T *) dst) |= local_result;
+           break;
+         case UPC_XOR:
+           *((shared _UPC_RED_T *) dst) ^= local_result;
+           break;
+#endif // _UPC_NOINT_T
+         case UPC_LOGAND:
+           *((shared _UPC_RED_T *) dst) =
+             *((shared _UPC_RED_T *) dst) && local_result;
+           break;
+         case UPC_LOGOR:
+           *((shared _UPC_RED_T *) dst) =
+             *((shared _UPC_RED_T *) dst) || local_result;
+           break;
+         case UPC_MIN:
+           if (local_result < *((shared _UPC_RED_T *) dst))
+             *((shared _UPC_RED_T *) dst) = local_result;
+           break;
+         case UPC_MAX:
+           if (local_result > *((shared _UPC_RED_T *) dst))
+             *((shared _UPC_RED_T *) dst) = local_result;
+           break;
+         case UPC_FUNC:
+           *((shared _UPC_RED_T *) dst) =
+             func (local_result, *((shared _UPC_RED_T *) dst));
+           break;
+         case UPC_NONCOMM_FUNC:
+           *((shared _UPC_RED_T *) dst) =
+             func (local_result, *((shared _UPC_RED_T *) dst));
+           break;
+         }                     // else
+
+      ++*dst_lock_cnt;
+
+      if (*dst_lock_cnt == num_thr)
+       {
+         upc_unlock (dst_lock);
+         upc_lock_free (dst_lock);
+         upc_free (dst_lock_cnt);
+       }
+      else
+       upc_unlock (dst_lock);
+    }
+
+#endif // PUSH
+
+#ifdef PULL
+  if (MYTHREAD == dst_thr)
+    {
+      // initialize dst to the first non-null result
+      i = 0;
+      while (elem_cnt_on_thr[i] == 0)
+       ++i;
+
+      *((shared _UPC_RED_T *) dst) = shared_result[i];
+
+      ++i;
+
+      for (; i < THREADS; ++i)
+       {
+         // Pull values only from threads where n_local>0.
+         if (elem_cnt_on_thr[i] > 0)
+           {
+             switch (op)
+               {
+               case UPC_ADD:
+                 *((shared _UPC_RED_T *) dst) += shared_result[i];
+                 break;
+               case UPC_MULT:
+                 *((shared _UPC_RED_T *) dst) *= shared_result[i];
+                 break;
+#ifndef _UPC_NONINT_T
+                 // Skip if not integral type, per spec 4.3.1.1
+                 // (See additional comments in upc_collective.c)
+               case UPC_AND:
+                 *((shared _UPC_RED_T *) dst) &= shared_result[i];
+                 break;
+               case UPC_OR:
+                 *((shared _UPC_RED_T *) dst) |= shared_result[i];
+                 break;
+               case UPC_XOR:
+                 *((shared _UPC_RED_T *) dst) ^= shared_result[i];
+                 break;
+#endif
+               case UPC_LOGAND:
+                 *((shared _UPC_RED_T *) dst) =
+                   *((shared _UPC_RED_T *) dst) && shared_result[i];
+                 break;
+               case UPC_LOGOR:
+                 *((shared _UPC_RED_T *) dst) =
+                   *((shared _UPC_RED_T *) dst) || shared_result[i];
+                 break;
+               case UPC_MIN:
+                 if (shared_result[i] < *((shared _UPC_RED_T *) dst))
+                   *((shared _UPC_RED_T *) dst) = shared_result[i];
+                 break;
+               case UPC_MAX:
+                 if (shared_result[i] > *((shared _UPC_RED_T *) dst))
+                   *((shared _UPC_RED_T *) dst) = shared_result[i];
+                 break;
+               case UPC_FUNC:
+                 *((shared _UPC_RED_T *) dst) = func (shared_result[i],
+                                                      *((shared _UPC_RED_T *)
+                                                        dst));
+                 break;
+               case UPC_NONCOMM_FUNC:
+                 *((shared _UPC_RED_T *) dst) = func (shared_result[i],
+                                                      *((shared _UPC_RED_T *)
+                                                        dst));
+                 break;
+               }
+           }
+       }
+      upc_free (shared_result);
+    }
+#endif // PULL
+
+  free (elem_cnt_on_thr);
+
+  // Synchronize using barriers in the cases of MYSYNC and ALLSYNC.
+
+  if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+
+    upc_barrier;
+}
Index: libgupc/config/darwin/upc-crt-config.h
===================================================================
--- libgupc/config/darwin/upc-crt-config.h      (.../trunk)     (revision 0)
+++ libgupc/config/darwin/upc-crt-config.h      (.../branches/gupc)     
(revision 231080)
@@ -0,0 +1,30 @@
+#define _XSTR(X) #X
+#define _STR(S) _XSTR(S)
+
+#define DARWIN_DEF_SECT_SYM(TYPE, SECT, SUFFIX) \
+       __asm__ (".globl ___" _STR(SECT) "_" _STR(SUFFIX) "\n" \
+       "\t.section __" _STR(TYPE) "," _STR(SECT) "\n" \
+       "___" _STR(SECT) "_" _STR(SUFFIX) ":\n")
+
+#define DARWIN_DEF_SECT_BEGIN(TYPE, SECT) \
+        DARWIN_DEF_SECT_SYM (TYPE, SECT, start)
+
+#define DARWIN_DEF_SECT_END(TYPE, SECT) \
+        DARWIN_DEF_SECT_SYM (TYPE, SECT, end)
+
+/* Define UPC sections via __asm__ as zero space cannot be
+   allocated on Darwin OS via the usual method.  */
+
+#define UPC_SHARED_SECTION_BEGIN \
+       DARWIN_DEF_SECT_BEGIN (DATA, GUPCR_SHARED_SECTION_NAME); \
+       __asm__ (".space 256\n");
+#define UPC_SHARED_SECTION_END \
+       DARWIN_DEF_SECT_END (DATA, GUPCR_SHARED_SECTION_NAME);
+#define UPC_PGM_INFO_SECTION_BEGIN \
+       DARWIN_DEF_SECT_BEGIN (DATA, GUPCR_PGM_INFO_SECTION_NAME);
+#define UPC_PGM_INFO_SECTION_END \
+       DARWIN_DEF_SECT_END (DATA, GUPCR_PGM_INFO_SECTION_NAME);
+#define UPC_INIT_ARRAY_SECTION_BEGIN \
+       DARWIN_DEF_SECT_BEGIN (DATA, GUPCR_INIT_ARRAY_SECTION_NAME);
+#define UPC_INIT_ARRAY_SECTION_END \
+       DARWIN_DEF_SECT_END (DATA, GUPCR_INIT_ARRAY_SECTION_NAME);
Index: libgupc/config/default/upc-crt-begin-end.h
===================================================================
--- libgupc/config/default/upc-crt-begin-end.h  (.../trunk)     (revision 0)
+++ libgupc/config/default/upc-crt-begin-end.h  (.../branches/gupc)     
(revision 231080)
@@ -0,0 +1,29 @@
+/* Used by upc-crtbegin to define the beginning of the shared section.  */
+#ifndef GUPCR_SHARED_BEGIN_NAME
+#define GUPCR_SHARED_BEGIN_NAME __upc_shared_start
+#endif
+
+/* Used by upc-crtend to define the end of the shared section.  */
+#ifndef GUPCR_SHARED_END_NAME
+#define GUPCR_SHARED_END_NAME __upc_shared_end
+#endif
+ 
+/* Used by upc-crtbegin to define the beginning of the shared section.  */
+#ifndef GUPCR_PGM_INFO_BEGIN_NAME
+#define GUPCR_PGM_INFO_BEGIN_NAME __upc_pgm_info_start
+#endif
+
+/* Used by upc-crtend to define the end of the shared section.  */
+#ifndef GUPCR_PGM_INFO_END_NAME
+#define GUPCR_PGM_INFO_END_NAME __upc_pgm_info_end
+#endif
+ 
+/* Used by upc-crtbegin to define the beginning of UPC init. array section.  */
+#ifndef GUPCR_INIT_ARRAY_BEGIN_NAME
+#define GUPCR_INIT_ARRAY_BEGIN_NAME __upc_init_array_start
+#endif
+
+/* Used by upc-crtend to define the beginning of UPC init. array section.  */
+#ifndef GUPCR_INIT_ARRAY_END_NAME
+#define GUPCR_INIT_ARRAY_END_NAME __upc_init_array_end
+#endif
Index: libgupc/config/default/upc-crt-config.h
===================================================================
--- libgupc/config/default/upc-crt-config.h     (.../trunk)     (revision 0)
+++ libgupc/config/default/upc-crt-config.h     (.../branches/gupc)     
(revision 231080)
@@ -0,0 +1,36 @@
+#define _XSTR(S) #S
+#define _STR(S) _XSTR(S)
+
+/* Establish a symbol at the beginning of the data section
+   Must take up some space, so that variables don't begin
+   at offset zero.  */
+#define UPC_SHARED_SECTION_BEGIN \
+char GUPCR_SHARED_BEGIN_NAME [256]  \
+     __attribute__((section(_STR(GUPCR_SHARED_SECTION_NAME))));
+
+/* Establish a symbol at the beginning of the program info data section.  */
+#define UPC_PGM_INFO_SECTION_BEGIN \
+char GUPCR_PGM_INFO_BEGIN_NAME []  \
+     __attribute__((section(_STR(GUPCR_PGM_INFO_SECTION_NAME)))) = {};
+
+/* Establish a symbol at the beginning of the section that contains
+   a list of addresses pointing to UPC data initialization procedures.  */
+#define UPC_INIT_ARRAY_SECTION_BEGIN \
+void (*GUPCR_INIT_ARRAY_BEGIN_NAME[]) (void) \
+     __attribute__((section(_STR(GUPCR_INIT_ARRAY_SECTION_NAME)))) = {};
+
+/* Establish a symbol at the end of the shared data section.  */
+#define UPC_SHARED_SECTION_END \
+char GUPCR_SHARED_END_NAME []  \
+     __attribute__((section(_STR(GUPCR_SHARED_SECTION_NAME)))) = {'\0'};
+
+/* Establish a symbol at the end of the program info data section.  */
+#define UPC_PGM_INFO_SECTION_END \
+char GUPCR_PGM_INFO_END_NAME []  \
+     __attribute__((section(_STR(GUPCR_PGM_INFO_SECTION_NAME)))) = {'\0'};
+
+/* Establish a symbol at the end of the UPC init. procedure
+   table section.  */
+#define UPC_INIT_ARRAY_SECTION_END \
+void (*GUPCR_INIT_ARRAY_END_NAME[]) (void) \
+     __attribute__((section(_STR(GUPCR_INIT_ARRAY_SECTION_NAME)))) = {0};
Index: libgupc/include/upc_ops.def
===================================================================
--- libgupc/include/upc_ops.def (.../trunk)     (revision 0)
+++ libgupc/include/upc_ops.def (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,164 @@
+/* UPc Operation (used in  collectives and atomic ops).  */
+
+/*
+- Supported AMO integer types are UPC_INT, UPC_UINT, UPC_LONG, UPC_ULONG,
+UPC_INT32, UPC_UINT32, UPC_INT64, and UPC_UINT64.
+- Supported AMO floating-point types are UPC_FLOAT and UPC_DOUBLE.
+- Supported AMO accessors are UPC_GET, UPC_SET, and UPC_CSWAP.
+- Supported AMO bit-wise operations are UPC_AND, UPC_OR, and UPC_XOR.
+- Supported AMO numeric operations are UPC_ADD, UPC_SUB, UPC_MULT, UPC_INC,
+UPC_DEC, UPC_MAX, and UPC_MIN.   */
+
+upc_op = {
+    op_upc_name = "UPC_ADD";
+    op_name = "add";
+    op_op = "+";
+    op_bit = 0;
+    op_c_value = "(1LL << 0)";
+    op_mode = "numeric";
+    op_atomic_ok;
+    op_require_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_MULT";
+    op_name = "mult";
+    op_op = "*";
+    op_bit = 1;
+    op_c_value = "(1LL << 1)";
+    op_mode = "numeric";
+    op_atomic_ok;
+    op_require_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_AND";
+    op_name = "and";
+    op_op = "&";
+    op_bit = 2;
+    op_c_value = "(1LL << 2)";
+    op_mode = "logical";
+    op_atomic_ok;
+    op_require_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_OR";
+    op_name = "or";
+    op_op = "|";
+    op_bit = 3;
+    op_c_value = "(1LL << 3)";
+    op_mode = "logical";
+    op_atomic_ok;
+    op_require_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_XOR";
+    op_name = "xor";
+    op_op = "^";
+    op_bit = 4;
+    op_c_value = "(1LL << 4)";
+    op_mode = "logical";
+    op_atomic_ok;
+    op_require_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_LOGAND";
+    op_name = "logand";
+    op_bit = 5;
+    op_c_value = "(1LL << 5)";
+    op_mode = "logical";
+  };
+upc_op = {
+    op_upc_name = "UPC_LOGOR";
+    op_name = "logor";
+    op_bit = 6;
+    op_c_value = "(1LL << 6)";
+    op_mode = "logical";
+  };
+upc_op = {
+    op_upc_name = "UPC_MIN";
+    op_name = "min";
+    op_bit = 7;
+    op_c_value = "(1LL << 7)";
+    op_mode = "numeric";
+    op_atomic_ok;
+    op_require_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_MAX";
+    op_name = "max";
+    op_bit = 8;
+    op_c_value = "(1LL << 8)";
+    op_mode = "numeric";
+    op_atomic_ok;
+    op_require_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_GET";
+    op_name = "get";
+    op_bit = 9;
+    op_c_value = "(1LL << 9)";
+    op_mode = "access";
+    op_atomic_ok;
+    op_require_fetch_ptr;
+    op_null_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_SET";
+    op_name = "set";
+    op_bit = 10;
+    op_c_value = "(1LL << 10)";
+    op_mode = "access";
+    op_atomic_ok;
+    op_require_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_CSWAP";
+    op_name = "compare_exchange";
+    op_bit = 11;
+    op_c_value = "(1LL << 11)";
+    op_mode = "access";
+    op_atomic_ok;
+    op_require_operand1;
+    op_require_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_SUB";
+    op_name = "sub";
+    op_op = "-";
+    op_bit = 12;
+    op_c_value = "(1LL << 12)";
+    op_mode = "numeric";
+    op_atomic_ok;
+    op_require_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_INC";
+    op_name = "inc";
+    op_op = "+";
+    op_bit = 13;
+    op_c_value = "(1LL << 13)";
+    op_mode = "numeric";
+    op_atomic_ok;
+    op_null_operand1;
+    op_null_operand2;
+  };
+upc_op = {
+    op_upc_name = "UPC_DEC";
+    op_name = "dec";
+    op_op = "-";
+    op_bit = 14;
+    op_c_value = "(1LL << 14)";
+    op_mode = "numeric";
+    op_atomic_ok;
+    op_null_operand1;
+    op_null_operand2;
+  };
Index: libgupc/include/upc_types.def
===================================================================
--- libgupc/include/upc_types.def       (.../trunk)     (revision 0)
+++ libgupc/include/upc_types.def       (.../branches/gupc)     (revision 
231080)
@@ -0,0 +1,196 @@
+/*
+- Supported AMO integer types are UPC_INT, UPC_UINT, UPC_LONG, UPC_ULONG,
+UPC_INT32, UPC_UINT32, UPC_INT64, and UPC_UINT64.
+- Supported AMO floating-point types are UPC_FLOAT and UPC_DOUBLE.
+- Supported AMO accessors are UPC_GET, UPC_SET, and UPC_CSWAP.
+- Supported AMO bit-wise operations are UPC_AND, UPC_OR, and UPC_XOR.
+- Supported AMO numeric operations are UPC_ADD, UPC_SUB, UPC_MULT, UPC_INC,
+UPC_DEC, UPC_MAX, and UPC_MIN.   */
+
+upc_type = {
+    type_upc_name = "UPC_CHAR";
+    type_abbrev = "C";
+    type_c_name = "char";
+    type_value = 1;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_UCHAR";
+    type_abbrev = "UC";
+    type_c_name = "unsigned char";
+    type_value = 2;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_SHORT";
+    type_abbrev = "S";
+    type_c_name = "short";
+    type_value = 3;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_USHORT";
+    type_abbrev = "US";
+    type_c_name = "unsigned short";
+    type_value = 4;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_INT";
+    type_abbrev = "I";
+    type_c_name = "int";
+    type_value = 5;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_UINT";
+    type_abbrev = "UI";
+    type_c_name = "unsigned int";
+    type_value = 6;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_LONG";
+    type_abbrev = "L";
+    type_c_name = "long";
+    type_value = 7;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_ULONG";
+    type_abbrev = "UL";
+    type_c_name = "unsigned long";
+    type_value = 8;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_LLONG";
+    type_abbrev = "LL";
+    type_c_name = "long long";
+    type_value = 9;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_ULLONG";
+    type_abbrev = "ULL";
+    type_c_name = "unsigned long long";
+    type_value = 10;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_INT8";
+    type_abbrev = "I8";
+    type_c_name = "int8_t";
+    type_value = 11;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_UINT8";
+    type_abbrev = "UI8";
+    type_c_name = "uint8_t";
+    type_value = 12;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_INT16";
+    type_abbrev = "I16";
+    type_c_name = "int16_t";
+    type_value = 13;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_UINT16";
+    type_abbrev = "UI16";
+    type_c_name = "uint16_t";
+    type_value = 14;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_INT32";
+    type_abbrev = "I32";
+    type_c_name = "int32_t";
+    type_value = 15;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_UINT32";
+    type_abbrev = "UI32";
+    type_c_name = "uint32_t";
+    type_value = 16;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_INT64";
+    type_abbrev = "I64";
+    type_c_name = "int64_t";
+    type_value = 17;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_UINT64";
+    type_abbrev = "UI64";
+    type_c_name = "uint64_t";
+    type_value = 18;
+    type_atomic_ok;
+    type_numeric_op_ok;
+    type_bit_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_FLOAT";
+    type_abbrev = "F";
+    type_c_name = "float";
+    type_value = 19;
+    type_floating_point;
+    type_atomic_ok;
+    type_numeric_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_DOUBLE";
+    type_abbrev = "D";
+    type_c_name = "double";
+    type_value = 20;
+    type_floating_point;
+    type_atomic_ok;
+    type_numeric_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_LDOUBLE";
+    type_abbrev = "LD";
+    type_c_name = "long double";
+    type_value = 21;
+    type_floating_point;
+    type_numeric_op_ok;
+  };
+upc_type = {
+    type_upc_name = "UPC_PTS";
+    type_abbrev = "PTS";
+    type_c_name = "shared void *";
+    type_value = 22;
+    type_atomic_ok;
+  };
Index: libgupc/portals4/doxygen.cfg.in
===================================================================
--- libgupc/portals4/doxygen.cfg.in     (.../trunk)     (revision 0)
+++ libgupc/portals4/doxygen.cfg.in     (.../branches/gupc)     (revision 
231080)
@@ -0,0 +1,1722 @@
+# Doxyfile 1.7.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a hash (#) is considered a comment and will be ignored.
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = @PACKAGE@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER         = @PACKAGE_VERSION@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = @PACKAGE_NAME@
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           = @DOXYGEN_HTML_LOGO@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = @DX_DOCDIR@
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed 
description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH        = @top_srcdir@/portals4
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = YES
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given 
extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by 
doxygen.
+
+EXTENSION_MAPPING      = upc=C
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use 
public
+# instead of private inheritance when no explicit protection keyword is 
present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate 
getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penalty.
+# If the system has enough physical memory increasing the cache will improve 
the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will roughly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory 
hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically 
from
+# the version control system). Doxygen will invoke the program by executing 
(via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that 
contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT                  = @top_srcdir@/config.h.in \
+                         gcc-upc-lib.h @top_srcdir@/portals4
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS          = *.c *.h *.upc
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT 
tag.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS = */address@hidden@/dox-filter-config-h
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these 
sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header. Note that when using a custom header you are responsible
+# for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when 
changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# If the HTML_TIMESTAMP tag is set to YES then the generated HTML
+# documentation will contain the timesstamp.
+
+HTML_TIMESTAMP         = NO
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated 
HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product 
suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely 
identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters";>
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes";>
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the
+# mathjax.org site, so you can quickly see the result without installing
+# MathJax, but it is strongly recommended to install a local copy of MathJax
+# before deployment.
+
+MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvantages are that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = @DX_LATEX@
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = letter
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = header.tex
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = YES
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = YES
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be 
expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = @HAVE_DOT@
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will write a font called Helvetica to the output
+# directory and reference it in all dot files that doxygen generates.
+# When you want a differently looking font you can specify the font name
+# using DOT_FONTNAME. You need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = YES
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = @DX_DOT@
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
Index: libgupc/portals4/gcc-upc-lib.in
===================================================================
--- libgupc/portals4/gcc-upc-lib.in     (.../trunk)     (revision 0)
+++ libgupc/portals4/gcc-upc-lib.in     (.../branches/gupc)     (revision 
231080)
@@ -0,0 +1,171 @@
+/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
+   This file is part of the UPC runtime library.
+   Written by Gary Funck <address@hidden>
+   and Nenad Vukicevic <address@hidden>
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+
+#ifndef _GCC_UPC_LIB_H_
+#define _GCC_UPC_LIB_H_ 1
+
+#ifdef IN_TARGET_LIBS
+#include "config.h"
+#include <unistd.h>
+#endif /* IN_TARGET_LIBS */
+
+/* Required for size_t definition.  */
+#include <stddef.h>
+
+#pragma upc c_code
+
+/* Helper macros for expanding the value of a macro as a string.  */
+#define __UPC_STR__(S) #S
+#define __UPC_XSTR__(S) __UPC_STR__(S)
+
+#ifdef __UPC_STATIC_THREADS__
+/* Defined at compile time by the -fupc-threads=N switch.  */
+#define __UPC_N_THREADS__ THREADS
+#define __UPC_STR__(S) #S
+#define __UPC_XSTR__(S) __UPC_STR__(S)
+#define __UPC_THREADS_CONFIG__ " staticthreads=" __UPC_XSTR__(THREADS)
+#else
+/* Defined at run time.  */
+extern const int THREADS;
+#define __UPC_N_THREADS__ -1
+#define __UPC_THREADS_CONFIG__ "dynamicthreads"
+#endif
+
+#define __UPC_THREADS_MODEL__ "process"
+
+/* Support for atomics - UPC Specification 1.3.  */
+#define __UPC_ATOMIC__ 1
+
+/* Support for castability - UPC Specification 1.3.  */
+#define __UPC_CASTABLE__ 1
+
+/* Support for UPC collectives.  */
+#define __UPC_COLLECTIVE__ 1
+
+/* Support for non-blocking transfer operations - UPC Specification 1.3.  */
+#define __UPC_NB__ 1
+
+/* Support for GASP - http://gasp.hcs.ufl.edu/.  */ 
+#define __UPC_PUPC__ 1
+
+/* Support for high-performance wall-clock timer - UPC Specification 1.3.  */
+#define __UPC_TICK__ 1
+
+#pragma upc upc_code
+/* Opaque data type for referencing UPC atomic domains.  */
+typedef shared struct upc_atomicdomain_struct upc_atomicdomain_t;
+#pragma upc c_code
+
+/* Place configuration information required by the Berkeley
+   UPC compilation system into the object file.  */
+static const char GCCUPCConfig[]
+#if __MACH__
+  __attribute__ ((section ("__DATA,upc_pgm_info"))) __attribute__ ((used)) =
+#else
+  __attribute__ ((section ("upc_pgm_info"))) __attribute__ ((used)) =
+#endif
+  "$GCCUPCConfig: (" __BASE_FILE__ ") "
+  __UPC_THREADS_CONFIG__ " " __UPC_THREADS_MODEL__ "$";
+
+#undef __UPC_XSTR__
+#undef __UPC_STR__
+
+extern const int MYTHREAD;
+
+/* Depth count used to implement the semantics of
+   nested upc_forall statements.  */
+extern int __upc_forall_depth;
+
+/* The UPC runtime's main program must run first,
+   we rename the user's main to upc_main().  */
+#if __MACH__
+extern int
+main ()
+__asm__ ("_upc_main");
+#else
+extern int
+main ()
+__asm__ ("upc_main");
+#endif
+
+/* Remap calls to exit so that they invoke the UPC runtime's
+   implementation of exit instead.  */
+#define exit __upc_exit
+
+/* Implementation of upc_fence.  */
+#define upc_fence __upc_fence()
+
+/* upc_shared_ptr_t is predefined as the representation of
+   a shared pointer type.  */
+
+/* Runtime variables used by optimized code generation
+   on some targets.  */
+/* The base address of the UPC shared section.  */
+extern char __upc_shared_start[1];
+
+/* Runtime procedures.  */
+//include lib_runtime_api
+
+//include detect_target64
+
+/* Runtime shared access procedures.  */
+//include mode_types
+
+#if defined (__UPC_INLINE_LIB__) || defined (IN_TARGET_LIBS)
+
+/* Library routines have access to runtime internals.  */
+
+//include gupcr_config_h
+//include lib_min_max
+//include lib_config_heap
+//include lib_config_shared_section
+//include lib_pts_defs
+
+#endif /* __UPC_INLINE_LIB__ || IN_TARGET_LIBS */
+
+#ifdef __UPC_INLINE_LIB__
+
+//include lib_mem_barrier
+//include lib_gmem
+//include lib_node_local
+//include lib_max_threads_def
+/* Must include stdio.h because of FILE def.  */
+#include <stdio.h>
+//include lib_utils_api
+//include lib_portals
+//include lib_inline_gmem
+/* We need to include <string.h> to define memcpy() */
+#include <string.h>
+//include lib_inline_access
+
+#else
+
+//include lib_access_prototypes
+
+#endif /* __UPC_INLINE_LIB__ */
+
+#endif /* !_GCC_UPC_LIB_H_ */
Index: libgupc/portals4/gupcr_coll_reduce.in
===================================================================
--- libgupc/portals4/gupcr_coll_reduce.in       (.../trunk)     (revision 0)
+++ libgupc/portals4/gupcr_coll_reduce.in       (.../branches/gupc)     
(revision 231080)
@@ -0,0 +1,606 @@
+/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
+   This file is part of the UPC runtime library.
+   Written by Gary Funck <address@hidden>
+   and Nenad Vukicevic <address@hidden>
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/*****************************************************************************/
+/*                                                                           */
+/*  Copyright (c) 2004, Michigan Technological University                    */
+/*  All rights reserved.                                                     */
+/*                                                                           */
+/*  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 in the documentation and/or other materials provided          */
+/*  with the distribution.                                                   */
+/*  * Neither the name of the Michigan Technological University              */
+/*  nor the names of its contributors may be used to endorse or promote      */
+/*  products derived from this software without specific prior written       */
+/*  permission.                                                              */
+/*                                                                           */
+/*  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.             */
+/*                                                                           */
+/*****************************************************************************/
+
+#include <stdlib.h>
+#include <upc.h>
+#include <upc_collective.h>
+#include <upc_coll.h>
+#include "gupcr_config.h"
+#include "gupcr_defs.h"
+#include "gupcr_sup.h"
+#include "gupcr_portals.h"
+#include "gupcr_gmem.h"
+#include "gupcr_utils.h"
+#include "gupcr_coll_sup.h"
+
+/*****************************************************************************/
+/*                                                                           */
+/*        UPC collective function library, reference implementation          */
+/*                                                                           */
+/*   Steve Seidel, Dept. of Computer Science, Michigan Technological Univ.   */
+/*   address@hidden                                        March 1, 2004      
*/
+/*                                                                           */
+/*****************************************************************************/
+
+/**
+ * @file gupcr_coll_reduce.upc
+ * GUPC Portals4 reduce collectives implementation.
+ *
+ * @addtogroup COLLECTIVES GUPCR Collectives Functions
+ * @{
+ */
+
+/** Collectives reduce storage pointer */
+gupcr_reduce_str_t gupcr_reduce_storage;
+
+/**
+ * Convert from UPC reduce to Portals atomic operation.
+ *
+ * @parm [in] op UPC reduce operation
+ * @retval Portals atomic operation
+*/
+ptl_op_t
+gupcr_portals_reduce_op (upc_op_t op)
+{
+  switch (op)
+    {
+    case UPC_ADD:
+      return PTL_SUM;
+    case UPC_MULT:
+      return PTL_PROD;
+    case UPC_AND:
+      return PTL_BAND;
+    case UPC_OR:
+      return PTL_BOR;
+    case UPC_XOR:
+      return PTL_BXOR;
+    case UPC_LOGAND:
+      return PTL_LAND;
+    case UPC_LOGOR:
+      return PTL_LOR;
+    case UPC_MIN:
+      return PTL_MIN;
+    case UPC_MAX:
+      return PTL_MAX;
+    default:
+      gupcr_fatal_error ("cannot convert UPC reduce operation 0x%lx.", op);
+    }
+}
+
+PREPROCESS_BEGIN
+#ifdef _UPC_NONINT_T
+/**
+ * Collectives UPC_LOGAND function for float types
+ *
+ * Portals4 does not define logical AND atomic operations
+ * and they will be executed as functions.
+ */
+  _UPC_RED_T
+gupcr_coll_logand_GENERIC (_UPC_RED_T a, _UPC_RED_T b)
+{
+  return a && b;
+}
+
+/**
+ * Collectives UPC_LOGOR function for float types
+ *
+ * Portals4 does not define logical OR atomic operations
+ * and they will be executed as functions.
+ */
+
+_UPC_RED_T
+gupcr_coll_logor_GENERIC (_UPC_RED_T a, _UPC_RED_T b)
+{
+  return a || b;
+}
+#endif /* _UPC_NONINT_T */
+
+/**
+ * Collectives reduce (_GENERIC) function
+ *
+ * The following steps are taken to calculate the reduced value:
+ *
+ * - Each thread reduces the values it has affinity to. Note that
+ *   some of the threads might not participate in collectives reduce.
+ * - A reduce tree is created out of the threads participating.
+ * - All the parent threads signal their children that they are ready
+ *   for the collectives reduce operation.
+ * - All the children perform atomic portals reduce operations in the
+ *   parent shared space. The reduced values are propagated to the
+ *   top of the tree.
+ * - Result is written to the specified destination.
+ *
+ * @param [in] dst Destination shared pointer
+ * @param [in] src Source shared pointer
+ * @param [in] op Collectives reduce operation
+ * @param [in] nelems Number of elements
+ * @param [in] blk_size Block size
+ * @param [in] func Optional reduce function
+ * @param [in] sync_mode Synchronization mode
+ *
+ */
+void upc_all_reduce_GENERIC
+  (shared void *dst,
+   shared const void *src,
+   upc_op_t op,
+   size_t nelems,
+   size_t blk_size,
+   _UPC_RED_T (*func) (_UPC_RED_T, _UPC_RED_T), upc_flag_t sync_mode)
+{
+  int i, n_local, full_rows, last_row;
+  int num_thr, tail_thr, extras, ph, src_thr, dst_thr, velems, start;
+
+  _UPC_RED_T local_result = 0;
+  _UPC_RED_T *l_src;
+
+  if (!upc_coll_init_flag)
+    upc_coll_init ();
+
+  gupcr_trace (FC_COLL, "COLL ALL_REDUCE ENTER _UPC_RED_T %lu %lu",
+              (long unsigned) nelems, (long unsigned) blk_size);
+
+  if (blk_size == 0)
+    blk_size = nelems;
+
+#ifdef _UPC_COLL_CHECK_ARGS
+  upc_coll_err (dst, src, NULL, 0, sync_mode, blk_size, nelems, op, UPC_RED);
+#endif
+
+  /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC.  */
+  if (UPC_IN_MYSYNC & sync_mode || !(UPC_IN_NOSYNC & sync_mode))
+    upc_barrier;
+
+  /* Compute n_local, the number of elements local to this thread.  */
+  n_local = 0;
+
+  /* Also compute start, the starting index of src for each thread.  */
+
+  src_thr = upc_threadof ((shared void *) src);
+  dst_thr = upc_threadof ((shared void *) dst);
+  ph = upc_phaseof ((shared void *) src);
+
+  /* nelems plus the number of virtual elements in first row.  */
+  velems = nelems + src_thr * blk_size + ph;
+
+  /* Include virtual elements when computing number of local elements.  */
+  full_rows = velems / (blk_size * THREADS);
+  last_row = velems % (blk_size * THREADS);
+  tail_thr = last_row / blk_size;
+
+  /* Calculate number of participating threads.  */
+  num_thr = (nelems + ph + blk_size - 1) / blk_size;
+  if (num_thr > THREADS)
+    num_thr = THREADS;
+
+  gupcr_debug (FC_COLL,
+              "src_thr: %d tail_thr: %d ph: %d num_thr: %d full_rows: %d",
+              src_thr, tail_thr, ph, num_thr, full_rows);
+
+  /* Calculate number of local elements.  */
+  if (blk_size > 0)
+    {
+      if (MYTHREAD <= tail_thr)
+       if (MYTHREAD == tail_thr)
+         extras = last_row % blk_size;
+       else
+         extras = blk_size;
+      else
+       extras = 0;
+
+      n_local = blk_size * full_rows + extras;
+
+      /* Adjust the number of elements in this thread, if necessary.  */
+      if (MYTHREAD < src_thr)
+       n_local -= blk_size;
+      else if (MYTHREAD == src_thr)
+       n_local -= ph;
+    }
+  else
+    {
+      n_local = 0;
+      if (src_thr == MYTHREAD) /* Revise the number of local elements.  */
+       n_local = nelems;
+    }
+
+  /* Starting index for this thread
+     Note: start is sometimes negative because src is
+     addressed here as if its block size is 1.  */
+
+  if (blk_size > 0)
+    if (MYTHREAD > src_thr)
+      start = MYTHREAD - src_thr - ph * THREADS;
+    else if (MYTHREAD < src_thr)
+      start = (blk_size - ph) * THREADS + MYTHREAD - src_thr;
+    else                       /* This is the source thread.  */
+      start = 0;
+  else
+    start = 0;
+
+#ifdef _UPC_NONINT_T
+  /* Logical operations on floating point types must execute as
+     functions as Portals4 does not have support for them.  */
+  switch (op)
+    {
+    case UPC_LOGAND:
+      func = &gupcr_coll_logand_GENERIC;
+      op = UPC_FUNC;
+      break;
+    case UPC_LOGOR:
+      func = &gupcr_coll_logor_GENERIC;
+      op = UPC_FUNC;
+      break;
+    }
+#endif /* _UPC_NOINT_T */
+
+  /* Reduce the elements local to this thread.  */
+
+  if (n_local > 0)
+    {
+      int loop_cnt = n_local - 1;
+
+      l_src = (_UPC_RED_T *) ((shared const _UPC_RED_T *) src + start);
+      local_result = *l_src++;
+
+      switch (op)
+       {
+       case UPC_ADD:
+         while (loop_cnt--)
+           local_result += *l_src++;
+         break;
+       case UPC_MULT:
+         while (loop_cnt--)
+           local_result *= *l_src++;
+         break;
+#ifndef _UPC_NONINT_T
+         /* Skip if not integral type, per spec 4.3.1.1
+            (See additional comments in upc_collective.c) */
+       case UPC_AND:
+         while (loop_cnt--)
+           local_result &= *l_src++;
+         break;
+       case UPC_OR:
+         while (loop_cnt--)
+           local_result |= *l_src++;
+         break;
+       case UPC_XOR:
+         while (loop_cnt--)
+           local_result ^= *l_src++;
+         break;
+       case UPC_LOGAND:
+         while (loop_cnt--)
+           local_result = local_result && *l_src++;
+         break;
+       case UPC_LOGOR:
+         while (loop_cnt--)
+           local_result = local_result || *l_src++;
+         break;
+#endif /* !_UPC_NOINT_T */
+       case UPC_MIN:
+         while (loop_cnt--)
+           {
+             if (local_result > *l_src)
+               local_result = *l_src;
+             ++l_src;
+           }
+         break;
+       case UPC_MAX:
+         while (loop_cnt--)
+           {
+             if (local_result < *l_src)
+               local_result = *l_src;
+             ++l_src;
+           }
+         break;
+       case UPC_FUNC:
+         while (loop_cnt--)
+           local_result = func (local_result, *l_src++);
+         break;
+       case UPC_NONCOMM_FUNC:
+         while (loop_cnt--)
+           local_result = func (local_result, *l_src++);
+         break;
+       default:
+         gupcr_fatal_error ("bad UPC collectives reduce operator 0x%lx", op);
+       }
+    }
+
+  /* Note: local_result is undefined if n_local == 0.
+     Note: Only a proper subset of threads have a meaningful local_result.
+     Note: dst might be a thread that does not have a local result.  */
+
+  /* Global reduce on only participating threads.  */
+  if (n_local)
+    {
+      /* Local pointer where reduced values are written too.  */
+      _UPC_RED_T *t_result =
+       (_UPC_RED_T *) & gupcr_reduce_storage[MYTHREAD].value[0];
+
+      /* Initialize collectives reduce tree.  */
+      gupcr_coll_tree_setup (dst_thr, src_thr, num_thr);
+
+      /* Copy in local results into the area for reduce operation.
+         NOTE: Not needed for the case of collective functions. However,
+         this covers the case of only one thread.  */
+      *t_result = local_result;
+
+#ifdef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+/* Run reduce operation without triggered functions.  */
+#undef GUPCR_USE_PORTALS4_TRIGGERED_OPS
+#endif
+#if GUPCR_USE_PORTALS4_TRIGGERED_OPS
+      /* Note: In the case of UPC_FUNC and UPC_NONCOMM, it is not possible
+         to use triggered operations on inner nodes. In that case, inner
+         nodes must calculate reduced value by calling the specified
+         function.  */
+      if (gupcr_coll_child_cnt)
+       {
+         if (IS_ROOT_THREAD)
+           {
+             /* ROOT THREAD */
+             /* Let children know that parent is ready.  */
+             for (i = 0; i < gupcr_coll_child_cnt; i++)
+               {
+                 size_t offset = upc_addrfield ((shared void *)
+                                                &(gupcr_reduce_storage
+                                                  [MYTHREAD].signal));
+                 gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+               }
+             gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+             /* Wait for children to report their values.  */
+             gupcr_coll_signal_wait (gupcr_coll_child_cnt);
+
+             /* Reduce local values with those of children if necessary.  */
+             if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+               {
+                 /* Reduce local result with those of children.  */
+                 for (i = 0; i < gupcr_coll_child_cnt; i++)
+                   {
+                     local_result =
+                       func (local_result, *(_UPC_RED_T *)
+                             & gupcr_reduce_storage[MYTHREAD].value[i]);
+                   }
+                 *t_result = local_result;
+               }
+           }
+         else
+           {
+             /* INNER THREAD */
+             /* Prepare triggered atomic function.  */
+             if ((op != UPC_FUNC) && (op != UPC_NONCOMM_FUNC))
+               {
+                 /* Use triggered atomic operations once children sent
+                    their results and parent is ready to receive it.  */
+                 size_t offset = upc_addrfield ((shared void *)
+                                                &(gupcr_reduce_storage
+                                                  [MYTHREAD].value[0]));
+                 gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+                                            offset, sizeof (_UPC_RED_T),
+                                            gupcr_portals_reduce_op (op),
+                                            _UPC_TO_PTL_TYPECVT,
+                                            gupcr_coll_child_cnt + 1);
+               }
+             /* Let children know that parent is ready.  */
+             for (i = 0; i < gupcr_coll_child_cnt; i++)
+               {
+                 size_t offset = upc_addrfield ((shared void *)
+                                                &(gupcr_reduce_storage
+                                                  [MYTHREAD].signal));
+                 gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+               }
+             gupcr_coll_ack_wait (gupcr_coll_child_cnt);
+
+             /* Wait for completion, children and parent are ready.  */
+             gupcr_coll_signal_wait (gupcr_coll_child_cnt + 1);
+             /* Execute reduce functions if necessary.  */
+             if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+               {
+                 size_t offset = upc_addrfield ((shared void *)
+                                                &(gupcr_reduce_storage
+                                                  [MYTHREAD].value[0]));
+                 size_t doffset =
+                   upc_addrfield ((shared void *)
+                                  &(gupcr_reduce_storage[MYTHREAD].value
+                                    [gupcr_coll_child_index]));
+                 /* Reduce local result with those of children.  */
+                 for (i = 0; i < gupcr_coll_child_cnt; i++)
+                   {
+                     local_result = func (local_result, *(_UPC_RED_T *)
+                                          &
+                                          gupcr_reduce_storage
+                                          [MYTHREAD].value[i]);
+                   }
+                 *t_result = local_result;
+                 gupcr_coll_put (gupcr_coll_parent_thread, doffset, offset,
+                                 sizeof (_UPC_RED_T));
+               }
+             /* Wait for our value to go up the tree.  */
+             gupcr_coll_ack_wait (1);
+           }
+       }
+      else
+       {
+         /* Avoid the case where only one thread is available.  */
+         if (!IS_ROOT_THREAD)
+           {
+             /* LEAF THREAD */
+             size_t offset = upc_addrfield ((shared void *)
+                                            &(gupcr_reduce_storage
+                                              [MYTHREAD].value[0]));
+             switch (op)
+               {
+               case UPC_FUNC:
+               case UPC_NONCOMM_FUNC:
+                 {
+                   /* Schedule a triggered put once signal is received.  */
+                   size_t doffset = upc_addrfield ((shared void *)
+                                                   &(gupcr_reduce_storage
+                                                     [MYTHREAD].
+                                                     value
+                                                     
[gupcr_coll_child_index]));
+                   gupcr_coll_trigput (gupcr_coll_parent_thread, doffset,
+                                       offset, sizeof (_UPC_RED_T), 1);
+                 }
+                 break;
+               default:
+                 /* Schedule a triggered atomic put once parent is ready.  */
+                 gupcr_coll_trigput_atomic (gupcr_coll_parent_thread, offset,
+                                            offset, sizeof (_UPC_RED_T),
+                                            gupcr_portals_reduce_op (op),
+                                            _UPC_TO_PTL_TYPECVT, 1);
+                 break;
+               }
+             /* Wait for parent to be ready.  */
+             gupcr_coll_signal_wait (1);
+             /* Wait for our value to leave.  */
+             gupcr_coll_ack_wait (1);
+           }
+       }
+#else /* NO TRIGGERED OPS */
+      /* Send signal to all children.  */
+      if (gupcr_coll_child_cnt)
+       {
+         /* ROOT OR INNER THREAD */
+         int wait_cnt = gupcr_coll_child_cnt;
+
+         /* Signal that parent is ready to receive the locally reduced
+            values from its children. Value that we send does not matter.  */
+         for (i = 0; i < gupcr_coll_child_cnt; i++)
+           {
+             size_t offset = upc_addrfield ((shared void *)
+                                            &(gupcr_reduce_storage
+                                              [MYTHREAD].signal));
+             gupcr_coll_put (gupcr_coll_child[i], offset, offset, 1);
+           }
+         gupcr_coll_ack_wait (wait_cnt);
+
+         /* Wait for children to report their local reduced values and
+            parent to report it is ready to receive the reduced value.  */
+         if (!IS_ROOT_THREAD)
+           ++wait_cnt;
+         gupcr_coll_signal_wait (wait_cnt);
+
+         /* Compute result if reduce functions are used.  */
+         if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+           {
+             for (i = 0; i < gupcr_coll_child_cnt; i++)
+               {
+                 local_result = func (local_result,
+                                      *(_UPC_RED_T *) &
+                                      gupcr_reduce_storage[MYTHREAD].value
+                                      [i]);
+               }
+             /* Prepare reduced value for going up the tree.  */
+             *t_result = local_result;
+           }
+       }
+      else if (!IS_ROOT_THREAD)
+       {
+         /* LEAF THREAD */
+         gupcr_coll_signal_wait (1);
+       }
+
+      /* Send reduced value to the parent.  */
+      if (!IS_ROOT_THREAD)
+       {
+         /* LEAF OR INNER THREAD */
+         /* Each child places its result into the parent memory slot
+            dedicated for the child. The parent is responsible
+            for creating the reduced result for itself and its
+            children.  */
+         if ((op == UPC_FUNC) || (op == UPC_NONCOMM_FUNC))
+           {
+             size_t doffset = upc_addrfield ((shared void *)
+                                             &(gupcr_reduce_storage
+                                               [MYTHREAD].value
+                                               [gupcr_coll_child_index]));
+             size_t soffset =
+               upc_addrfield ((shared void *)
+                              &(gupcr_reduce_storage[MYTHREAD].value[0]));
+             gupcr_coll_put (gupcr_coll_parent_thread, doffset, soffset,
+                             sizeof (_UPC_RED_T));
+           }
+         else
+           {
+             size_t offset = upc_addrfield ((shared void *)
+                                            &(gupcr_reduce_storage
+                                              [MYTHREAD].value[0]));
+             gupcr_coll_put_atomic (gupcr_coll_parent_thread, offset, offset,
+                                    sizeof (_UPC_RED_T),
+                                    gupcr_portals_reduce_op (op),
+                                    _UPC_TO_PTL_TYPECVT);
+           }
+         gupcr_coll_ack_wait (1);
+       }
+#endif /* GUPCR_USE_PORTALS4_TRIGGERED_OPS */
+
+      /* Copy result into the caller's specified destination.  */
+      if (IS_ROOT_THREAD)
+       {
+         *(shared _UPC_RED_T *) dst = *t_result;
+       }
+    }
+
+  /* Synchronize using barriers in the cases of MYSYNC and ALLSYNC.  */
+  if (UPC_OUT_MYSYNC & sync_mode || !(UPC_OUT_NOSYNC & sync_mode))
+    upc_barrier;
+
+  gupcr_trace (FC_COLL, "COLL ALL_REDUCE EXIT");
+}
Index: libgupc/smp/gcc-upc-lib.in
===================================================================
--- libgupc/smp/gcc-upc-lib.in  (.../trunk)     (revision 0)
+++ libgupc/smp/gcc-upc-lib.in  (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,206 @@
+/* Copyright (C) 2008-2015 Free Software Foundation, Inc.
+   This file is part of the UPC runtime library.
+   Written by Gary Funck <address@hidden>
+   and Nenad Vukicevic <address@hidden>
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+
+#ifndef _GCC_UPC_LIB_H_
+#define _GCC_UPC_LIB_H_ 1
+
+#if __UPC_PUPC_INST__
+#pragma pupc off
+#endif /* __UPC_PUPC_INST__ */
+
+#ifdef IN_TARGET_LIBS
+#include "config.h"
+#include <unistd.h>
+/* required, for Posix sched_yield() */
+#ifdef _POSIX_PRIORITY_SCHEDULING
+#include <sched.h>
+#endif
+#endif /* IN_TARGET_LIBS */
+
+/* required, for size_t definition */
+#include <sys/types.h>
+
+#pragma upc c_code
+
+/* helper macros for expanding the value of a macro as a string. */
+#define __UPC_STR__(S) #S
+#define __UPC_XSTR__(S) __UPC_STR__(S)
+
+#ifdef __UPC_PTHREADS_MODEL_TLS__
+#define GUPCR_THREAD_LOCAL __thread
+#else
+#define GUPCR_THREAD_LOCAL
+#endif
+
+#ifdef __UPC_STATIC_THREADS__
+/* defined at compile time by the -fupc-threads=N switch */
+#define __UPC_N_THREADS__ THREADS
+#define __UPC_STR__(S) #S
+#define __UPC_XSTR__(S) __UPC_STR__(S)
+#define __UPC_THREADS_CONFIG__ " staticthreads=" __UPC_XSTR__(THREADS)
+#else
+/* defined at run time */
+extern const int THREADS;
+#define __UPC_N_THREADS__ -1
+#define __UPC_THREADS_CONFIG__ "dynamicthreads"
+#endif
+
+#ifdef __UPC_PTHREADS_MODEL_TLS__
+#define __UPC_USES_PTHREADS__ 1
+#define __UPC_THREADS_MODEL__ "pthreads-tls"
+#else
+#define __UPC_THREADS_MODEL__ "process"
+#endif
+
+/* Support for atomics - UPC Specification 1.3.  */
+#define __UPC_ATOMIC__ 1
+
+/* Support for castability - UPC Specification 1.3.  */
+#define __UPC_CASTABLE__ 1
+
+/* Support for UPC collectives.  */
+#define __UPC_COLLECTIVE__ 1
+
+/* Support for non-blocking transfer operations - UPC Specification 1.3.  */
+#define __UPC_NB__ 1
+
+/* Support for GASP - http://gasp.hcs.ufl.edu/.  */ 
+#define __UPC_PUPC__ 1
+
+/* Support for high-performance wall-clock timer - UPC Specification 1.3.  */
+#define __UPC_TICK__ 1
+
+#pragma upc upc_code
+/* Opaque data type for referencing UPC atomic domains.  */
+typedef shared struct upc_atomicdomain_struct upc_atomicdomain_t;
+#pragma upc c_code
+
+/* Place configuration information required by the Berkeley
+   UPC compilation system into the object file. */
+static const char GCCUPCConfig[]
+#if __MACH__
+   __attribute__ ((section("__DATA,upc_pgm_info"))) __attribute__ ((used)) =
+#else
+   __attribute__ ((section("upc_pgm_info"))) __attribute__ ((used)) =
+#endif
+  "$GCCUPCConfig: (" __BASE_FILE__ ") "
+                   __UPC_THREADS_CONFIG__ " " __UPC_THREADS_MODEL__ "$";
+
+#undef __UPC_XSTR__
+#undef __UPC_STR__
+
+extern GUPCR_THREAD_LOCAL const int MYTHREAD;
+
+/* Depth count used to implement the semantics of
+   nested upc_forall statements.  */
+extern GUPCR_THREAD_LOCAL int __upc_forall_depth;
+
+#if !defined(_CRAYT3E)
+/* The UPC runtime's main program must run first,
+ * we rename the user's main to upc_main(). */
+#if __MACH__
+extern int main () __asm__("_upc_main");
+#else
+extern int main () __asm__("upc_main");
+#endif
+#endif
+
+/* Remap calls to exit so that they invoke the UPC runtime's
+   implementation of exit instead. */
+#define exit __upc_exit
+
+/* Implementation of upc_fence.  */
+#define upc_fence __upc_fence()
+
+/* upc_shared_ptr_t is predefined as the representation of
+   a shared pointer type. */
+
+/* Runtime variables used by optimized code generation
+   on some targets. */
+/* The base address of the UPC global area */
+extern void * const __upc_global;
+/* The size of each thread's contribution to the global shared. */
+extern const size_t __upc_local_size;
+/* The base address of the UPC shared section */
+extern char __upc_shared_start[1];
+/* A pre-calculated value equal to:
+     (__upc_global - __upc_shared_start) which
+   is used to map a pointer-to-shared's address field
+   into a global memory address. */
+extern unsigned long const __upc_global_base;
+
+/* Runtime procedures */
+//include lib_runtime_api
+
+//include detect_target64
+
+/* Runtime shared access procedures */
+//include mode_types
+
+#if defined(__UPC_INLINE_LIB__) || defined(IN_TARGET_LIBS)
+
+/* Library routines have access to runtime internals.  */
+
+//include gupcr_config_h
+//include lib_min_max
+//include lib_config_vm
+//include lib_vm_api
+//include lib_config_heap
+//include lib_heap_api
+//include lib_config_shared_section
+//include lib_pts_defs
+//include lib_max_threads_def
+//include lib_sptr_to_addr
+
+#endif /* __UPC_INLINE_LIB__ || IN_TARGET_LIBS */
+
+#ifdef IN_TARGET_LIBS
+
+//include lib_atomic
+//include lib_spin_until
+
+#endif /* IN_TARGET_LIBS */
+
+#ifdef __UPC_INLINE_LIB__
+
+//include lib_fence_defs
+/* We need to include <string.h> to define memcpy() */
+#include <string.h>
+//include lib_inline_mem_sup
+//include lib_inline_access
+
+#else
+
+//include lib_access_prototypes
+
+#endif /* __UPC_INLINE_LIB__ */
+
+#if __UPC_PUPC_INST__
+#pragma pupc on
+#endif /* __UPC_PUPC_INST__ */
+
+#endif /* !_GCC_UPC_LIB_H_ */
Index: libgupc/smp/upc_atomic.def
===================================================================
--- libgupc/smp/upc_atomic.def  (.../trunk)     (revision 0)
+++ libgupc/smp/upc_atomic.def  (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,5 @@
+Autogen Definitions upc_atomic;
+
+#include upc_types.def
+#include upc_ops.def
+
Index: libgupc/smp/upc_atomic.tpl
===================================================================
--- libgupc/smp/upc_atomic.tpl  (.../trunk)     (revision 0)
+++ libgupc/smp/upc_atomic.tpl  (.../branches/gupc)     (revision 231080)
@@ -0,0 +1,555 @@
+[= Autogen5 template upc =]
+/* Process the definitions file with autogen to produce upc_atomic.upc:
+
+   autogen -L ../include upc_atomic.def
+
+   Copyright (C) 2013-2015 Free Software Foundation, Inc.
+   This file is part of the UPC runtime Library.
+   Written by Gary Funck <address@hidden>
+   and Nenad Vukicevic <address@hidden>
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#include <upc.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <upc_atomic.h>
+#include "upc_config.h"
+
+/**
+ * @file __upc_atomic.upc
+ * GUPC Portals4 UPC atomics implementation.
+ */
+
+/**
+ * @addtogroup ATOMIC GUPCR Atomics Functions
+ * @{
+ */
+
+/** Atomic domain representation */
+struct upc_atomicdomain_struct
+{
+  upc_op_t ops;
+  upc_type_t optype;
+};
+
+/* Represent a bit-encoded operation as an integer.  */
+typedef unsigned int upc_op_num_t;
+
+[= FOR upc_type =][=
+  IF (exist? "type_atomic_ok") =][=
+    (define abbrev-type (string-append (get "type_abbrev") "_type")) =]
+typedef [=type_c_name=] [= (. abbrev-type) =];[=
+  ENDIF =][=
+ENDFOR =]
+
+[= (define access-ops "") =][=
+  FOR upc_op =][=
+    (if (and (exist? "op_atomic_ok") (= (get "op_mode") "access"))
+      (begin
+        (if (> (string-length access-ops) 0)
+               (set! access-ops (string-append access-ops " | ")))
+        (set! access-ops (string-append access-ops
+                           (get "op_upc_name"))))) =][=
+  ENDFOR =]
+#define ATOMIC_ACCESS_OPS ([= (. access-ops) =])
+[= (define num-ops "") =][=
+  FOR upc_op =][=
+    (if (and (exist? "op_atomic_ok") (= (get "op_mode") "numeric"))
+      (begin
+        (if (> (string-length num-ops) 0)
+               (set! num-ops (string-append num-ops " | ")))
+        (set! num-ops (string-append num-ops (get "op_upc_name"))))) =][=
+  ENDFOR =]
+#define ATOMIC_NUM_OPS ([= (. num-ops) =])
+[= (define bit-ops "") =][=
+  FOR upc_op =][=
+    (if (and (exist? "op_atomic_ok") (= (get "op_mode") "logical"))
+      (begin
+        (if (> (string-length bit-ops) 0)
+               (set! bit-ops (string-append bit-ops " | ")))
+        (set! bit-ops (string-append bit-ops (get "op_upc_name"))))) =][=
+  ENDFOR =]
+#define ATOMIC_BIT_OPS ([= (. bit-ops) =])
+#define ATOMIC_ALL_OPS (ATOMIC_ACCESS_OPS | ATOMIC_NUM_OPS \
+                        | ATOMIC_BIT_OPS)
+
+/**
+ * Check if OP is a valid atomic operation type.
+ *
+ * @param [in] op UPC atomic operation
+ * @retval TRUE if op is a valid atomic operation
+ */
+static inline bool
+__upc_atomic_is_valid_op (upc_op_t op)
+{
+  return !((op & ~(-op)) || (op & ~ATOMIC_ALL_OPS));
+}
+
+/**
+ * Convert the bit-encoded OP into an integer.
+ *
+ * @param [in] op UPC atomic operation
+ * @retval op represented as integer index
+ *  (UPC_ADD_OP, UPC_MULT_OP ...)
+ */
+static inline upc_op_num_t
+__upc_atomic_op_num (upc_op_t op)
+{
+  return (LONG_LONG_BITS - 1) - __builtin_clzll ((long long) op);
+}
+
+/**
+ * Check if UPC_TYPE is a valid atomic operation type.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval TRUE if atomic operations are supported on UPC_TYPE
+ */
+static bool
+__upc_atomic_is_valid_type (upc_type_t upc_type)
+{
+  switch (upc_type)
+    {[=
+FOR upc_type =][=
+  IF (exist? "type_atomic_ok") =]
+    case [=type_upc_name=]:[=
+  ENDIF =][=
+ENDFOR =]
+      return true;
+    default: break;
+    }
+    return false;
+}
+
+/**
+ * Return the atomic operations supported for type UPC_TYPE.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval bit vector of supported atomic operations.
+ */
+static upc_op_t
+__upc_atomic_supported_ops (upc_type_t upc_type)
+{
+  switch (upc_type)
+    {[=
+FOR upc_type =][=
+  IF (exist? "type_atomic_ok") =][=
+    (define valid-ops "ATOMIC_ACCESS_OPS")
+    (if (exist? "type_numeric_op_ok")
+        (set! valid-ops (string-append
+                          valid-ops " | ATOMIC_NUM_OPS")))
+    (if (exist? "type_bit_op_ok")
+        (set! valid-ops (string-append
+                          valid-ops " | ATOMIC_BIT_OPS"))) =]
+    case [=type_upc_name=]:
+      return [= (. valid-ops) =];[=
+  ENDIF =][=
+ENDFOR =]
+    }
+    return 0;
+}
+
+/**
+ * Convert UPC atomic operation into a string.
+ *
+ * @param [in] upc_op UPC atomic operation
+ * @retval Character string
+ */
+static const char *
+__upc_atomic_op_name (upc_op_num_t op_num)
+{
+  switch (op_num)
+    {[=
+FOR upc_op =][=
+  IF (exist? "op_atomic_ok") =]
+    case [=op_upc_name=]_OP:
+      return "[=op_upc_name=]";[=
+  ENDIF =][=
+ENDFOR =]
+    }
+    return NULL;
+}
+
+/**
+ * Convert UPC atomic type into a string.
+ *
+ * @param [in] upc_type UPC atomic type
+ * @retval Character string
+ */
+static const char *
+__upc_atomic_type_name (upc_type_t upc_type)
+{
+  switch (upc_type)
+    {[=
+FOR upc_type =][=
+  IF (exist? "type_atomic_ok") =]
+    case [=type_upc_name=]:
+      return "[=type_upc_name=]";[=
+  ENDIF =][=
+ENDFOR =]
+    }
+    return NULL;
+}
+
+#define REQ_FETCH_PTR 0b00000001
+#define REQ_OPERAND1  0b00000010
+#define REQ_OPERAND2  0b00000100
+#define NULL_OPERAND1 0b00001000
+#define NULL_OPERAND2 0b00010000
+
+static const unsigned int operand_check[] =
+  {[=
+FOR upc_op =]
+    /* [=op_upc_name=]_OP */ [=
+  (define nil '())
+  (define check-bits nil) =][=
+  IF (exist? "op_atomic_ok") =][=
+  (if (exist? "op_require_fetch_ptr")
+      (set! check-bits (append check-bits '("REQ_FETCH_PTR"))))
+  (if (exist? "op_require_operand1")
+      (set! check-bits (append check-bits '("REQ_OPERAND1"))))
+  (if (exist? "op_require_operand2")
+      (set! check-bits (append check-bits '("REQ_OPERAND2"))))
+  (if (exist? "op_null_operand1")
+      (set! check-bits (append check-bits '("NULL_OPERAND1"))))
+  (if (exist? "op_null_operand2")
+      (set! check-bits (append check-bits '("NULL_OPERAND2")))) =][=
+  ELSE =][=
+      (set! check-bits (append check-bits "0")) =][=
+  ENDIF =][=
+  (. (join " | " check-bits)) =],[=
+ENDFOR =]
+  };
+
+static inline void
+__upc_atomic_check_operands (upc_op_num_t op_num,
+                  void * restrict fetch_ptr,
+                  const void * restrict operand1,
+                  const void * restrict operand2)
+{
+  const unsigned int check = operand_check[op_num];
+  if ((check & REQ_FETCH_PTR) && fetch_ptr == NULL)
+    __upc_fatal ("atomic operation `%s' "
+                 "requires a non-NULL fetch pointer",
+                __upc_atomic_op_name (op_num));
+  if ((check & REQ_OPERAND1) && operand1 == NULL)
+    __upc_fatal ("atomic operation `%s' "
+                 "requires a non-NULL operand1 pointer",
+                __upc_atomic_op_name (op_num));
+  if ((check & REQ_OPERAND2) && operand2 == NULL)
+    __upc_fatal ("atomic operation `%s' "
+                 "requires a non-NULL operand2 pointer",
+                __upc_atomic_op_name (op_num));
+  if ((check & NULL_OPERAND1) && operand1 != NULL)
+    __upc_fatal ("atomic operation `%s' "
+                 "requires a NULL operand1 pointer",
+                __upc_atomic_op_name (op_num));
+  if ((check & NULL_OPERAND2) && operand2 != NULL)
+    __upc_fatal ("atomic operation `%s' "
+                 "requires a NULL operand2 pointer",
+                __upc_atomic_op_name (op_num));
+}[=
+FOR upc_type =][= IF (exist? "type_atomic_ok") =][=
+    (define abbrev-type (string-append (get "type_abbrev") "_type")) =]
+
+static void
+__upc_atomic_[=type_abbrev=] (
+       [= (. abbrev-type) =] * restrict fetch_ptr,
+       upc_op_num_t op_num,
+       shared [= (. abbrev-type) =] * restrict target,
+       [= (. abbrev-type) =] * restrict operand1 __attribute__((unused)),
+       [= (. abbrev-type) =] * restrict operand2 __attribute__((unused)))
+{
+  [= (. abbrev-type) =] orig_value __attribute__((unused));
+  [= (. abbrev-type) =] new_value __attribute__((unused));
+  [=IF (= (get "type_abbrev") "PTS") =]
+  int op_ok __attribute__((unused));[=
+  ENDIF =]
+  [= (. abbrev-type) =] *target_ptr = __cvtaddr (*(upc_shared_ptr_t *)&target);
+  switch (op_num)
+    {[=
+  FOR upc_op =][=
+    IF (exist? "op_atomic_ok") =][=
+      IF (= (get "op_mode") "access") =]
+      case [=op_upc_name=]_OP:[=
+        CASE op_upc_name =][=
+        = 'UPC_GET'    =]
+        __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);[=
+        = 'UPC_SET'    =]
+       if (fetch_ptr == NULL)
+         __atomic_store (target_ptr, operand1, __ATOMIC_SEQ_CST);
+       else
+         __atomic_exchange (target_ptr, operand1, &orig_value,
+                            /* memmodel */ __ATOMIC_SEQ_CST);[=
+        = 'UPC_CSWAP'  =]
+       orig_value = *operand1;
+       /* __atomic_compare_exchange will return the previous value
+          in &orig_value independent of whether operand2 is written
+          to the target location.  */[=
+       IF (= (get "type_abbrev") "PTS") =]
+       op_ok = __atomic_compare_exchange (target_ptr, &orig_value, operand2,
+                               /* weak */ 0,
+                               /* success_memmodel */ __ATOMIC_SEQ_CST,
+                               /* failure_memmodel */ __ATOMIC_SEQ_CST);
+       /* If the previous compare exchange operation failed, check
+          for UPC PTS equality (which ignores phase).  If the pointers
+          compare as equal, try again.  */
+       if (!op_ok && (orig_value == *operand1))
+         {
+            (void) __atomic_compare_exchange (target_ptr,
+                               &orig_value, operand2,
+                               /* weak */ 0,
+                               /* success_memmodel */ __ATOMIC_SEQ_CST,
+                               /* failure_memmodel */ __ATOMIC_SEQ_CST);
+         }[=
+        ELSE =]
+       (void) __atomic_compare_exchange (target_ptr,
+                           &orig_value, operand2,
+                           /* weak */ 0,
+                           /* success_memmodel */ __ATOMIC_SEQ_CST,
+                           /* failure_memmodel */ __ATOMIC_SEQ_CST);[=
+        ENDIF =][=
+        ESAC =]
+        break;[=
+      ENDIF =][=
+      IF (or (and (exist? "type_numeric_op_ok")
+                  (= (get "op_mode") "numeric"))
+            (and (exist? "type_bit_op_ok")
+                  (= (get "op_mode") "logical"))) =]
+      case [=op_upc_name=]_OP:[=
+        IF (and (not (exist? "type_floating_point"))
+               (~* (get "op_upc_name")
+                   "UPC_(ADD|SUB|INC|DEC|AND|OR|XOR)$")) =][=
+          CASE op_upc_name =][=
+          ~* 'UPC_(ADD|SUB|AND|OR|XOR)$' =]
+       orig_value = __atomic_fetch_[=op_name=] (target_ptr, *operand1,
+                               __ATOMIC_SEQ_CST);[=
+          = 'UPC_INC' =]
+       orig_value = __atomic_fetch_add (target_ptr, ([=type_c_name=]) 1,
+                               __ATOMIC_SEQ_CST);[=
+          = 'UPC_DEC' =]
+       orig_value = __atomic_fetch_sub (target_ptr, ([=type_c_name=]) 1,
+                               __ATOMIC_SEQ_CST);[=
+          ESAC =][=
+        ELSE =][=
+         (define op_calc "") =][=
+          CASE op_upc_name =][=
+          ~* 'UPC_(ADD|SUB|AND|OR|XOR)$' =][=
+           (set! op_calc
+             (string-append "orig_value "
+                            (get "op_op")
+                            " *operand1")) =][=
+          ~* 'UPC_(INC|DEC)$' =][=
+           (set! op_calc
+             (string-append "orig_value "
+                            (get "op_op")
+                            " (" (get "type_c_name") ") 1")) =][=
+         = 'UPC_MULT' =][=
+           (set! op_calc "orig_value * *operand1") =][=
+         = 'UPC_MIN' =][=
+           (set! op_calc
+             "(*operand1 < orig_value) ? *operand1 : orig_value") =][=
+         = 'UPC_MAX' =][=
+           (set! op_calc
+             "(*operand1 > orig_value) ? *operand1 : orig_value") =][=
+         ESAC =]
+       do
+         {
+            __atomic_load (target_ptr, &orig_value, __ATOMIC_SEQ_CST);
+           new_value = [= (. op_calc) =];
+         }
+       while (!__atomic_compare_exchange (target_ptr, &orig_value, &new_value,
+                               /* weak */ 0,
+                               /* success_memmodel */ __ATOMIC_SEQ_CST,
+                               /* failure_memmodel */ __ATOMIC_SEQ_CST));[=
+        ENDIF =]
+        break;[=
+      ENDIF =][=
+    ENDIF =][=
+  ENDFOR =]
+      default: break;
+    }
+  if (fetch_ptr != NULL)
+    *fetch_ptr = orig_value;
+}[=
+  ENDIF =][=
+ENDFOR =]
+
+/**
+ * UPC atomic relaxed operation.
+ *
+ * @param [in] domain Atomic domain
+ * @param [in] fetch_ptr Target of the update
+ * @param [in] op Atomic operation
+ * @param [in] target Target address of the operation
+ * @param [in] operand1 Operation required argument
+ * @param [in] operand2 Operation required argument
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_atomic_relaxed (upc_atomicdomain_t *domain,
+                  void * restrict fetch_ptr,
+                  upc_op_t op,
+                  shared void * restrict target,
+                  const void * restrict operand1,
+                  const void * restrict operand2)
+{
+  struct upc_atomicdomain_struct *ldomain =
+    (struct upc_atomicdomain_struct *) &domain[MYTHREAD];
+  upc_op_num_t op_num;
+  if (op & ~(-op))
+    __upc_fatal ("atomic operation (0x%llx) may have only "
+                 "a single bit set", (long long)op);
+  if (!__upc_atomic_is_valid_op (op))
+    __upc_fatal ("invalid atomic operation (0x%llx)",
+                 (long long)op);
+  op_num = __upc_atomic_op_num (op);
+  if (op & ~ldomain->ops)
+    __upc_fatal ("invalid operation (%s) for specified domain",
+                __upc_atomic_op_name (op_num));
+  __upc_atomic_check_operands (op_num, fetch_ptr, operand1, operand2);
+  switch (ldomain->optype)
+    {[=
+    FOR upc_type =][= IF (exist? "type_atomic_ok") =][=
+    (define abbrev-type (string-append (get "type_abbrev") "_type")) =]
+    case [=type_upc_name=]:
+      __upc_atomic_[=type_abbrev=] (
+              ([= (. abbrev-type) =] *) fetch_ptr,
+              op_num,
+              (shared [= (. abbrev-type) =] *) target,
+              ([= (. abbrev-type) =] *) operand1,
+              ([= (. abbrev-type) =] *) operand2);
+      break;[=
+    ENDIF =][= ENDFOR =]
+    }
+}
+
+/**
+ * UPC atomic strict operation.
+ *
+ * @param [in] domain Atomic domain
+ * @param [in] fetch_ptr Target of the update
+ * @param [in] op Atomic operation
+ * @param [in] target Target address of the operation
+ * @param [in] operand1 Operation required argument
+ * @param [in] operand2 Operation required argument
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_atomic_strict (upc_atomicdomain_t *domain,
+                  void * restrict fetch_ptr,
+                  upc_op_t op,
+                  shared void * restrict target,
+                  const void * restrict operand1,
+                  const void * restrict operand2)
+{
+  upc_fence;
+  upc_atomic_relaxed (domain, fetch_ptr, op, target, operand1, operand2);
+  upc_fence;
+}
+
+/**
+ * Collective allocation of atomic domain.
+ *
+ * Implementation uses native Portals4 atomic functions and the
+ * hint field is ignored.
+ *
+ * @parm [in] type Atomic operation type
+ * @parm [in] ops Atomic domain operations
+ * @parm [in] hints Atomic operation hint
+ * @retval Allocated atomic domain pointer
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+upc_atomicdomain_t *
+upc_all_atomicdomain_alloc (upc_type_t type,
+                           upc_op_t ops,
+                           __attribute__((unused)) upc_atomichint_t hints)
+{
+  upc_atomicdomain_t *domain;
+  struct upc_atomicdomain_struct *ldomain;
+  upc_op_t supported_ops;
+  if (!__upc_atomic_is_valid_type (type))
+    __upc_fatal ("unsupported atomic type: 0x%llx",
+                 (long long) type);
+  supported_ops = __upc_atomic_supported_ops (type);
+  if ((ops & ~supported_ops) != 0)
+    __upc_fatal ("one/more requested atomic operations (0x%llx) unsupported "
+                 "for type `%s'", (long long) ops,
+                __upc_atomic_type_name (type));
+  domain = (upc_atomicdomain_t *)
+    upc_all_alloc (THREADS, sizeof (struct upc_atomicdomain_struct));
+  if (domain == NULL)
+    __upc_fatal ("unable to allocate atomic domain");
+  ldomain = (struct upc_atomicdomain_struct *)&domain[MYTHREAD];
+  ldomain->ops = ops;
+  ldomain->optype = type;
+  return domain;
+}
+
+/**
+ * Collective free of the atomic domain.
+ *
+ * @param [in] domain Pointer to atomic domain
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+void
+upc_all_atomicdomain_free (upc_atomicdomain_t * domain)
+{
+  assert (domain != NULL);
+  upc_barrier;
+  if (MYTHREAD == 0)
+    {
+      upc_free (domain);
+    }
+  upc_barrier;
+}
+
+/**
+ * Query implementation for expected performance.
+ *
+ * @parm [in] ops Atomic domain operations
+ * @parm [in] optype Atomic operation type
+ * @parm [in] addr Atomic address
+ * @retval Expected performance
+ *
+ * @ingroup UPCATOMIC UPC Atomic Functions
+ */
+int
+upc_atomic_isfast (__attribute__((unused)) upc_type_t optype,
+                  __attribute__((unused)) upc_op_t ops,
+                  __attribute__((unused)) shared void *addr)
+{
+  /* We could make the distinction that only operations
+     directly supported by the builtin atomics are "fast",
+     but for now ... everything in the SMP runtime is
+     defined to be fast.  */
+  return UPC_ATOMIC_PERFORMANCE_FAST;
+}
+
+/** @} */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]