backport: Makefile.am: Merge from upstream...

Merge libcilkrts from upstream.

libcilkrts/
	* Makefile.am: Merge from upstream, version 2.0.4420.0
	<https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git>.
	* README: Likewise.
	* configure.ac: Likewise.
	* configure.tgt: Likewise.
	* include/cilk/cilk.h: Likewise.
	* include/cilk/cilk_api.h: Likewise.
	* include/cilk/cilk_api_linux.h: Likewise.
	* include/cilk/cilk_stub.h: Likewise.
	* include/cilk/cilk_undocumented.h: Likewise.
	* include/cilk/common.h: Likewise.
	* include/cilk/holder.h: Likewise.
	* include/cilk/hyperobject_base.h: Likewise.
	* include/cilk/metaprogramming.h: Likewise.
	* include/cilk/reducer.h: Likewise.
	* include/cilk/reducer_file.h: Likewise.
	* include/cilk/reducer_list.h: Likewise.
	* include/cilk/reducer_max.h: Likewise.
	* include/cilk/reducer_min.h: Likewise.
	* include/cilk/reducer_min_max.h: Likewise.
	* include/cilk/reducer_opadd.h: Likewise.
	* include/cilk/reducer_opand.h: Likewise.
	* include/cilk/reducer_opmul.h: Likewise.
	* include/cilk/reducer_opor.h: Likewise.
	* include/cilk/reducer_opxor.h: Likewise.
	* include/cilk/reducer_ostream.h: Likewise.
	* include/cilk/reducer_string.h: Likewise.
	* include/cilktools/cilkscreen.h: Likewise.
	* include/cilktools/cilkview.h: Likewise.
	* include/cilktools/fake_mutex.h: Likewise.
	* include/cilktools/lock_guard.h: Likewise.
	* include/internal/abi.h: Likewise.
	* include/internal/cilk_fake.h: Likewise.
	* include/internal/cilk_version.h: Likewise.
	* include/internal/metacall.h: Likewise.
	* include/internal/rev.mk: Likewise.
	* mk/cilk-version.mk: Likewise.
	* runtime/acknowledgements.dox: Likewise.
	* runtime/bug.cpp: Likewise.
	* runtime/bug.h: Likewise.
	* runtime/c_reducers.c: Likewise.
	* runtime/cilk-abi-cilk-for.cpp: Likewise.
	* runtime/cilk-abi-vla-internal.c: Likewise.
	* runtime/cilk-abi-vla-internal.h: Likewise.
	* runtime/cilk-abi.c: Likewise.
	* runtime/cilk-ittnotify.h: Likewise.
	* runtime/cilk-tbb-interop.h: Likewise.
	* runtime/cilk_api.c: Likewise.
	* runtime/cilk_fiber-unix.cpp: Likewise.
	* runtime/cilk_fiber-unix.h: Likewise.
	* runtime/cilk_fiber.cpp: Likewise.
	* runtime/cilk_fiber.h: Likewise.
	* runtime/cilk_malloc.c: Likewise.
	* runtime/cilk_malloc.h: Likewise.
	* runtime/component.h: Likewise.
	* runtime/config/generic/cilk-abi-vla.c: Likewise.
	* runtime/config/generic/os-fence.h: Likewise.
	* runtime/config/generic/os-unix-sysdep.c: Likewise.
	* runtime/config/x86/cilk-abi-vla.c: Likewise.
	* runtime/config/x86/os-fence.h: Likewise.
	* runtime/config/x86/os-unix-sysdep.c: Likewise.
	* runtime/doxygen-layout.xml: Likewise.
	* runtime/doxygen.cfg: Likewise.
	* runtime/except-gcc.cpp: Likewise.
	* runtime/except-gcc.h: Likewise.
	* runtime/except.h: Likewise.
	* runtime/frame_malloc.c: Likewise.
	* runtime/frame_malloc.h: Likewise.
	* runtime/full_frame.c: Likewise.
	* runtime/full_frame.h: Likewise.
	* runtime/global_state.cpp: Likewise.
	* runtime/global_state.h: Likewise.
	* runtime/jmpbuf.c: Likewise.
	* runtime/jmpbuf.h: Likewise.
	* runtime/linux-symbols.ver: Likewise.
	* runtime/local_state.c: Likewise.
	* runtime/local_state.h: Likewise.
	* runtime/mac-symbols.txt: Likewise.
	* runtime/metacall_impl.c: Likewise.
	* runtime/metacall_impl.h: Likewise.
	* runtime/os-unix.c: Likewise.
	* runtime/os.h: Likewise.
	* runtime/os_mutex-unix.c: Likewise.
	* runtime/os_mutex.h: Likewise.
	* runtime/pedigrees.c: Likewise.
	* runtime/pedigrees.h: Likewise.
	* runtime/record-replay.cpp: Likewise.
	* runtime/record-replay.h: Likewise.
	* runtime/reducer_impl.cpp: Likewise.
	* runtime/reducer_impl.h: Likewise.
	* runtime/rts-common.h: Likewise.
	* runtime/scheduler.c: Likewise.
	* runtime/scheduler.h: Likewise.
	* runtime/signal_node.c: Likewise.
	* runtime/signal_node.h: Likewise.
	* runtime/spin_mutex.c: Likewise.
	* runtime/spin_mutex.h: Likewise.
	* runtime/stats.c: Likewise.
	* runtime/stats.h: Likewise.
	* runtime/sysdep-unix.c: Likewise.
	* runtime/sysdep.h: Likewise.
	* runtime/worker_mutex.c: Likewise.
	* runtime/worker_mutex.h: Likewise.
	* include/cilk/reducer_vector.h: New.
	* runtime/cilk_str_mem.h: New.
	* runtime/config/arm/cilk-abi-vla.c: New.
	* runtime/config/arm/os-fence.h: New.
	* runtime/config/arm/os-unix-sysdep.c: New.
	* runtime/declare-alloca.h: New.
	* runtime/sslib/ignore_handler_s.c: New.
	* runtime/sslib/safe_lib.h: New.
	* runtime/sslib/safe_lib_errno.h: New.
	* runtime/sslib/safe_str_constraint.c: New.
	* runtime/sslib/safe_str_constraint.h: New.
	* runtime/sslib/safe_str_lib.h: New.
	* runtime/sslib/safe_types.h: New.
	* runtime/sslib/safeclib_private.h: New.
	* runtime/sslib/snprintf_s.h: New.
	* runtime/sslib/snprintf_support.c: New.
	* runtime/sslib/strcpy_s.c: New.
	* runtime/sslib/strncpy_s.c: New.
	* runtime/sslib/strnlen_s.c: New.
	* runtime/symbol_test.c: Remove.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

From-SVN: r235870
This commit is contained in:
Ilya Verbin 2016-05-04 12:29:14 +00:00 committed by Ilya Verbin
parent d9cb3e7598
commit 2e01cda69d
124 changed files with 9622 additions and 4389 deletions

View File

@ -1,3 +1,131 @@
2016-05-04 Ilya Verbin <ilya.verbin@intel.com>
* Makefile.am: Merge from upstream, version 2.0.4420.0
<https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git>.
* README: Likewise.
* configure.ac: Likewise.
* configure.tgt: Likewise.
* include/cilk/cilk.h: Likewise.
* include/cilk/cilk_api.h: Likewise.
* include/cilk/cilk_api_linux.h: Likewise.
* include/cilk/cilk_stub.h: Likewise.
* include/cilk/cilk_undocumented.h: Likewise.
* include/cilk/common.h: Likewise.
* include/cilk/holder.h: Likewise.
* include/cilk/hyperobject_base.h: Likewise.
* include/cilk/metaprogramming.h: Likewise.
* include/cilk/reducer.h: Likewise.
* include/cilk/reducer_file.h: Likewise.
* include/cilk/reducer_list.h: Likewise.
* include/cilk/reducer_max.h: Likewise.
* include/cilk/reducer_min.h: Likewise.
* include/cilk/reducer_min_max.h: Likewise.
* include/cilk/reducer_opadd.h: Likewise.
* include/cilk/reducer_opand.h: Likewise.
* include/cilk/reducer_opmul.h: Likewise.
* include/cilk/reducer_opor.h: Likewise.
* include/cilk/reducer_opxor.h: Likewise.
* include/cilk/reducer_ostream.h: Likewise.
* include/cilk/reducer_string.h: Likewise.
* include/cilktools/cilkscreen.h: Likewise.
* include/cilktools/cilkview.h: Likewise.
* include/cilktools/fake_mutex.h: Likewise.
* include/cilktools/lock_guard.h: Likewise.
* include/internal/abi.h: Likewise.
* include/internal/cilk_fake.h: Likewise.
* include/internal/cilk_version.h: Likewise.
* include/internal/metacall.h: Likewise.
* include/internal/rev.mk: Likewise.
* mk/cilk-version.mk: Likewise.
* runtime/acknowledgements.dox: Likewise.
* runtime/bug.cpp: Likewise.
* runtime/bug.h: Likewise.
* runtime/c_reducers.c: Likewise.
* runtime/cilk-abi-cilk-for.cpp: Likewise.
* runtime/cilk-abi-vla-internal.c: Likewise.
* runtime/cilk-abi-vla-internal.h: Likewise.
* runtime/cilk-abi.c: Likewise.
* runtime/cilk-ittnotify.h: Likewise.
* runtime/cilk-tbb-interop.h: Likewise.
* runtime/cilk_api.c: Likewise.
* runtime/cilk_fiber-unix.cpp: Likewise.
* runtime/cilk_fiber-unix.h: Likewise.
* runtime/cilk_fiber.cpp: Likewise.
* runtime/cilk_fiber.h: Likewise.
* runtime/cilk_malloc.c: Likewise.
* runtime/cilk_malloc.h: Likewise.
* runtime/component.h: Likewise.
* runtime/config/generic/cilk-abi-vla.c: Likewise.
* runtime/config/generic/os-fence.h: Likewise.
* runtime/config/generic/os-unix-sysdep.c: Likewise.
* runtime/config/x86/cilk-abi-vla.c: Likewise.
* runtime/config/x86/os-fence.h: Likewise.
* runtime/config/x86/os-unix-sysdep.c: Likewise.
* runtime/doxygen-layout.xml: Likewise.
* runtime/doxygen.cfg: Likewise.
* runtime/except-gcc.cpp: Likewise.
* runtime/except-gcc.h: Likewise.
* runtime/except.h: Likewise.
* runtime/frame_malloc.c: Likewise.
* runtime/frame_malloc.h: Likewise.
* runtime/full_frame.c: Likewise.
* runtime/full_frame.h: Likewise.
* runtime/global_state.cpp: Likewise.
* runtime/global_state.h: Likewise.
* runtime/jmpbuf.c: Likewise.
* runtime/jmpbuf.h: Likewise.
* runtime/linux-symbols.ver: Likewise.
* runtime/local_state.c: Likewise.
* runtime/local_state.h: Likewise.
* runtime/mac-symbols.txt: Likewise.
* runtime/metacall_impl.c: Likewise.
* runtime/metacall_impl.h: Likewise.
* runtime/os-unix.c: Likewise.
* runtime/os.h: Likewise.
* runtime/os_mutex-unix.c: Likewise.
* runtime/os_mutex.h: Likewise.
* runtime/pedigrees.c: Likewise.
* runtime/pedigrees.h: Likewise.
* runtime/record-replay.cpp: Likewise.
* runtime/record-replay.h: Likewise.
* runtime/reducer_impl.cpp: Likewise.
* runtime/reducer_impl.h: Likewise.
* runtime/rts-common.h: Likewise.
* runtime/scheduler.c: Likewise.
* runtime/scheduler.h: Likewise.
* runtime/signal_node.c: Likewise.
* runtime/signal_node.h: Likewise.
* runtime/spin_mutex.c: Likewise.
* runtime/spin_mutex.h: Likewise.
* runtime/stats.c: Likewise.
* runtime/stats.h: Likewise.
* runtime/sysdep-unix.c: Likewise.
* runtime/sysdep.h: Likewise.
* runtime/worker_mutex.c: Likewise.
* runtime/worker_mutex.h: Likewise.
* include/cilk/reducer_vector.h: New.
* runtime/cilk_str_mem.h: New.
* runtime/config/arm/cilk-abi-vla.c: New.
* runtime/config/arm/os-fence.h: New.
* runtime/config/arm/os-unix-sysdep.c: New.
* runtime/declare-alloca.h: New.
* runtime/sslib/ignore_handler_s.c: New.
* runtime/sslib/safe_lib.h: New.
* runtime/sslib/safe_lib_errno.h: New.
* runtime/sslib/safe_str_constraint.c: New.
* runtime/sslib/safe_str_constraint.h: New.
* runtime/sslib/safe_str_lib.h: New.
* runtime/sslib/safe_types.h: New.
* runtime/sslib/safeclib_private.h: New.
* runtime/sslib/snprintf_s.h: New.
* runtime/sslib/snprintf_support.c: New.
* runtime/sslib/strcpy_s.c: New.
* runtime/sslib/strncpy_s.c: New.
* runtime/sslib/strnlen_s.c: New.
* runtime/symbol_test.c: Remove.
* Makefile.in: Regenerate.
* configure: Regenerate.
2016-04-26 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/60290

View File

@ -1,8 +1,6 @@
# @copyright
# Copyright (C) 2011, 2013, Intel Corporation
# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ -17,7 +15,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# @copyright
# 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
@ -30,6 +27,20 @@
# 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.
#
# *********************************************************************
#
# PLEASE NOTE: This file is a downstream copy of a file mainitained in
# a repository at cilkplus.org. Changes made to this file that are not
# submitted through the contribution process detailed at
# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
# time that a new version is released. Changes only submitted to the
# GNU compiler collection or posted to the git repository at
# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
# not tracked.
#
# We welcome your contributions to this open source project. Thank you
# for your assistance in helping us improve Cilk Plus.
AUTOMAKE_OPTIONS = foreign
@ -37,7 +48,7 @@ AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I .. -I ../config
# Compiler and linker flags.
GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime -I$(top_srcdir)/runtime/config/$(config_dir) -DIN_CILK_RUNTIME=1
GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime -I$(top_srcdir)/runtime/config/$(config_dir) -I$(top_srcdir)/runtime/sslib -DIN_CILK_RUNTIME=1
# GENERAL_FLAGS += -D_Cilk_spawn="" -D_Cilk_sync="" -D_Cilk_for=for
# Enable Intel Cilk Plus extension
@ -60,6 +71,19 @@ toolexeclib_LTLIBRARIES = libcilkrts.la
libcilkrts_la_SOURCES = \
runtime/config/$(config_dir)/cilk-abi-vla.c \
runtime/config/$(config_dir)/os-unix-sysdep.c \
runtime/sslib/ignore_handler_s.c \
runtime/sslib/safe_lib.h \
runtime/sslib/safe_lib_errno.h \
runtime/sslib/safe_str_constraint.c \
runtime/sslib/safe_str_constraint.h \
runtime/sslib/safe_str_lib.h \
runtime/sslib/safe_types.h \
runtime/sslib/safeclib_private.h \
runtime/sslib/snprintf_s.h \
runtime/sslib/snprintf_support.c \
runtime/sslib/strcpy_s.c \
runtime/sslib/strncpy_s.c \
runtime/sslib/strnlen_s.c \
runtime/bug.cpp \
runtime/cilk-abi.c \
runtime/cilk-abi-cilk-for.cpp \
@ -85,7 +109,6 @@ libcilkrts_la_SOURCES = \
runtime/signal_node.c \
runtime/spin_mutex.c \
runtime/stats.c \
runtime/symbol_test.c \
runtime/sysdep-unix.c \
runtime/worker_mutex.c

View File

@ -15,11 +15,9 @@
@SET_MAKE@
# @copyright
# Copyright (C) 2011, 2013, Intel Corporation
# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ -34,7 +32,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# @copyright
# 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
@ -47,14 +44,26 @@
# 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.
#
# *********************************************************************
#
# PLEASE NOTE: This file is a downstream copy of a file mainitained in
# a repository at cilkplus.org. Changes made to this file that are not
# submitted through the contribution process detailed at
# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
# time that a new version is released. Changes only submitted to the
# GNU compiler collection or posted to the git repository at
# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
# not tracked.
#
# We welcome your contributions to this open source project. Thank you
# for your assistance in helping us improve Cilk Plus.
#########################################################################
#
# @copyright
# Copyright (C) 2011-2013, Intel Corporation
# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ -69,7 +78,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# @copyright
# 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
@ -82,6 +90,20 @@
# 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.
#
# *********************************************************************
#
# PLEASE NOTE: This file is a downstream copy of a file mainitained in
# a repository at cilkplus.org. Changes made to this file that are not
# submitted through the contribution process detailed at
# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
# time that a new version is released. Changes only submitted to the
# GNU compiler collection or posted to the git repository at
# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
# not tracked.
#
# We welcome your contributions to this open source project. Thank you
# for your assistance in helping us improve Cilk Plus.
###########################################################################
# DO NOT EDIT THIS FILE!
@ -184,14 +206,16 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
"$(DESTDIR)$(cilkincludedir)" "$(DESTDIR)$(toolexeclibdir)"
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
libcilkrts_la_LIBADD =
am_libcilkrts_la_OBJECTS = cilk-abi-vla.lo os-unix-sysdep.lo bug.lo \
cilk-abi.lo cilk-abi-cilk-for.lo cilk-abi-vla-internal.lo \
cilk_api.lo cilk_fiber.lo cilk_fiber-unix.lo cilk_malloc.lo \
c_reducers.lo except-gcc.lo frame_malloc.lo full_frame.lo \
global_state.lo jmpbuf.lo local_state.lo metacall_impl.lo \
os_mutex-unix.lo os-unix.lo pedigrees.lo record-replay.lo \
reducer_impl.lo scheduler.lo signal_node.lo spin_mutex.lo \
stats.lo symbol_test.lo sysdep-unix.lo worker_mutex.lo
am_libcilkrts_la_OBJECTS = cilk-abi-vla.lo os-unix-sysdep.lo \
ignore_handler_s.lo safe_str_constraint.lo snprintf_support.lo \
strcpy_s.lo strncpy_s.lo strnlen_s.lo bug.lo cilk-abi.lo \
cilk-abi-cilk-for.lo cilk-abi-vla-internal.lo cilk_api.lo \
cilk_fiber.lo cilk_fiber-unix.lo cilk_malloc.lo c_reducers.lo \
except-gcc.lo frame_malloc.lo full_frame.lo global_state.lo \
jmpbuf.lo local_state.lo metacall_impl.lo os_mutex-unix.lo \
os-unix.lo pedigrees.lo record-replay.lo reducer_impl.lo \
scheduler.lo signal_node.lo spin_mutex.lo stats.lo \
sysdep-unix.lo worker_mutex.lo
libcilkrts_la_OBJECTS = $(am_libcilkrts_la_OBJECTS)
libcilkrts_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@ -375,7 +399,8 @@ ACLOCAL_AMFLAGS = -I .. -I ../config
# Always generate unwind tables
GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime \
-I$(top_srcdir)/runtime/config/$(config_dir) \
-DIN_CILK_RUNTIME=1 -fcilkplus -funwind-tables
-I$(top_srcdir)/runtime/sslib -DIN_CILK_RUNTIME=1 -fcilkplus \
-funwind-tables
AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99
AM_CPPFLAGS = $(GENERAL_FLAGS)
AM_LDFLAGS = $(XLDFLAGS)
@ -389,6 +414,19 @@ toolexeclib_LTLIBRARIES = libcilkrts.la
libcilkrts_la_SOURCES = \
runtime/config/$(config_dir)/cilk-abi-vla.c \
runtime/config/$(config_dir)/os-unix-sysdep.c \
runtime/sslib/ignore_handler_s.c \
runtime/sslib/safe_lib.h \
runtime/sslib/safe_lib_errno.h \
runtime/sslib/safe_str_constraint.c \
runtime/sslib/safe_str_constraint.h \
runtime/sslib/safe_str_lib.h \
runtime/sslib/safe_types.h \
runtime/sslib/safeclib_private.h \
runtime/sslib/snprintf_s.h \
runtime/sslib/snprintf_support.c \
runtime/sslib/strcpy_s.c \
runtime/sslib/strncpy_s.c \
runtime/sslib/strnlen_s.c \
runtime/bug.cpp \
runtime/cilk-abi.c \
runtime/cilk-abi-cilk-for.cpp \
@ -414,11 +452,10 @@ libcilkrts_la_SOURCES = \
runtime/signal_node.c \
runtime/spin_mutex.c \
runtime/stats.c \
runtime/symbol_test.c \
runtime/sysdep-unix.c \
runtime/worker_mutex.c
CILK_REVISION = 3902
CILK_REVISION = 4420
# Load the $(REVISION) value.
@ -591,6 +628,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame_malloc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/full_frame.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/global_state.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ignore_handler_s.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jmpbuf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local_state.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metacall_impl.Plo@am__quote@
@ -600,11 +638,15 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pedigrees.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/record-replay.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reducer_impl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe_str_constraint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scheduler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal_node.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf_support.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spin_mutex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stats.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbol_test.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcpy_s.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strncpy_s.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen_s.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysdep-unix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/worker_mutex.Plo@am__quote@
@ -643,6 +685,48 @@ os-unix-sysdep.lo: runtime/config/$(config_dir)/os-unix-sysdep.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o os-unix-sysdep.lo `test -f 'runtime/config/$(config_dir)/os-unix-sysdep.c' || echo '$(srcdir)/'`runtime/config/$(config_dir)/os-unix-sysdep.c
ignore_handler_s.lo: runtime/sslib/ignore_handler_s.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ignore_handler_s.lo -MD -MP -MF $(DEPDIR)/ignore_handler_s.Tpo -c -o ignore_handler_s.lo `test -f 'runtime/sslib/ignore_handler_s.c' || echo '$(srcdir)/'`runtime/sslib/ignore_handler_s.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ignore_handler_s.Tpo $(DEPDIR)/ignore_handler_s.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/ignore_handler_s.c' object='ignore_handler_s.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ignore_handler_s.lo `test -f 'runtime/sslib/ignore_handler_s.c' || echo '$(srcdir)/'`runtime/sslib/ignore_handler_s.c
safe_str_constraint.lo: runtime/sslib/safe_str_constraint.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT safe_str_constraint.lo -MD -MP -MF $(DEPDIR)/safe_str_constraint.Tpo -c -o safe_str_constraint.lo `test -f 'runtime/sslib/safe_str_constraint.c' || echo '$(srcdir)/'`runtime/sslib/safe_str_constraint.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/safe_str_constraint.Tpo $(DEPDIR)/safe_str_constraint.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/safe_str_constraint.c' object='safe_str_constraint.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o safe_str_constraint.lo `test -f 'runtime/sslib/safe_str_constraint.c' || echo '$(srcdir)/'`runtime/sslib/safe_str_constraint.c
snprintf_support.lo: runtime/sslib/snprintf_support.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT snprintf_support.lo -MD -MP -MF $(DEPDIR)/snprintf_support.Tpo -c -o snprintf_support.lo `test -f 'runtime/sslib/snprintf_support.c' || echo '$(srcdir)/'`runtime/sslib/snprintf_support.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/snprintf_support.Tpo $(DEPDIR)/snprintf_support.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/snprintf_support.c' object='snprintf_support.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o snprintf_support.lo `test -f 'runtime/sslib/snprintf_support.c' || echo '$(srcdir)/'`runtime/sslib/snprintf_support.c
strcpy_s.lo: runtime/sslib/strcpy_s.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strcpy_s.lo -MD -MP -MF $(DEPDIR)/strcpy_s.Tpo -c -o strcpy_s.lo `test -f 'runtime/sslib/strcpy_s.c' || echo '$(srcdir)/'`runtime/sslib/strcpy_s.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/strcpy_s.Tpo $(DEPDIR)/strcpy_s.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/strcpy_s.c' object='strcpy_s.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strcpy_s.lo `test -f 'runtime/sslib/strcpy_s.c' || echo '$(srcdir)/'`runtime/sslib/strcpy_s.c
strncpy_s.lo: runtime/sslib/strncpy_s.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strncpy_s.lo -MD -MP -MF $(DEPDIR)/strncpy_s.Tpo -c -o strncpy_s.lo `test -f 'runtime/sslib/strncpy_s.c' || echo '$(srcdir)/'`runtime/sslib/strncpy_s.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/strncpy_s.Tpo $(DEPDIR)/strncpy_s.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/strncpy_s.c' object='strncpy_s.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strncpy_s.lo `test -f 'runtime/sslib/strncpy_s.c' || echo '$(srcdir)/'`runtime/sslib/strncpy_s.c
strnlen_s.lo: runtime/sslib/strnlen_s.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strnlen_s.lo -MD -MP -MF $(DEPDIR)/strnlen_s.Tpo -c -o strnlen_s.lo `test -f 'runtime/sslib/strnlen_s.c' || echo '$(srcdir)/'`runtime/sslib/strnlen_s.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/strnlen_s.Tpo $(DEPDIR)/strnlen_s.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/sslib/strnlen_s.c' object='strnlen_s.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strnlen_s.lo `test -f 'runtime/sslib/strnlen_s.c' || echo '$(srcdir)/'`runtime/sslib/strnlen_s.c
cilk-abi.lo: runtime/cilk-abi.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cilk-abi.lo -MD -MP -MF $(DEPDIR)/cilk-abi.Tpo -c -o cilk-abi.lo `test -f 'runtime/cilk-abi.c' || echo '$(srcdir)/'`runtime/cilk-abi.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cilk-abi.Tpo $(DEPDIR)/cilk-abi.Plo
@ -762,13 +846,6 @@ stats.lo: runtime/stats.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stats.lo `test -f 'runtime/stats.c' || echo '$(srcdir)/'`runtime/stats.c
symbol_test.lo: runtime/symbol_test.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT symbol_test.lo -MD -MP -MF $(DEPDIR)/symbol_test.Tpo -c -o symbol_test.lo `test -f 'runtime/symbol_test.c' || echo '$(srcdir)/'`runtime/symbol_test.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/symbol_test.Tpo $(DEPDIR)/symbol_test.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/symbol_test.c' object='symbol_test.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o symbol_test.lo `test -f 'runtime/symbol_test.c' || echo '$(srcdir)/'`runtime/symbol_test.c
sysdep-unix.lo: runtime/sysdep-unix.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sysdep-unix.lo -MD -MP -MF $(DEPDIR)/sysdep-unix.Tpo -c -o sysdep-unix.lo `test -f 'runtime/sysdep-unix.c' || echo '$(srcdir)/'`runtime/sysdep-unix.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sysdep-unix.Tpo $(DEPDIR)/sysdep-unix.Plo

View File

@ -40,6 +40,9 @@ configure script:
% ./configure --prefix=/your/path/to/lib
It is also possible to use CMake if the above method does not apply
well in your environment. Instruction is available in CMakeLists.txt.
#
# 2. USING:
#
@ -79,6 +82,9 @@ http://cilkplus.org/
Changes to the Intel Cilk Plus runtime are welcome and should be
contributed to the upstream version via http://cilkplus.org/.
Thanks to Tobias Burnus for showing us the magic to make gcc and g++
automatically include the Cilk Plus runtime.
------------------------
Intel and Cilk are trademarks of Intel Corporation in the U.S. and/or
other countries.

3250
libcilkrts/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,6 @@
# @copyright
# Copyright (C) 2011-2013, Intel Corporation
# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ -17,7 +15,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# @copyright
# 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
@ -30,6 +27,20 @@
# 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.
#
# *********************************************************************
#
# PLEASE NOTE: This file is a downstream copy of a file mainitained in
# a repository at cilkplus.org. Changes made to this file that are not
# submitted through the contribution process detailed at
# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
# time that a new version is released. Changes only submitted to the
# GNU compiler collection or posted to the git repository at
# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
# not tracked.
#
# We welcome your contributions to this open source project. Thank you
# for your assistance in helping us improve Cilk Plus.
AC_INIT([Cilk Runtime Library], [2.0], [cilk@intel.com])
AC_PREREQ([2.64])
@ -39,6 +50,10 @@ AC_PREREQ([2.64])
AC_CANONICAL_SYSTEM
target_alias=${target_alias-$host_alias}
AC_SUBST(target_alias)
# Test for GNU extensions. Will define _GNU_SOURCE if they're available
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE(foreign no-dist)
AM_MAINTAINER_MODE
@ -134,6 +149,10 @@ case "${target}" in
config_dir="x86"
;;
arm-*-*)
config_dir="arm"
;;
*)
config_dir="generic"
;;
@ -189,8 +208,7 @@ AC_LINK_IFELSE(
# Check for pthread_{,attr_}[sg]etaffinity_np.
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#define _GNU_SOURCE
#include <pthread.h>],
[#include <pthread.h>],
[cpu_set_t cpuset;
pthread_attr_t attr;
pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);

View File

@ -1,8 +1,6 @@
# @copyright
# Copyright (C) 2011-2013, Intel Corporation
# Copyright (C) 2013-2016, Intel Corporation
# All rights reserved.
#
# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ -17,7 +15,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# @copyright
# 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
@ -30,13 +27,29 @@
# 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.
#
# *********************************************************************
#
# PLEASE NOTE: This file is a downstream copy of a file mainitained in
# a repository at cilkplus.org. Changes made to this file that are not
# submitted through the contribution process detailed at
# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
# time that a new version is released. Changes only submitted to the
# GNU compiler collection or posted to the git repository at
# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
# not tracked.
#
# We welcome your contributions to this open source project. Thank you
# for your assistance in helping us improve Cilk Plus.
# Disable Cilk Runtime library for non x86 architecture...for now.
# Disable Cilk Runtime library for unsupported architectures.
case "${target}" in
x86_64-*-*)
;;
i?86-*-*)
;;
arm-*-*)
;;
*-*-*)
UNSUPPORTED=1
;;

View File

@ -1,10 +1,8 @@
/* cilk.h -*-C++-*-
*
* @copyright
* Copyright (C) 2010-2013, Intel Corporation
* Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,40 +29,54 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file cilk.h
*
* @brief Provides convenient aliases for the Cilk language keywords.
* @brief Provides convenient aliases for Intel(R) Cilk(TM) language keywords.
*
* @details
* Since Cilk is a nonstandard extension to both C and C++, the Cilk
* language keywords all begin with `_Cilk_`, which guarantees that they
* Since Intel Cilk Plus is a nonstandard extension to both C and C++, the Intel
* Cilk language keywords all begin with "`_Cilk_`", which guarantees that they
* will not conflict with user-defined identifiers in properly written
* programs, so that standard C and C++ programs can safely be
* compiled a Cilk-enabled C or C++ compiler.
* programs. This way, a Cilk-enabled C or C++ compiler can safely compile
* "standard" C and C++ programs.
*
* However, this means that the keywords _look_ like something grafted on to
* the base language. Therefore, you can include this header:
*
* #include "cilk/cilk.h"
*
* and then write the Cilk keywords with a `cilk_` prefix instead of
* `_Cilk_`.
* and then write the Intel Cilk keywords with a "`cilk_`" prefix instead of
* "`_Cilk_`".
*
* @ingroup language
*/
/** @defgroup language Language Keywords
* Definitions having to do with the Cilk language.
* Definitions for the Intel Cilk language.
* @{
*/
#ifndef cilk_spawn
# define cilk_spawn _Cilk_spawn ///< Spawn a task that can execute in parallel.
# define cilk_sync _Cilk_sync ///< Wait for spawned tasks to complete.
# define cilk_for _Cilk_for ///< Execute iterations of a for loop in parallel.
# define cilk_for _Cilk_for ///< Execute iterations of a `for` loop in parallel.
#endif
/// @}

View File

@ -1,10 +1,8 @@
/* cilk_api.h
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,23 +29,37 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file cilk_api.h
*
* @brief Defines the documented API exposed by the Cilk Plus for use
* by applications.
* @brief Defines the Intel(R) Cilk(TM) Plus API for use by applications.
*
* @ingroup api
*/
#ifndef INCLUDED_CILK_API_H
#define INCLUDED_CILK_API_H
/** @defgroup api Runtime API
* API to allow user programs to interact with the Cilk runtime.
* @{
*/
* API to interact with the Intel Cilk Plus runtime.
* @{
*/
#ifndef CILK_STUB /* Real (non-stub) definitions */
@ -81,7 +92,7 @@
__CILKRTS_BEGIN_EXTERN_C
/** Return values from __cilkrts_set_param() and __cilkrts_set_param_w()
/** Return values from `__cilkrts_set_param()` and `__cilkrts_set_param_w()`
*/
enum __cilkrts_set_param_status {
__CILKRTS_SET_PARAM_SUCCESS = 0, /**< Success - parameter set */
@ -91,79 +102,79 @@ enum __cilkrts_set_param_status {
__CILKRTS_SET_PARAM_LATE = 4 /**< Too late to change parameter value */
};
/** Set user controllable runtime parameters
/** Sets user controllable runtime parameters
*
* Call this function to set runtime parameters that control the behavior
* of the Cilk scheduler.
* Call this function to set runtime parameters that control the behavior
* of the Intel Cilk Plus scheduler.
*
* @param param A string specifying the parameter to be set. One of:
* - `"nworkers"`
* - `"force reduce"`
* @param value A string specifying the parameter value.
* @returns A value from the @ref __cilkrts_set_param_status
* @returns A value from the @ref __cilkrts_set_param_status
* enumeration indicating the result of the operation.
*
* @par The "nworkers" parameter
*
* This parameter specifies the number of worker threads to be created by the
* Cilk runtime. @a Value must be a string of digits to be parsed by
* `strtol()`.
* Intel Cilk Plus runtime. @a Value must be a string of digits to be parsed by
* `strtol()` as a decimal number.
*
* The number of worker threads is:
* 1. the value set with `__cilkrts_set_param("nworkers")`, if it is
* 1. the value set with `__cilkrts_set_param("nworkers")`, if it is
* positive; otherwise,
* 2. the value of the CILK_NWORKERS environment variable, if it is
* 2. the value of the CILK_NWORKERS environment variable, if it is
* defined; otherwise
* 3. the number of cores available, as reported by the operating system.
*
* @note
* Technically, Cilk distinguishes between the _user thread_ (the thread that
* the user code was executing on when the Cilk runtime started), and
* _worker threads_ (new threads created by the Cilk runtime to support
* Cilk parallelism). `nworkers` actually includes both the user thread and
* the worker threads; that is, it is one greater than the number of true
* worker threads.
* Technically, Intel Cilk Plus distinguishes between the _user thread_ (the thread
* that the user code was executing on when the Intel Cilk Plus runtime started),
* and _worker threads_ (new threads created by the Intel Cilk Plus runtime to
* support Intel Cilk Plus parallelism). `nworkers` actually includes both the user
* thread and the worker threads; that is, it is one greater than the number of
* true "worker threads".
*
* @note
* Setting `nworkers = 1` produces serial behavior. Cilk spawns and syncs will
* be executed, but with only one worker, continuations will never be stolen,
* so all code will execute in serial.
* Setting `nworkers = 1` produces serial behavior. Intel Cilk Plus spawns and syncs
* will be executed, but with only one worker, continuations will never be
* stolen, so all code will execute in serial.
*
* @warning
* The number of worker threads can only be set *before* the runtime has
* started. Attempting to set it when the runtime is running will have no
* effect, and will return an error code. You can call __cilkrts_end_cilk()
* The number of worker threads can only be set *before* the runtime has
* started. Attempting to set it when the runtime is running will have no
* effect, and will return an error code. You can call __cilkrts_end_cilk()
* to shut down the runtime to change the number of workers.
*
* @warning
* The default Cilk scheduler behavior is usually pretty good. The ability
* to override `nworkers` can be useful for experimentation, but it wont
* usually be necessary for getting good performance.
* The default Intel Cilk scheduler behavior is usually pretty good. The
* ability to override `nworkers` can be useful for experimentation, but it
* won't usually be necessary for getting good performance.
*
* @par The "force reduce" parameter
*
* This parameter controls whether the runtime should allocate a new view
* for a reducer for every parallel strand that it is accessed on. (See
* @ref pagereducers.) @a Value must be `"1"` or `"true"` to enable the
* force reduce behavior, or `"0"` or `"false"` to disable it.
* for a reducer for every parallel strand that it is accessed on. (See
* @ref pagereducers.) @a Value must be `"1"` or `"true"` to enable the
* "force reduce" behavior, or `"0"` or `"false"` to disable it.
*
* Force reduce behavior will also be enabled if
* "Force reduce" behavior will also be enabled if
* `__cilkrts_set_param("force reduce")` is not called, but the
* `CILK_FORCE_REDUCE` environment variable is defined.
*
* @warning
* When this option is enabled, `nworkers` should be set to `1`. Using force
* reduce with more than one worker may result in runtime errors.
*
* When this option is enabled, `nworkers` should be set to `1`. Using "force
* reduce" with more than one worker may result in runtime errors.
*
* @warning
* Enabling this option can significantly reduce performance. It should
* _only_ be used as a debugging tool.
* Enabling this option can significantly reduce performance. Use it
* _only_ as a debugging tool.
*/
CILK_API(int) __cilkrts_set_param(const char *param, const char *value);
#ifdef _WIN32
/**
* Set user controllable parameters using wide strings
* Sets user controllable parameters using wide strings
*
* @note This variant of __cilkrts_set_param() is only available
* on Windows.
@ -173,36 +184,36 @@ CILK_API(int) __cilkrts_set_param(const char *param, const char *value);
CILK_API(int) __cilkrts_set_param_w(const wchar_t *param, const wchar_t *value);
#endif
/** Shut down and deallocate all Cilk state. The runtime will abort the
* application if Cilk is still in use by this thread. Otherwise the runtime
* will wait for all other threads using Cilk to exit.
/** Shuts down and deallocates all Intel Cilk Plus states. If Intel Cilk Plus is still in
* use by the calling thread, the runtime aborts the application. Otherwise, the
* runtime waits for all other threads using Intel Cilk Plus to exit.
*/
CILK_API(void) __cilkrts_end_cilk(void);
/** Initialize the Cilk data structures and start the runtime.
/** Initializes Intel Cilk Plus data structures and start the runtime.
*/
CILK_API(void) __cilkrts_init(void);
/** Return the runtime `nworkers` parameter. (See the discussion of `nworkers`
/** Returns the runtime `nworkers` parameter. (See the discussion of `nworkers`
* in the documentation for __cilkrts_set_param().)
*/
CILK_API(int) __cilkrts_get_nworkers(void);
/** Return the number of thread data structures.
/** Returns the number of thread data structures.
*
* This function returns the number of data structures that has been allocated
* allocated by the runtime to hold information about user and worker threads.
* This function returns the number of data structures that have been allocated
* by the runtime to hold information about user and worker threads.
*
* If you dont already know what this is good for, then you probably dont
* need it.
* If you don't already know what this is good for, then you probably don't
* need it. :)
*/
CILK_API(int) __cilkrts_get_total_workers(void);
/** What thread is the function running on?
/** Returns a small integer identifying the current thread.
*
* Return a small integer identifying the current thread. Each worker thread
* started by the Cilk runtime library has a unique worker number in the range
* `1 .. nworkers - 1`.
* What thread is the function running on? Each worker thread
* started by the Intel Cilk Plus runtime library has a unique worker number in the
* range `1 .. nworkers - 1`.
*
* All _user_ threads (threads started by the user, or by other libraries) are
* identified as worker number 0. Therefore, the worker number is not unique
@ -210,13 +221,13 @@ CILK_API(int) __cilkrts_get_total_workers(void);
*/
CILK_API(int) __cilkrts_get_worker_number(void);
/** Test whether “force reduce” behavior is enabled.
*
/** Tests whether "force reduce" behavior is enabled.
*
* @return Non-zero if force-reduce mode is on, zero if it is off.
*/
CILK_API(int) __cilkrts_get_force_reduce(void);
/** Interact with tools
/** Interacts with tools
*/
CILK_API(void)
__cilkrts_metacall(unsigned int tool, unsigned int code, void *data);
@ -229,12 +240,13 @@ typedef struct _EXCEPTION_RECORD _EXCEPTION_RECORD;
*/
typedef void (*__cilkrts_pfn_seh_callback)(const _EXCEPTION_RECORD *exception);
/** Specify a function to call when a non-C++ exception is caught.
/** Specifies a function to call when a non-C++ exception is caught.
*
* Cilk Plus parallelism plays nicely with C++ exception handling, but the
* Cilk Plus runtime has no way to unwind the stack across a strand boundary
* for Microsoft SEH (Structured Exception Handling) exceptions. Therefore,
* when the runtime catches such an exception, it must abort the application.
* Intel Cilk Plus parallelism plays nicely with C++ exception handling, but
* the Intel Cilk Plus runtime has no way to unwind the stack across a strand
* boundary for Microsoft SEH ("Structured Exception Handling") exceptions.
* Therefore, when the runtime catches such an exception, it must abort the
* application.
*
* If an SEH callback has been set, the runtime will call it before aborting.
*
@ -267,33 +279,33 @@ __cilkrts_bump_worker_rank_internal(__cilkrts_worker* w);
/// @endcond
/** Get the current pedigree, in a linked list representation.
/** Gets the current pedigree in a linked list representation.
*
* This routine returns a copy of the last node in the pedigree list.
* For example, if the current pedigree (in order) is <1, 2, 3, 4>,
* then this method returns a node with rank == 4, and whose parent
* field points to the node with rank of 3. In summary, following the
* nodes in the chain visits the terms of the pedigree in reverse.
*
*
* The returned node is guaranteed to be valid only until the caller
* of this routine has returned.
*/
__CILKRTS_INLINE
__cilkrts_pedigree __cilkrts_get_pedigree(void)
__cilkrts_pedigree __cilkrts_get_pedigree(void)
{
return __cilkrts_get_pedigree_internal(__cilkrts_get_tls_worker());
return __cilkrts_get_pedigree_internal(__cilkrts_get_tls_worker());
}
/** Context used by __cilkrts_get_pedigree_info.
*
* @deprecated
* This data structure is only used by the deprecated
* This data structure is only used by the deprecated
* __cilkrts_get_pedigree_info function.
*
* Callers should initialize the `data` array to NULL and set the `size`
* field to `sizeof(__cilkrts_pedigree_context_t)` before the first call
* to __cilkrts_get_pedigree_info(), and should not examine or modify it
* thereafter.
* to `__cilkrts_get_pedigree_info()`. Also, callers should not examine or
* modify `data` thereafter.
*/
typedef struct
{
@ -301,16 +313,16 @@ typedef struct
void *data[3]; /**< Opaque context data */
} __cilkrts_pedigree_context_t;
/** Get pedigree information.
/** Gets pedigree information.
*
* @deprecated
* Use __cilkrts_get_pedigree() instead.
*
* This routine allows code to walk up the stack of Cilk frames to gather
* This routine allows code to walk up the stack of Intel Cilk Plus frames to gather
* the pedigree.
*
* Initialize the pedigree walk by filling the pedigree context with NULLs
* and setting the size field to sizeof(__cilkrts_pedigree_context).
* and setting the size field to `sizeof(__cilkrts_pedigree_context)`.
* Other than initialization to NULL to start the walk, user coder should
* consider the pedigree context data opaque and should not examine or
* modify it.
@ -326,7 +338,7 @@ CILK_API(int)
__cilkrts_get_pedigree_info(/* In/Out */ __cilkrts_pedigree_context_t *context,
/* Out */ uint64_t *sf_birthrank);
/** Get the rank of the currently executing worker.
/** Gets the rank of the currently executing worker.
*
* @deprecated
* Use `__cilkrts_get_pedigree().rank` instead.
@ -335,16 +347,16 @@ __cilkrts_get_pedigree_info(/* In/Out */ __cilkrts_pedigree_context_t *context,
* @returns <0 - Failure - *rank is not changed
*/
CILK_EXPORT_AND_INLINE
int __cilkrts_get_worker_rank(uint64_t *rank)
int __cilkrts_get_worker_rank(uint64_t *rank)
{
*rank = __cilkrts_get_pedigree().rank;
return 0;
}
/** Increment the pedigree rank of the currently executing worker.
/** Increments the pedigree rank of the currently executing worker.
*
* @returns 0 - Success - rank was incremented
* @returns-1 - Failure
* @returns -1 - Failure
*/
CILK_EXPORT_AND_INLINE
int __cilkrts_bump_worker_rank(void)
@ -352,7 +364,7 @@ int __cilkrts_bump_worker_rank(void)
return __cilkrts_bump_worker_rank_internal(__cilkrts_get_tls_worker());
}
/** Increment the pedigree rank for a cilk_for loop.
/** Increments the pedigree rank for a `cilk_for` loop.
* Obsolete.
*
* @deprecated
@ -362,7 +374,7 @@ int __cilkrts_bump_worker_rank(void)
* be called, but will have no effect.
*/
CILK_EXPORT_AND_INLINE
int __cilkrts_bump_loop_rank(void)
int __cilkrts_bump_loop_rank(void)
{
return 0;
}
@ -375,7 +387,7 @@ __CILKRTS_END_EXTERN_C
#else /* CILK_STUB */
// Programs compiled with CILK_STUB are not linked with the Cilk runtime
// Programs compiled with CILK_STUB are not linked with the Intel Cilk Plus runtime
// library, so they should not have external references to runtime functions.
// Therefore, the functions are replaced with stubs.
@ -401,8 +413,8 @@ __CILKRTS_END_EXTERN_C
/*
* A stub method for __cilkrts_get_pedigree.
* Returns an empty __cilkrts_pedigree.
*/
* Returns an empty __cilkrts_pedigree.
*/
__CILKRTS_INLINE
__cilkrts_pedigree __cilkrts_get_pedigree_stub(void)
{

View File

@ -1,9 +1,7 @@
/*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -31,6 +28,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
*/

View File

@ -1,10 +1,8 @@
/* cilk_stub.h -*-C++-*-
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,13 +29,27 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
*/
#ifndef INCLUDED_CILK_STUB_DOT_H
#define INCLUDED_CILK_STUB_DOT_H
/* Definitions for creating a serialization from a Cilk program.
/* Definitions for creating a serialization from an Intel(R) Cilk(TM) Plus program.
* These definitions are suitable for use by a compiler that is not
* Cilk-enabled.
*/
@ -47,9 +58,14 @@
#undef __cilk
#define CILK_STUB
/* Replace Cilk keywords with serial equivalents */
/* Replace Intel Cilk keywords with serial equivalents */
#define _Cilk_spawn
#define _Cilk_sync
#define _Cilk_for for
/* Replace simd-loop keywords with serial equivalents */
#define _Simd
#define _Safelen(...)
#define _Reduction(...)
#endif /* ! defined(INCLUDED_CILK_STUB_DOT_H) */

View File

@ -1,9 +1,7 @@
/*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -31,6 +28,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
******************************************************************************
*
@ -83,7 +94,7 @@ CILK_EXPORT __CILKRTS_NOTHROW
void *__cilkrts_get_sf(void);
/**
* Returns the size of stacks created by Cilk.
* Returns the size of stacks created by Intel(R) Cilk(TM) Plus.
*/
CILK_EXPORT __CILKRTS_NOTHROW
size_t __cilkrts_get_stack_size(void);

View File

@ -1,10 +1,8 @@
/** common.h
*
* @copyright
* Copyright (C) 2010-2013, Intel Corporation
* Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,18 +29,31 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file common.h
*
* @brief Defines common macros and structures used by the Intel Cilk Plus
* runtime.
* @brief Defines common macros and structures used by the Intel(R) Cilk(TM) Plus runtime.
*
* @ingroup common
*/
/** @defgroup common Common Definitions
* Macro, structure, and class definitions used elsewhere in the runtime.
* Definitions for runtime macros, structures, and classes.
* @{
*/
@ -51,18 +61,17 @@
#define INCLUDED_CILK_COMMON
#ifdef __cplusplus
/** Namespace for all Cilk definitions that can be included in user code.
/** Namespace for all Intel Cilk Plus definitions that can be included in user code.
*/
namespace cilk {
/** Namespace for definitions that are primarily intended for use
* in other Cilk definitions.
/** Namespace for definitions re-used in other Intel Cilk Plus definitions.
*/
namespace internal {}
}
#endif
/** Cilk library version = 1.01
/** Intel Cilk Plus library version = 1.02
*/
#define CILK_LIBRARY_VERSION 102
@ -73,7 +82,7 @@ namespace cilk {
#endif
/**
* Prefix standard library function and type names with __STDNS in order to
* Prefix standard library function and type names with __STDNS to
* get correct lookup in both C and C++.
*/
#ifdef __cplusplus
@ -159,7 +168,7 @@ namespace cilk {
/**
* Macro to specify alignment of a data member in a structure.
* Because of the way that gccs alignment attribute is defined, @a n must
* Because of the way that gcc's alignment attribute is defined, @a n must
* be a numeric literal, not just a compile-time constant expression.
*/
#ifdef _WIN32
@ -231,7 +240,7 @@ namespace cilk {
/**
* OS-independent macro to specify a function that should be inlined
*/
#ifdef __cpluspus
#ifdef __cplusplus
// C++
# define __CILKRTS_INLINE inline
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
@ -247,7 +256,7 @@ namespace cilk {
/**
* Functions marked as CILK_EXPORT_AND_INLINE have both
* inline versions defined in the Cilk API, as well as
* inline versions defined in the Intel Cilk Plus API, as well as
* non-inlined versions that are exported (for
* compatibility with previous versions that did not
* inline the functions).
@ -306,13 +315,14 @@ namespace cilk {
#endif /* ! defined(_MSC_VER) || (_MSC_VER >= 1600) */
/**
* @brief Application Binary Interface version of the Cilk runtime library.
* @brief Application Binary Interface (ABI) version of the Intel Cilk Plus runtime
* library.
*
* The ABI version is determined by the compiler used. An object file
* compiled with a higher ABI version is not compatible with a library that is
* compiled with a lower ABI version. An object file compiled with a lower
* ABI version, however, can be used with a library compiled with a higher ABI
* version unless otherwise stated.
* The compiler determines the ABI version used for compilation. Object files
* compiled with higher ABI versions are not compatible with libraries compiled
* with lower ABI versions. However, an object file compiled with a lower ABI
* version can be used with a library compiled with a higher ABI version
* (unless otherwise stated.)
*/
#ifndef __CILKRTS_ABI_VERSION
# ifdef IN_CILK_RUNTIME

View File

@ -1,9 +1,7 @@
/*
* @copyright
* Copyright (C) 2011-2013, Intel Corporation
* Copyright (C) 2011-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -31,6 +28,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
*/
@ -60,8 +71,8 @@
* common variable where it is not necessary to preserve changes from
* different parallel strands. In effect, a holder acts a bit like
* thread-local storage, but has qualities that work better with the
* fork-join structure of Cilk. In particular, a holder has the following
* qualities:
* fork-join structure of Intel(R) Cilk(TM) Plus. In particular, a holder has the
* following qualities:
*
* - The view of a holder before the first spawn within a function is the same
* as the view after each sync (as in the case of a reducer).
@ -220,7 +231,7 @@
* same as the view on entry to 'h'. More importantly, the view of the holder
* within the recursive call to 'compute' is the same as the view on entry to
* 'h', even if a different worker is executing the recursive call. Thus, the
* holder view within a Cilk program has useful qualities not found in
* holder view within a Intel Cilk Plus program has useful qualities not found in
* thread-local storage.
*/

View File

@ -1,9 +1,7 @@
/*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -31,6 +28,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
*/
@ -49,7 +60,7 @@
#if defined _WIN32 || defined _WIN64
# if !defined CILK_STUB && !defined IN_CILK_RUNTIME
/* bring in the Cilk library, which has definitions for some of these
/* bring in the Intel(R) Cilk(TM) Plus library, which has definitions for some of these
* functions. */
# pragma comment(lib, "cilkrts")
# endif
@ -126,7 +137,7 @@ CILK_EXPORT
#else // CILK_STUB
// Programs compiled with CILK_STUB are not linked with the Cilk runtime
// Programs compiled with CILK_STUB are not linked with the Intel Cilk Plus runtime
// library, so they should not have external references to cilkrts functions.
// Furthermore, they don't need the hyperobject functionality, so the
// functions can be stubbed.

View File

@ -1,10 +1,8 @@
/* metaprogramming.h -*- C++ -*-
*
* @copyright
* Copyright (C) 2012-2013, Intel Corporation
* Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,11 +29,25 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file metaprogramming.h
*
* @brief Defines metaprogramming utility classes used in the Cilk library.
* @brief Defines metaprogramming utility classes used in the Intel(R) Cilk(TM) Plus library.
*
* @ingroup common
*/
@ -61,7 +72,7 @@ namespace internal {
/** Test if a class is empty.
*
* If @a Class is an empty (and therefore necessarily stateless) class, then
* the empty base-class optimization guarantees that
* the "empty base-class optimization" guarantees that
* `sizeof(check_for_empty_class<Class>) == sizeof(char)`. Conversely, if
* `sizeof(check_for_empty_class<Class>) > sizeof(char)`, then @a Class is not
* empty, and we must discriminate distinct instances of @a Class.
@ -84,7 +95,7 @@ namespace internal {
* @ingroup common
*/
template <class Class>
class class_is_empty {
class class_is_empty {
class check_for_empty_class : public Class
{
char m_data;
@ -147,11 +158,11 @@ public:
* @tparam Size The required minimum size of the resulting class.
* @tparam Alignment The required alignment of the resulting class.
*
* @pre @a Alignment shall be a power of 2 no greater then 64.
* @pre @a Alignment shall be a power of 2 no greater than 64.
*
* @note This is implemented using the `CILK_ALIGNAS` macro, which uses
* the non-standard, implementation-specific features
* `__declspec(align(N))` on Windows, and
* `__declspec(align(N))` on Windows, and
* `__attribute__((__aligned__(N)))` on Unix. The `gcc` implementation
* of `__attribute__((__aligned__(N)))` requires a numeric literal `N`
* (_not_ an arbitrary compile-time constant expression). Therefore,
@ -165,21 +176,22 @@ public:
template <std::size_t Size, std::size_t Alignment>
struct aligned_storage;
template<std::size_t Size> class aligned_storage<Size, 1>
/// @cond
template<std::size_t Size> class aligned_storage<Size, 1>
{ CILK_ALIGNAS( 1) char m_bytes[Size]; };
template<std::size_t Size> class aligned_storage<Size, 2>
template<std::size_t Size> class aligned_storage<Size, 2>
{ CILK_ALIGNAS( 2) char m_bytes[Size]; };
template<std::size_t Size> class aligned_storage<Size, 4>
template<std::size_t Size> class aligned_storage<Size, 4>
{ CILK_ALIGNAS( 4) char m_bytes[Size]; };
template<std::size_t Size> class aligned_storage<Size, 8>
template<std::size_t Size> class aligned_storage<Size, 8>
{ CILK_ALIGNAS( 8) char m_bytes[Size]; };
template<std::size_t Size> class aligned_storage<Size, 16>
template<std::size_t Size> class aligned_storage<Size, 16>
{ CILK_ALIGNAS(16) char m_bytes[Size]; };
template<std::size_t Size> class aligned_storage<Size, 32>
template<std::size_t Size> class aligned_storage<Size, 32>
{ CILK_ALIGNAS(32) char m_bytes[Size]; };
template<std::size_t Size> class aligned_storage<Size, 64>
template<std::size_t Size> class aligned_storage<Size, 64>
{ CILK_ALIGNAS(64) char m_bytes[Size]; };
/// @endcond
/** A buffer of uninitialized bytes with the same size and alignment as a
* specified type.
@ -188,14 +200,14 @@ template<std::size_t Size> class aligned_storage<Size, 64>
* properties as `Type`, but it will contain only raw (uninitialized) bytes.
* This allows the definition of a data member which can contain a `Type`
* object which is initialized explicitly under program control, rather
* than implicitly as part of the initialization of the containing class.
* than implicitly as part of the initialization of the containing class.
* For example:
*
* class C {
* storage_for_object<MemberClass> _member;
* public:
* C() ... // Does NOT initialize _member
* void initialize(args)
* void initialize(args)
* { new (_member.pointer()) MemberClass(args); }
* const MemberClass& member() const { return _member.object(); }
* MemberClass& member() { return _member.object(); }
@ -204,21 +216,22 @@ template<std::size_t Size> class aligned_storage<Size, 64>
* by this class.
*/
template <typename Type>
class storage_for_object :
class storage_for_object :
aligned_storage< sizeof(Type), align_of<Type>::value >
{
public:
/// Return a typed reference to the buffer.
const Type& object() const { return *reinterpret_cast<Type*>(this); }
/// Return a typed reference to the buffer.
Type& object() { return *reinterpret_cast<Type*>(this); }
};
/** Get the functor class corresponding to a binary function type.
*
* The `binary_functor` template class class can be instantiated with a binary
* The `binary_functor` template class can be instantiated with a binary
* functor class or with a real binary function, and will yield an equivalent
* binary functor class class in either case.
* binary functor class in either case.
*
* @tparam F A binary functor class, a binary function type, or a pointer to
* binary function type.
@ -260,7 +273,7 @@ struct binary_functor<R(*)(A,B)> {
* `typed_indirect_binary_function<F>` is an `Adaptable Binary Function` class
* based on an existing binary functor class or binary function type @a F. If
* @a F is a stateless class, then this class will be empty, and its
* `operator()` will invoke @a Fs `operator()`. Otherwise, an object of this
* `operator()` will invoke @a F's `operator()`. Otherwise, an object of this
* class will hold a pointer to an object of type @a F, and will refer its
* `operator()` calls to the pointed-to @a F object.
*
@ -276,14 +289,15 @@ struct binary_functor<R(*)(A,B)> {
*
* @note Just to repeat: if `F` is an empty class, then
* `typed_indirect_binary_function\<F\>' is also an empty class.
* This is critical for its use in the @ref min_max::view_base
* This is critical for its use in the
* @ref cilk::cilk_lib_1_1::min_max_internal::view_base
* "min/max reducer view classes", where it allows the view to
* call a comparison functor in the monoid without actually
* having to allocate a pointer in the view class when the
* having to allocate a pointer in the view class when the
* comparison class is empty.
*
* @note If you have an `Adaptable Binary Function` class or a binary
* function type, then you can use the
* function type, then you can use the
* @ref indirect_binary_function class, which derives the
* argument and result types parameter type instead of requiring
* you to specify them as template arguments.
@ -312,7 +326,7 @@ class typed_indirect_binary_function : std::binary_function<A1, A2, R>
public:
/// Constructor captures a pointer to the wrapped function.
typed_indirect_binary_function(const F* f) : f(f) {}
/// Return the comparator pointer, or `NULL` if the comparator is stateless.
const F* pointer() const { return f; }
@ -323,10 +337,10 @@ public:
/// @copydoc typed_indirect_binary_function
/// Specialization for an empty functor class. (This is only possible if @a F
/// itself is an empty class. If @a F is a function or pointer-to-function
/// itself is an empty class. If @a F is a function or pointer-to-function
/// type, then the functor will contain a pointer.)
template <typename F, typename A1, typename A2, typename R, typename Functor>
class typed_indirect_binary_function<F, A1, A2, R, Functor, true> :
class typed_indirect_binary_function<F, A1, A2, R, Functor, true> :
std::binary_function<A1, A2, R>
{
public:
@ -335,7 +349,7 @@ public:
/// Constructor discards the pointer to a stateless functor class.
typed_indirect_binary_function(const F* f) {}
/// Create an instance of the stateless functor class and apply it to the arguments.
R operator()(const A1& a1, const A2& a2) const { return F()(a1, a2); }
};
@ -343,28 +357,29 @@ public:
/** Indirect binary function class with inferred types.
*
* This is identical to @ref typed_indirect_binary_function, except that it
* derives the binary function argument and result types from the parameter
* type @a F instead of taking them as additional template parameters. If @a F
* is a class type, then it must be an `Adaptable Binary Function`.
* This is identical to @ref cilk::internal::typed_indirect_binary_function,
* except that it derives the binary function argument and result types from
* the parameter type @a F instead of taking them as additional template
* parameters. If @a F is a class type, then it must be an `Adaptable Binary
* Function`.
*
* @see typed_indirect_binary_function
*
* @ingroup common
*/
template <typename F, typename Functor = typename binary_functor<F>::type>
class indirect_binary_function :
class indirect_binary_function :
typed_indirect_binary_function< F
, typename Functor::first_argument_type
, typename Functor::second_argument_type
, typename Functor::result_type
>
>
{
typedef typed_indirect_binary_function< F
, typename Functor::first_argument_type
, typename Functor::second_argument_type
, typename Functor::result_type
>
>
base;
public:
indirect_binary_function(const F* f) : base(f) {} ///< Constructor
@ -373,7 +388,7 @@ public:
/** Choose a type based on a boolean constant.
*
* This metafunction is identical to C++11s condition metafunction.
* This metafunction is identical to C++11's condition metafunction.
* It needs to be here until we can reasonably assume that users will be
* compiling with C++11.
*
@ -407,12 +422,12 @@ struct condition<false, IfTrue, IfFalse>
* Causes a compilation error if a compile-time constant expression is false.
*
* @par Usage example.
* This assertion is used in reducer_min_max.h to avoid defining
* This assertion is used in reducer_min_max.h to avoid defining
* legacy reducer classes that would not be binary-compatible with the
* same classes compiled with earlier versions of the reducer library.
*
* __CILKRTS_STATIC_ASSERT(
* internal::class_is_empty< internal::binary_functor<Compare> >::value,
* internal::class_is_empty< internal::binary_functor<Compare> >::value,
* "cilk::reducer_max<Value, Compare> only works with an empty Compare class");
*
* @note In a C++11 compiler, this is just the language predefined
@ -468,13 +483,13 @@ inline void* allocate_aligned(std::size_t size, std::size_t alignment)
#ifdef _WIN32
return _aligned_malloc(size, alignment);
#else
#if defined(__ANDROID__)
#if defined(__ANDROID__) || defined(__VXWORKS__)
return memalign(std::max(alignment, sizeof(void*)), size);
#else
void* ptr;
return (posix_memalign(&ptr, std::max(alignment, sizeof(void*)), size) == 0) ? ptr : 0;
#endif
#endif
#endif
}
/** Implementation-specific aligned memory deallocation function.
@ -487,13 +502,13 @@ inline void deallocate_aligned(void* ptr)
_aligned_free(ptr);
#else
std::free(ptr);
#endif
#endif
}
/** Class to allocate and guard an aligned pointer.
*
* A new_aligned_pointer object allocates aligned heap-allocated memory when
* it is created, and automatically deallocates it when it is destroyed
* it is created, and automatically deallocates it when it is destroyed
* unless its `ok()` function is called.
*
* @tparam T The type of the object to allocate on the heap. The allocated
@ -504,14 +519,14 @@ class new_aligned_pointer {
void* m_ptr;
public:
/// Constructor allocates the pointer.
new_aligned_pointer() :
new_aligned_pointer() :
m_ptr(allocate_aligned(sizeof(T), internal::align_of<T>::value)) {}
/// Destructor deallocates the pointer.
~new_aligned_pointer() { if (m_ptr) deallocate_aligned(m_ptr); }
/// Get the pointer.
operator void*() { return m_ptr; }
/// Return the pointer and release the guard.
T* ok() {
T* ok() {
T* ptr = static_cast<T*>(m_ptr);
m_ptr = 0;
return ptr;

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,7 @@
/*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -18,7 +16,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -31,6 +28,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,8 @@
/* reducer_max.h -*- C++ -*-
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,6 +29,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_max.h

View File

@ -1,10 +1,8 @@
/* reducer_min.h -*- C++ -*-
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,6 +29,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_min.h

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,8 @@
/* reducer_opadd.h -*- C++ -*-
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,6 +29,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opadd.h
@ -55,9 +66,9 @@
*
* @ingroup Reducers
*
* You should be familiar with @ref pagereducers "Cilk reducers", described in
* file `reducers.md`, and particularly with @ref reducers_using, before trying
* to use the information in this file.
* You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
* described in file `reducers.md`, and particularly with @ref reducers_using,
* before trying to use the information in this file.
*
* @section redopadd_usage Usage Example
*
@ -78,11 +89,11 @@
* @subsection redopadd_monoid_operator Operator
*
* The operator of an addition reducer is the addition operator, defined by
* the `+` binary operator on `Type`.
* the "`+`" binary operator on `Type`.
*
* @subsection redopadd_monoid_identity Identity
*
* The identity value of the reducer is the numeric value `0`. This is
* The identity value of the reducer is the numeric value "`0`". This is
* expected to be the value of the default constructor `Type()`.
*
* @section redopadd_operations Operations
@ -130,22 +141,22 @@
* @section redopadd_floating_point Issues with Floating-Point Types
*
* Because of precision and round-off issues, floating-point addition is not
* really associative. For example, `(1e30 + -1e30) + 1 == 1`, but
* really associative. For example, `(1e30 + -1e30) + 1 == 1`, but
* `1e30 + (-1e30 + 1) == 0`.
*
* In many cases, this wont matter, but computations which have been
* In many cases, this won't matter, but computations which have been
* carefully ordered to control round-off errors may not deal well with
* being reassociated. In general, you should be sure to understand the
* floating-point behavior of your program before doing any transformation
* that will reassociate its computations.
* floating-point behavior of your program before doing any transformation
* that will reassociate its computations.
*
* @section redopadd_types Type and Operator Requirements
*
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
* The operator `+=` must be defined on `Type`, with `x += a` having the
* same meaning as `x = x + a`. In addition, if the code uses the `-=`,
* The operator "`+=`" must be defined on `Type`, with `x += a` having the
* same meaning as `x = x + a`. In addition, if the code uses the "`-=`",
* pre-increment, post-increment, pre-decrement, or post-decrement operators,
* then the corresponding operators must be defined on `Type`.
*
@ -174,18 +185,18 @@ namespace cilk {
/** The addition reducer view class.
*
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_add<Type> >`. It holds the accumulator variable
* for the reduction, and allows only addition and subtraction operations to
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_add<Type> >`. It holds the accumulator variable
* for the reduction, and allows only addition and subtraction operations to
* be performed on it.
*
* @note The reducer dereference operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view classs
* @note The reducer "dereference" operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view class's
* `+=` operation would be used in an expression like `*r += a`, where
* `r` is an op_add reducer variable.
*
* @tparam Type The type of the contained accumulator variable. This will
* be the value type of a monoid_with_view that is
* @tparam Type The type of the contained accumulator variable. This will
* be the value type of a monoid_with_view that is
* instantiated with this view.
*
* @see ReducersAdd
@ -197,19 +208,19 @@ template <typename Type>
class op_add_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
public:
/** Class to represent the right-hand side of
/** Class to represent the right-hand side of
* `*reducer = *reducer ± value`.
*
* The only assignment operator for the op_add_view class takes an
* rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_add_view are
* ones which generate an rhs_proxy that is, expressions of the form
* ones which generate an rhs_proxy - that is, expressions of the form
* `op_add_view ± value ... ± value`.
*
* @warning
* The lhs and rhs views in such an assignment must be the same;
* The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 + x` is
* legal; `v1 = v2 + x` is illegal.) This condition will be checked with a
* runtime assertion when compiled in debug mode.
@ -222,7 +233,7 @@ public:
const op_add_view* m_view;
Type m_value;
// Constructor is invoked only from op_add_view::operator+() and
// Constructor is invoked only from op_add_view::operator+() and
// op_add_view::operator-().
//
rhs_proxy(const op_add_view* view, const Type& value) :
@ -232,13 +243,13 @@ public:
rhs_proxy(); // Disable default constructor
public:
//@{
/** Add or subtract an additional rhs value. If `v` is an op_add_view
* and `a1` is a value, then the expression `v + a1` invokes the views
* `operator+()` to create an rhs_proxy for `(v, a1)`; then
* `v + a1 + a2` invokes the rhs_proxys `operator+()` to create a new
///@{
/** Adds or subtracts an additional rhs value. If `v` is an op_add_view
* and `a1` is a value, then the expression `v + a1` invokes the view's
* `operator+()` to create an rhs_proxy for `(v, a1)`; then
* `v + a1 + a2` invokes the rhs_proxy's `operator+()` to create a new
* rhs_proxy for `(v, a1+a2)`. This allows the right-hand side of an
* assignment to be not just `view ± value`, but
* assignment to be not just `view ± value`, but
* `view ± value ± value ... ± value`. The effect is that
*
* v = v ± a1 ± a2 ... ± an;
@ -249,11 +260,11 @@ public:
*/
rhs_proxy& operator+(const Type& x) { m_value += x; return *this; }
rhs_proxy& operator-(const Type& x) { m_value -= x; return *this; }
//@}
///@}
};
/** Default/identity constructor. This constructor initializes the
/** Default/identity constructor. This constructor initializes the
* contained value to `Type()`, which is expected to be the identity value
* for addition on `Type`.
*/
@ -262,8 +273,8 @@ public:
/** Construct with a specified initial value.
*/
explicit op_add_view(const Type& v) : base(v) {}
/** Reduction operation.
/** Reduces the views of two strands.
*
* This function is invoked by the @ref op_add monoid to combine the views
* of two strands when the right strand merges with the left one. It adds
@ -284,13 +295,13 @@ public:
* These functions support the various syntaxes for incrementing or
* decrementing the accumulator variable contained in the view.
*/
//@{
///@{
/** Increment the accumulator variable by @a x.
/** Increments the accumulator variable by @a x.
*/
op_add_view& operator+=(const Type& x) { this->m_value += x; return *this; }
/** Decrement the accumulator variable by @a x.
/** Decrements the accumulator variable by @a x.
*/
op_add_view& operator-=(const Type& x) { this->m_value -= x; return *this; }
@ -298,7 +309,7 @@ public:
*/
op_add_view& operator++() { ++this->m_value; return *this; }
/** Post-increment.
/** Post-increments.
*
* @note Conventionally, post-increment operators return the old value
* of the incremented variable. However, reducer views do not
@ -307,11 +318,11 @@ public:
*/
void operator++(int) { this->m_value++; }
/** Pre-decrement.
/** Pre-decrements.
*/
op_add_view& operator--() { --this->m_value; return *this; }
/** Post-decrement.
/** Post-decrements.
*
* @note Conventionally, post-decrement operators return the old value
* of the decremented variable. However, reducer views do not
@ -320,19 +331,19 @@ public:
*/
void operator--(int) { this->m_value--; }
/** Create an object representing `*this + x`.
/** Creates an object representing `*this + x`.
*
* @see rhs_proxy
*/
rhs_proxy operator+(const Type& x) const { return rhs_proxy(this, x); }
/** Create an object representing `*this - x`.
/** Creates an object representing `*this - x`.
*
* @see rhs_proxy
*/
rhs_proxy operator-(const Type& x) const { return rhs_proxy(this, -x); }
/** Assign the result of a `view ± value` expression to the view. Note that
/** Assigns the result of a `view ± value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@ -342,12 +353,12 @@ public:
this->m_value += rhs.m_value;
return *this;
}
//@}
///@}
};
/** Monoid class for addition reductions. Instantiate the cilk::reducer
/** Monoid class for addition reductions. Instantiate the cilk::reducer
* template class with an op_add monoid to create an addition reducer class.
* For example, to compute
* the sum of a set of `int` values:
@ -356,10 +367,10 @@ public:
*
* @tparam Type The reducer value type.
* @tparam Align If `false` (the default), reducers instantiated on this
* monoid will be naturally aligned (the Cilk library 1.0
* monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
* will be cache-aligned for binary compatibility with
* reducers in Cilk library version 0.9.
* will be cache-aligned for binary compatibility with
* reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersAdd
* @see op_add_view
@ -378,13 +389,13 @@ struct op_add : public monoid_with_view<op_add_view<Type>, Align> {};
* value can be added to a `%reducer_opadd` with `r += a`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
* reducers rather than the old wrappers like reducer_opadd.
* reducers rather than the old wrappers like reducer_opadd.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
* @note Implicit conversions are provided between `%reducer_opadd`
* @note Implicit conversions are provided between `%reducer_opadd`
* and `reducer<%op_add>`. This allows incremental code
* conversion: old code that used `%reducer_opadd` can pass a
* `%reducer_opadd` to a converted function that now expects a
@ -408,8 +419,8 @@ class reducer_opadd : public reducer< op_add<Type, true> >
public:
/// The view type for the reducer.
typedef typename base::view_type view_type;
/// The views rhs proxy type.
/// The view's rhs proxy type.
typedef typename view_type::rhs_proxy rhs_proxy;
/// The view type for the reducer.
@ -420,8 +431,8 @@ class reducer_opadd : public reducer< op_add<Type, true> >
/** @name Constructors
*/
//@{
///@{
/** Default (identity) constructor.
*
* Constructs the wrapper with the default initial value of `Type()`.
@ -433,29 +444,29 @@ class reducer_opadd : public reducer< op_add<Type, true> >
* Constructs the wrapper with a specified initial value.
*/
explicit reducer_opadd(const Type& initial_value) : base(initial_value) {}
//@}
///@}
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_add_view. */
//@{
///@{
/// @copydoc op_add_view::operator+=(const Type&)
reducer_opadd& operator+=(const Type& x) { view() += x; return *this; }
/// @copydoc op_add_view::operator-=(const Type&)
reducer_opadd& operator-=(const Type& x) { view() -= x; return *this; }
/// @copydoc op_add_view::operator++()
reducer_opadd& operator++() { ++view(); return *this; }
/// @copydoc op_add_view::operator++(int)
void operator++(int) { view()++; }
/// @copydoc op_add_view::operator-\-()
reducer_opadd& operator--() { --view(); return *this; }
/// @copydoc op_add_view::operator-\-(int)
void operator--(int) { view()--; }
@ -463,26 +474,26 @@ class reducer_opadd : public reducer< op_add<Type, true> >
// reducer_opadd::operator-() have different behavior and a different
// return type than this definition. The legacy version is defined as a
// member function, so this new version is defined as a free function to
// give it a different signature, so that they wont end up sharing a
// give it a different signature, so that they won't end up sharing a
// single object file entry.
/// @copydoc op_add_view::operator+(const Type&) const
friend rhs_proxy operator+(const reducer_opadd& r, const Type& x)
{
return r.view() + x;
{
return r.view() + x;
}
/// @copydoc op_add_view::operator-(const Type&) const
friend rhs_proxy operator-(const reducer_opadd& r, const Type& x)
{
return r.view() - x;
{
return r.view() - x;
}
/// @copydoc op_add_view::operator=(const rhs_proxy&)
reducer_opadd& operator=(const rhs_proxy& temp)
reducer_opadd& operator=(const rhs_proxy& temp)
{
view() = temp;
return *this;
return *this;
}
//@}
///@}
/** @name Dereference
* @details Dereferencing a wrapper is a no-op. It simply returns the
@ -501,25 +512,25 @@ class reducer_opadd : public reducer< op_add<Type, true> >
* // operator += is a wrapper member function that
* // calls the corresponding view function
*/
//@{
///@{
reducer_opadd& operator*() { return *this; }
reducer_opadd const& operator*() const { return *this; }
reducer_opadd* operator->() { return this; }
reducer_opadd const* operator->() const { return this; }
//@}
///@}
/** @name Upcast
* @details In Cilk library 0.9, reducers were always cache-aligned. In
* library 1.0, reducer cache alignment is optional. By default, reducers
* are unaligned (i.e., just naturally aligned), but legacy wrappers
* inherit from cache-aligned reducers for binary compatibility.
* @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
* In library 1.0, reducer cache alignment is optional. By default,
* reducers are unaligned (i.e., just naturally aligned), but legacy
* wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
* pseudo-upcasts to the corresponding unaligned reducer class.
*/
//@{
///@{
operator reducer< op_add<Type, false> >& ()
{
return *reinterpret_cast< reducer< op_add<Type, false> >* >(this);
@ -528,15 +539,15 @@ class reducer_opadd : public reducer< op_add<Type, true> >
{
return *reinterpret_cast< const reducer< op_add<Type, false> >* >(this);
}
//@}
///@}
};
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_add<Type> >` class to have an
* `operator reducer_opadd<Type>& ()` conversion operator that statically
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_add<Type> >` class to have an
* `operator reducer_opadd<Type>& ()` conversion operator that statically
* downcasts the `reducer<op_add>` to the corresponding `reducer_opadd` type.
* (The reverse conversion, from `reducer_opadd` to `reducer<op_add>`, is just
* an upcast, which is provided for free by the language.)
@ -557,20 +568,20 @@ struct legacy_reducer_downcast<reducer<op_add<Type, Align> > >
/** @ingroup ReducersAdd
*/
//@{
///@{
/** @name C Language Reducer Macros
*
* These macros are used to declare and work with numeric op_add reducers in
* These macros are used to declare and work with numeric op_add reducers in
* C code.
*
* @see @ref page_reducers_in_c
*/
//@{
///@{
__CILKRTS_BEGIN_EXTERN_C
/** Opadd reducer type name.
/** Declares opadd reducer type name.
*
* This macro expands into the identifier which is the name of the op_add
* reducer type for a specified numeric type.
@ -584,7 +595,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPADD_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opadd_,tn)
/** Declare an op_add reducer object.
/** Declares an op_add reducer object.
*
* This macro expands into a declaration of an op_add reducer object for a
* specified numeric type. For example:
@ -609,29 +620,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
/** Declare the op_add reducer functions for a numeric type.
/** Declares the op_add reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_add reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPADD_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPADD_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opadd,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opadd,tn);
/** Define the op_add reducer functions for a numeric type.
/** Defines the op_add reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
* the reducer functionality for the op_add reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPADD_DEFINITION(t,tn) \
@ -640,13 +651,13 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l += *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opadd,tn) \
{ *(t*)v = 0; }
//@{
/** @def CILK_C_REDUCER_OPADD_INSTANCE
* @brief Declare or define implementation functions for a reducer type.
///@{
/** @def CILK_C_REDUCER_OPADD_INSTANCE
* @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
* will be defined, and this macro will generate reducer implementation
* will be defined, and this macro will generate reducer implementation
* functions. Everywhere else, `CILK_C_DEFINE_REDUCERS` will be undefined,
* and this macro will expand into external declarations for the functions.
*/
@ -657,9 +668,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPADD_INSTANCE(t,tn) \
CILK_C_REDUCER_OPADD_DECLARATION(t,tn)
#endif
//@}
///@}
/* Declare or define an instance of the reducer type and its functions for each
/* Declares or defines an instance of the reducer type and its functions for each
* numeric type.
*/
CILK_C_REDUCER_OPADD_INSTANCE(char, char)
@ -683,8 +694,8 @@ CILK_C_REDUCER_OPADD_INSTANCE(long double, longdouble)
__CILKRTS_END_EXTERN_C
//@}
///@}
//@}
///@}
#endif /* REDUCER_OPADD_H_INCLUDED */

View File

@ -1,10 +1,8 @@
/* reducer_opand.h -*- C++ -*-
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,11 +29,25 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opand.h
*
* @brief Defines classes for doing parallel bitwise and reductions.
* @brief Defines classes for doing parallel bitwise AND reductions.
*
* @ingroup ReducersAnd
*
@ -48,16 +59,16 @@
#include <cilk/reducer.h>
/** @defgroup ReducersAnd Bitwise And Reducers
/** @defgroup ReducersAnd Bitwise AND Reducers
*
* Bitwise and reducers allow the computation of the bitwise and of a set of
* Bitwise AND reducers allow the computation of the bitwise AND of a set of
* values in parallel.
*
* @ingroup Reducers
*
* You should be familiar with @ref pagereducers "Cilk reducers", described in
* file `reducers.md`, and particularly with @ref reducers_using, before trying
* to use the information in this file.
* You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
* described in file `reducers.md`, and particularly with @ref reducers_using,
* before trying to use the information in this file.
*
* @section redopand_usage Usage Example
*
@ -72,19 +83,18 @@
*
* @subsection redopand_monoid_values Value Set
*
* The value set of a bitwise and reducer is the set of values of `Type`,
* The value set of a bitwise AND reducer is the set of values of `Type`,
* which is expected to be a builtin integer type which has a representation
* as a sequence of bits (or something like it, such as `bool` or
* `std::bitset`).
*
* @subsection redopand_monoid_operator Operator
*
* The operator of a bitwise and reducer is the bitwise and operator, defined
* by the `&` binary operator on `Type`.
* The bitwise AND operator is defined by the "`&`" binary operator on `Type`.
*
* @subsection redopand_monoid_identity Identity
*
* The identity value of the reducer is the value whose representation
* The identity value of the reducer is the value whose representation
* contains all 1-bits. This is expected to be the value of the expression
* `~Type()` (i.e., the bitwise negation operator applied to the default value
* of the value type).
@ -106,7 +116,7 @@
*
* @subsection redopand_initial Initial Values
*
* If a bitwise and reducer is constructed without an explicit initial value,
* If a bitwise AND reducer is constructed without an explicit initial value,
* then its initial value will be its identity value, as long as `Type`
* satisfies the requirements of @ref redopand_types.
*
@ -121,17 +131,17 @@
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
* The operator `&=` must be defined on `Type`, with `x &= a` having the
* The operator "`&=`" must be defined on `Type`, with `x &= a` having the
* same meaning as `x = x & a`.
*
* The expression `~ Type()` must be a valid expression which yields the
* identity value (the value of `Type` whose representation consists of all
* 1-bits).
*
* @section redopand_in_c Bitwise And Reducers in C
* @section redopand_in_c Bitwise AND Reducers in C
*
* The @ref CILK_C_REDUCER_OPAND and @ref CILK_C_REDUCER_OPAND_TYPE macros can
* be used to do bitwise and reductions in C. For example:
* be used to do bitwise AND reductions in C. For example:
*
* CILK_C_REDUCER_OPAND(r, uint, ~0);
* CILK_C_REGISTER_REDUCER(r);
@ -148,14 +158,14 @@
namespace cilk {
/** The bitwise and reducer view class.
/** The bitwise AND reducer view class.
*
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_and<Type> >`. It holds the accumulator variable
* for the reduction, and allows only `and` operations to be performed on it.
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_and<Type> >`. It holds the accumulator variable
* for the reduction, and allows only AND operations to be performed on it.
*
* @note The reducer dereference operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view classs
* @note The reducer "dereference" operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view class's
* `&=` operation would be used in an expression like `*r &= a`, where
* `r` is an opmod reducer variable.
*
@ -172,18 +182,18 @@ template <typename Type>
class op_and_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
public:
/** Class to represent the right-hand side of `*reducer = *reducer & value`.
*
* The only assignment operator for the op_and_view class takes an
* rhs_proxy as its operand. This results in the syntactic restriction
* rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_and_view are
* ones which generate an rhs_proxy that is, expressions of the form
* ones which generate an rhs_proxy - that is, expressions of the form
* `op_and_view & value ... & value`.
*
* @warning
* The lhs and rhs views in such an assignment must be the same;
* The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 & x` is
* legal; `v1 = v2 & x` is illegal.) This condition will be checked with
* a runtime assertion when compiled in debug mode.
@ -205,12 +215,12 @@ public:
rhs_proxy(); // Disable default constructor
public:
/** Bitwise and with an additional rhs value. If `v` is an op_and_view
/** Bitwise AND with an additional `rhs` value. If `v` is an op_and_view
* and `a1` is a value, then the expression `v & a1` invokes the
* views `operator&()` to create an rhs_proxy for `(v, a1)`; then
* `v & a1 & a2` invokes the rhs_proxys `operator&()` to create a new
* view's `operator&()` to create an rhs_proxy for `(v, a1)`; then
* `v & a1 & a2` invokes the rhs_proxy's `operator&()` to create a new
* rhs_proxy for `(v, a1&a2)`. This allows the right-hand side of an
* assignment to be not just `view & value`, but
* assignment to be not just `view & value`, but
* `view & value & value ... & value`. The effect is that
*
* v = v & a1 & a2 ... & an;
@ -231,13 +241,13 @@ public:
/** Construct with a specified initial value.
*/
explicit op_and_view(const Type& v) : base(v) {}
/** Reduction operation.
/** Reduces the views of two strands.
*
* This function is invoked by the @ref op_and monoid to combine the views
* of two strands when the right strand merges with the left one. It
* ands the value contained in the left-strand view with the value
* "ANDs" the value contained in the left-strand view with the value
* contained in the right-strand view, and leaves the value in the
* right-strand view undefined.
*
@ -248,25 +258,25 @@ public:
* reduce operation.
*/
void reduce(op_and_view* right) { this->m_value &= right->m_value; }
/** @name Accumulator variable updates.
*
* These functions support the various syntaxes for anding the
* These functions support the various syntaxes for "ANDing" the
* accumulator variable contained in the view with some value.
*/
//@{
///@{
/** And the accumulator variable with @a x.
/** Performs AND between the accumulator variable and @a x.
*/
op_and_view& operator&=(const Type& x) { this->m_value &= x; return *this; }
/** Create an object representing `*this & x`.
/** Creates an object representing `*this & x`.
*
* @see rhs_proxy
*/
rhs_proxy operator&(const Type& x) const { return rhs_proxy(this, x); }
/** Assign the result of a `view & value` expression to the view. Note that
/** Assigns the result of a `view & value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@ -276,23 +286,23 @@ public:
this->m_value &= rhs.m_value;
return *this;
}
//@}
///@}
};
/** Monoid class for bitwise and reductions. Instantiate the cilk::reducer
* template class with an op_and monoid to create a bitwise and reducer
* class. For example, to compute the bitwise and of a set of `unsigned long`
/** Monoid class for bitwise AND reductions. Instantiate the cilk::reducer
* template class with an op_and monoid to create a bitwise AND reducer
* class. For example, to compute the bitwise AND of a set of `unsigned long`
* values:
*
* cilk::reducer< cilk::op_and<unsigned long> > r;
*
* @tparam Type The reducer value type.
* @tparam Align If `false` (the default), reducers instantiated on this
* monoid will be naturally aligned (the Cilk library 1.0
* monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
* will be cache-aligned for binary compatibility with
* reducers in Cilk library version 0.9.
* will be cache-aligned for binary compatibility with
* reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersAnd
* @see op_and_view
@ -302,22 +312,22 @@ public:
template <typename Type, bool Align = false>
struct op_and : public monoid_with_view<op_and_view<Type>, Align> {};
/** Deprecated bitwise and reducer class.
/** Deprecated bitwise AND reducer class.
*
* reducer_opand is the same as @ref reducer<@ref op_and>, except that
* reducer_opand is a proxy for the contained view, so that accumulator
* variable update operations can be applied directly to the reducer. For
* example, a value is anded with a `reducer<%op_and>` with `*r &= a`, but a
* value can be anded with a `%reducer_opand` with `r &= a`.
* example, a value is "ANDed" with a `reducer<%op_and>` with `*r &= a`, but a
* value can be "ANDed" with a `%reducer_opand` with `r &= a`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
* reducers rather than the old wrappers like reducer_opand.
* reducers rather than the old wrappers like reducer_opand.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
* @note Implicit conversions are provided between `%reducer_opand`
* @note Implicit conversions are provided between `%reducer_opand`
* and `reducer<%op_and>`. This allows incremental code
* conversion: old code that used `%reducer_opand` can pass a
* `%reducer_opand` to a converted function that now expects a
@ -341,20 +351,20 @@ class reducer_opand : public reducer< op_and<Type, true> >
public:
/// The view type for the reducer.
typedef typename base::view_type view_type;
/// The views rhs proxy type.
/// The view's rhs proxy type.
typedef typename view_type::rhs_proxy rhs_proxy;
/// The view type for the reducer.
typedef view_type View;
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
/** @name Constructors
*/
//@{
///@{
/** Default constructor.
*
* Constructs the wrapper with the default initial value of `Type()`
@ -367,13 +377,13 @@ public:
* Constructs the wrapper with a specified initial value.
*/
explicit reducer_opand(const Type& initial_value) : base(initial_value) {}
//@}
///@}
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_and_view. */
//@{
///@{
/// @copydoc op_and_view::operator&=(const Type&)
reducer_opand& operator&=(const Type& x)
@ -381,26 +391,26 @@ public:
view() &= x;
return *this;
}
// The legacy definition of reducer_opand::operator&() has different
// behavior and a different return type than this definition. The legacy
// version is defined as a member function, so this new version is defined
// as a free function to give it a different signature, so that they wont
// as a free function to give it a different signature, so that they won't
// end up sharing a single object file entry.
/// @copydoc op_and_view::operator&(const Type&) const
friend rhs_proxy operator&(const reducer_opand& r, const Type& x)
{
return r.view() & x;
{
return r.view() & x;
}
/// @copydoc op_and_view::operator=(const rhs_proxy&)
reducer_opand& operator=(const rhs_proxy& temp)
{
reducer_opand& operator=(const rhs_proxy& temp)
{
view() = temp;
return *this;
return *this;
}
//@}
///@}
/** @name Dereference
* @details Dereferencing a wrapper is a no-op. It simply returns the
@ -419,25 +429,25 @@ public:
* // operator &= is a wrapper member function that
* // calls the corresponding view function
*/
//@{
///@{
reducer_opand& operator*() { return *this; }
reducer_opand const& operator*() const { return *this; }
reducer_opand* operator->() { return this; }
reducer_opand const* operator->() const { return this; }
//@}
///@}
/** @name Upcast
* @details In Cilk library 0.9, reducers were always cache-aligned. In
* library 1.0, reducer cache alignment is optional. By default, reducers
* are unaligned (i.e., just naturally aligned), but legacy wrappers
* inherit from cache-aligned reducers for binary compatibility.
* @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
* In library 1.0, reducer cache alignment is optional. By default,
* reducers are unaligned (i.e., just naturally aligned), but legacy
* wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
* pseudo-upcasts to the corresponding unaligned reducer class.
*/
//@{
///@{
operator reducer< op_and<Type, false> >& ()
{
return *reinterpret_cast< reducer< op_and<Type, false> >* >(this);
@ -446,14 +456,14 @@ public:
{
return *reinterpret_cast< const reducer< op_and<Type, false> >* >(this);
}
//@}
///@}
};
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_and<Type> >` class to have an
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_and<Type> >` class to have an
* `operator reducer_opand<Type>& ()` conversion operator that statically
* downcasts the `reducer<op_and>` to the corresponding `reducer_opand` type.
* (The reverse conversion, from `reducer_opand` to `reducer<op_and>`, is just
@ -475,7 +485,7 @@ struct legacy_reducer_downcast<reducer<op_and<Type, Align> > >
/** @ingroup ReducersAdd
*/
//@{
///@{
/** @name C language reducer macros
*
@ -483,13 +493,13 @@ struct legacy_reducer_downcast<reducer<op_and<Type, Align> > >
*
* @see @ref page_reducers_in_c
*/
//@{
///@{
__CILKRTS_BEGIN_EXTERN_C
/** Opand reducer type name.
/** Declares `opand` reducer type name.
*
* This macro expands into the identifier which is the name of the op_and
* This macro expands into the identifier which is the name of the op_and
* reducer type for a specified numeric type.
*
* @param tn The @ref reducers_c_type_names "numeric type name" specifying
@ -501,7 +511,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPAND_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opand_,tn)
/** Declare an op_and reducer object.
/** Declares an op_and reducer object.
*
* This macro expands into a declaration of an op_and reducer object for a
* specified numeric type. For example:
@ -526,29 +536,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
/** Declare the op_and reducer functions for a numeric type.
/** Declares the op_and reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_and reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPAND_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPAND_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opand,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opand,tn);
/** Define the op_and reducer functions for a numeric type.
/** Defines the op_and reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
* the reducer functionality for the op_and reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPAND_DEFINITION(t,tn) \
@ -557,10 +567,10 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l &= *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opand,tn) \
{ *(t*)v = ~((t)0); }
//@{
/** @def CILK_C_REDUCER_OPAND_INSTANCE
* @brief Declare or define implementation functions for a reducer type.
///@{
/** @def CILK_C_REDUCER_OPAND_INSTANCE
* @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
* will be defined, and this macro will generate reducer implementation
@ -574,9 +584,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPAND_INSTANCE(t,tn) \
CILK_C_REDUCER_OPAND_DECLARATION(t,tn)
#endif
//@}
///@}
/* Declare or define an instance of the reducer type and its functions for
/* Declares or defines an instance of the reducer type and its functions for
* each numeric type.
*/
CILK_C_REDUCER_OPAND_INSTANCE(char, char)
@ -597,8 +607,8 @@ CILK_C_REDUCER_OPAND_INSTANCE(unsigned long long, ulonglong)
__CILKRTS_END_EXTERN_C
//@}
///@}
//@}
///@}
#endif /* REDUCER_OPAND_H_INCLUDED */

View File

@ -1,10 +1,8 @@
/* reducer_opmul.h -*- C++ -*-
*
* @copyright
* Copyright (C) 2012-2013, Intel Corporation
* Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,6 +29,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opmul.h
@ -55,9 +66,9 @@
*
* @ingroup Reducers
*
* You should be familiar with @ref pagereducers "Cilk reducers", described in
* file `reducers.md`, and particularly with @ref reducers_using, before trying
* to use the information in this file.
* You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
* described in file `reducers.md`, and particularly with @ref reducers_using,
* before trying to use the information in this file.
*
* @section redopmul_usage Usage Example
*
@ -79,11 +90,11 @@
* @subsection redopmul_monoid_operator Operator
*
* The operator of a multiplication reducer is the multiplication operation,
* defined by the `*` binary operator on `Type`.
* defined by the "`*`" binary operator on `Type`.
*
* @subsection redopmul_monoid_identity Identity
*
* The identity value of the reducer is the numeric value `1`. This is
* The identity value of the reducer is the numeric value "`1`". This is
* expected to be the value of the expression `Type(1)`.
*
* @section redopmul_operations Operations
@ -119,18 +130,18 @@
* not really associative. For example, `(1e200 * 1e-200) * 1e-200 == 1e-200`,
* but `1e200 * (1e-200 * 1e-200 == 0.
*
* In many cases, this wont matter, but computations which have been
* In many cases, this won't matter, but computations which have been
* carefully ordered to control overflow and underflow may not deal well with
* being reassociated. In general, you should be sure to understand the
* floating-point behavior of your program before doing any transformation
* that will reassociate its computations.
* floating-point behavior of your program before doing any transformation
* that will reassociate its computations.
*
* @section redopmul_types Type and Operator Requirements
*
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
* The operator `*=` must be defined on `Type`, with `x *= a` having the same
* The operator "`*=`" must be defined on `Type`, with `x *= a` having the same
* meaning as `x = x * a`.
*
* The expression `Type(1)` must be a valid expression which yields the
@ -158,18 +169,18 @@ namespace cilk {
/** The multiplication reducer view class.
*
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_mul<Type> >`. It holds the accumulator variable
* for the reduction, and allows only multiplication operations to be
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_mul<Type> >`. It holds the accumulator variable
* for the reduction, and allows only multiplication operations to be
* performed on it.
*
* @note The reducer dereference operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view classs
* @note The reducer "dereference" operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view class's
* `*=` operation would be used in an expression like `*r *= a`, where
* `r` is an op_mul reducer variable.
*
* @tparam Type The type of the contained accumulator variable. This will
* be the value type of a monoid_with_view that is
* @tparam Type The type of the contained accumulator variable. This will
* be the value type of a monoid_with_view that is
* instantiated with this view.
*
* @see ReducersMul
@ -181,18 +192,18 @@ template <typename Type>
class op_mul_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
public:
/** Class to represent the right-hand side of `*reducer = *reducer * value`.
*
* The only assignment operator for the op_mul_view class takes an
* rhs_proxy as its operand. This results in the syntactic restriction
* The only assignment operator for the op_mul_view class takes an
* rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_mul_view are
* ones which generate an rhs_proxy that is, expressions of the form
* ones which generate an rhs_proxy - that is, expressions of the form
* `op_mul_view * value ... * value`.
*
* @warning
* The lhs and rhs views in such an assignment must be the same;
* The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 * x` is
* legal; `v1 = v2 * x` is illegal.) This condition will be checked with a
* runtime assertion when compiled in debug mode.
@ -213,12 +224,12 @@ public:
rhs_proxy(); // Disable default constructor
public:
/** Multiply by an additional rhs value. If `v` is an op_mul_view and
* `a1` is a value, then the expression `v * a1` invokes the views
* `operator*()` to create an rhs_proxy for `(v, a1)`; then
* `v * a1 * a2` invokes the rhs_proxys `operator*()` to create a
/** Multiplies by an additional `rhs` value. If `v` is an op_mul_view and
* `a1` is a value, then the expression `v * a1` invokes the view's
* `operator*()` to create an rhs_proxy for `(v, a1)`; then
* `v * a1 * a2` invokes the rhs_proxy's `operator*()` to create a
* new rhs_proxy for `(v, a1*a2)`. This allows the right-hand side of
* an assignment to be not just `view * value`, but
* an assignment to be not just `view * value`, but
* `view * value * value ... * value`. The effect is that
*
* v = v * a1 * a2 ... * an;
@ -231,7 +242,7 @@ public:
};
/** Default/identity constructor. This constructor initializes the
/** Default/identity constructor. This constructor initializes the
* contained value to `Type(1)`, which is expected to be the identity
* value for multiplication on `Type`.
*/
@ -240,8 +251,8 @@ public:
/** Construct with a specified initial value.
*/
explicit op_mul_view(const Type& v) : base(v) {}
/** Reduction operation.
/** Reduces two strand views.
*
* This function is invoked by the @ref op_mul monoid to combine the views
* of two strands when the right strand merges with the left one. It
@ -256,25 +267,25 @@ public:
* reduce operation.
*/
void reduce(op_mul_view* right) { this->m_value *= right->m_value; }
/** @name Accumulator variable updates.
*
* These functions support the various syntaxes for multiplying the
* accumulator variable contained in the view by some value.
*/
//@{
///@{
/** Multiply the accumulator variable by @a x.
/** Multiplies the accumulator variable by @a x.
*/
op_mul_view& operator*=(const Type& x) { this->m_value *= x; return *this; }
/** Create an object representing `*this * x`.
/** Creates an object representing `*this * x`.
*
* @see rhs_proxy
*/
rhs_proxy operator*(const Type& x) const { return rhs_proxy(this, x); }
/** Assign the result of a `view * value` expression to the view. Note that
/** Assigns the result of a `view * value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@ -284,8 +295,8 @@ public:
this->m_value *= rhs.m_value;
return *this;
}
//@}
///@}
};
/** Monoid class for multiplication reductions. Instantiate the cilk::reducer
@ -309,7 +320,7 @@ struct op_mul : public monoid_with_view< op_mul_view<Type> > {};
/** @ingroup ReducersAdd
*/
//@{
///@{
/** @name C language reducer macros
*
@ -318,11 +329,11 @@ struct op_mul : public monoid_with_view< op_mul_view<Type> > {};
*
* @see @ref page_reducers_in_c
*/
//@{
///@{
__CILKRTS_BEGIN_EXTERN_C
/** Opmul reducer type name.
/** Declares `opmul` reducer type name.
*
* This macro expands into the identifier which is the name of the op_mul
* reducer type for a specified numeric type.
@ -336,7 +347,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPMUL_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opmul_,tn)
/** Declare an op_mul reducer object.
/** Declares an op_mul reducer object.
*
* This macro expands into a declaration of an op_mul reducer object for a
* specified numeric type. For example:
@ -361,29 +372,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
/** Declare the op_mul reducer functions for a numeric type.
/** Declares the op_mul reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which
* This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_mul reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPMUL_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPMUL_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opmul,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opmul,tn);
/** Define the op_mul reducer functions for a numeric type.
/** Defines the op_mul reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
* the reducer functionality for the op_mul reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPMUL_DEFINITION(t,tn) \
@ -392,10 +403,10 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l *= *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opmul,tn) \
{ *(t*)v = 1; }
//@{
/** @def CILK_C_REDUCER_OPMUL_INSTANCE
* @brief Declare or define implementation functions for a reducer type.
///@{
/** @def CILK_C_REDUCER_OPMUL_INSTANCE
* @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
* will be defined, and this macro will generate reducer implementation
@ -409,9 +420,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPMUL_INSTANCE(t,tn) \
CILK_C_REDUCER_OPMUL_DECLARATION(t,tn)
#endif
//@}
///@}
/* Declare or define an instance of the reducer type and its functions for each
/* Declares or defines an instance of the reducer type and its functions for each
* numeric type.
*/
CILK_C_REDUCER_OPMUL_INSTANCE(char, char)
@ -435,8 +446,8 @@ CILK_C_REDUCER_OPMUL_INSTANCE(long double, longdouble)
__CILKRTS_END_EXTERN_C
//@}
///@}
//@}
///@}
#endif /* REDUCER_OPMUL_H_INCLUDED */

View File

@ -1,10 +1,8 @@
/* reducer_opor.h -*- C++ -*-
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,11 +29,25 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opor.h
*
* @brief Defines classes for doing parallel bitwise or reductions.
* @brief Defines classes for doing parallel bitwise OR reductions.
*
* @ingroup ReducersOr
*
@ -48,16 +59,16 @@
#include <cilk/reducer.h>
/** @defgroup ReducersOr Bitwise Or Reducers
/** @defgroup ReducersOr Bitwise `OR` Reducers
*
* Bitwise and reducers allow the computation of the bitwise and of a set of
* Bitwise `OR` reducers allow the computation of the bitwise `OR` of a set of
* values in parallel.
*
* @ingroup Reducers
*
* You should be familiar with @ref pagereducers "Cilk reducers", described in
* file `reducers.md`, and particularly with @ref reducers_using, before trying
* to use the information in this file.
* You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
* described in file `reducers.md`, and particularly with @ref reducers_using,
* before trying to use the information in this file.
*
* @section redopor_usage Usage Example
*
@ -72,18 +83,18 @@
*
* @subsection redopor_monoid_values Value Set
*
* The value set of a bitwise or reducer is the set of values of `Type`, which
* The value set of a bitwise `OR` reducer is the set of values of `Type`, which
* is expected to be a builtin integer type which has a representation as a
* sequence of bits (or something like it, such as `bool` or `std::bitset`).
*
* @subsection redopor_monoid_operator Operator
*
* The operator of a bitwise or reducer is the bitwise or operator, defined by
* the `|` binary operator on `Type`.
* The operator of a bitwise `OR` reducer is the bitwise OR operator, defined by
* the "`|`" binary operator on `Type`.
*
* @subsection redopor_monoid_identity Identity
*
* The identity value of the reducer is the value whose representation
* The identity value of the reducer is the value whose representation
* contains all 0-bits. This is expected to be the value of the default
* constructor `Type()`.
*
@ -104,8 +115,8 @@
*
* @subsection redopor_initial Initial Values
*
* If a bitwise or reducer is constructed without an explicit initial value,
* then its initial value will be its identity value, as long as `Type`
* If a bitwise OR reducer is constructed without an explicit initial value,
* then its initial value will be its identity value, as long as `Type`
* satisfies the requirements of @ref redopor_types.
*
* @subsection redopor_view_ops View Operations
@ -119,17 +130,17 @@
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
* The operator `|=` must be defined on `Type`, with `x |= a` having the
* The operator "`|=`" must be defined on `Type`, with `x |= a` having the
* same meaning as `x = x | a`.
*
* The expression `Type()` must be a valid expression which yields the
* identity value (the value of `Type` whose representation consists of all
* 0-bits).
*
* @section redopor_in_c Bitwise Or Reducers in C
* @section redopor_in_c Bitwise OR Reducers in C
*
* The @ref CILK_C_REDUCER_OPOR and @ref CILK_C_REDUCER_OPOR_TYPE macros can
* be used to do bitwise or reductions in C. For example:
* be used to do bitwise OR reductions in C. For example:
*
* CILK_C_REDUCER_OPOR(r, uint, 0);
* CILK_C_REGISTER_REDUCER(r);
@ -146,14 +157,14 @@
namespace cilk {
/** The bitwise or reducer view class.
/** The bitwise OR reducer view class.
*
* This is the view class for reducers created with
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_or<Type> >`. It holds the accumulator variable for
* the reduction, and allows only `or` operations to be performed on it.
*
* @note The reducer dereference operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view classs
* @note The reducer "dereference" operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view class's
* `|=` operation would be used in an expression like `*r |= a`, where
* `r` is an opmod reducer variable.
*
@ -170,18 +181,18 @@ template <typename Type>
class op_or_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
public:
/** Class to represent the right-hand side of `*reducer = *reducer | value`.
*
* The only assignment operator for the op_or_view class takes an
* The only assignment operator for the op_or_view class takes an
* rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_or_view are
* ones which generate an rhs_proxy that is, expressions of the form
* ones which generate an rhs_proxy - that is, expressions of the form
* `op_or_view | value ... | value`.
*
* @warning
* The lhs and rhs views in such an assignment must be the same;
* The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 | x` is
* legal; `v1 = v2 | x` is illegal.) This condition will be checked with
* a runtime assertion when compiled in debug mode.
@ -202,12 +213,12 @@ public:
rhs_proxy(); // Disable default constructor
public:
/** Bitwise or with an additional rhs value. If `v` is an op_or_view
* and `a1` is a value, then the expression `v | a1` invokes the
* views `operator|()` to create an rhs_proxy for `(v, a1)`; then
* `v | a1 | a2` invokes the rhs_proxys `operator|()` to create a new
/** bitwise OR with an additional rhs value. If `v` is an op_or_view
* and `a1` is a value, then the expression `v | a1` invokes the
* view's `operator|()` to create an rhs_proxy for `(v, a1)`; then
* `v | a1 | a2` invokes the rhs_proxy's `operator|()` to create a new
* rhs_proxy for `(v, a1|a2)`. This allows the right-hand side of an
* assignment to be not just `view | value`, but
* assignment to be not just `view | value`, but
( `view | value | value ... | value`. The effect is that
*
* v = v | a1 | a2 ... | an;
@ -228,12 +239,12 @@ public:
/** Construct with a specified initial value.
*/
explicit op_or_view(const Type& v) : base(v) {}
/** Reduction operation.
/** Reduces the views of two strands.
*
* This function is invoked by the @ref op_or monoid to combine the views
* of two strands when the right strand merges with the left one. It
* ors the value contained in the left-strand view by the value
* "ORs" the value contained in the left-strand view by the value
* contained in the right-strand view, and leaves the value in the
* right-strand view undefined.
*
@ -244,25 +255,25 @@ public:
* reduce operation.
*/
void reduce(op_or_view* right) { this->m_value |= right->m_value; }
/** @name Accumulator variable updates.
*
* These functions support the various syntaxes for oring the
* These functions support the various syntaxes for "ORing" the
* accumulator variable contained in the view with some value.
*/
//@{
///@{
/** Or the accumulator variable with @a x.
/** Perfoms an OR operation between the accumulator variable and @a x.
*/
op_or_view& operator|=(const Type& x) { this->m_value |= x; return *this; }
/** Create an object representing `*this | x`.
/** Creates an object representing `*this | x`.
*
* @see rhs_proxy
*/
rhs_proxy operator|(const Type& x) const { return rhs_proxy(this, x); }
/** Assign the result of a `view | value` expression to the view. Note that
/** Assigns the result of a `view | value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@ -272,23 +283,23 @@ public:
this->m_value |= rhs.m_value;
return *this;
}
//@}
///@}
};
/** Monoid class for bitwise or reductions. Instantiate the cilk::reducer
* template class with an op_or monoid to create a bitwise or reducer
* class. For example, to compute the bitwise or of a set of `unsigned long`
/** Monoid class for bitwise OR reductions. Instantiate the cilk::reducer
* template class with an op_or monoid to create a bitwise OR reducer
* class. For example, to compute the bitwise OR of a set of `unsigned long`
* values:
*
* cilk::reducer< cilk::op_or<unsigned long> > r;
*
* @tparam Type The reducer value type.
* @tparam Align If `false` (the default), reducers instantiated on this
* monoid will be naturally aligned (the Cilk library 1.0
* monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
* will be cache-aligned for binary compatibility with
* reducers in Cilk library version 0.9.
* will be cache-aligned for binary compatibility with
* reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersOr
* @see op_or_view
@ -298,22 +309,22 @@ public:
template <typename Type, bool Align = false>
struct op_or : public monoid_with_view<op_or_view<Type>, Align> {};
/** Deprecated bitwise or reducer class.
/** Deprecated bitwise OR reducer class.
*
* reducer_opor is the same as @ref reducer<@ref op_or>, except that
* reducer_opor is a proxy for the contained view, so that accumulator
* variable update operations can be applied directly to the reducer. For
* example, a value is ored with a `reducer<%op_or>` with `*r |= a`, but a
* value can be ored with a `%reducer_opor` with `r |= a`.
* example, a value is "ORed" with a `reducer<%op_or>` with `*r |= a`, but a
* value can be "ORed" with a `%reducer_opor` with `r |= a`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
* reducers rather than the old wrappers like reducer_opor.
* reducers rather than the old wrappers like reducer_opor.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
* @note Implicit conversions are provided between `%reducer_opor`
* @note Implicit conversions are provided between `%reducer_opor`
* and `reducer<%op_or>`. This allows incremental code
* conversion: old code that used `%reducer_opor` can pass a
* `%reducer_opor` to a converted function that now expects a
@ -337,20 +348,20 @@ class reducer_opor : public reducer< op_or<Type, true> >
public:
/// The view type for the reducer.
typedef typename base::view_type view_type;
/// The views rhs proxy type.
/// The view's rhs proxy type.
typedef typename view_type::rhs_proxy rhs_proxy;
/// The view type for the reducer.
typedef view_type View;
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
/** @name Constructors
*/
//@{
///@{
/** Default (identity) constructor.
*
* Constructs the wrapper with the default initial value of `Type()`.
@ -362,38 +373,38 @@ class reducer_opor : public reducer< op_or<Type, true> >
* Constructs the wrapper with a specified initial value.
*/
explicit reducer_opor(const Type& initial_value) : base(initial_value) {}
//@}
///@}
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_and_view. */
//@{
///@{
/// @copydoc op_or_view::operator|=(const Type&)
reducer_opor& operator|=(const Type& x)
{
view() |= x; return *this;
view() |= x; return *this;
}
// The legacy definition of reducer_opor::operator|() has different
// behavior and a different return type than this definition. The legacy
// version is defined as a member function, so this new version is defined
// as a free function to give it a different signature, so that they wont
// as a free function to give it a different signature, so that they won't
// end up sharing a single object file entry.
/// @copydoc op_or_view::operator|(const Type&) const
friend rhs_proxy operator|(const reducer_opor& r, const Type& x)
{
return r.view() | x;
{
return r.view() | x;
}
/// @copydoc op_and_view::operator=(const rhs_proxy&)
reducer_opor& operator=(const rhs_proxy& temp)
{
view() = temp; return *this;
view() = temp; return *this;
}
//@}
///@}
/** @name Dereference
* @details Dereferencing a wrapper is a no-op. It simply returns the
@ -412,25 +423,25 @@ class reducer_opor : public reducer< op_or<Type, true> >
* // operator &= is a wrapper member function that
* // calls the corresponding view function
*/
//@{
///@{
reducer_opor& operator*() { return *this; }
reducer_opor const& operator*() const { return *this; }
reducer_opor* operator->() { return this; }
reducer_opor const* operator->() const { return this; }
//@}
///@}
/** @name Upcast
* @details In Cilk library 0.9, reducers were always cache-aligned. In
* library 1.0, reducer cache alignment is optional. By default, reducers
* are unaligned (i.e., just naturally aligned), but legacy wrappers
* inherit from cache-aligned reducers for binary compatibility.
* @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
* In library 1.0, reducer cache alignment is optional. By default,
* reducers are unaligned (i.e., just naturally aligned), but legacy
* wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
* pseudo-upcasts to the corresponding unaligned reducer class.
*/
//@{
///@{
operator reducer< op_or<Type, false> >& ()
{
return *reinterpret_cast< reducer< op_or<Type, false> >* >(this);
@ -439,15 +450,15 @@ class reducer_opor : public reducer< op_or<Type, true> >
{
return *reinterpret_cast< const reducer< op_or<Type, false> >* >(this);
}
//@}
///@}
};
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_or<Type> >` class to have an
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_or<Type> >` class to have an
* `operator reducer_opor<Type>& ()` conversion operator that statically
* downcasts the `reducer<op_or>` to the corresponding `reducer_opor` type.
* (The reverse conversion, from `reducer_opor` to `reducer<op_or>`, is just
@ -469,7 +480,7 @@ struct legacy_reducer_downcast<reducer<op_or<Type, Align> > >
/** @ingroup ReducersOr
*/
//@{
///@{
/** @name C language reducer macros
*
@ -477,11 +488,11 @@ struct legacy_reducer_downcast<reducer<op_or<Type, Align> > >
*
* @see @ref page_reducers_in_c
*/
//@{
///@{
__CILKRTS_BEGIN_EXTERN_C
/** Opor reducer type name.
/** Declares OPOR reducer type name.
*
* This macro expands into the identifier which is the name of the op_or
* reducer type for a specified numeric type.
@ -495,7 +506,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPOR_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opor_,tn)
/** Declare an op_or reducer object.
/** Declares an op_or reducer object.
*
* This macro expands into a declaration of an op_or reducer object for a
* specified numeric type. For example:
@ -520,29 +531,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
/** Declare the op_or reducer functions for a numeric type.
/** Declares the op_or reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_or reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPOR_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPOR_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opor,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opor,tn);
/** Define the op_or reducer functions for a numeric type.
/** Defines the op_or reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
* the reducer functionality for the op_or reducer type for a specified
* the reducer functionality for the op_or reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPOR_DEFINITION(t,tn) \
@ -551,10 +562,10 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l |= *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opor,tn) \
{ *(t*)v = 0; }
//@{
/** @def CILK_C_REDUCER_OPOR_INSTANCE
* @brief Declare or define implementation functions for a reducer type.
///@{
/** @def CILK_C_REDUCER_OPOR_INSTANCE
* @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
* will be defined, and this macro will generate reducer implementation
@ -568,9 +579,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPOR_INSTANCE(t,tn) \
CILK_C_REDUCER_OPOR_DECLARATION(t,tn)
#endif
//@}
///@}
/* Declare or define an instance of the reducer type and its functions for each
/* Declare or define an instance of the reducer type and its functions for each
* numeric type.
*/
CILK_C_REDUCER_OPOR_INSTANCE(char, char)
@ -591,8 +602,8 @@ CILK_C_REDUCER_OPOR_INSTANCE(unsigned long long, ulonglong)
__CILKRTS_END_EXTERN_C
//@}
///@}
//@}
///@}
#endif /* REDUCER_OPOR_H_INCLUDED */

View File

@ -1,10 +1,8 @@
/* reducer_opxor.h -*- C++ -*-
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,6 +29,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_opxor.h
@ -48,16 +59,16 @@
#include <cilk/reducer.h>
/** @defgroup ReducersXor Bitwise Xor Reducers
/** @defgroup ReducersXor Bitwise XOR Reducers
*
* Bitwise and reducers allow the computation of the bitwise and of a set of
* Bitwise XOR reducers allow the computation of the bitwise XOR of a set of
* values in parallel.
*
* @ingroup Reducers
*
* You should be familiar with @ref pagereducers "Cilk reducers", described in
* file `reducers.md`, and particularly with @ref reducers_using, before trying
* to use the information in this file.
* You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
* described in file `reducers.md`, and particularly with @ref reducers_using,
* before trying to use the information in this file.
*
* @section redopxor_usage Usage Example
*
@ -72,18 +83,17 @@
*
* @subsection redopxor_monoid_values Value Set
*
* The value set of a bitwise xor reducer is the set of values of `Type`, which
* The value set of a bitwise XOR reducer is the set of values of `Type`, which
* is expected to be a builtin integer type which has a representation as a
* sequence of bits (or something like it, such as `bool` or `std::bitset`).
*
* @subsection redopxor_monoid_operator Operator
*
* The operator of a bitwise xor reducer is the bitwise xor operator, defined
* by the `^` binary operator on `Type`.
* The bitwise XOR operator is defined by the "`^`" binary operator on `Type`.
*
* @subsection redopxor_monoid_identity Identity
*
* The identity value of the reducer is the value whose representation
* The identity value of the reducer is the value whose representation
* contains all 0-bits. This is expected to be the value of the default
* constructor `Type()`.
*
@ -104,8 +114,8 @@
*
* @subsection redopxor_initial Initial Values
*
* If a bitwise xor reducer is constructed without an explicit initial value,
* then its initial value will be its identity value, as long as `Type`
* If a bitwise XOR reducer is constructed without an explicit initial value,
* then its initial value will be its identity value, as long as `Type`
* satisfies the requirements of @ref redopxor_types.
*
* @subsection redopxor_view_ops View Operations
@ -119,17 +129,17 @@
* `Type` must be `Copy Constructible`, `Default Constructible`, and
* `Assignable`.
*
* The operator `^=` must be defined on `Type`, with `x ^= a` having the
* The operator "`^=`" must be defined on `Type`, with `x ^= a` having the
* same meaning as `x = x ^ a`.
*
* The expression `Type()` must be a valid expression which yields the
* identity value (the value of `Type` whose representation consists of all
* 0-bits).
*
* @section redopxor_in_c Bitwise Xor Reducers in C
* @section redopxor_in_c Bitwise XOR Reducers in C
*
* The @ref CILK_C_REDUCER_OPXOR and @ref CILK_C_REDUCER_OPXOR_TYPE macros can
* be used to do bitwise xor reductions in C. For example:
* be used to do bitwise XOR reductions in C. For example:
*
* CILK_C_REDUCER_OPXOR(r, uint, 0);
* CILK_C_REGISTER_REDUCER(r);
@ -146,14 +156,14 @@
namespace cilk {
/** The bitwise xor reducer view class.
/** The bitwise XOR reducer view class.
*
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_xor<Type> >`. It holds the accumulator variable
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_xor<Type> >`. It holds the accumulator variable
* for the reduction, and allows only `xor` operations to be performed on it.
*
* @note The reducer dereference operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view classs
* @note The reducer "dereference" operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view class's
* `^=` operation would be used in an expression like `*r ^= a`, where
* `r` is an opmod reducer variable.
*
@ -170,18 +180,18 @@ template <typename Type>
class op_xor_view : public scalar_view<Type>
{
typedef scalar_view<Type> base;
public:
/** Class to represent the right-hand side of `*reducer = *reducer ^ value`.
*
* The only assignment operator for the op_xor_view class takes an
* The only assignment operator for the op_xor_view class takes an
* rhs_proxy as its operand. This results in the syntactic restriction
* that the only expressions that can be assigned to an op_xor_view are
* ones which generate an rhs_proxy that is, expressions of the form
* ones which generate an rhs_proxy - that is, expressions of the form
* `op_xor_view ^ value ... ^ value`.
*
* @warning
* The lhs and rhs views in such an assignment must be the same;
* The lhs and rhs views in such an assignment must be the same;
* otherwise, the behavior will be undefined. (I.e., `v1 = v1 ^ x` is
* legal; `v1 = v2 ^ x` is illegal.) This condition will be checked with
* a runtime assertion when compiled in debug mode.
@ -202,12 +212,12 @@ public:
rhs_proxy(); // Disable default constructor
public:
/** Bitwise xor with an additional rhs value. If `v` is an op_xor_view
* and `a1` is a value, then the expression `v ^ a1` invokes the
* views `operator^()` to create an rhs_proxy for `(v, a1)`; then
* `v ^ a1 ^ a2` invokes the rhs_proxys `operator^()` to create a new
/** bitwise XOR with an additional rhs value. If `v` is an op_xor_view
* and `a1` is a value, then the expression `v ^ a1` invokes the
* view's `operator^()` to create an rhs_proxy for `(v, a1)`; then
* `v ^ a1 ^ a2` invokes the rhs_proxy's `operator^()` to create a new
* rhs_proxy for `(v, a1^a2)`. This allows the right-hand side of an
* assignment to be not just `view ^ value`, but
* assignment to be not just `view ^ value`, but
( `view ^ value ^ value ... ^ value`. The effect is that
*
* v = v ^ a1 ^ a2 ... ^ an;
@ -228,12 +238,12 @@ public:
/** Construct with a specified initial value.
*/
explicit op_xor_view(const Type& v) : base(v) {}
/** Reduction operation.
/** Reduces the views of two strands.
*
* This function is invoked by the @ref op_xor monoid to combine the views
* of two strands when the right strand merges with the left one. It
* xors the value contained in the left-strand view by the value
* "XORs" the value contained in the left-strand view by the value
* contained in the right-strand view, and leaves the value in the
* right-strand view undefined.
*
@ -244,25 +254,25 @@ public:
* reduce operation.
*/
void reduce(op_xor_view* right) { this->m_value ^= right->m_value; }
/** @name Accumulator variable updates.
*
* These functions support the various syntaxes for xoring the
* These functions support the various syntaxes for "XORing" the
* accumulator variable contained in the view with some value.
*/
//@{
///@{
/** Xor the accumulator variable with @a x.
/** Performs XOR operation between the accumulator variable and @a x.
*/
op_xor_view& operator^=(const Type& x) { this->m_value ^= x; return *this; }
/** Create an object representing `*this ^ x`.
/** Creates an object representing `*this ^ x`.
*
* @see rhs_proxy
*/
rhs_proxy operator^(const Type& x) const { return rhs_proxy(this, x); }
/** Assign the result of a `view ^ value` expression to the view. Note that
/** Assigns the result of a `view ^ value` expression to the view. Note that
* this is the only assignment operator for this class.
*
* @see rhs_proxy
@ -272,23 +282,23 @@ public:
this->m_value ^= rhs.m_value;
return *this;
}
//@}
///@}
};
/** Monoid class for bitwise xor reductions. Instantiate the cilk::reducer
* template class with an op_xor monoid to create a bitwise xor reducer
* class. For example, to compute the bitwise xor of a set of `unsigned long`
/** Monoid class for bitwise XOR reductions. Instantiate the cilk::reducer
* template class with an op_xor monoid to create a bitwise XOR reducer
* class. For example, to compute the bitwise XOR of a set of `unsigned long`
* values:
*
* cilk::reducer< cilk::op_xor<unsigned long> > r;
*
* @tparam Type The reducer value type.
* @tparam Align If `false` (the default), reducers instantiated on this
* monoid will be naturally aligned (the Cilk library 1.0
* monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
* will be cache-aligned for binary compatibility with
* reducers in Cilk library version 0.9.
* will be cache-aligned for binary compatibility with
* reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersXor
* @see op_xor_view
@ -298,22 +308,22 @@ public:
template <typename Type, bool Align = false>
struct op_xor : public monoid_with_view<op_xor_view<Type>, Align> {};
/** Deprecated bitwise xor reducer class.
/** Deprecated bitwise XOR reducer class.
*
* reducer_opxor is the same as @ref reducer<@ref op_xor>, except that
* reducer_opxor is a proxy for the contained view, so that accumulator
* variable update operations can be applied directly to the reducer. For
* example, a value is xored with a `reducer<%op_xor>` with `*r ^= a`, but a
* value can be xored with a `%reducer_opxor` with `r ^= a`.
* example, a value is "XORed" with a `reducer<%op_xor>` with `*r ^= a`, but a
* value can be "XORed" with a `%reducer_opxor` with `r ^= a`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
* reducers rather than the old wrappers like reducer_opand.
* reducers rather than the old wrappers like reducer_opand.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
* @note Implicit conversions are provided between `%reducer_opxor`
* @note Implicit conversions are provided between `%reducer_opxor`
* and `reducer<%op_xor>`. This allows incremental code
* conversion: old code that used `%reducer_opxor` can pass a
* `%reducer_opxor` to a converted function that now expects a
@ -337,20 +347,20 @@ class reducer_opxor : public reducer< op_xor<Type, true> >
public:
/// The view type for the reducer.
typedef typename base::view_type view_type;
/// The views rhs proxy type.
/// The view's rhs proxy type.
typedef typename view_type::rhs_proxy rhs_proxy;
/// The view type for the reducer.
typedef view_type View;
/// The monoid type for the reducer.
typedef typename base::monoid_type Monoid;
/** @name Constructors
*/
//@{
///@{
/** Default (identity) constructor.
*
* Constructs the wrapper with the default initial value of `Type()`.
@ -362,38 +372,38 @@ class reducer_opxor : public reducer< op_xor<Type, true> >
* Constructs the wrapper with a specified initial value.
*/
explicit reducer_opxor(const Type& initial_value) : base(initial_value) {}
//@}
///@}
/** @name Forwarded functions
* @details Functions that update the contained accumulator variable are
* simply forwarded to the contained @ref op_and_view. */
//@{
///@{
/// @copydoc op_xor_view::operator^=(const Type&)
reducer_opxor& operator^=(const Type& x)
{
view() ^= x; return *this;
view() ^= x; return *this;
}
// The legacy definition of reducer_opxor::operator^() has different
// behavior and a different return type than this definition. The legacy
// version is defined as a member function, so this new version is defined
// as a free function to give it a different signature, so that they wont
// as a free function to give it a different signature, so that they won't
// end up sharing a single object file entry.
/// @copydoc op_xor_view::operator^(const Type&) const
friend rhs_proxy operator^(const reducer_opxor& r, const Type& x)
{
return r.view() ^ x;
{
return r.view() ^ x;
}
/// @copydoc op_and_view::operator=(const rhs_proxy&)
reducer_opxor& operator=(const rhs_proxy& temp)
{
view() = temp; return *this;
view() = temp; return *this;
}
//@}
///@}
/** @name Dereference
* @details Dereferencing a wrapper is a no-op. It simply returns the
@ -412,25 +422,25 @@ class reducer_opxor : public reducer< op_xor<Type, true> >
* // operator &= is a wrapper member function that
* // calls the corresponding view function
*/
//@{
///@{
reducer_opxor& operator*() { return *this; }
reducer_opxor const& operator*() const { return *this; }
reducer_opxor* operator->() { return this; }
reducer_opxor const* operator->() const { return this; }
//@}
///@}
/** @name Upcast
* @details In Cilk library 0.9, reducers were always cache-aligned. In
* library 1.0, reducer cache alignment is optional. By default, reducers
* are unaligned (i.e., just naturally aligned), but legacy wrappers
* inherit from cache-aligned reducers for binary compatibility.
* @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
* In library 1.0, reducer cache alignment is optional. By default,
* reducers are unaligned (i.e., just naturally aligned), but legacy
* wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
* pseudo-upcasts to the corresponding unaligned reducer class.
*/
//@{
///@{
operator reducer< op_xor<Type, false> >& ()
{
return *reinterpret_cast< reducer< op_xor<Type, false> >* >(this);
@ -439,15 +449,15 @@ class reducer_opxor : public reducer< op_xor<Type, true> >
{
return *reinterpret_cast< const reducer< op_xor<Type, false> >* >(this);
}
//@}
///@}
};
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_xor<Type> >` class to have an
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_xor<Type> >` class to have an
* `operator reducer_opxor<Type>& ()` conversion operator that statically
* downcasts the `reducer<op_xor>` to the corresponding `reducer_opxor` type.
* (The reverse conversion, from `reducer_opxor` to `reducer<op_xor>`, is just
@ -469,7 +479,7 @@ struct legacy_reducer_downcast<reducer<op_xor<Type, Align> > >
/** @ingroup ReducersXor
*/
//@{
///@{
/** @name C language reducer macros
*
@ -477,11 +487,11 @@ struct legacy_reducer_downcast<reducer<op_xor<Type, Align> > >
*
* @see @ref page_reducers_in_c
*/
//@{
///@{
__CILKRTS_BEGIN_EXTERN_C
/** Opxor reducer type name.
/** Declares OPXOR reducer type name.
*
* This macro expands into the identifier which is the name of the op_xor
* reducer type for a specified numeric type.
@ -495,7 +505,7 @@ __CILKRTS_BEGIN_EXTERN_C
#define CILK_C_REDUCER_OPXOR_TYPE(tn) \
__CILKRTS_MKIDENT(cilk_c_reducer_opxor_,tn)
/** Declare an op_xor reducer object.
/** Declares an op_xor reducer object.
*
* This macro expands into a declaration of an op_xor reducer object for a
* specified numeric type. For example:
@ -520,29 +530,29 @@ __CILKRTS_BEGIN_EXTERN_C
/// @cond internal
/** Declare the op_xor reducer functions for a numeric type.
/** Declares the op_xor reducer functions for a numeric type.
*
* This macro expands into external function declarations for functions which
* implement the reducer functionality for the op_xor reducer type for a
* specified numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPXOR_DECLARATION(t,tn) \
typedef CILK_C_DECLARE_REDUCER(t) CILK_C_REDUCER_OPXOR_TYPE(tn); \
__CILKRTS_DECLARE_REDUCER_REDUCE(cilk_c_reducer_opxor,tn,l,r); \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opxor,tn);
/** Define the op_xor reducer functions for a numeric type.
/** Defines the op_xor reducer functions for a numeric type.
*
* This macro expands into function definitions for functions which implement
* the reducer functionality for the op_xor reducer type for a specified
* the reducer functionality for the op_xor reducer type for a specified
* numeric type.
*
* @param t The value type of the reducer.
* @param tn The value type name identifier, used to construct the reducer
* @param tn The value "type name" identifier, used to construct the reducer
* type name, function names, etc.
*/
#define CILK_C_REDUCER_OPXOR_DEFINITION(t,tn) \
@ -551,10 +561,10 @@ __CILKRTS_BEGIN_EXTERN_C
{ *(t*)l ^= *(t*)r; } \
__CILKRTS_DECLARE_REDUCER_IDENTITY(cilk_c_reducer_opxor,tn) \
{ *(t*)v = 0; }
//@{
/** @def CILK_C_REDUCER_OPXOR_INSTANCE
* @brief Declare or define implementation functions for a reducer type.
///@{
/** @def CILK_C_REDUCER_OPXOR_INSTANCE
* @brief Declares or defines implementation functions for a reducer type.
*
* In the runtime source file c_reducers.c, the macro `CILK_C_DEFINE_REDUCERS`
* will be defined, and this macro will generate reducer implementation
@ -568,9 +578,9 @@ __CILKRTS_BEGIN_EXTERN_C
# define CILK_C_REDUCER_OPXOR_INSTANCE(t,tn) \
CILK_C_REDUCER_OPXOR_DECLARATION(t,tn)
#endif
//@}
///@}
/* Declare or define an instance of the reducer type and its functions for each
/* Declares or defines an instance of the reducer type and its functions for each
* numeric type.
*/
CILK_C_REDUCER_OPXOR_INSTANCE(char, char)
@ -591,8 +601,8 @@ CILK_C_REDUCER_OPXOR_INSTANCE(unsigned long long, ulonglong)
__CILKRTS_END_EXTERN_C
//@}
///@}
//@}
///@}
#endif /* REDUCER_OPXOR_H_INCLUDED */

View File

@ -1,9 +1,8 @@
/*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
/* reducer_ostream.h -*- C++ -*-
*
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -18,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -31,263 +29,489 @@
* 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.
*
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/*
* reducer_ostream.h
/** @file reducer_ostream.h
*
* Purpose: Hyper-object to write to 'std::ostream's
* @brief Defines a class for writing to an ostream in parallel.
*
* Classes: reducer_ostream
* @ingroup ReducersOstream
*
* Description:
* ============
* Output streams ('std::ostream's) are a convenient means of writing text to
* files, the user console, or sockets. In a serial program, text is written
* to an ostream in a specific, logical order. For example, computing while
* traversing a data structure and printing them to an 'ostream' will result
* in the values being printed in the order of traversal. In a parallel
* version of the same program, however, different parts of the data structure
* may be traversed in a different order, resulting in a non-deterministic
* ordering of the stream. Worse, multiple strands may write to the same
* stream simultaneously, resulting in a data race. Replacing the
* 'std::ostream' with a 'cilk::reducer_ostream' will solve both problems: Data
* will appeaer in the stream in the same order as it would for the serial
* program, and there will be no races (no locks) on the common stream.
*
* Usage Example:
* ==============
* Assume we wish to traverse an array of objects, performing an operation on
* each object and writing the result to a file. Without a reducer_ostream,
* we have a race on the 'output' file stream:
*..
* void compute(std::ostream& os, double x)
* {
* // Perform some significant computation and print the result:
* os << std::asin(x);
* }
*
* int test()
* {
* const std::size_t ARRAY_SIZE = 1000000;
* extern double myArray[ARRAY_SIZE];
*
* std::ofstream output("output.txt");
* cilk_for (std::size_t i = 0; i < ARRAY_SIZE; ++i)
* {
* compute(output, myArray[i]);
* }
*
* return 0;
* }
*..
* The race is solved by using a reducer_ostream to proxy the 'output' file:
*..
* void compute(cilk::reducer_ostream& os, double x)
* {
* // Perform some significant computation and print the result:
* *os << std::asin(x);
* }
*
* int test()
* {
* const std::size_t ARRAY_SIZE = 1000000;
* extern double myArray[ARRAY_SIZE];
*
* std::ofstream output("output.txt");
* cilk::reducer_ostream hyper_output(output);
* cilk_for (std::size_t i = 0; i < ARRAY_SIZE; ++i)
* {
* compute(hyper_output, myArray[i]);
* }
*
* return 0;
* }
*..
*
* Limitations:
* ============
* There are two possible values for the formatting flags immediately after a
* 'cilk_spawn' statement: they may either have the value that was set by the
* spawn function, or they may have default values. Because of
* non-determinism in the processor scheduling, there is no way to determine
* which it will be. Similarly, the formatting flags after a 'cilk_sync' may
* or may not have the same value as before the sync. Therefore, one must use
* a disciplined coding style to avoid formatting errors. There are two
* approaches to mitigating the problem: The first is to eliminate the
* difference between the two possible outcomes by ensuring that the spawned
* function always returns the flags to their initial state:
*..
* void compute(cilk::reducer_ostream& os, double x)
* {
* // Perform some significant computation and print the result:
* int saveprec = os.precision(5);
* os << std::asin(x);
* os.precision(saveprec);
* }
*..
* The second approach is to write your streaming operations such that they
* don't depend on the previous state of the formatting flags by setting any
* important flags before every block of output:
*..
* cilk_spawn compute(hyper_output, value);
*
* hyper_output->precision(2); // Don't depend on previous precision
* *hyper_output << f();
* *hyper_output << g();
*..
* Another concern is memory usage. A reducer_ostream will buffer as much text
* as necessary to ensure that the order of output matches that of the serial
* version of the program. If all spawn branches perform an equal amount of
* output, then one can expect that half of the output before a sync will be
* buffered in memory. This hyperobject is therefore not well suited for
* serializing very large quantities of text output.
* @see @ref ReducersOstream
*/
#ifndef REDUCER_OSTREAM_H_INCLUDED
#define REDUCER_OSTREAM_H_INCLUDED
#include <cilk/reducer.h>
#include <iostream>
#include <ostream>
#include <sstream>
/** @defgroup ReducersOstream Ostream Reducers
*
* Ostream reducers allow multiple strands to write to an ostream in parallel.
*
* @ingroup Reducers
*
* You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
* described in file reducers.md, and particularly with @ref reducers_using,
* before trying to use the information in this file.
*
* @section redostream_usage Usage Example
*
* One of the most common debugging techniques is adding `print` statements
* to the code being debugged. When the code is parallelized, the results can
* be less than satisfactory, as output from multiple strands is mingled in an
* unpredictable way. Like other reducers, an ostream reducer requires minimal
* recoding to guarantee that the output from parallelized computation will be
* ordered the same as though the computation were executed serially.
*
* cilk::reducer<cilk::op_ostream> r(std::cerr);
* cilk_for (int i = 0; i != data.size(); ++i) {
* *r << "Iteration " << i << ":\n";
* ... some computation ...
* *r << " Step 1:" << some information;
* ... some more computation ...
* *r << " Step 2:" << some more information;
* ... still more computation ...
* *r << " Step 3:" << still more information;
* }
*
* Output on standard error:
*
* Iteration 1:
* Step 1: ...
* Step 2: ...
* Step 3: ...
* Iteration 2:
* Step 1: ...
* Step 2: ...
* Step 3: ...
* Iteration 3:
* Step 1: ...
* Step 2: ...
* Step 3: ...
* ...
*
* @section redostream_overview Overview
*
* An "ostream reducer" is not really a reducer. It uses the reducer
* technology to coordinate operations on parallel strands to achieve
* the same behavior in a parallel computation that would be seen in a
* serial computation, but it does not have a monoid. It has a "monoid
* class," because that is part of the implementation framework, but it
* does not represent a mathematical monoid: there is no value type, no
* associative operation, and no identity value. The reducer is used for
* its side effect rather than to construct a value.
*
* You might think of an ostream reducer as a relative of a
* @ref ReducersString "string reducer" which uses stream output
* syntax (`stream << value`) instead of string append syntax
* (`string += value`), and which writes its result string to an
* ostream instead of making it available as the reducer value.
*
* Another difference is that "real" reducers protect their contained
* value quite strongly from improper access by the user. Ostream reducers,
* on the other hand, pretty much have to expose the ostream, since normal
* use of an ostream involves accessing its internal state. Furthermore,
* the ostream reducer just coordinates output to an existing ostream -
* there is nothing to keep the user from writing directly to the attached
* stream, with unpredictable results.
*
* @section redostream_operations Operations
*
* In the operation descriptions below, the type name `Ostream` refers to the
* reducer's ostream type, `std::basic_ostream<Char, Traits>`.
*
* @subsection redostream_constructors Constructors
*
* The only constructor is
*
* reducer(const Ostream& os)
*
* This creates a reducer that is associated with the existing ostream `os`.
* Anything "written to" the reducer will (eventually) be written to `os`.
*
* @subsection redostream_get_set Set and Get
*
* Just as a stream does not have a "value," neither does an ostream
* reducer. Therefore, none of the usual `set_value`, `get_value`,
* `move_in`, or `move_out` functions are available for ostream reducers.
*
* @subsection redostream_initial Initial Values
*
* Ostream reducers do not have default constructors.
*
* @subsection redostream_view_ops View Operations
*
* An ostream reducer view is actually a kind of `std::ostream`. Therefore,
* any operation that can be used on an ostream can be used on an ostream
* reducer view. For example:
*
* reducer<op_ostream> r(cout);
* *r << setw(5) << (x=1) << endl;
*
*
* @section redostream_performance Performance Considerations
*
* Ostream reducers work by creating a string stream for each non-leftmost
* view. When two strands are merged, the contents of the string buffer of the
* right view are written to the left view. Since all non-leftmost strands are
* eventually merged, all output is eventually written to the associated
* ostream.
*
* This implementation has two consequences.
*
* First, all output written to an ostream reducer on a stolen strand is kept
* in memory (in a string buffer) until the strand is merged with the leftmost
* strand. This means that some portion of the output written to an ostream
* reducer during a parallel computation - half of the total output, on
* average - will temporarily be held in memory during the computation.
* Obviously, ostream reducers will work better for small and moderate amounts
* of output.
*
* Second, buffered ostream reducer content must be copied at every merge.
* The total amount of copying is potentially proportional to the total amount
* of output multiplied by the number of strands stolen during the computation.
*
* In short, writing to an ostream in a parallel computation with an ostream
* reducer will always be less efficient than writing the same output directly
* to the ostream in a serial computation. The value of the ostream
* reducer is not in the writing of the ostream itself, but in removing the
* race and serialization obstacles that the ostream output would cause in an
* otherwise parallelizable computation.
*
*
* @section redostream_state Stream State
*
* The reducer implementation can correctly order the output that is written
* to an ostream. However, an ostream has additional state that controls its
* behavior, such as its formatting attributes, error state, extensible arrays, * and registered callbacks. If these are modified during the computation, the * reducer implementation cannot guarantee that they will be the same in a
* parallel computation as in a serial computation. In particular:
*
* - In the serial execution, the ostream state in the continuation of a
* spawn will be the same as the state at the end of the spawned function.
* In the parallel execution, if the continuation is stolen, its view will
* contain a newly created ostream with the default initial state.
* - In the serial execution, the ostream state following a sync is the same
* as the state before the sync. In the parallel execution, if the
* continuation is stolen, then the state following the sync will be the
* same as the state at the end of some spawned function.
*
* In short, you must not make any assumptions about the stream state of an
* ostream reducer:
*
* - Following a `cilk_spawn`.
* - Following a `cilk_sync`.
* - At the start of an iteration of a `cilk_for` loop.
* - Following the completion of a `cilk_for` loop.
*
* @section redostream_types Type and Operator Requirements
*
* `std::basic_ostream<Char, Traits>` must be a valid type.
*/
namespace cilk {
/**
* @brief Class 'reducer_ostream' is the representation of a hyperobject for
* output text streaming.
/** @ingroup ReducersOstream */
//@{
/** The ostream reducer view class.
*
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_basic_ostream<Char, Traits> >`. It holds the
* actual ostream for a parallel strand, and allows only stream output
* operations to be performed on it.
*
* @note The reducer "dereference" operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view
* class's `<<` operation would be used in an expression like
* `*r << "x = " << x`, where `r` is an ostream reducer.
*
* @tparam Char The ostream element type (not the ostream type).
* @tparam Traits The character traits type.
*
* @see ReducersOstream
* @see op_basic_ostream
*/
class reducer_ostream
template<typename Char, typename Traits>
class op_basic_ostream_view : public std::basic_ostream<Char, Traits>
{
typedef std::basic_ostream<Char, Traits> base;
typedef std::basic_ostream<Char, Traits> ostream_type;
// A non-leftmost view is associated with a private string buffer. (The
// leftmost view is associated with the buffer of the reducer's associated
// ostream, so its private buffer is unused.)
//
std::basic_stringbuf<Char, Traits> m_buffer;
public:
/// Internal representation of the per-strand view of the data for reducer_ostream
class View: public std::ostream
/** Value type. Required by @ref monoid_with_view.
*/
typedef ostream_type value_type;
/** Reduce operation. Required by @ref monoid_with_view.
*/
void reduce(op_basic_ostream_view* other)
{
public:
/// Type of the std::stream reducer_ostream is based on
typedef std::ostream Base;
friend class reducer_ostream;
View():
std::ostream(0)
{
Base::rdbuf(&strbuf_);
};
private:
void use_ostream (const std::ostream &os)
{
Base::rdbuf(os.rdbuf());
Base::flags(os.flags()); // Copy formatting flags
Base::setstate(os.rdstate()); // Copy error state
// Writing an empty buffer results in failure. Testing `sgetc()` is the
// easiest way of checking for an empty buffer.
if (other->m_buffer.sgetc() != Traits::eof()) {
*this << (&other->m_buffer);
}
}
private:
std::stringbuf strbuf_;
};
/** Non-leftmost (identity) view constructor. The view is associated with
* its internal buffer. Required by @ref monoid_base.
*/
op_basic_ostream_view() : base(&m_buffer) {}
public:
/// Definition of data view, operation, and identity for reducer_ostream
struct Monoid: monoid_base< View >
/** Leftmost view constructor. The view is associated with an existing
* ostream.
*/
op_basic_ostream_view(const ostream_type& os) : base(0)
{
static void reduce (View *left, View *right);
};
base::rdbuf(os.rdbuf()); // Copy stream buffer
base::flags(os.flags()); // Copy formatting flags
base::setstate(os.rdstate()); // Copy error state
}
private:
// Hyperobject to serve up views
reducer<Monoid> imp_;
/** Sets/gets.
*
* These are all no-ops.
*/
//@{
void view_set_value(const value_type&)
{ assert("set_value() is not allowed on ostream reducers" && 0); }
const value_type& view_get_value() const
{ assert("get_value() is not allowed on ostream reducers" && 0);
return *this; }
typedef value_type const& return_type_for_get_value;
void view_move_in(const value_type&)
{ assert("move_in() is not allowed on ostream reducers" && 0); }
void view_move_out(const value_type&)
{ assert("move_out() is not allowed on ostream reducers" && 0); }
//@}
};
/** Ostream monoid class. Instantiate the cilk::reducer template class with an
* op_basic_ostream monoid to create an ostream reducer class:
*
* cilk::reducer< cilk::op_basic_string<char> > r;
*
* @tparam Char The stream element type (not the stream type).
* @tparam Traits The character traits type.
*
* @see ReducersOstream
* @see op_basic_ostream_view
* @see reducer_ostream
* @see op_ostream
* @see op_wostream
*/
template<typename Char,
typename Traits = std::char_traits<Char>,
bool Align = false>
class op_basic_ostream :
public monoid_with_view< op_basic_ostream_view<Char, Traits>, Align >
{
typedef monoid_with_view< op_basic_ostream_view<Char, Traits>, Align >
base;
typedef std::basic_ostream<Char, Traits> ostream_type;
typedef provisional_guard<typename base::view_type> view_guard;
// Methods that provide the API for the reducer
public:
// Construct an initial 'reducer_ostream' from an 'std::ostream'. The
// specified 'os' stream is used as the eventual destination for all
// text streamed to this hyperobject.
explicit reducer_ostream(const std::ostream &os);
/** View type of the monoid.
*/
typedef typename base::view_type view_type;
// Return a modifiable reference to the underlying 'ostream' object.
std::ostream& get_reference();
/**
* Append data from some type to the reducer_ostream
/** @name Construct function.
*
* @param v Value to be appended to the reducer_ostream
* The only supported ostream reducer constructor takes a reference to
* an existing ostream.
*
* @param os The ostream destination for receive all data written to the
* reducer.
*/
static void construct(
op_basic_ostream* monoid,
view_type* view,
const ostream_type& os)
{
view_guard vg( new((void*) view) view_type(os) );
vg.confirm_if( new((void*) monoid) op_basic_ostream );
}
};
/**
* Convenience typedef for narrow ostreams.
*/
typedef op_basic_ostream<char> op_ostream;
/**
* Convenience typedef for wide ostreams.
*/
typedef op_basic_ostream<wchar_t> op_wostream;
/// @cond internal
class reducer_ostream;
/** Metafunction specialization for reducer conversion.
*
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer<op_basic_ostream<char> >` class
* to have an `operator reducer_ostream& ()` conversion operator that
* statically downcasts the `reducer<op_basic_ostream<char> >` to
* `reducer_ostream`. (The reverse conversion, from `reducer_ostream` to
* `reducer<op_basic_ostream<char> >`, is just an upcast, which is provided
* for free by the language.)
*/
template<bool Align>
struct legacy_reducer_downcast<
reducer<op_basic_ostream<char, std::char_traits<char>, Align> > >
{
typedef reducer_ostream type;
};
/// @endcond
/** Deprecated ostream reducer class.
*
* reducer_ostream is the same as @ref cilk::reducer<@ref op_ostream>, except
* that reducer_ostream is a proxy for the contained view, so that ostream
* operations can be applied directly to the reducer. For example, a number is
* written to a `reducer<op_ostream>` with `*r << x`, but a number can be
* written to a `reducer_ostream` with `r << x`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
* reducers rather than the old wrappers like reducer_ostream. The
* `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
* @note Implicit conversions are provided between `%reducer_ostream`
* and `reducer<%op_ostream>`. This allows incremental code
* conversion: old code that used `%reducer_ostream` can pass a
* `%reducer_ostream` to a converted function that now expects a
* pointer or reference to a `reducer<%op_ostream>`, and vice versa.
*
* @tparam Char The stream element type (not the stream type).
* @tparam Traits The character traits type.
*
* @see op_ostream
* @see reducer
* @see ReducersOstream
*/
class reducer_ostream :
public reducer<op_basic_ostream<char, std::char_traits<char>, true> >
{
typedef reducer<op_basic_ostream<char, std::char_traits<char>, true> > base;
using base::view;
public:
/// The view type for the reducer.
typedef base::view_type View;
/// The monoid type for the reducer.
typedef base::monoid_type Monoid;
/** Constructs an initial `reducer_ostream` from a `std::ostream`. The
* specified stream is used as the eventual destination for all text
* streamed to this hyperobject.
*/
explicit reducer_ostream(const std::ostream &os) : base(os) {}
/** Returns a modifiable reference to the underlying 'ostream' object.
*/
std::ostream& get_reference() { return view(); }
/** Writes to the ostream.
*/
template<typename T>
std::ostream &
operator<< (const T &v)
std::ostream& operator<< (const T &v)
{
return imp_.view() << v;
return view() << v;
}
/**
* Append data from a std::ostream to the reducer_ostream
* Calls a manipulator.
*
* @param _Pfn std::ostream to copy from
* @param _Pfn Pointer to the manipulator function.
*/
std::ostream &
operator<< (std::ostream &(*_Pfn)(std::ostream &))
reducer_ostream& operator<< (std::ostream &(*_Pfn)(std::ostream &))
{
View &v = imp_.view();
return ((*_Pfn)(v));
(*_Pfn)(view());
return *this;
}
/** @name Dereference
* @details Dereferencing a wrapper is a no-op. It simply returns the
* wrapper. Combined with the rule that the wrapper forwards view
* operations to its contained view, this means that view operations can
* be written the same way on reducers and wrappers, which is convenient
* for incrementally converting old code using wrappers to use reducers
* instead. That is:
*
* reducer<op_ostream> r;
* *r << "a"; // *r returns the view
* // operator<<() is a view member function
*
* reducer_ostream w;
* *w << "a"; // *w returns the wrapper
* // operator<<() is a wrapper member function
* // that calls the corresponding view function
*/
//@{
reducer_ostream& operator*() { return *this; }
reducer_ostream const& operator*() const { return *this; }
reducer_ostream* operator->() { return this; }
reducer_ostream const* operator->() const { return this; }
//@}
/** @name Upcast
* @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
* In library 1.0, reducer cache alignment is optional. By default,
* reducers are unaligned (i.e., just naturally aligned), but legacy
* wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
* pseudo-upcasts to the corresponding unaligned reducer class.
*/
//@{
operator reducer<op_ostream>& ()
{
return *reinterpret_cast< reducer<op_ostream>* >(this);
}
operator const reducer<op_ostream>& () const
{
return *reinterpret_cast< const reducer<op_ostream>* >(this);
}
//@}
};
// -------------------------------------------
// class reducer_ostream::Monoid
// -------------------------------------------
/**
* Appends string from "right" reducer_basic_string onto the end of
* the "left". When done, the "right" reducer_basic_string is empty.
*/
void
reducer_ostream::Monoid::reduce(View *left, View *right)
{
left->operator<< (&right->strbuf_);
}
// --------------------------
// class reducer_ostream
// --------------------------
/**
* Construct a reducer_ostream which will write to the specified std::ostream
*
* @param os std::ostream to write to
*/
inline
reducer_ostream::reducer_ostream(const std::ostream &os) :
imp_()
{
View &v = imp_.view();
v.use_ostream(os);
}
/**
* Get a reference to the std::ostream
*/
inline
std::ostream &
reducer_ostream::get_reference()
{
View &v = imp_.view();
return v;
}
} // namespace cilk
#endif // REDUCER_OSTREAM_H_INCLUDED
#endif // REDUCER_OSTREAM_H_INCLUDED

View File

@ -1,10 +1,8 @@
/* reducer_string.h -*- C++ -*-
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -19,7 +17,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -32,6 +29,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_string.h
@ -52,14 +63,14 @@
/** @defgroup ReducersString String Reducers
*
* String reducers allow the creation of a string by concatenating a set of
* String reducers allow the creation of a string by concatenating a set of
* strings or characters in parallel.
*
* @ingroup Reducers
*
* You should be familiar with @ref pagereducers "Cilk reducers", described in
* file reducers.md, and particularly with @ref reducers_using, before trying
* to use the information in this file.
* You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
* described in file reducers.md, and particularly with @ref reducers_using,
* before trying to use the information in this file.
*
* @section redstring_usage Usage Example
*
@ -79,24 +90,24 @@
* @subsection redstring_monoid_values Value Set
*
* The value set of a string reducer is the set of values of the class
* `std::basic_string<Char, Traits, Alloc>`, which we refer to as the
* reducers string type.
* `std::basic_string<Char, Traits, Alloc>`, which we refer to as "the
* reducer's string type".
*
* @subsection redstring_monoid_operator Operator
*
* The operator of a string reducer is the string concatenation operator,
* defined by the `+` binary operator on the reducers string type.
* The operator of a string reducer is the string concatenation operator,
* defined by the "`+`" binary operator on the reducer's string type.
*
* @subsection redstring_monoid_identity Identity
*
* The identity value of a string reducer is the empty string, which is the
* The identity value of a string reducer is the empty string, which is the
* value of the expression
* `std::basic_string<Char, Traits, Alloc>([allocator])`.
*
* @section redstring_operations Operations
*
* In the operation descriptions below, the type name `String` refers to the
* reducers string type, `std::basic_string<Char, Traits, Alloc>`.
* reducer's string type, `std::basic_string<Char, Traits, Alloc>`.
*
* @subsection redstring_constructors Constructors
*
@ -151,8 +162,8 @@
* the string computation.
*
* The strings for new views are created (by the view identity constructor)
* using the same allocator as the string that was created when the reducer
* was constructed. Note that this allocator is determined when the reducer is
* using the same allocator as the string that was created when the reducer
* was constructed. Note that this allocator is determined when the reducer is
* constructed. The following two examples may have very different behavior:
*
* string<Char, Traits, Allocator> a_string;
@ -166,7 +177,7 @@
* ... parallel computation ...
* reducer2.move_out(a_string);
*
* * `reducer1` will be constructed with the same allocator as `a_string`,
* * `reducer1` will be constructed with the same allocator as `a_string`,
* because the string was specified in the constructor. The `move_in`
* and `move_out` can therefore be done with a `swap` in constant time.
* * `reducer2` will be constructed with a _default_ allocator of type
@ -175,8 +186,8 @@
* in _O(N)_ time.
*
* (All instances of an allocator type with no internal state (like
* `std::allocator`) are the same. You only need to worry about the same
* allocator issue when you create string reducers with custom allocator
* `std::allocator`) are "the same". You only need to worry about the "same
* allocator" issue when you create string reducers with custom allocator
* types.)
*
* @section redstring_types Type and Operator Requirements
@ -192,12 +203,12 @@ namespace cilk {
/** The string append reducer view class.
*
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_basic_string<Type, Traits, Allocator> >`. It holds
* `cilk::reducer< cilk::op_basic_string<Char, Traits, Allocator> >`. It holds
* the accumulator variable for the reduction, and allows only append
* operations to be performed on it.
*
* @note The reducer dereference operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view classs
* @note The reducer "dereference" operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view class's
* `append` operation would be used in an expression like
* `r->append(a)`, where `r` is a string append reducer variable.
*
@ -215,7 +226,7 @@ class op_basic_string_view
typedef std::list<string_type> list_type;
typedef typename string_type::size_type size_type;
// The view's value is represented by a list of strings and a single
// The view's value is represented by a list of strings and a single
// string. The value is the concatenation of the strings in the list with
// the single string at the end. All string operations apply to the single
// string; reduce operations cause lists of partial strings from multiple
@ -224,7 +235,7 @@ class op_basic_string_view
mutable string_type m_string;
mutable list_type m_list;
// Before returning the value of the reducer, concatenate all the strings
// Before returning the value of the reducer, concatenate all the strings
// in the list with the single string.
//
void flatten() const
@ -263,11 +274,11 @@ public:
return m_string.get_allocator();
}
/** Reduction operation.
/** Reduces the views of two strands.
*
* This function is invoked by the @ref op_basic_string monoid to combine
* the views of two strands when the right strand merges with the left
* one. It appends the value contained in the right-strand view to the
* the views of two strands when the right strand merges with the left
* one. It appends the value contained in the right-strand view to the
* value contained in the left-strand view, and leaves the value in the
* right-strand view undefined.
*
@ -294,7 +305,7 @@ public:
//@}
/** @name Pass constructor arguments through to the string constructor.
/** @name Passes constructor arguments to the string constructor.
*/
//@{
@ -351,16 +362,18 @@ public:
m_string.clear();
}
void view_set_value(const string_type& s)
void view_set_value(const string_type& s)
{ m_list.clear(); m_string = s; }
string_type const& view_get_value() const
string_type const& view_get_value() const
{ flatten(); return m_string; }
string_type & view_get_reference()
typedef string_type const& return_type_for_get_value;
string_type & view_get_reference()
{ flatten(); return m_string; }
string_type const& view_get_reference() const
string_type const& view_get_reference() const
{ flatten(); return m_string; }
//@}
@ -403,10 +416,10 @@ public:
* @tparam Traits The character traits type.
* @tparam Alloc The string allocator type.
* @tparam Align If `false` (the default), reducers instantiated on this
* monoid will be naturally aligned (the Cilk library 1.0
* monoid will be naturally aligned (the Intel Cilk Plus library 1.0
* behavior). If `true`, reducers instantiated on this monoid
* will be cache-aligned for binary compatibility with
* reducers in Cilk library version 0.9.
* will be cache-aligned for binary compatibility with
* reducers in Intel Cilk Plus library version 0.9.
*
* @see ReducersString
* @see op_basic_string_view
@ -418,11 +431,13 @@ template<typename Char,
typename Traits = std::char_traits<Char>,
typename Alloc = std::allocator<Char>,
bool Align = false>
class op_basic_string :
class op_basic_string :
public monoid_with_view< op_basic_string_view<Char, Traits, Alloc>, Align >
{
typedef monoid_with_view< op_basic_string_view<Char, Traits, Alloc>, Align >
base;
typedef provisional_guard<typename base::view_type> view_guard;
Alloc m_allocator;
public:
@ -442,7 +457,7 @@ public:
op_basic_string(const Alloc& allocator = Alloc()) : m_allocator(allocator)
{}
/** Create an identity view.
/** Creates an identity view.
*
* String view identity constructors take the string allocator as an
* argument.
@ -450,48 +465,67 @@ public:
* @param v The address of the uninitialized memory in which the view
* will be constructed.
*/
void identity(view_type *v) const { ::new((void*) v) view_type(m_allocator); }
void identity(view_type *v) const
{ ::new((void*) v) view_type(m_allocator); }
/** @name Construct functions
*
* A string append reduction monoid must have a copy of the allocator of
* the leftmost views string, so that it can use it in the `identity`
* the leftmost view's string, so that it can use it in the `identity`
* operation. This, in turn, requires that string reduction monoids have a
* specialized `construct()` function.
*
* All string reducer monoid `construct()` functions first construct the
* leftmost view, using the arguments that were passed in from the reducer
* constructor. They then call the views `get_allocator()` function to
* constructor. They then call the view's `get_allocator()` function to
* get the string allocator from the string in the leftmost view, and pass
* that to the monoid constructor.
*/
//@{
static void construct(op_basic_string* monoid, view_type* view)
{ provisional( new ((void*)view) view_type() ).confirm_if(
new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
{
view_guard vg( new((void*) view) view_type() );
vg.confirm_if(
new((void*) monoid) op_basic_string(view->get_allocator()) );
}
template <typename T1>
static void construct(op_basic_string* monoid, view_type* view, const T1& x1)
{ provisional( new ((void*)view) view_type(x1) ).confirm_if(
new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
static void construct(op_basic_string* monoid, view_type* view,
const T1& x1)
{
view_guard vg( new((void*) view) view_type(x1) );
vg.confirm_if(
new((void*) monoid) op_basic_string(view->get_allocator()) );
}
template <typename T1, typename T2>
static void construct(op_basic_string* monoid, view_type* view, const T1& x1, const T2& x2)
{ provisional( new ((void*)view) view_type(x1, x2) ).confirm_if(
new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
static void construct(op_basic_string* monoid, view_type* view,
const T1& x1, const T2& x2)
{
view_guard vg( new((void*) view) view_type(x1, x2) );
vg.confirm_if(
new((void*) monoid) op_basic_string(view->get_allocator()) );
}
template <typename T1, typename T2, typename T3>
static void construct(op_basic_string* monoid, view_type* view, const T1& x1, const T2& x2,
const T3& x3)
{ provisional( new ((void*)view) view_type(x1, x2, x3) ).confirm_if(
new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
static void construct(op_basic_string* monoid, view_type* view,
const T1& x1, const T2& x2, const T3& x3)
{
view_guard vg( new((void*) view) view_type(x1, x2, x3) );
vg.confirm_if(
new((void*) monoid) op_basic_string(view->get_allocator()) );
}
template <typename T1, typename T2, typename T3, typename T4>
static void construct(op_basic_string* monoid, view_type* view, const T1& x1, const T2& x2,
const T3& x3, const T4& x4)
{ provisional( new ((void*)view) view_type(x1, x2, x3, x4) ).confirm_if(
new ((void*)monoid) op_basic_string(view->get_allocator()) ); }
static void construct(op_basic_string* monoid, view_type* view,
const T1& x1, const T2& x2, const T3& x3,
const T4& x4)
{
view_guard vg( new((void*) view) view_type(x1, x2, x3, x4) );
vg.confirm_if(
new((void*) monoid) op_basic_string(view->get_allocator()) );
}
//@}
};
@ -500,7 +534,7 @@ public:
/** Convenience typedef for 8-bit strings
*/
typedef op_basic_string<char> op_string;
/** Convenience typedef for 16-bit strings
*/
typedef op_basic_string<wchar_t> op_wstring;
@ -516,13 +550,13 @@ typedef op_basic_string<wchar_t> op_wstring;
* with `r.push_back(a)`.
*
* @deprecated Users are strongly encouraged to use `reducer<monoid>`
* reducers rather than the old wrappers like reducer_basic_string.
* reducers rather than the old wrappers like reducer_basic_string.
* The `reducer<monoid>` reducers show the reducer/monoid/view
* architecture more clearly, are more consistent in their
* implementation, and present a simpler model for new
* user-implemented reducers.
*
* @note Implicit conversions are provided between `%reducer_basic_string`
* @note Implicit conversions are provided between `%reducer_basic_string`
* and `reducer<%op_basic_string>`. This allows incremental code
* conversion: old code that used `%reducer_basic_string` can pass a
* `%reducer_basic_string` to a converted function that now expects a
@ -540,17 +574,17 @@ typedef op_basic_string<wchar_t> op_wstring;
template<typename Char,
typename Traits = std::char_traits<Char>,
typename Alloc = std::allocator<Char> >
class reducer_basic_string :
class reducer_basic_string :
public reducer< op_basic_string<Char, Traits, Alloc, true> >
{
typedef reducer< op_basic_string<Char, Traits, Alloc, true> > base;
using base::view;
public:
/// The reducers string type.
/// The reducer's string type.
typedef typename base::value_type string_type;
/// The reducers primitive component type.
/// The reducer's primitive component type.
typedef Char basic_value_type;
/// The string size type.
@ -566,7 +600,7 @@ public:
/** @name Constructors
*/
//@{
/** @name Forward constructor calls to the base class.
*
* All basic_string constructor forms are supported.
@ -575,15 +609,15 @@ public:
reducer_basic_string() {}
template <typename T1>
reducer_basic_string(const T1& x1) :
reducer_basic_string(const T1& x1) :
base(x1) {}
template <typename T1, typename T2>
reducer_basic_string(const T1& x1, const T2& x2) :
reducer_basic_string(const T1& x1, const T2& x2) :
base(x1, x2) {}
template <typename T1, typename T2, typename T3>
reducer_basic_string(const T1& x1, const T2& x2, const T3& x3) :
reducer_basic_string(const T1& x1, const T2& x2, const T3& x3) :
base(x1, x2, x3) {}
template <typename T1, typename T2, typename T3, typename T4>
@ -591,18 +625,18 @@ public:
base(x1, x2, x3, x4) {}
//@}
/** Allow mutable access to the string within the current view.
/** Allows mutable access to the string within the current view.
*
* @warning If this method is called before the parallel calculation is
* @warning If this method is called before the parallel calculation is
* complete, the string returned by this method will be a
* partial result.
*
* @returns A mutable reference to the string within the current view.
*/
string_type &get_reference()
string_type &get_reference()
{ return view().view_get_reference(); }
/** Allow read-only access to the string within the current view.
/** Allows read-only access to the string within the current view.
*
* @warning If this method is called before the parallel calculation is
* complete, the string returned by this method will be a
@ -610,10 +644,10 @@ public:
*
* @returns A const reference to the string within the current view.
*/
string_type const &get_reference() const
string_type const &get_reference() const
{ return view().view_get_reference(); }
/** @name Append to the string.
/** @name Appends to the string.
*
* These operations are simply forwarded to the view.
*/
@ -629,7 +663,7 @@ public:
void append(size_type count, Char ch)
{ view().append(count, ch); }
// Append to the string
// Appends to the string
reducer_basic_string<Char, Traits, Alloc> &operator+=(Char ch)
{ view() += ch; return *this; }
reducer_basic_string<Char, Traits, Alloc> &operator+=(const Char *ptr)
@ -664,10 +698,10 @@ public:
//@}
/** @name Upcast
* @details In Cilk library 0.9, reducers were always cache-aligned. In
* library 1.0, reducer cache alignment is optional. By default, reducers
* are unaligned (i.e., just naturally aligned), but legacy wrappers
* inherit from cache-aligned reducers for binary compatibility.
* @details In Intel Cilk Plus library 0.9, reducers were always cache-aligned.
* In library 1.0, reducer cache alignment is optional. By default,
* reducers are unaligned (i.e., just naturally aligned), but legacy
* wrappers inherit from cache-aligned reducers for binary compatibility.
*
* This means that a wrapper will automatically be upcast to its aligned
* reducer base class. The following conversion operators provide
@ -676,14 +710,14 @@ public:
//@{
operator reducer< op_basic_string<Char, Traits, Alloc, false> >& ()
{
return *reinterpret_cast< reducer<
op_basic_string<Char, Traits, Alloc, false> >*
return *reinterpret_cast< reducer<
op_basic_string<Char, Traits, Alloc, false> >*
>(this);
}
operator const reducer< op_basic_string<Char, Traits, Alloc, false> >& () const
{
return *reinterpret_cast< const reducer<
op_basic_string<Char, Traits, Alloc, false> >*
op_basic_string<Char, Traits, Alloc, false> >*
>(this);
}
//@}
@ -703,11 +737,11 @@ typedef reducer_basic_string<wchar_t> reducer_wstring;
/// @cond internal
/** Metafunction specialization for reducer conversion.
*
* This specialization of the @ref legacy_reducer_downcast template class
* This specialization of the @ref legacy_reducer_downcast template class
* defined in reducer.h causes the `reducer< op_basic_string<Char> >` class to
* have an `operator reducer_basic_string<Char>& ()` conversion operator that
* statically downcasts the `reducer<op_basic_string>` to the corresponding
* `reducer_basic_string` type. (The reverse conversion, from
* `reducer_basic_string` type. (The reverse conversion, from
* `reducer_basic_string` to `reducer<op_basic_string>`, is just an upcast,
* which is provided for free by the language.)
*

View File

@ -0,0 +1,533 @@
/* reducer_vector.h -*- C++ -*-
*
* Copyright (C) 2009-2016, Intel Corporation
* 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 Intel Corporation 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
* HOLDER 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*/
/** @file reducer_vector.h
*
* @brief Defines classes for doing parallel vector creation by appending.
*
* @ingroup ReducersVector
*
* @see ReducersVector
*/
#ifndef REDUCER_VECTOR_H_INCLUDED
#define REDUCER_VECTOR_H_INCLUDED
#include <cilk/reducer.h>
#include <vector>
#include <list>
/** @defgroup ReducersVector Vector Reducers
*
* Vector reducers allow the creation of a standard vector by
* appending a set of elements in parallel.
*
* @ingroup Reducers
*
* You should be familiar with @ref pagereducers "Intel(R) Cilk(TM) Plus reducers",
* described in file `reducers.md`, and particularly with @ref reducers_using,
* before trying to use the information in this file.
*
* @section redvector_usage Usage Example
*
* typedef ... SourceData;
* typedef ... ResultData;
* vector<SourceData> input;
* ResultData expensive_computation(const SourceData& x);
* cilk::reducer< cilk::op_vector<ResultData> > r;
* cilk_for (int i = 0; i != input.size(); ++i) {
* r->push_back(expensive_computation(input[i]));
* }
* vector result;
* r.move_out(result);
*
* @section redvector_monoid The Monoid
*
* @subsection redvector_monoid_values Value Set
*
* The value set of a vector reducer is the set of values of the class
* `std::vector<Type, Alloc>`, which we refer to as "the reducer's vector
* type".
*
* @subsection redvector_monoid_operator Operator
*
* The operator of a vector reducer is vector concatenation.
*
* @subsection redvector_monoid_identity Identity
*
* The identity value of a vector reducer is the empty vector, which is the
* value of the expression `std::vector<Type, Alloc>([allocator])`.
*
* @section redvector_operations Operations
*
* In the operation descriptions below, the type name `Vector` refers to
* the reducer's vector type, `std::vector<Type, Alloc>`.
*
* @subsection redvector_constructors Constructors
*
* Any argument list which is valid for a `std::vector` constructor is valid
* for a vector reducer constructor. The usual move-in constructor is also
* provided:
*
* reducer(move_in(Vector& variable))
*
* @subsection redvector_get_set Set and Get
*
* void r.set_value(const Vector& value)
* const Vector& = r.get_value() const
* void r.move_in(Vector& variable)
* void r.move_out(Vector& variable)
*
* @subsection redvector_initial Initial Values
*
* A vector reducer with no constructor arguments, or with only an allocator
* argument, will initially contain the identity value, an empty vector.
*
* @subsection redvector_view_ops View Operations
*
* The view of a vector reducer provides the following member functions:
*
* void push_back(const Type& element)
* void insert_back(const Type& element)
* void insert_back(Vector::size_type n, const Type& element)
* template <typename Iter> void insert_back(Iter first, Iter last)
*
* The `push_back` functions is the same as the corresponding `std::vector`
* function. The `insert_back` function is the same as the `std::vector`
* `insert` function, with the first parameter fixed to the end of the vector.
*
* @section redvector_performance Performance Considerations
*
* Vector reducers work by creating a vector for each view, collecting those
* vectors in a list, and then concatenating them into a single result vector
* at the end of the computation. This last step takes place in serial code,
* and necessarily takes time proportional to the length of the result vector.
* Thus, a parallel vector reducer cannot actually speed up the time spent
* directly creating the vector. This trivial example would probably be slower
* (because of reducer overhead) than the corresponding serial code:
*
* vector<T> a;
* reducer<op_vector<T> > r;
* cilk_for (int i = 0; i != a.length(); ++i) {
* r->push_back(a[i]);
* }
* vector<T> result;
* r.move_out(result);
*
* What a vector reducer _can_ do is to allow the _remainder_ of the
* computation to be done in parallel, without having to worry about
* managing the vector computation.
*
* The vectors for new views are created (by the view identity constructor)
* using the same allocator as the vector that was created when the reducer
* was constructed. Note that this allocator is determined when the reducer
* is constructed. The following two examples may have very different
* behavior:
*
* vector<Type, Allocator> a_vector;
*
* reducer< op_vector<Type, Allocator> reducer1(move_in(a_vector));
* ... parallel computation ...
* reducer1.move_out(a_vector);
*
* reducer< op_vector<Type, Allocator> reducer2;
* reducer2.move_in(a_vector);
* ... parallel computation ...
* reducer2.move_out(a_vector);
*
* * `reducer1` will be constructed with the same allocator as `a_vector`,
* because the vector was specified in the constructor. The `move_in`
* and`move_out` can therefore be done with a `swap` in constant time.
* * `reducer2` will be constructed with a _default_ allocator of type
* `Allocator`, which may not be the same as the allocator of `a_vector`.
* Therefore, the `move_in` and `move_out` may have to be done with a
* copy in _O(N)_ time.
*
* (All instances of an allocator class with no internal state (like
* `std::allocator`) are "the same". You only need to worry about the "same
* allocator" issue when you create vector reducers with a custom allocator
* class that has data members.)
*
* @section redvector_types Type and Operator Requirements
*
* `std::vector<Type, Alloc>` must be a valid type.
*/
namespace cilk {
/** @ingroup ReducersVector */
//@{
/** @brief The vector reducer view class.
*
* This is the view class for reducers created with
* `cilk::reducer< cilk::op_vector<Type, Allocator> >`. It holds the
* accumulator variable for the reduction, and allows only append operations
* to be performed on it.
*
* @note The reducer "dereference" operation (`reducer::operator *()`)
* yields a reference to the view. Thus, for example, the view
* class's `push_back` operation would be used in an expression like
* `r->push_back(a)`, where `r` is a vector reducer variable.
*
* @tparam Type The vector element type (not the vector type).
* @tparam Alloc The vector allocator type.
*
* @see @ref ReducersVector
* @see op_vector
*/
template<typename Type, typename Alloc>
class op_vector_view
{
typedef std::vector<Type, Alloc> vector_type;
typedef std::list<vector_type, typename Alloc::template rebind<vector_type>::other>
list_type;
typedef typename vector_type::size_type size_type;
// The view's value is represented by a list of vectors and a single
// vector. The value is the concatenation of the vectors in the list with
// the single vector at the end. All vector operations apply to the single
// vector; reduce operations cause lists of partial vectors from multiple
// strands to be combined.
//
mutable vector_type m_vector;
mutable list_type m_list;
// Before returning the value of the reducer, concatenate all the vectors
// in the list with the single vector.
//
void flatten() const
{
if (m_list.empty()) return;
typename list_type::iterator i;
size_type len = m_vector.size();
for (i = m_list.begin(); i != m_list.end(); ++i)
len += i->size();
vector_type result(get_allocator());
result.reserve(len);
for (i = m_list.begin(); i != m_list.end(); ++i)
result.insert(result.end(), i->begin(), i->end());
m_list.clear();
result.insert(result.end(), m_vector.begin(), m_vector.end());
result.swap(m_vector);
}
public:
/** @name Monoid support.
*/
//@{
/// Required by cilk::monoid_with_view
typedef vector_type value_type;
/// Required by @ref op_vector
Alloc get_allocator() const
{
return m_vector.get_allocator();
}
/** Reduces the views of two strands.
*
* This function is invoked by the @ref op_vector monoid to combine
* the views of two strands when the right strand merges with the left
* one. It appends the value contained in the right-strand view to the
* value contained in the left-strand view, and leaves the value in the
* right-strand view undefined.
*
* @param other A pointer to the right-strand view. (`this` points to
* the left-strand view.)
*
* @note Used only by the @ref op_vector monoid to implement the
* monoid reduce operation.
*/
void reduce(op_vector_view* other)
{
if (!other->m_vector.empty() || !other->m_list.empty()) {
// (list, string) + (other_list, other_string) =>
// (list + {string} + other_list, other_string)
if (!m_vector.empty()) {
// simulate m_list.push_back(std::move(m_vector))
m_list.push_back(vector_type(get_allocator()));
m_list.back().swap(m_vector);
}
m_list.splice(m_list.end(), other->m_list);
m_vector.swap(other->m_vector);
}
}
//@}
/** @name Passes constructor arguments to the vector constructor.
*/
//@{
op_vector_view() :
m_vector(), m_list(get_allocator()) {}
template <typename T1>
op_vector_view(const T1& x1) :
m_vector(x1), m_list(get_allocator()) {}
template <typename T1, typename T2>
op_vector_view(const T1& x1, const T2& x2) :
m_vector(x1, x2), m_list(get_allocator()) {}
template <typename T1, typename T2, typename T3>
op_vector_view(const T1& x1, const T2& x2, const T3& x3) :
m_vector(x1, x2, x3), m_list(get_allocator()) {}
template <typename T1, typename T2, typename T3, typename T4>
op_vector_view(const T1& x1, const T2& x2, const T3& x3, const T4& x4) :
m_vector(x1, x2, x3, x4), m_list(get_allocator()) {}
//@}
/** Move-in constructor.
*/
explicit op_vector_view(cilk::move_in_wrapper<value_type> w) :
m_vector(w.value().get_allocator()),
m_list(w.value().get_allocator())
{
m_vector.swap(w.value());
}
/** @name Reducer support.
*/
//@{
void view_move_in(vector_type& v)
{
m_list.clear();
if (get_allocator() == v.get_allocator()) {
// Equal allocators. Do a (fast) swap.
m_vector.swap(v);
}
else {
// Unequal allocators. Do a (slow) copy.
m_vector = v;
}
v.clear();
}
void view_move_out(vector_type& v)
{
flatten();
if (get_allocator() == v.get_allocator()) {
// Equal allocators. Do a (fast) swap.
m_vector.swap(v);
}
else {
// Unequal allocators. Do a (slow) copy.
v = m_vector;
m_vector.clear();
}
}
void view_set_value(const vector_type& v)
{
m_list.clear();
m_vector = v;
}
vector_type const& view_get_value() const
{
flatten();
return m_vector;
}
typedef vector_type const& return_type_for_get_value;
//@}
/** @name View modifier operations.
*
* @details These simply wrap the corresponding operations on the
* underlying vector.
*/
//@{
/** Adds an element at the end of the list.
*
* Equivalent to `vector.push_back()`
*/
void push_back(const Type x)
{
m_vector.push_back(x);
}
/** @name Insert elements at the end of the vector.
*
* Equivalent to `vector.insert(vector.end(), )`
*/
//@{
void insert_back(const Type& element)
{ m_vector.insert(m_vector.end(), element); }
void insert_back(typename vector_type::size_type n, const Type& element)
{ m_vector.insert(m_vector.end(), n, element); }
template <typename Iter>
void insert_back(Iter first, Iter last)
{ m_vector.insert(m_vector.end(), first, last); }
//@}
//@}
};
/** @brief The vector append monoid class.
*
* Instantiate the cilk::reducer template class with an op_vector monoid to
* create a vector reducer class. For example, to concatenate a
* collection of integers:
*
* cilk::reducer< cilk::op_vector<int> > r;
*
* @tparam Type The vector element type (not the vector type).
* @tparam Alloc The vector allocator type.
*
* @see ReducersVector
* @see op_vector_view
* @ingroup ReducersVector
*/
template<typename Type, typename Alloc = std::allocator<Type> >
class op_vector :
public cilk::monoid_with_view< op_vector_view<Type, Alloc>, false >
{
typedef cilk::monoid_with_view< op_vector_view<Type, Alloc>, false > base;
typedef provisional_guard<typename base::view_type> view_guard;
// The allocator to be used when constructing new views.
Alloc m_allocator;
public:
/// View type.
typedef typename base::view_type view_type;
/** Constructor.
*
* There is no default constructor for vector monoids, because the
* allocator must always be specified.
*
* @param allocator The list allocator to be used when
* identity-constructing new views.
*/
op_vector(const Alloc& allocator = Alloc()) : m_allocator(allocator) {}
/** Creates an identity view.
*
* Vector view identity constructors take the vector allocator as an
* argument.
*
* @param v The address of the uninitialized memory in which the view
* will be constructed.
*/
void identity(view_type *v) const
{
::new((void*) v) view_type(m_allocator);
}
/** @name construct functions
*
* A vector append monoid must have a copy of the allocator of
* the leftmost view's vector, so that it can use it in the `identity`
* operation. This, in turn, requires that vector append monoids have a
* specialized `construct()` function.
*
* All vector append monoid `construct()` functions first construct the
* leftmost view, using the arguments that were passed in from the reducer
* constructor. They then call the view's `get_allocator()` function to
* get the vector allocator from the vector in the leftmost view, and pass
* that to the monoid constructor.
*/
//@{
static void construct(op_vector* monoid, view_type* view)
{
view_guard vg( new((void*) view) view_type() );
vg.confirm_if( new((void*) monoid) op_vector(view->get_allocator()) );
}
template <typename T1>
static void construct(op_vector* monoid, view_type* view, const T1& x1)
{
view_guard vg( new((void*) view) view_type(x1) );
vg.confirm_if( new((void*) monoid) op_vector(view->get_allocator()) );
}
template <typename T1, typename T2>
static void construct(op_vector* monoid, view_type* view,
const T1& x1, const T2& x2)
{
view_guard vg( new((void*) view) view_type(x1, x2) );
vg.confirm_if( new((void*) monoid) op_vector(view->get_allocator()) );
}
template <typename T1, typename T2, typename T3>
static void construct(op_vector* monoid, view_type* view,
const T1& x1, const T2& x2, const T3& x3)
{
view_guard vg( new((void*) view) view_type(x1, x2, x3) );
vg.confirm_if( new((void*) monoid) op_vector(view->get_allocator()) );
}
//@}
};
} // namespace cilk
#endif // REDUCER_VECTOR_H_INCLUDED

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2010-2013, Intel Corporation
* Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2010-2013, Intel Corporation
* Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2013, Intel Corporation
* Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************
*

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2011-2013, Intel Corporation
* Copyright (C) 2011-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************
*

View File

@ -1,11 +1,9 @@
/*
* abi.h
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -20,7 +18,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -33,6 +30,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
******************************************************************************/
@ -460,6 +471,20 @@ CILK_ABI(void) __cilkrts_enter_frame_fast_1(__cilkrts_stack_frame *sf);
*/
CILK_ABI(void) __cilkrts_leave_frame(__cilkrts_stack_frame *sf);
/**
* Suspends the runtime by notifying the workers that they should not try to
* steal. This function is supposed to be called from a non-parallel region
* (i.e., after cilk_sync in the top-level spawning function). Otherwise,
* which workers are sleeping or busy is unpredictable in general.
* The runtime can be resumed by calling __cilkrts_resume().
*/
CILK_ABI(void) __cilkrts_suspend(void);
/**
* Resumes the runtime by notifying the workers that they can steal.
*/
CILK_ABI(void) __cilkrts_resume(void);
/**
* Wait for any spawned children of this function to complete before
* continuing. This function will only return when the join counter

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2011-2013, Intel Corporation
* Copyright (C) 2011-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -1,10 +1,8 @@
// cilk_version.h
//
// @copyright
// Copyright (C) 2009-2013, Intel Corporation
// Copyright (C) 2009-2016, Intel Corporation
// All rights reserved.
//
// @copyright
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@ -19,7 +17,6 @@
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// @copyright
// 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
@ -32,16 +29,30 @@
// 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.
//
// *********************************************************************
//
// PLEASE NOTE: This file is a downstream copy of a file mainitained in
// a repository at cilkplus.org. Changes made to this file that are not
// submitted through the contribution process detailed at
// http://www.cilkplus.org/submit-cilk-contribution will be lost the next
// time that a new version is released. Changes only submitted to the
// GNU compiler collection or posted to the git repository at
// https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
// not tracked.
//
// We welcome your contributions to this open source project. Thank you
// for your assistance in helping us improve Cilk Plus.
// DO NOT EDIT THIS FILE!
//
// It was automatically generated by cilkrts/include/internal/Makefile
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_BUILD 3902
#define VERSION_BUILD 4420
#define VERSION_REV 0
#define VERSION_STRING "2,0,3902,0"
#define VERSION_HASH "b4e38f4f7e3e"
#define VERSION_BRANCH "v14.0"
#define TBB_REV_NUMBER ""
#define VERSION_YEAR "2013"
#define VERSION_STRING "2,0,4420,0"
#define VERSION_HASH "3b2d6aa9059c"
#define VERSION_BRANCH "eng"
#define TBB_REV_NUMBER "14788"
#define VERSION_YEAR "2015"

View File

@ -1,11 +1,9 @@
// -*- C++ -*-
/*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -20,7 +18,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -33,6 +30,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
******************************************************************************
*

View File

@ -1,10 +1,8 @@
#########################################################################
#
# @copyright
# Copyright (C) 2011-2013, Intel Corporation
# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ -19,7 +17,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# @copyright
# 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
@ -32,10 +29,24 @@
# 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.
#
# *********************************************************************
#
# PLEASE NOTE: This file is a downstream copy of a file mainitained in
# a repository at cilkplus.org. Changes made to this file that are not
# submitted through the contribution process detailed at
# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
# time that a new version is released. Changes only submitted to the
# GNU compiler collection or posted to the git repository at
# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
# not tracked.
#
# We welcome your contributions to this open source project. Thank you
# for your assistance in helping us improve Cilk Plus.
###########################################################################
# DO NOT EDIT THIS FILE!
#
# It was automatically generated by cilkrts/include/internal/Makefile
CILK_REVISION = 3902
CILK_REVISION = 4420

View File

@ -1,10 +1,8 @@
#########################################################################
#
# @copyright
# Copyright (C) 2009-2013, Intel Corporation
# Copyright (C) 2009-2016, Intel Corporation
# All rights reserved.
#
# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ -19,7 +17,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# @copyright
# 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
@ -32,6 +29,20 @@
# 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.
#
# *********************************************************************
#
# PLEASE NOTE: This file is a downstream copy of a file mainitained in
# a repository at cilkplus.org. Changes made to this file that are not
# submitted through the contribution process detailed at
# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
# time that a new version is released. Changes only submitted to the
# GNU compiler collection or posted to the git repository at
# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
# not tracked.
#
# We welcome your contributions to this open source project. Thank you
# for your assistance in helping us improve Cilk Plus.
###########################################################################
# cilk-version.mk
#

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/*

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "bug.h"
@ -54,7 +65,7 @@ __CILKRTS_BEGIN_EXTERN_C
COMMON_PORTABLE const char *const __cilkrts_assertion_failed =
"%s:%d: cilk assertion failed: %s\n";
COMMON_PORTABLE void __cilkrts_bug(const char *fmt,...) cilk_nothrow
COMMON_PORTABLE NORETURN __cilkrts_bug(const char *fmt,...) cilk_nothrow
{
#if defined (_WIN32) && defined(_DEBUG)
_CRTIMP void __cdecl _wassert(__in_z const wchar_t * _Message,

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2010-2013, Intel Corporation
* Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@ -47,6 +58,13 @@
#define CILK_C_DEFINE_REDUCERS
#ifdef _WRS_KERNEL
#define WCHAR_MIN 0
#define WCHAR_MAX USHRT_MAX
#define WINT_MIN INT_MIN
#define WINT_MAX INT_MAX
#endif
#include <cilk/reducer_opadd.h>
#include <cilk/reducer_opand.h>
#include <cilk/reducer_opmul.h>

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2011, 2013, Intel Corporation
* Copyright (C) 2011-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@ -405,6 +416,9 @@ CILK_ABI_THROWS_VOID __cilkrts_cilk_for_32(__cilk_abi_f32_t body, void *data,
CILK_ABI_THROWS_VOID __cilkrts_cilk_for_64(__cilk_abi_f64_t body, void *data,
cilk64_t count, int grain)
{
// Cilkscreen should not report this call in a stack trace
NOTIFY_ZC_INTRINSIC((char *)"cilkscreen_hide_call", 0);
// Check for an empty range here as an optimization - don't need to do any
// __cilkrts_stack_frame initialization
if (count > 0)

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2013, Intel Corporation
* Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/*

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2013, Intel Corporation
* Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2010-2013, Intel Corporation
* Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@ -296,6 +307,45 @@ CILK_ABI_VOID __cilkrts_sync(__cilkrts_stack_frame *sf)
__cilkrts_c_sync(w, sf);
}
/**
* Suspends the runtime by notifying the workers that they should not try to
* steal. This function is supposed to be called from a non-parallel region
* (i.e., after cilk_sync in the top-level spawning function). Otherwise,
* which workers are sleeping or busy is unpredictable in general.
* The runtime can be resumed by calling __cilkrts_resume().
*/
CILK_ABI_VOID __cilkrts_suspend(void)
{
global_state_t *g = cilkg_get_global_state();
if (NULL == g || g->P < 2)
return;
__cilkrts_worker *w = __cilkrts_get_tls_worker();
// Do nothing if worker/frame is not available
if (NULL == w || NULL == w->current_stack_frame)
return;
// Do nothing if this was called within a parallel region.
__cilkrts_stack_frame *sf = w->current_stack_frame;
if (0 == (sf->flags & CILK_FRAME_LAST) || (sf->flags & CILK_FRAME_UNSYNCHED))
return;
__cilkrts_worker *root = g->workers[0];
root->l->steal_failure_count = g->max_steal_failures + 1;
CILK_ASSERT(root->l->signal_node);
signal_node_msg(root->l->signal_node, 0);
}
/**
* Resumes the runtime by notifying the workers that they can steal.
*/
CILK_ABI_VOID __cilkrts_resume(void)
{
global_state_t *g = cilkg_get_global_state();
if (NULL == g || g->P < 2)
return;
__cilkrts_worker *root = g->workers[0];
CILK_ASSERT(root->l->signal_node);
signal_node_msg(root->l->signal_node, 1);
}
/*
* __cilkrts_get_sf
*
@ -391,6 +441,10 @@ CILK_ABI_WORKER_PTR BIND_THREAD_RTN(void)
__cilkrts_set_tls_worker(w);
__cilkrts_cilkscreen_establish_worker(w);
START_INTERVAL(w, INTERVAL_IN_SCHEDULER);
START_INTERVAL(w, INTERVAL_IN_RUNTIME);
{
full_frame *ff = __cilkrts_make_full_frame(w, 0);
@ -462,13 +516,10 @@ CILK_ABI_WORKER_PTR BIND_THREAD_RTN(void)
global_os_mutex_unlock();
/* If there's only 1 worker, the counts will be started in
* __cilkrts_scheduler */
if (g->P > 1)
{
START_INTERVAL(w, INTERVAL_IN_SCHEDULER);
START_INTERVAL(w, INTERVAL_WORKING);
}
/* We are about to switch back into user code after binding the
thread. Start working again. */
STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_WORKING);
ITT_SYNC_RELEASING(&unique_obj);

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_CILK_ITTNOTIFY_DOT_H

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/*

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2012-2013, Intel Corporation
* Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "cilk_fiber-unix.h"
@ -47,33 +58,32 @@
#include <errno.h>
#include <sys/mman.h>
#include <unistd.h>
// You'd think that getting a defintion for alloca would be easy. But you'd
// be wrong. Here's a variant on what's recommended in the autoconf doc. I've
// remove the Windows portion since this is Unix-specific code.
#if defined HAVE_ALLOCA_H
# include <alloca.h>
#elif defined __GNUC__
# define alloca __builtin_alloca
#elif defined _AIX
# define alloca __alloca
#else
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
void *alloca (size_t);
#endif
#include "declare-alloca.h"
// MAP_ANON is deprecated on Linux, but seems to be required on Mac...
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
# define MAP_ANONYMOUS MAP_ANON
#endif
// MAP_STACK and MAP_GROWSDOWN have no affect in Linux as of 2014-04-04, but
// could be very useful in future versions. If they are not defined, then set
// them to zero (no bits set).
#ifndef MAP_STACK
# define MAP_STACK 0
#endif
#ifndef MAP_GROWSDOWN
# define MAP_GROWSDOWN 0
#endif
// Magic number for sanity checking fiber structure
const unsigned magic_number = 0x5afef00d;
int cilk_fiber_sysdep::s_page_size = getpagesize();
// Page size for stacks
#ifdef _WRS_KERNEL
long cilk_fiber_sysdep::s_page_size = 4096;
#else
long cilk_fiber_sysdep::s_page_size = sysconf(_SC_PAGESIZE);
#endif
cilk_fiber_sysdep::cilk_fiber_sysdep(std::size_t stack_size)
: cilk_fiber(stack_size)
@ -270,7 +280,7 @@ void cilk_fiber_sysdep::make_stack(size_t stack_size)
p = (char*)mmap(0, rounded_stack_size,
PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK|MAP_GROWSDOWN,
-1, 0);
if (MAP_FAILED == p) {
// For whatever reason (probably ran out of memory), mmap() failed.

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2012-2013, Intel Corporation
* Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_CILK_FIBER_UNIX_DOT_H
@ -126,13 +137,12 @@ struct cilk_fiber_sysdep : public cilk_fiber
inline char* get_stack_base_sysdep() { return m_stack_base; }
private:
char* m_stack_base; ///< The base of this fiber's stack.
char* m_stack; // Stack memory (low address)
__CILK_JUMP_BUFFER m_resume_jmpbuf; // Place to resume fiber
unsigned m_magic; // Magic number for checking
char* m_stack_base; ///< The base of this fiber's stack.
char* m_stack; ///< Stack memory (low address)
__CILK_JUMP_BUFFER m_resume_jmpbuf; ///< Place to resume fiber
unsigned m_magic; ///< Magic number for checking
static int s_page_size; // Page size for
// stacks.
static long s_page_size; ///< Page size for stacks.
// Allocate memory for a stack. This method
// initializes m_stack and m_stack_base.

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2012-2013, Intel Corporation
* Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/* Implementations of non-platform-specific aspects of cilk_fiber, especially

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2012-2013, Intel Corporation
* Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,12 +31,26 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "cilk_malloc.h"
#include <stdlib.h>
#if defined _WIN32 || defined _WIN64 || defined __linux__
#if defined _WIN32 || defined _WIN64 || defined __GLIBC__ || defined __linux__
#include <malloc.h>
#define HAS_MEMALIGN 1
#endif

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -0,0 +1,94 @@
/* cilk_str_mem.h -*-C-*-
*
*************************************************************************
*
* Copyright (C) 2014-2016, Intel Corporation
* 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 Intel Corporation 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
* HOLDER 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
* @file cilk_str_mem.h
*
* @breif Interface to safe string/memmory C API to replace banned C API.
*/
#ifndef INCLUDED_CILK_STR_MEM_DOT_H
#define INCLUDED_CILK_STR_MEM_DOT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _WIN32
# include "safe_lib.h"
# include "snprintf_s.h"
#define cilk_strlen(str) strnlen_s(str, RSIZE_MAX_STR)
#define cilk_strcpy_s strcpy_s
// Different sprintf entries with different argument lists.
#define cilk_snprintf_s snprintf_s_s
#define cilk_snprintf_i snprintf_s_i
#define cilk_snprintf_l snprintf_s_l
#define cilk_snprintf_si snprintf_s_si
#define cilk_snprintf_sl snprintf_s_sl
#else // ! defined _WIN32
#define CILK_MAX_STR (4UL << 10) // 4KB
#define cilk_strlen(str) strnlen_s(str, CILK_MAX_STR)
#define cilk_strcpy_s strcpy_s
#define cilk_snprintf_s sprintf_s
#define cilk_snprintf_i sprintf_s
#define cilk_snprintf_l sprintf_s
#define cilk_snprintf_si sprintf_s
#define cilk_snprintf_sl sprintf_s
#endif // ! defined _WIN32
#ifdef __cplusplus
}
#endif
#endif // INCLUDED_CILK_STR_MEM_DOT_H

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_COMPONENT_DOT_H

View File

@ -0,0 +1,115 @@
/* cilk-abi-vla.cpp -*-C++-*-
*
*************************************************************************
*
* Copyright (C) 2013-2016, Intel Corporation
* 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 Intel Corporation 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
* HOLDER 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
/*
* Implementation of Variable Length Array (VLA) ABI.
*
* The compiler calls these functions to allocate Variable Length Arrays
* at runtime. The compiler must guarantee that __cilkrts_stack_free() is
* called to cleanup any memory allocated by __cilkrts_stack_alloc().
*
* This generic implementation always allocates the memory from the heap.
* Optimally, the implementation should expand the frame of the calling
* function if possible, since that will be faster. See the x86 version
* for one possible implementation.
*/
#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include "internal/abi.h"
#include "cilk-abi-vla-internal.h"
// Allocate space for a variable length array
CILK_ABI(__cilkrts_void_ptr)
__cilkrts_stack_alloc(
__cilkrts_stack_frame *sf,
size_t size,
size_t distance_from_sp_to_alloca_area,
uint32_t align, // align is always >= minimum stack alignment and
// >= ptr_size as well, and must be a power of 2.
uint32_t needs_tag // non-zero if the pointer being returned needs to
// be tagged
)
{
// full_size will be a multiple of align, and contains
// enough extra space to allocate a marker.
size_t full_size = (size + align - 1) & ~(align - 1);
// Allocate memory from the heap. The compiler is responsible
// for guaranteeing us a chance to free it before the function
// exits
return (void *)vla_internal_heap_alloc(sf, full_size, align);
}
// Free the space allocated for a variable length array.
CILK_ABI(void)
__cilkrts_stack_free(
__cilkrts_stack_frame *sf,
void *p,
size_t size,
size_t distance_from_sp_to_alloca_area,
uint32_t align, // same requirements as for align in allocation,
// and must match alignment that was passed when
// doing the allocation
uint32_t known_from_stack // non-zero if this is known to be allocated
// on the stack, and therefore has no tag
)
{
// full_size will be a multiple of align, and contains
// enough extra space to allocate a marker if one was needed.
size_t full_size = (size + align - 1) & ~(align - 1);
// Just free the allocated memory to the heap since we don't know
// how to expand/contract the calling frame
vla_internal_heap_free(p, full_size);
}

View File

@ -0,0 +1,64 @@
/* os.h -*-C++-*-
*
*************************************************************************
*
* Copyright (C) 2009-2016, Intel Corporation
* 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 Intel Corporation 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
* HOLDER 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/*
* void __cilkrts_fence(void)
*
* Executes an MFENCE instruction to serialize all load and store instructions
* that were issued prior the MFENCE instruction. This serializing operation
* guarantees that every load and store instruction that precedes the MFENCE
* instruction is globally visible before any load or store instruction that
* follows the MFENCE instruction. The MFENCE instruction is ordered with
* respect to all load and store instructions, other MFENCE instructions, any
* SFENCE and LFENCE instructions, and any serializing instructions (such as
* the CPUID instruction).
*/
// COMMON_SYSDEP void __cilkrts_fence(void); ///< MFENCE instruction
# define __cilkrts_fence() __asm__ __volatile__ ("mcr p15,0,%[t],c7,c10,4\n" :: [t] "r" (0) : "memory");

View File

@ -0,0 +1,105 @@
/* os-unix-sysdep.c -*-C-*-
*
*************************************************************************
*
* Copyright (C) 2009-2016, Intel Corporation
* 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 Intel Corporation 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
* HOLDER 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*************************************************************************
*
* This file contains generic implementations of system-specific code for
* Unix-based systems
*/
#include "os.h"
#include "sysdep.h"
/*
* The cycle counter is used for debugging. This funciton is only called if
* CILK_PROFILE is defined when the runtime is built.
*/
COMMON_SYSDEP unsigned long long __cilkrts_getticks(void)
{
# warning "unimplemented cycle counter"
return 0;
}
/*
* A "short pause" - called from the Cilk runtime's spinloops.
*/
COMMON_SYSDEP void __cilkrts_short_pause(void)
{
# warning __cilkrts_short_pause empty
}
/*
* Interlocked exchange - used to implement the Cilk runtime's spinloops
*/
COMMON_SYSDEP int __cilkrts_xchg(volatile int *ptr, int x)
{
x = __sync_lock_test_and_set(ptr, x);
return x;
}
/*
* Restore the floating point state that is stored in a stack frame at each
* spawn. This should be called each time a frame is resumed.
*
* Only valid for IA32 and Intel64 processors.
*/
void restore_x86_fp_state (__cilkrts_stack_frame *sf)
{
}
/*
* Save the floating point state to the __cilkrts_stack_frame at each spawn.
*
* Architecture-specific - Should only be needed on IA32 and Intel64
* processors.
*/
void sysdep_save_fp_ctrl_state(__cilkrts_stack_frame *sf)
{
}

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2013, Intel Corporation
* Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@ -103,5 +114,5 @@ __cilkrts_stack_free(
// Just free the allocated memory to the heap since we don't know
// how to expand/contract the calling frame
vla_internal_heap_free(t, full_size);
vla_internal_heap_free(p, full_size);
}

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/*

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*************************************************************************
*
* This file contains generic implementations of system-specific code for

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2013, Intel Corporation
* Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@ -58,37 +69,21 @@
#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
// Getting a definition for alloca appears to be a pain in the butt. Here's
// a variant on what's recommended in the autoconf doc
#if defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#elif defined HAVE_ALLOCA_H
# include <alloca.h>
#elif defined __GNUC__
# define alloca __builtin_alloca
#elif defined _AIX
# define alloca __alloca
#else
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
void *alloca (size_t);
#endif
#include "declare-alloca.h"
#ifdef _WIN32
# define INLINE static __inline
# pragma warning(disable:1025) // Don't whine about zero extending result of unary operation
# define INLINE static __inline
# pragma warning(disable:1025) // Don't whine about zero extending result of unary operation
#else
# define INLINE static inline
# define INLINE static inline
#endif
#include "internal/abi.h"
#include "cilk-abi-vla-internal.h"
#ifdef __INTEL_COMPILER
// These functions are used only within __INTEL_COMPILER.
#if defined(__x86_64) || defined(_M_X64)
INLINE void setsp(void *val)
{
@ -151,7 +146,7 @@ INLINE void copy_frame_up_and_move_bp(
"movq %2, %%rcx;"
"shrq $3, %%rcx;"
"std; rep movsq; cld;"
"movl %3, %%rbp;" :
"movq %3, %%rbp;" :
:
"rm"(dst), "rm"(src), "rm"(cpy_bytes), "rm"(new_ebp) :
"rsi", "rdi", "rcx", "rbp", "memory");
@ -226,6 +221,7 @@ INLINE void copy_frame_up_and_move_bp(
}
#endif
#endif // __INTEL_COMPILER
#define c_cilk_ptr_from_heap 0xc2f2f00d
#define c_cilk_ptr_from_stack 0xc3f30d0f
@ -241,11 +237,17 @@ __cilkrts_stack_alloc(
// be tagged
)
{
#ifdef __INTEL_COMPILER
// full_size will be a multiple of align, and contains
// enough extra space to allocate a marker.
size_t full_size = (size + align - 1) & ~(align - 1);
#ifndef __INTEL_COMPILER
// Allocate memory from the heap. The compiler is responsible
// for guaranteeing us a chance to free it before the function
// exits
return (void *)vla_internal_heap_alloc(sf, full_size, align);
#else
if (needs_tag) {
full_size += align;
}
@ -336,10 +338,7 @@ __cilkrts_stack_alloc(
}
return t;
#else // Not __INTEL_COMPILER
// Not supported unless we can figure out how to get the size of the frame
return NULL;
#endif
#endif // __INTEL_COMPILER
}
// This frees the space allocated for a variable length array.
@ -356,12 +355,17 @@ __cilkrts_stack_free(
// on the stack, and therefore has no tag
)
{
#ifdef __INTEL_COMPILER
uint32_t *t = (uint32_t*)p;
// full_size will be a multiple of align, and contains
// enough extra space to allocate a marker if one was needed.
size_t full_size = (size + align - 1) & ~(align - 1);
#ifndef __INTEL_COMPILER
// Just free the allocated memory to the heap since we don't know
// how to expand/contract the calling frame
vla_internal_heap_free(p, full_size);
#else
uint32_t *t = (uint32_t*)p;
if (known_from_stack == 0) {
// if the compiler hasn't told the run-time that this is
// known to be on the stack, then this pointer must have been
@ -435,7 +439,5 @@ __cilkrts_stack_free(
else {
vla_internal_heap_free(t, full_size);
}
#else // Not __INTEL_COMPILER
// Not supported unless we can figure out how to get the size of the frame
#endif
#endif // __INTEL_COMPILER
}

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/* gcc before 4.4 does not implement __sync_synchronize properly */

View File

@ -2,7 +2,7 @@
*
*************************************************************************
*
* Copyright (C) 2009-2014, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*************************************************************************
*
* This file contains system-specific code for Unix systems
@ -96,7 +110,7 @@ COMMON_SYSDEP int __cilkrts_xchg(volatile int *ptr, int x)
* This declaration should generate an error when the Intel compiler adds
* supprt for the intrinsic.
*/
#ifdef __INTEL_COMPILER
#if defined(__INTEL_COMPILER) || defined(__clang__)
static inline int __builtin_cpu_supports(const char *feature)
{
return 1;
@ -124,7 +138,6 @@ void restore_x86_fp_state (__cilkrts_stack_frame *sf) {
#endif
}
void sysdep_save_fp_ctrl_state(__cilkrts_stack_frame *sf)
{
// If we're not going to restore, don't bother saving it
@ -135,7 +148,7 @@ void sysdep_save_fp_ctrl_state(__cilkrts_stack_frame *sf)
{
__asm__ ("stmxcsr %0" : "=m" (sf->mxcsr));
}
__asm__ ("fnstcw %0" : "=m" (sf->fpcsr));
__asm__ ("fnstcw %0" : "=m" (sf->fpcsr));
}
#endif
}

View File

@ -1,12 +1,10 @@
/* symbol_test.c -*-C-*-
/* cilk-abi-vla.cpp -*-C++-*-
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2013-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,30 +31,41 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
/* simple program to verify that there are no undefined symbols in the runtime.
* If the runtime uses any symbols that are not defined, compiling this program
* will cause a linker error.
/*
* You'd think that getting a declaration for alloca would be easy. But you'd
* be wrong. Here's a variant on what's recommended in the autoconf doc
*/
#define _Cilk_for for
extern void* __cilkrts_global_state;
void *volatile p;
void foo () { }
int main ()
{
int i;
long long j;
_Cilk_spawn foo();
_Cilk_for (i = 0; i < 2; ++i)
foo();
_Cilk_for (j = 0; j < 2; ++j)
foo();
p = __cilkrts_global_state;
return 0;
}
/* End symbol_test.c */
#if defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#elif defined HAVE_ALLOCA_H
# include <alloca.h>
#elif defined __GNUC__
# define alloca __builtin_alloca
#elif defined _AIX
# define alloca __alloca
#else
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
void *alloca (size_t);
#endif

View File

@ -1,11 +1,9 @@
<doxygenlayout version="1.0">
<!--
# @copyright
# Copyright (C) 2011-2013, Intel Corporation
# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ -20,7 +18,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# @copyright
# 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
@ -33,6 +30,20 @@
# 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.
#
# *********************************************************************
#
# PLEASE NOTE: This file is a downstream copy of a file mainitained in
# a repository at cilkplus.org. Changes made to this file that are not
# submitted through the contribution process detailed at
# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
# time that a new version is released. Changes only submitted to the
# GNU compiler collection or posted to the git repository at
# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
# not tracked.
#
# We welcome your contributions to this open source project. Thank you
# for your assistance in helping us improve Cilk Plus.
-->
<!-- Navigation index tabs for HTML output -->

View File

@ -1,10 +1,8 @@
# Doxyfile 1.7.4
# @copyright
# Copyright (C) 2011-2013, Intel Corporation
# Copyright (C) 2011-2016, Intel Corporation
# All rights reserved.
#
# @copyright
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@ -19,7 +17,6 @@
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# @copyright
# 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
@ -32,6 +29,20 @@
# 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.
#
# *********************************************************************
#
# PLEASE NOTE: This file is a downstream copy of a file mainitained in
# a repository at cilkplus.org. Changes made to this file that are not
# submitted through the contribution process detailed at
# http://www.cilkplus.org/submit-cilk-contribution will be lost the next
# time that a new version is released. Changes only submitted to the
# GNU compiler collection or posted to the git repository at
# https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
# not tracked.
#
# We welcome your contributions to this open source project. Thank you
# for your assistance in helping us improve Cilk Plus.
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "except-gcc.h"
@ -100,12 +111,12 @@ static void
decode_exceptions(char *out, size_t len, struct pending_exception_info *info)
{
if (info->empty())
snprintf(out, len, "[empty]");
cilk_snprintf_s(out, len, "%s", "[empty]");
else if (info->rethrow)
snprintf(out, len, "[rethrow %p]",
info->runtime_state.caughtExceptions);
cilk_snprintf_l(out, len, "[rethrow %p]",
info->runtime_state.caughtExceptions);
else
snprintf(out, len, "[throw %p]", (void *)info->active);
cilk_snprintf_l(out, len, "[throw %p]", (void *)info->active);
}
#endif

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "frame_malloc.h"

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2010-2013, Intel Corporation
* Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_FULL_FRAME_DOT_H

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "global_state.h"
@ -57,7 +68,7 @@
// TBD: There is a race when multiple threads try to initialize the
// user_settable_values??
//
//
// Set to true if the user settable values portion of the global state
// singleton is initialized, even if the rest of the singleton is not
// initialized.
@ -69,9 +80,10 @@ namespace {
// cilkg_get_user_settable_values() is called and partially-zero-filled until
// cilkg_init_global_state() is called. The first field is filled in with
// the size of a void* for the debugger and must be valid before initialization
global_state_t global_state_singleton =
static global_state_t global_state_singleton =
{
sizeof(void *), // addr_size
sizeof(void *), // addr_size
GLOBAL_STATE_VERSION, // structure version
};
@ -93,13 +105,15 @@ inline bool strmatch(const char* a, const char* b)
return 0 == std::strcmp(a, b);
}
// Returns the integer value represented by the null-terminated string at 's'.
// Returns the integer value represented by the null-terminated, decimal string
// at 's'.
inline long to_long(const char* s)
{
char *end;
errno = 0;
return std::strtol(s, &end, 0);
return std::strtol(s, &end, 10);
}
#ifdef _WIN32
@ -571,7 +585,6 @@ global_state_t* cilkg_init_global_state()
void cilkg_publish_global_state(global_state_t* g)
{
// TBD: which one of these needs to be executed first? I say
// cilkg_singleton_ptr needs to be set last, with a mfence in
// between, since it is the flag that cilkg_is_published_is
@ -584,7 +597,15 @@ void cilkg_publish_global_state(global_state_t* g)
void cilkg_deinit_global_state()
{
cilkg_singleton_ptr = NULL;
__cilkrts_global_state = NULL;
// The pointer to the global state needs to remain valid for the
// debugger. Thus, we can't clear the following pointer.
// __cilkrts_global_state = NULL;
// We also don't reset the global state, so that if we resume
// execution after ending Cilk, user set variables (e.g., # of
// workers) remains valid.
}
int cilkg_is_published(void)

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
@ -69,6 +80,16 @@ enum record_replay_t {
REPLAY_LOG
};
/**
* @brief Global state structure version.
*
* Since the global state is exposed for debugger access, we need a version
* number to let it know that the version of the structure is what it expects
* to see. If any of the fields marked as (fixed) below are changed, the
* version number needs to be bumped.
*/
#define GLOBAL_STATE_VERSION 0
/**
* @brief The global state is a structure that is shared by all workers in
* Cilk.
@ -109,7 +130,9 @@ struct global_state_t { /* COMMON_PORTABLE */
* debugger integration library will need to be changed to match!!!
*************************************************************************/
int addr_size; ///< Number of bytes for an address, used by debugger (fixed)
uint16_t addr_size; ///< Number of bytes for an address, used by debugger (fixed)
uint16_t version; ///< Version of this structure (fixed)
int system_workers; ///< Number of system workers (fixed)

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "jmpbuf.h"

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -1,11 +1,9 @@
/*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -20,7 +18,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -33,6 +30,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
CILKABI0
@ -87,11 +98,13 @@ CILKABI1
__cilkrts_get_sf;
__cilkrts_get_stack_size;
__cilkrts_get_worker_rank;
__cilkrts_resume;
__cilkrts_save_fp_ctrl_state;
__cilkrts_stack_alloc;
__cilkrts_stack_free;
__cilkrts_suspend;
__cilkrts_watch_stack;
} CILKABI0;
};
CILKLIB1.02
{

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2010-2013, Intel Corporation
* Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -7,7 +7,7 @@ ___cilkrts_bump_worker_rank
___cilkrts_bump_worker_rank_internal
___cilkrts_cilk_for_32
___cilkrts_cilk_for_64
___cilkrts_debugger_notification
___cilkrts_dump_stats
___cilkrts_end_cilk
___cilkrts_enter_frame
@ -33,15 +33,17 @@ ___cilkrts_hyperobject_alloc
___cilkrts_hyperobject_dealloc
___cilkrts_hyperobject_noop_destroy
___cilkrts_init
___cilkrts_irml_version
___cilkrts_leave_frame
___cilkrts_metacall
___cilkrts_resume
___cilkrts_rethrow
___cilkrts_return_exception
___cilkrts_save_fp_ctrl_state
___cilkrts_set_param
___cilkrts_stack_alloc
___cilkrts_stack_free
___cilkrts_suspend
___cilkrts_sync
___cilkrts_synched
___cilkrts_watch_stack

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "metacall_impl.h"

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2010-2013, Intel Corporation
* Copyright (C) 2010-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,15 +31,22 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifdef __linux__
// define _GNU_SOURCE before *any* #include.
// Even <stdint.h> will break later #includes if this macro is not
// already defined when it is #included.
# define _GNU_SOURCE
#endif
#include "os.h"
#include "bug.h"
#include "cilk_malloc.h"
@ -51,22 +55,27 @@
#if defined __linux__
# include <sys/sysinfo.h>
# include <sys/syscall.h>
#elif defined __APPLE__
# include <sys/sysctl.h>
// Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
#elif defined __DragonFly__
// No additional include files
#elif defined __FreeBSD__
// No additional include files
#elif defined __CYGWIN__
// Cygwin on Windows - no additional include files
#elif defined __VXWORKS__
# include <vxWorks.h>
# include <vxCpuLib.h>
# include <taskLib.h>
# include <taskLib.h>
// Solaris
#elif defined __sun__ && defined __svr4__
# include <sched.h>
// OSes we know about which don't require any additional files
#elif defined __CYGWIN__ || \
defined __DragonFly__ || \
defined __FreeBSD__ || \
defined __GNU__
// No additional include files
#else
# error "Unsupported OS"
#endif
@ -311,39 +320,67 @@ static pid_t linux_gettid(void)
* mask is set by the offload library to force the offload code away from
* cores that have offload support threads running on them.
*/
static int linux_get_affinity_count (int tid)
static int linux_get_affinity_count ()
{
#if !defined HAVE_PTHREAD_AFFINITY_NP
return 0;
long system_cores = sysconf(_SC_NPROCESSORS_ONLN);
int affinity_cores = 0;
#if defined HAVE_PTHREAD_AFFINITY_NP
#if defined (CPU_ALLOC_SIZE) && ! defined(DONT_USE_CPU_ALLOC_SIZE)
// Statically allocated cpu_set_t's max out at 1024 cores. If
// CPU_ALLOC_SIZE is available, use it to support large numbers of cores
size_t cpusetsize = CPU_ALLOC_SIZE(system_cores);
cpu_set_t *process_mask = (cpu_set_t *)__cilkrts_malloc(cpusetsize);
// Get the affinity mask for this thread
int err = pthread_getaffinity_np(pthread_self(),
cpusetsize,
process_mask);
// Count the available cores.
if (0 == err)
affinity_cores = CPU_COUNT_S(cpusetsize, process_mask);
__cilkrts_free(process_mask);
#else
// CPU_ALLOC_SIZE isn't available, or this is the Intel compiler build
// and we have to support RHEL5. Use a statically allocated cpu_set_t
cpu_set_t process_mask;
// Extract the thread affinity mask
int err = sched_getaffinity (tid, sizeof(process_mask),&process_mask);
int err = pthread_getaffinity_np(pthread_self(),
sizeof(process_mask),
&process_mask);
if (0 != err)
if (0 == err)
{
return 0;
}
// We have extracted the mask OK, so now we can count the number of threads
// in it. This is linear in the maximum number of CPUs available, We
// could do a logarithmic version, if we assume the format of the mask,
// but it's not really worth it. We only call this at thread startup
// anyway.
int available_procs = 0;
int i;
for (i = 0; i < CPU_SETSIZE; i++)
{
if (CPU_ISSET(i, &process_mask))
// We have extracted the mask OK, so now we can count the number of
// threads in it. This is linear in the maximum number of CPUs
// available, We could do a logarithmic version, if we assume the
// format of the mask, but it's not really worth it. We only call
// this at thread startup anyway.
int i;
for (i = 0; i < CPU_SETSIZE; i++)
{
available_procs++;
if (CPU_ISSET(i, &process_mask))
{
affinity_cores++;
}
}
}
#endif // CPU_ALLOC_SIZE
#endif // ! defined HAVE_PTHREAD_AFFINITY_NP
return available_procs;
#endif
// If we've got a count of cores this thread is supposed to use, that's
// the number or cores we'll use. Otherwise, default to the number of
// cores on the system.
if (0 == affinity_cores)
return system_cores;
else
return affinity_cores;
}
#endif // defined (__linux__) && ! defined(__ANDROID__)
@ -356,43 +393,56 @@ static int linux_get_affinity_count (int tid)
COMMON_SYSDEP int __cilkrts_hardware_cpu_count(void)
{
#if defined __ANDROID__ || (defined(__sun__) && defined(__svr4__))
return sysconf (_SC_NPROCESSORS_ONLN);
#if defined __ANDROID__ || \
defined __CYGWIN__ || \
defined __DragonFly__ || \
defined __FreeBSD__ || \
(defined(__sun__) && defined(__svr4__))
return (int)sysconf(_SC_NPROCESSORS_ONLN);
#elif defined __MIC__
/// HACK: Usually, the 3rd and 4th hyperthreads are not beneficial
/// on KNC. Also, ignore the last core.
int P = sysconf (_SC_NPROCESSORS_ONLN);
return P/2 - 2;
int count = (int)sysconf (_SC_NPROCESSORS_ONLN);
return count/2 - 2;
#elif defined __linux__
int affinity_count = linux_get_affinity_count(linux_gettid());
return (0 != affinity_count) ? affinity_count : sysconf (_SC_NPROCESSORS_ONLN);
return linux_get_affinity_count();
#elif defined __APPLE__
int count = 0;
int cmd[2] = { CTL_HW, HW_NCPU };
int count;
size_t len = sizeof count;
int status = sysctl(cmd, 2, &count, &len, 0, 0);
assert(status >= 0);
assert((unsigned)count == count);
int status = sysctlbyname("hw.logicalcpu", &count, &len, 0, 0);
assert(0 == status);
return count;
#elif defined __FreeBSD__ || defined __CYGWIN__ || defined __DragonFly__
int ncores = sysconf(_SC_NPROCESSORS_ONLN);
return ncores;
// Just get the number of processors
// return sysconf(_SC_NPROCESSORS_ONLN);
#elif defined __VXWORKS__
return __builtin_popcount( vxCpuEnabledGet() );
return __builtin_popcount(vxCpuEnabledGet());
#else
#error "Unknown architecture"
#error "Unsupported architecture"
#endif
}
COMMON_SYSDEP void __cilkrts_idle(void)
{
// This is another version of __cilkrts_yield() to be used when
// silencing workers that are not stealing work.
#if defined(__ANDROID__) || \
defined(__FreeBSD__) || \
defined(__VXWORKS__) || \
(defined(__sun__) && defined(__svr4__))
sched_yield();
#elif defined(__MIC__)
_mm_delay_32(1024);
#elif defined(__linux__) || \
defined(__APPLE__)
usleep(10000);
#else
# error "Unsupported architecture"
#endif
}
COMMON_SYSDEP void __cilkrts_sleep(void)
{
#ifdef __VXWORKS__
taskDelay(1);
taskDelay(1);
#else
usleep(1);
#endif
@ -400,13 +450,14 @@ COMMON_SYSDEP void __cilkrts_sleep(void)
COMMON_SYSDEP void __cilkrts_yield(void)
{
#if __APPLE__ || __FreeBSD__ || __VXWORKS__
// On MacOS, call sched_yield to yield quantum. I'm not sure why we
#if defined(__ANDROID__) || \
defined(__APPLE__) || \
defined(__FreeBSD__) || \
defined(__VXWORKS__) || \
(defined(__sun__) && defined(__svr4__))
// Call sched_yield to yield quantum. I'm not sure why we
// don't do this on Linux also.
sched_yield();
#elif defined(__DragonFly__)
// On DragonFly BSD, call sched_yield to yield quantum.
sched_yield();
#elif defined(__MIC__)
// On MIC, pthread_yield() really trashes things. Arch's measurements
// showed that calling _mm_delay_32() (or doing nothing) was a better
@ -414,14 +465,12 @@ COMMON_SYSDEP void __cilkrts_yield(void)
// giving up the processor and latency starting up when work becomes
// available
_mm_delay_32(1024);
#elif defined(__ANDROID__) || (defined(__sun__) && defined(__svr4__))
// On Android and Solaris, call sched_yield to yield quantum. I'm not
// sure why we don't do this on Linux also.
sched_yield();
#else
#elif defined(__linux__)
// On Linux, call pthread_yield (which in turn will call sched_yield)
// to yield quantum.
pthread_yield();
#else
# error "Unsupported architecture"
#endif
}
@ -434,11 +483,10 @@ COMMON_SYSDEP __STDNS size_t cilkos_getenv(char* value, __STDNS size_t vallen,
const char* envstr = getenv(varname);
if (envstr)
{
size_t len = strlen(envstr);
size_t len = cilk_strlen(envstr);
if (len > vallen - 1)
return len + 1;
strcpy(value, envstr);
cilk_strcpy_s(value, vallen, envstr);
return len;
}
else
@ -479,11 +527,25 @@ COMMON_SYSDEP void cilkos_warning(const char *fmt, ...)
fflush(stderr);
}
#ifdef __VXWORKS__
#ifdef _WRS_KERNEL
void cilkStart()
{
__cilkrts_init_tls_variables();
}
#else
_WRS_CONSTRUCTOR(cilkInit, 100)
{
__cilkrts_init_tls_variables();
}
#endif
#else
static void __attribute__((constructor)) init_once()
{
/*__cilkrts_debugger_notification_internal(CILK_DB_RUNTIME_LOADED);*/
__cilkrts_init_tls_variables();
}
#endif
#define PAGE 4096

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**
@ -49,6 +60,7 @@
#include "rts-common.h"
#include "cilk/common.h"
#include "cilk-tbb-interop.h"
#include "cilk_str_mem.h"
#ifdef __cplusplus
# include <cstddef>
@ -156,6 +168,7 @@ COMMON_SYSDEP int __cilkrts_xchg(volatile int *ptr, int x);
COMMON_SYSDEP void __cilkrts_sleep(void); ///< Sleep briefly
COMMON_SYSDEP void __cilkrts_yield(void); ///< Yield quantum
COMMON_SYSDEP void __cilkrts_idle(void); ///< Idle
/**
* @brief Gets environment variable 'varname' and copy its value into 'value'.

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#include "os_mutex.h"

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2007-2013, Intel Corporation
* Copyright (C) 2007-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_PEDIGREES_DOT_H

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2012-2013, Intel Corporation
* Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@ -46,8 +57,8 @@
#include <stdlib.h>
// clang is really strict about printf formats, so use the annoying integer
// printf macros. Unfortunately they're not avaiable on Windows
#ifdef _WIN32
// printf macros. Unfortunately they're not available on Windows (or on VxWorks)
#if defined(_WIN32) || defined(_WRS_KERNEL)
#define PRIu64 "llu"
#else
#define __STDC_FORMAT_MACROS 1
@ -251,10 +262,9 @@ char * walk_pedigree_nodes(char *p, const __cilkrts_pedigree *pnode)
if (pnode->parent)
{
p = walk_pedigree_nodes(p, pnode->parent);
p += sprintf(p, "_");
p += cilk_snprintf_s(p, PEDIGREE_BUFF_SIZE, "%s", (char *) "_");
}
return p + sprintf(p, "%" PRIu64, pnode->rank);
return p + cilk_snprintf_l(p, PEDIGREE_BUFF_SIZE, "%" PRIu64, pnode->rank);
}
/**
@ -278,7 +288,7 @@ void write_to_replay_log (__cilkrts_worker *w, const char *type,
// If we don't have an initial pedigree node, just use "0" to fill the slot
if (NULL == initial_node)
strcpy(pedigree, "0");
cilk_strcpy_s(pedigree, PEDIGREE_BUFF_SIZE, "0");
else
walk_pedigree_nodes(pedigree, initial_node);
@ -544,7 +554,9 @@ void load_recorded_log(__cilkrts_worker *w)
FILE *f;
// Open the log for reading
sprintf(local_replay_file_name, "%s%d.cilklog", w->g->record_replay_file_name, w->self);
cilk_snprintf_si(local_replay_file_name, sizeof(local_replay_file_name),
"%s%d.cilklog", w->g->record_replay_file_name, w->self);
f = fopen(local_replay_file_name, "r");
// Make sure we found a log!
@ -701,7 +713,8 @@ void replay_init_workers(global_state_t *g)
for(i = 0; i < g->total_workers; ++i)
{
__cilkrts_worker *w = g->workers[i];
sprintf(worker_file_name, "replay_log_%d.cilklog", w->self);
cilk_snprintf_i(worker_file_name, sizeof(worker_file_name),
"replay_log_%d.cilklog", w->self);
w->l->record_replay_fptr = fopen(worker_file_name, "w+");
CILK_ASSERT(NULL != w->l->record_replay_fptr);
}
@ -717,9 +730,8 @@ void replay_init_workers(global_state_t *g)
for(i = 0; i < g->total_workers; ++i)
{
__cilkrts_worker *w = g->workers[i];
sprintf(worker_file_name, "%s%d.cilklog",
g->record_replay_file_name,
w->self);
cilk_snprintf_si(worker_file_name, sizeof(worker_file_name),
"%s%d.cilklog", g->record_replay_file_name, w->self);
w->l->record_replay_fptr = fopen(worker_file_name, "w+");
CILK_ASSERT(NULL != w->l->record_replay_fptr);
}

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2012-2013, Intel Corporation
* Copyright (C) 2012-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
* Patents Pending, Intel Corporation.
**************************************************************************/

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
/**

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2009-2013, Intel Corporation
* Copyright (C) 2009-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
#ifndef INCLUDED_RTS_COMMON_DOT_H
@ -64,8 +75,8 @@
#define COMMON_SYSDEP
#define NON_COMMON
#if !(defined __GNUC__ || defined __ICC)
# define __builtin_expect(a_, b_) a_
#if !(defined __GNUC__ || defined __ICC) || defined(_WRS_KERNEL)
# define __builtin_expect(a_, b_) (a_)
#endif
#ifdef __cplusplus
@ -103,7 +114,7 @@
* intrinsics (__notify_intrinsic()). For those that don't, #undef the
* following definition:
*/
//#define ENABLE_NOTIFY_ZC_INTRINSIC 1
#define ENABLE_NOTIFY_ZC_INTRINSIC 1
#if defined(__INTEL_COMPILER)
/* The notify intrinsic was introduced in ICC 12.0. */
@ -112,12 +123,16 @@
# endif
#elif defined(__VXWORKS__)
# undef ENABLE_NOTIFY_ZC_INTRINSIC
#elif defined(__GNUC__)
# // GCC doesn't support the notify intrinsic as of 4.9
# undef ENABLE_NOTIFY_ZC_INTRINSIC
#elif defined(__clang__)
# if !defined(__has_extension) || !__has_extension(notify_zc_intrinsic)
# undef ENABLE_NOTIFY_ZC_INTRINSIC
# endif
#elif defined(__arm__)
// __notify_zc_intrinsic not yet supported by gcc for ARM
#elif ! (defined(__x86_64__) || defined(__i386) \
|| defined(_M_X64) || defined(_M_IX86))
// __notify_zc_intrinsic currently supported only for intel architecture
# undef ENABLE_NOTIFY_ZC_INTRINSIC
#endif

View File

@ -2,11 +2,9 @@
*
*************************************************************************
*
* @copyright
* Copyright (C) 2007-2013, Intel Corporation
* Copyright (C) 2007-2016, Intel Corporation
* All rights reserved.
*
* @copyright
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -21,7 +19,6 @@
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* @copyright
* 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
@ -34,6 +31,20 @@
* 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.
*
* *********************************************************************
*
* PLEASE NOTE: This file is a downstream copy of a file mainitained in
* a repository at cilkplus.org. Changes made to this file that are not
* submitted through the contribution process detailed at
* http://www.cilkplus.org/submit-cilk-contribution will be lost the next
* time that a new version is released. Changes only submitted to the
* GNU compiler collection or posted to the git repository at
* https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
* not tracked.
*
* We welcome your contributions to this open source project. Thank you
* for your assistance in helping us improve Cilk Plus.
*
**************************************************************************/
@ -1778,7 +1789,15 @@ static full_frame* check_for_work(__cilkrts_worker *w)
if (NULL == ff) {
// Punish the worker for failing to steal.
// No quantum for you!
__cilkrts_yield();
if (w->l->steal_failure_count > 30000) {
// Punish more if the worker has been doing unsuccessful steals
// for a long time. After return from the idle state, it will
// be given a grace period to react quickly.
__cilkrts_idle();
w->l->steal_failure_count -= 300;
} else {
__cilkrts_yield();
}
w->l->steal_failure_count++;
} else {
// Reset steal_failure_count since there is obviously still work to
@ -1808,6 +1827,7 @@ static full_frame* search_until_work_found_or_done(__cilkrts_worker *w)
ff = check_for_work(w);
break;
case SCHEDULE_WAIT: // go into wait-mode.
START_INTERVAL(w, INTERVAL_SCHEDULE_WAIT);
CILK_ASSERT(WORKER_SYSTEM == w->l->type);
// If we are about to wait, then we better not have
// a frame that we should execute...
@ -1818,6 +1838,7 @@ static full_frame* search_until_work_found_or_done(__cilkrts_worker *w)
// Runtime is waking up.
notify_children_run(w);
w->l->steal_failure_count = 0;
STOP_INTERVAL(w, INTERVAL_SCHEDULE_WAIT);
break;
case SCHEDULE_EXIT: // exit the scheduler.
CILK_ASSERT(WORKER_USER != w->l->type);
@ -2006,9 +2027,6 @@ static void worker_scheduler_init_function(__cilkrts_worker *w)
// The startup work varies, depending on the worker type.
switch (w->l->type) {
case WORKER_USER:
// Stop working once we've entered the scheduler.
// For user workers, INTERVAL_IN_SCHEDULER counts the time
// since we called bind_thread.
break;
case WORKER_SYSTEM:
@ -2022,11 +2040,6 @@ static void worker_scheduler_init_function(__cilkrts_worker *w)
// Runtime is waking up.
notify_children_run(w);
w->l->steal_failure_count = 0;
// For system threads, count all the time this thread is
// alive in the scheduling loop.
START_INTERVAL(w, INTERVAL_IN_SCHEDULER);
START_INTERVAL(w, INTERVAL_WORKING);
break;
default:
__cilkrts_bug("Unknown worker %p of type %d entering scheduling loop\n",
@ -2047,8 +2060,6 @@ static void worker_scheduler_terminate_function(__cilkrts_worker *w)
// A user worker should never finish by falling through the
// scheduling loop.
CILK_ASSERT(WORKER_USER != w->l->type);
STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
STOP_INTERVAL(w, INTERVAL_IN_SCHEDULER);
}
/**
@ -2060,30 +2071,36 @@ static void worker_scheduler_terminate_function(__cilkrts_worker *w)
*/
static void worker_scheduler_function(__cilkrts_worker *w)
{
START_INTERVAL(w, INTERVAL_INIT_WORKER);
worker_scheduler_init_function(w);
STOP_INTERVAL(w, INTERVAL_INIT_WORKER);
// The main scheduling loop body.
while (!w->g->work_done) {
// Set intervals. Now we are in the runtime instead of working.
START_INTERVAL(w, INTERVAL_IN_RUNTIME);
STOP_INTERVAL(w, INTERVAL_WORKING);
// Execute the "body" of the scheduling loop, and figure
// out the fiber to jump to next.
START_INTERVAL(w, INTERVAL_SCHED_LOOP);
cilk_fiber* fiber_to_resume
= worker_scheduling_loop_body(w->l->scheduling_fiber, w);
STOP_INTERVAL(w, INTERVAL_SCHED_LOOP);
if (fiber_to_resume) {
// Suspend the current fiber and resume next one.
NOTE_INTERVAL(w, INTERVAL_SUSPEND_RESUME_OTHER);
// Whenever we jump to resume user code, we stop being in
// the runtime, and start working.
STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_WORKING);
cilk_fiber_suspend_self_and_resume_other(w->l->scheduling_fiber,
fiber_to_resume);
// Return here only when this (scheduling) fiber is
// resumed (i.e., this worker wants to reenter the runtime).
// We've already switched from WORKING to IN_RUNTIME in
// the runtime code that handles the fiber switch. Thus, at
// this point we are IN_RUNTIME already.
}
}
@ -2183,6 +2200,8 @@ NORETURN __cilkrts_c_sync(__cilkrts_worker *w,
__cilkrts_stack_frame *sf_at_sync)
{
full_frame *ff;
STOP_INTERVAL(w, INTERVAL_WORKING);
START_INTERVAL(w, INTERVAL_IN_RUNTIME);
// Claim: This read of w->l->frame_ff can occur without
// holding the worker lock because when w has reached a sync
@ -2343,6 +2362,11 @@ void __cilkrts_c_THE_exception_check(__cilkrts_worker *w,
int stolen_p;
__cilkrts_stack_frame *saved_sf = NULL;
// For the exception check, stop working and count as time in
// runtime.
STOP_INTERVAL(w, INTERVAL_WORKING);
START_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_THE_EXCEPTION_CHECK);
BEGIN_WITH_WORKER_LOCK(w) {
@ -2410,6 +2434,11 @@ void __cilkrts_c_THE_exception_check(__cilkrts_worker *w,
else
{
NOTE_INTERVAL(w, INTERVAL_THE_EXCEPTION_CHECK_USELESS);
// If we fail the exception check and return, then switch back
// to working.
STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_WORKING);
return;
}
}
@ -2419,6 +2448,9 @@ NORETURN __cilkrts_exception_from_spawn(__cilkrts_worker *w,
__cilkrts_stack_frame *returning_sf)
{
full_frame *ff = w->l->frame_ff;
STOP_INTERVAL(w, INTERVAL_WORKING);
START_INTERVAL(w, INTERVAL_IN_RUNTIME);
// This is almost the same as THE_exception_check, except
// the detach didn't happen, we don't need to undo the tail
// update.
@ -2551,6 +2583,10 @@ __cilkrts_stack_frame *simulate_pop_tail(__cilkrts_worker *w)
void __cilkrts_return(__cilkrts_worker *w)
{
full_frame *ff, *parent_ff;
// Count time during the return as in the runtime.
STOP_INTERVAL(w, INTERVAL_WORKING);
START_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_RETURNING);
BEGIN_WITH_WORKER_LOCK_OPTIONAL(w) {
@ -2604,6 +2640,8 @@ void __cilkrts_return(__cilkrts_worker *w)
} END_WITH_WORKER_LOCK_OPTIONAL(w);
STOP_INTERVAL(w, INTERVAL_RETURNING);
STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_WORKING);
}
static void __cilkrts_unbind_thread()
@ -2619,13 +2657,10 @@ static void __cilkrts_unbind_thread()
if (w) {
g = w->g;
// If there's only 1 worker, the counts will be stopped in
// __cilkrts_scheduler
if (g->P > 1)
{
STOP_INTERVAL(w, INTERVAL_WORKING);
STOP_INTERVAL(w, INTERVAL_IN_SCHEDULER);
}
// Matches the START in bind_thread in cilk-abi.c.
STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
STOP_INTERVAL(w, INTERVAL_IN_SCHEDULER);
__cilkrts_set_tls_worker(0);
@ -2658,6 +2693,11 @@ void __cilkrts_c_return_from_initial(__cilkrts_worker *w)
{
struct cilkred_map *rm;
// When we are returning from the initial frame, switch from
// INTERVAL_WORKING into INTERVAL_IN_RUNTIME.
STOP_INTERVAL(w, INTERVAL_WORKING);
START_INTERVAL(w, INTERVAL_IN_RUNTIME);
/* This is only called on a user thread worker. */
CILK_ASSERT(w->l->type == WORKER_USER);
@ -3629,6 +3669,11 @@ slow_path_reductions_for_spawn_return(__cilkrts_worker *w,
// We have reductions to execute (and we can't hold locks).
__cilkrts_frame_unlock(w, ff->parent);
// After we've released the lock, start counting time as
// WORKING again.
STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_WORKING);
// Merge all reducers into the left map.
left_map = repeated_merge_reducer_maps(&w,
left_map,
@ -3649,6 +3694,9 @@ slow_path_reductions_for_spawn_return(__cilkrts_worker *w,
ff->pending_exception = w->l->pending_exception;
w->l->pending_exception = NULL;
STOP_INTERVAL(w, INTERVAL_WORKING);
START_INTERVAL(w, INTERVAL_IN_RUNTIME);
// Lock ff->parent for the next loop around.
__cilkrts_frame_lock(w, ff->parent);
@ -3809,6 +3857,11 @@ slow_path_reductions_for_sync(__cilkrts_worker *w,
return w;
}
} END_WITH_FRAME_LOCK(w, ff);
// After we've released the lock, start counting time as
// WORKING again.
STOP_INTERVAL(w, INTERVAL_IN_RUNTIME);
START_INTERVAL(w, INTERVAL_WORKING);
// If we get here, we have a nontrivial reduction to execute.
middle_map = repeated_merge_reducer_maps(&w,
@ -3816,6 +3869,9 @@ slow_path_reductions_for_sync(__cilkrts_worker *w,
middle_map);
verify_current_wkr(w);
STOP_INTERVAL(w, INTERVAL_WORKING);
START_INTERVAL(w, INTERVAL_IN_RUNTIME);
// Save any exceptions generated because of the reduction
// process. These get merged the next time around the
// loop.

Some files were not shown because too many files have changed in this diff Show More