The list of most significant changes made over time in
Intel(R) Threading Building Blocks (Intel(R) TBB).
+Intel TBB 2019 Update 6
+TBB_INTERFACE_VERSION == 11006
+
+Changes (w.r.t. Intel TBB 2019 Update 5):
+
+- Added support for Microsoft* Visual Studio* 2019.
+- Added support for enqueuing tbb::task into tbb::task_arena
+ (https://github.com/01org/tbb/issues/116).
+- Improved support for allocator propagation on concurrent_hash_map
+ assigning and swapping.
+- Improved scalable_allocation_command cleanup operations to release
+ more memory buffered by the calling thread.
+- Separated allocation of small and large objects into distinct memory
+ regions, which helps to reduce excessive memory caching inside the
+ TBB allocator.
+
+Preview Features:
+
+- Removed template class gfx_factory from the flow graph API.
+
+------------------------------------------------------------------------
Intel TBB 2019 Update 5
TBB_INTERFACE_VERSION == 11005
PREDEFINED = TBB_PREVIEW_FLOW_GRAPH_FEATURES \
TBB_PREVIEW_FLOW_GRAPH_NODES \
- __TBB_GFX_PRESENT \
__TBB_PREVIEW_OPENCL_NODE \
__TBB_CPP11_RVALUE_REF_PRESENT \
__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT \
__TBB_ALIGNAS_PRESENT \
__TBB_CPP11_TEMPLATE_ALIASES_PRESENT \
__TBB_FLOW_GRAPH_CPP11_FEATURES \
- __TBB_PREVIEW_GFX_FACTORY \
__TBB_PREVIEW_STREAMING_NODE
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
tbb_root?=.
include $(tbb_root)/build/common.inc
# Threading Building Blocks 2019 Update 5
-[![Stable release](https://img.shields.io/badge/version-2019_U5-green.svg)](https://github.com/01org/tbb/releases/tag/2019_U5)
+[![Stable release](https://img.shields.io/badge/version-2019_U6-green.svg)](https://github.com/01org/tbb/releases/tag/2019_U6)
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
Threading Building Blocks (TBB) lets you easily write parallel C++ programs that take
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
COMPILE_ONLY = -c -MMD
PREPROC_ONLY = -E -x c++
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
ifndef arch
arch:=$(shell uname -p)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
COMPILE_ONLY = -c -MMD
PREPROC_ONLY = -E -x c++
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
ifndef arch
ifeq ($(shell uname -m),i386)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
include $(tbb_root)/build/BSD.clang.inc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
COMPILE_ONLY = -c -MMD
PREPROC_ONLY = -E -x c++
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
include $(tbb_root)/build/BSD.inc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# TODO: investigate why version_string.ver is not complete when $(RML_SERVER.OBJ) is being compiled.
.NOTPARALLEL:
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
#------------------------------------------------------------------------------
# Define rules for making the TBB shared library.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# default target
default_malloc: malloc malloc_test
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# default target
default_tbbproxy: tbbproxy tbbproxy_test
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
#------------------------------------------------------------------------------
# Define rules for making the TBB tests.
# These tests depend on other technologies
TEST_TBB_SPECIAL.EXE = test_openmp.$(TEST_EXT) \
test_cilk_interop.$(TEST_EXT) \
- test_gfx_factory.$(TEST_EXT) \
test_opencl_node.$(TEST_EXT)
# skip mode_plugin for now
# The issue reveals itself if a version of binutils is prior to 2.17
ifeq (linux_icc,$(tbb_os)_$(compiler))
test_cilk_interop.$(TEST_EXT): LIBS += -lcilkrts
-test_gfx_factory.$(TEST_EXT): LIBS += -lcilkrts
endif
test_tbb_cilk: test_cilk_interop.$(TEST_EXT)
$(run_cmd) ./test_cilk_interop.$(TEST_EXT) $(args)
# For deprecated files, we don't mind warnings etc., thus compilation rules are most relaxed
CPLUS_FLAGS_DEPRECATED = $(DEFINE_KEY)__TBB_TEST_DEPRECATED=1 $(subst $(WARNING_KEY),,$(CPLUS_FLAGS)) $(WARNING_SUPPRESS) $(INCLUDE_KEY)$(tbb_root)/src/test
-TEST_TBB_OLD.OBJ = test_concurrent_vector_v2.$(OBJ) test_concurrent_queue_v2.$(OBJ) test_mutex_v2.$(OBJ) test_task_scheduler_observer_v3.$(OBJ)
+TEST_TBB_OLD.OBJ = test_concurrent_vector_v2.$(OBJ) test_concurrent_queue_v2.$(OBJ) test_mutex_v2.$(OBJ) test_task_scheduler_observer_v3.$(OBJ)
$(TEST_TBB_OLD.OBJ): CPLUS_FLAGS := $(CPLUS_FLAGS_DEPRECATED)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
include $(tbb_root)/build/BSD.clang.inc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
include $(tbb_root)/build/BSD.inc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
COMPILE_ONLY = -c -MMD
PREPROC_ONLY = -E -x c++
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
ifndef arch
arch:=$(shell uname -p)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
COMPILE_ONLY = -c -xMMD -errtags
PREPROC_ONLY = -E -xMMD
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
COMPILE_ONLY = -c -MMD
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
COMPILE_ONLY = -c -MMD
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
COMPILE_ONLY = -c -MMD
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
#
# Extra gmake command-line parameters for use with Android:
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
####### Detections and Commands ###############################################
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Usage:
# android.linux.launcher.sh [-v] [-q] [-s] [-r <repeats>] [-u] [-l <library>] <executable> <arg1> <arg2> <argN>
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
####### Detections and Commands ###############################################
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
####### Detections and Commands ###############################################
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
#------------------------------------------------------------------------------
# Defines settings for building the TBB run-time as a static library.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Provides unified tool for preparing TBB for packaging
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
ifndef tbb_os
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
ifeq ($(tbb_strict),1)
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
function readAllFromFile(fname) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
-REM
-REM
-REM
-REM
setlocal
for %%D in ("%tbb_root%") do set actual_root=%%~fD
set fslash_root=%actual_root:\=/%
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Script used to generate tbbvars.[c]sh scripts
bin_dir="$PWD" #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
include $(tbb_root)/build/macos.clang.inc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
ifneq ($(arch),$(filter $(arch),ia32 intel64 armv7 armv7s arm64))
$(error $(arch) is unknown architecture. Known arhitechtures are ia32 intel64 armv7 armv7s arm64)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
CPLUS ?= clang++
CONLY ?= clang
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
CPLUS ?= g++
CONLY ?= gcc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
CPLUS ?= icpc
CONLY ?= icc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
####### Detections and Commands ###############################################
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
CPLUS ?= pathCC
CONLY ?= pathcc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
####### Detections and Commands ###############################################
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
CPLUS ?= clang++
CONLY ?= clang
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
CPLUS ?= g++
CONLY ?= gcc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
CPLUS ?= icpc
CONLY ?= icc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
####### Detections and Commands ###############################################
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
CPLUS ?= icpc
CONLY ?= icc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
ifeq ($(tbb_os),mic)
$(error MIC supports only cross-compilation. Specify "target=mic" instead.)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Usage:
# mic.linux.launcher.sh [-v] [-q] [-s] [-r <repeats>] [-u] [-l <library>] <executable> <arg1> <arg2> <argN>
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
ifneq (mic,$(offload))
$(error File mic.offload.inc should not be included directly. Use offload=mic instead.)
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
-REM
-REM
-REM
-REM
set cmd_line=
if DEFINED run_prefix set cmd_line=%run_prefix%
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Usage:
# test_launcher.sh [-v] [-q] [-s] [-r <repeats>] [-u] [-l <library>] <executable> <arg1> <arg2> <argN>
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Script used to generate version info string
echo "#define __TBB_VERSION_STRINGS(N) \\"
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Script used to generate version info string
echo "#define __TBB_VERSION_STRINGS(N) \\"
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Script used to generate version info string
echo "#define __TBB_VERSION_STRINGS(N) \\"
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Script used to generate version info string
echo "#define __TBB_VERSION_STRINGS(N) \\"
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Script used to generate version info string
echo "#define __TBB_VERSION_STRINGS(N) \\"
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
var WshShell = WScript.CreateObject("WScript.Shell");
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
#------------------------------------------------------------------------------
# Define compiler-specific variables.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
#------------------------------------------------------------------------------
# Overriding settings from windows.inc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
#------------------------------------------------------------------------------
# Define compiler-specific variables.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
export SHELL = cmd
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
#
# Usage:
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
include(CMakeParseArguments)
-# Copyright (c) 2017-2019 Intel Corporation
+# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
include(CMakeParseArguments)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
#
# Usage:
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
function(tbb_conf_gen_print_help)
message("Usage: cmake -DTBB_ROOT=<tbb_root> -DTBB_OS=Linux|Windows|Darwin [-DSAVE_TO=<path>] -P tbb_config_generator.cmake")
-# Copyright (c) 2017-2019 Intel Corporation
+# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
function(tbb_conf_gen_print_help)
message("Usage: cmake -DINSTALL_DIR=<config_install_dir> -DSYSTEM_NAME=Linux|Darwin <parameters> -P tbb_config_generator.cmake
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# It defines the following variables:
# TBB_tbb_FOUND
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# TBB_FOUND should not be set explicitly. It is defined automatically by CMake.
# Handling of TBB_VERSION is in TBBConfigVersion.cmake.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
set(PACKAGE_VERSION @TBB_VERSION@)
Windows* OS only)
Microsoft* Visual C++ 14.1 (Microsoft* Visual Studio* 2017,
Windows* OS only)
+ Microsoft* Visual C++ 14.2 (Microsoft* Visual Studio* 2019,
+ Windows* OS only)
Microsoft* Windows* Software Development Kit for Windows* 8.1
Microsoft* Windows* Software Development Kit for Windows* 10
For each supported Linux* operating system, the standard gcc
the -flifetime-dse=1 option to prevent crashes at runtime,
or use Intel(R) TBB makefiles that automatically set this option.
- - The current implementation of gfx_factory does not allow memory
- buffer objects to be used concurrently. As a result, several
- streaming nodes customized with gfx_factory cannot be connected
- with each other directly.
-
------------------------------------------------------------------------
(C) 2019 Intel Corporation
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs examples.
PROG=sub_string_finder_extended
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <iostream>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_MIC_OFFLOAD
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <iostream>
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# This file should be always located and called in $(tbb_root)/examples
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
-REM
-REM
-REM
-REM
:: Getting parameters
if ("%1") == ("") goto error0
if ("%2") == ("debug") set postfix=_debug
set output_dir=%3
+:: Check if necessary .dll's already exist in output directory
+set dlls=tbb%postfix%.dll tbbmalloc%postfix%.dll
+(for %%a in (%dlls%) do (
+ if not exist %output_dir%\%%a (
+ goto copy_libs
+ )
+))
+:: Necessary .dll's already exist; no need to do anything
+exit /B 0
+
+:copy_libs
:: Optional 4th parameter to set install root
if ("%4") NEQ ("") set TBBROOT=%4
:: Actually we can set install root by ourselves
:: If it is not, try running Microsoft Visual Studio 2017 from Microsoft* Developer Command Prompt* for VS 2017.
:: For details, see https://developercommunity.visualstudio.com/content/problem/730/vs154-env-var-vs150comntools-missing-from-build-sy.html
if ("%VS150COMNTOOLS%") NEQ ("") set vc_dir=vc14
+:: The same comment also applies to Microsoft Visual Studio 2019 and variable VS160COMNTOOLS
+if ("%VS160COMNTOOLS%") NEQ ("") set vc_dir=vc14
:: Are we standalone/oss or inside compiler?
if exist "%TBBROOT%\bin\%arch%\%vc_dir%\tbb%postfix%.dll" set interim_path=bin\%arch%
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# detect if a compiler can support C++11
# If CXX0XFLAGS already set, do not change it
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# The C++ compiler
#CXX=g++
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Per-build Makefile rules (for recursive $(MAKE) calls from Makefile)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "video.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// common Windows parts
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
-REM
-REM
-REM
-REM
if "%DXSDK_DIR%"=="" goto error_no_DXSDK
goto end
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// common Windows parts
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "video.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __VIDEO_H__
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/////// Common internal implementation of Windows-specific stuff //////////////
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#import <Foundation/Foundation.h>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#import <Foundation/Foundation.h>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#import <Availability.h>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#import "tbbAppDelegate.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Uncomment next line to disable shared memory features if you do not have libXext
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef FAST_RANDOM_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef UTILITY_H_
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Workaround for ICC 11.0 not finding __sync_fetch_and_add_4 on some of the Linux platforms.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstdio>
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <string>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstdio>
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _MSC_VER
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*-------------------------------------------------------------*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*-------------------------------------------------------------*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*-------------------------------------------------------------*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*-------------------------------------------------------------*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*-------------------------------------------------------------*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*-------------------------------------------------------------*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*-------------------------------------------------------------*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define TBB_PREVIEW_FLOW_GRAPH_FEATURES 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*-------------------------------------------------------------*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*-------------------------------------------------------------*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBBexample_graph_logicsim_dlatch_H
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
PROG=test_all
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBBexample_graph_logicsim_basics_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBBexample_graph_logicsim_fba_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBBexample_graph_logicsim_oba_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBBexample_graph_logicsim_tba_H
+++ /dev/null
-# Copyright (c) 2016-2019 Intel Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-#
-
-# GNU Makefile that builds and runs example.
-
-run_cmd=
-PROG=matmult
-ARGS=
-
-# icpc by default
-ifneq (,$(shell which icc 2>/dev/null))
- CXX=icpc
-endif
-
-# autodetect C++11 support
-include ../../common/examples-common.inc
-
-ifeq ($(shell uname), Linux)
-LIBS+= -lrt -lpthread -lcilkrts
-else ifeq ($(shell uname), Darwin)
-override CXXFLAGS += -Wl,-rpath,$(TBBROOT)/lib
-endif
-
-all: release test
-
-release:
- $(CXX) -O2 -DNDEBUG *.cpp $(CXXFLAGS) -o $(PROG) -ltbb $(LIBS) $(CXX0XFLAGS)
-
-debug:
- $(CXX) -O0 -g -DTBB_USE_DEBUG *.cpp $(CXXFLAGS) -o $(PROG) -ltbb_debug $(LIBS) $(CXX0XFLAGS)
-
-profile: override CXXFLAGS += -DTBB_USE_THREADING_TOOLS -g
-profile: release
-
-clean:
- $(RM) $(PROG) *.o *.d
-
-test:
- $(run_cmd) ./$(PROG) $(ARGS)
-
-perf_build: release
-
-perf_run:
- $(run_cmd) ./$(PROG)
+++ /dev/null
-# Copyright (c) 2016-2019 Intel Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-#
-
-# Common Makefile that builds and runs example.
-
-# Just specify your program basename
-run_cmd=
-PROG=matmult
-ARGS=
-
-# Trying to find if icl.exe is set
-CXX1 = $(TBB_CXX)-
-CXX2 = $(CXX1:icl.exe-=icl.exe)
-CXX = $(CXX2:-=cl.exe)
-
-# The C++ compiler options
-MYCXXFLAGS = /EHsc /W3 /nologo /D _CONSOLE /D _MBCS /D WIN32 /D _CRT_SECURE_NO_WARNINGS /D _CRT_NONSTDC_NO_DEPRECATE /wd4267 /wd4244
-MYLDFLAGS = /INCREMENTAL:NO /NOLOGO /DEBUG /FIXED:NO $(LDFLAGS)
-
-all: release test
-
-release:
- $(CXX) *.cpp /MD /O2 /Zi /D NDEBUG $(MYCXXFLAGS) /link tbb.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
-
-debug:
- $(CXX) *.cpp /MDd /Od /Zi /D TBB_USE_DEBUG /D _DEBUG $(MYCXXFLAGS) /link tbb_debug.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
-
-profile:
- $(CXX) *.cpp /MD /O2 /Zi /D NDEBUG $(MYCXXFLAGS) /D TBB_USE_THREADING_TOOLS /link tbb.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
-
-clean:
- @cmd.exe /C del $(PROG).exe *.obj *.?db *.manifest
-
-test:
- $(PROG) $(ARGS)
-
-perf_build: release
-
-perf_run:
- $(PROG) $(PERF_RUN_ARGS)
-
+++ /dev/null
-/*
- Copyright (c) 2016-2019 Intel Corporation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-
-
-*/
-
-// -------------------------------------------------------------------------------------------------
-// This is an example of a matrix multiplication Gen kernel usage with TBB Flow Graph.
-// It exemplifies support for compute offload to Intel(R) Graphics Technology in the flow graph API.
-// -------------------------------------------------------------------------------------------------
-
-#define TBB_PREVIEW_FLOW_GRAPH_NODES 1
-#define TBB_PREVIEW_FLOW_GRAPH_FEATURES 1
-
-#include "tbb/tbb_config.h"
-#include "../../common/utility/utility.h"
-
-#if __TBB_PREVIEW_GFX_FACTORY && __TBB_PREVIEW_STREAMING_NODE
-
-#if _MSC_VER
-#pragma warning(disable : 4503) // suppress warning C4503: decorated name length exceeded, name was truncated
-#endif
-
-// -------------------------------------------------------------------------------------------------
-
-#include <iostream>
-
-#include <cilk/cilk.h>
-#include <cilk/cilk_api.h>
-
-#include "tbb/tick_count.h"
-#include "tbb/flow_graph.h"
-#include "tbb/gfx_factory.h"
-
-// -------------------------------------------------------------------------------------------------
-
-#define SLM_TILE_X (4*8)
-#define SLM_TILE_Y (4*8)
-#define SLM_TILE_K (4*8)
-
-#define SIZE_X (2*SLM_TILE_X)
-#define SIZE_Y (2*SLM_TILE_Y)
-#define SIZE_K (2*SLM_TILE_X)
-
-#ifdef __GFX__
-#define BARRIER _gfx_gpgpu_thread_barrier()
-#else
-#define BARRIER
-#endif
-
-#define TILE_Y 8
-#define TILE_K 8
-#define TILE_X 8
-
-// The naive straightforward algorithm used to obtain reference results on CPU
-void matmult_naive(const float* A, const float* B, float* C) {
- for (int y = 0; y < SIZE_Y; y++) {
- for (int x = 0; x < SIZE_X; x++) {
- C[y * SIZE_Y + x] = (float)0;
-
- for (int k = 0; k < SIZE_K; k++) {
- C[y * SIZE_Y + x] += A[y * SIZE_K + k] * B[k * SIZE_K + x];
- }
- }
- }
-}
-
-// Shared Local Memory based algorithm
-__declspec(target(gfx_kernel))
-void matmult_tiled_slm(const float A[][SIZE_K], const float B[][SIZE_X], float C[][SIZE_X]) {
- // The parallel loop nest below iterates over "supertiles" in the resulting
- // matrix C and it is parallelized across thread groups, 1 iteration per
- // group, which effectively means that the loop nest is peeled off.
- // This kernel is programmed so that each thread group calculates one
- // resulting supertile in matrix C.
- _Cilk_for _Thread_group(int tg_y = 0; tg_y < SIZE_Y; tg_y += SLM_TILE_Y) {
- _Cilk_for _Thread_group(int tg_x = 0; tg_x < SIZE_X; tg_x += SLM_TILE_X) {
- // declare "supertiles" of each matrix to be allocated in SLM
- __thread_group_local float slm_atile[SLM_TILE_Y][SLM_TILE_K];
- __thread_group_local float slm_btile[SLM_TILE_K][SLM_TILE_X];
- __thread_group_local float slm_ctile[SLM_TILE_Y][SLM_TILE_X];
-
- // initialize the result supertile (in parallel)
- //slm_ctile[:][:] = (float)0;
- _Cilk_for(int i0 = 0; i0 < SLM_TILE_Y; i0++)
- _Cilk_for(int i1 = 0; i1 < SLM_TILE_X; i1++)
- slm_ctile[i0][i1] = (float)0;
-
- // calculate the dot product of supertiles:
- for (int super_k = 0; super_k < SIZE_K; super_k += SLM_TILE_K) {
- // cache A's and B's "supertiles" in SLM (in parallel)
- //slm_atile[:][:] = A[tg_y:SLM_TILE_Y][super_k:SLM_TILE_K];
- _Cilk_for(int i0 = 0; i0 < SLM_TILE_Y; i0++)
- _Cilk_for(int i1 = 0; i1 < SLM_TILE_K; i1++)
- slm_atile[i0][i1] = A[tg_y + i0][super_k + i1];
-
- //slm_btile[:][:] = B[super_k:SLM_TILE_K][tg_x:SLM_TILE_X];
- _Cilk_for(int i0 = 0; i0 < SLM_TILE_K; i0++)
- _Cilk_for(int i1 = 0; i1 < SLM_TILE_X; i1++)
- slm_btile[i0][i1] = B[super_k + i0][tg_x + i1];
-
- // need a barrier, since every tile in tiles are used by
- // multiple threads in the group
- BARRIER;
-
- // now multiply the supertiles as usual matrices (in parallel)
- // ...
- // ... using the most effective tiled algorithm:
- _Cilk_for(int t_y = 0; t_y < SLM_TILE_Y; t_y += TILE_Y) {
- _Cilk_for(int t_x = 0; t_x < SLM_TILE_X; t_x += TILE_X) {
- // allocate tiles in registers
- float atile[TILE_Y][TILE_K], btile[TILE_X];
- float ctile[TILE_Y][TILE_X];
-
- // ... and initialize ctile to zero
- ctile[:][:] = (float)0;
-
- // calculate the dot product of the tiles
- for (int k = 0; k < SLM_TILE_K; k += TILE_K) {
- atile[:][:] = slm_atile[t_y:TILE_Y][k:TILE_K];
-
- for (int k_ind = 0; k_ind < TILE_K; k_ind++) {
- btile[:] = slm_btile[k + k_ind][t_x:TILE_X];
-
- // multiply current btile row by atile's
- // current element and add up to corresponding
- // ctile row
- for (int y_ind = 0; y_ind < TILE_Y; y_ind++) {
- ctile[y_ind][:] += atile[y_ind][k_ind] *
- btile[:];
- }
- }
- }
- // flush the thread-local ctile (registers) into the
- // thread group-local supertile (SLM) adding up
- // elements
- slm_ctile[t_y:TILE_Y][t_x:TILE_X] += ctile[:][:];
- }
- }
-
- // barrier to make sure
- // (1) next iteration of the loop does not overwrite a and b
- // SLM tiles used in the above calculation of slm_ctile
- // (2) on the last iteration of the loop, all threads wait
- // for the SLM ctile calculation to be completed before
- // writing it back to memory below this loop
- BARRIER;
- }
-
- // write (in parallel) the result supertile back to memory:
- //C[tg_y:SLM_TILE_Y][tg_x:SLM_TILE_X] = slm_ctile[:][:];
- _Cilk_for(int i0 = 0; i0 < SLM_TILE_Y; i0++)
- _Cilk_for(int i1 = 0; i1 < SLM_TILE_X; i1++)
- C[tg_y + i0][tg_x + i1] = slm_ctile[i0][i1];
-
- // next iteration of the loop zeroes out slm_ctile - make sure this
- // always happens after slm_ctile has been dumped to memory (above
- // loop nest completes):
- BARRIER;
- }
- }
-}
-
-// Matrix initialization function
-void init_matrix(int width, int height, float* matrix) {
- for (int j = 0; j < height; j++) {
- for (int i = 0; i < width; i++) {
- matrix[j * height + i] = (float)(j * 4 + i);
- }
- }
-}
-
-// Validate matrix with reference values
-bool validate_mat(char *title, int size_y, int size_x, const float* mat, const float* ref_mat) {
- int err_cnt = 0;
- printf("verifying %s...", title);
- fflush(stdout);
-
- for (int y = 0; y < size_y; y++) {
- for (int x = 0; x < size_x; x++) {
- float val = mat[y * size_y + x];
- float gold_val = ref_mat[y * size_y + x];
-
- if (val != gold_val) {
- if (err_cnt == 0) {
- printf("\n");
- }
- if (++err_cnt < 10) {
- std::cout <<
- " ERROR at [" << y << "][" << x << "]: " <<
- val << "(should be " << gold_val << ")" << std::endl;
- }
- }
- }
- }
- if (err_cnt == 0) {
- printf(" ok\n");
- } else {
- printf("FAILED\n");
- }
- return err_cnt == 0;
-}
-
-// ----------------------------------------------------------------------------
-// Helper types and functions
-// ----------------------------------------------------------------------------
-
-struct matrix_size {
- int columns;
- int rows;
-};
-
-typedef std::tuple< tbb::flow::gfx_buffer<float>,
- tbb::flow::gfx_buffer<float>,
- tbb::flow::gfx_buffer<float> > kernel_args_type;
-typedef kernel_args_type cpu_args_type;
-typedef kernel_args_type validation_args_type;
-
-// Constructs flow graph with three computation nodes that all make matrixes multiplication
-// - CPU node - obtains reference result on CPU
-// - CPU SLM node - Intel(R) Cilk(TM) based matrixes multiplication implementation on CPU
-// - GPU node - obtains result on GPU using GFX offload API
-void mat_multiplication() {
-
- //------------------------------------------
- // TBB Flow Graph nodes declaration section
- //------------------------------------------
-
- tbb::flow::graph g;
- tbb::flow::gfx_factory factory(g);
-
- // Enqueue task for running on Gen
- tbb::flow::split_node< kernel_args_type > gpu_slm_split_n(g);
- tbb::flow::streaming_node< kernel_args_type, tbb::flow::queueing, tbb::flow::gfx_factory > gpu_slm_mat_mult_n(g, matmult_tiled_slm, tbb::flow::gfx_factory::dummy_device_selector(), factory);
-
- // Obtain SLM algorithm result on CPU
- tbb::flow::function_node< cpu_args_type, tbb::flow::gfx_buffer<float> > cpu_slm_mat_mult_n(g, tbb::flow::unlimited, [](const cpu_args_type& args) -> tbb::flow::gfx_buffer<float> {
- // Get references to matrixes
- const tbb::flow::gfx_buffer<float >& A_MATRIX = std::get<0>(args);
- const tbb::flow::gfx_buffer<float>& B_MATRIX = std::get<1>(args);
- tbb::flow::gfx_buffer<float> CPU_SLM_MATRIX = std::get<2>(args);
-
- matmult_tiled_slm((float(*)[SIZE_K])A_MATRIX.data(), (float(*)[SIZE_X])B_MATRIX.data(), (float(*)[SIZE_X])CPU_SLM_MATRIX.data());
-
- return CPU_SLM_MATRIX;
- });
-
- // Obtain reference result on CPU
- tbb::flow::function_node< cpu_args_type, tbb::flow::gfx_buffer<float> > cpu_naive_mat_mult_n(g, tbb::flow::unlimited, [](const cpu_args_type& args) -> tbb::flow::gfx_buffer<float> {
- // Get references to matrixes
- const tbb::flow::gfx_buffer<float>& A_MATRIX = std::get<0>(args);
- const tbb::flow::gfx_buffer<float>& B_MATRIX = std::get<1>(args);
- tbb::flow::gfx_buffer<float> CPU_NAIVE_MATRIX = std::get<2>(args);
-
- matmult_naive(A_MATRIX.data(), B_MATRIX.data(), CPU_NAIVE_MATRIX.data());
-
- return CPU_NAIVE_MATRIX;
- });
-
- // Validate computed matrixes
- tbb::flow::join_node< validation_args_type > validation_join_n(g);
- tbb::flow::function_node< validation_args_type > mat_validation_n(g, tbb::flow::unlimited, [](const validation_args_type& result) {
- // Get references to matrixes
- const tbb::flow::gfx_buffer<float>& GPU_SLM_MAT = std::get<0>(result);
- const tbb::flow::gfx_buffer<float>& CPU_SLM_MAT = std::get<1>(result);
- const tbb::flow::gfx_buffer<float>& CPU_NAIVE_MAT = std::get<2>(result);
-
- // Verify results
- // Check that slm algorithm produces correct results on CPU:
- validate_mat("matrix multiply: 'SLM' CPU vs. CPU", SIZE_Y, SIZE_X, CPU_SLM_MAT.data(), CPU_NAIVE_MAT.data());
- // Verify Gen results:
- validate_mat("matrix multiply: SLM Gen vs. CPU", SIZE_Y, SIZE_X, GPU_SLM_MAT.data(), CPU_NAIVE_MAT.data());
- });
-
- //-----------------------------------------
- // Make edge section - connecting nodes
- //-----------------------------------------
-
- // Prepare main graph input ports for data
- make_edge(tbb::flow::output_port<0>(gpu_slm_split_n), tbb::flow::input_port<0>(gpu_slm_mat_mult_n));
- make_edge(tbb::flow::output_port<1>(gpu_slm_split_n), tbb::flow::input_port<1>(gpu_slm_mat_mult_n));
- make_edge(tbb::flow::output_port<2>(gpu_slm_split_n), tbb::flow::input_port<2>(gpu_slm_mat_mult_n));
-
- // Join results
- make_edge(tbb::flow::output_port<2>(gpu_slm_mat_mult_n), tbb::flow::input_port<0>(validation_join_n));
- make_edge(cpu_slm_mat_mult_n, tbb::flow::input_port<1>(validation_join_n));
- make_edge(cpu_naive_mat_mult_n, tbb::flow::input_port<2>(validation_join_n));
-
- //Verify correctness
- make_edge(validation_join_n, mat_validation_n);
-
- // Set args for GFX kernel.
- // Default behaviour if not set.
- gpu_slm_mat_mult_n.set_args(tbb::flow::port_ref<0, 2>);
-
- //-----------------------------------------
- // Input sizes and matrixes initialization
- //-----------------------------------------
-
- const matrix_size A_MATRIX_SIZE = { SIZE_Y, SIZE_K };
- const matrix_size B_MATRIX_SIZE = { SIZE_K, SIZE_X };
- const matrix_size GPU_SLM_MATRIX_SIZE = { SIZE_Y, SIZE_X };
- const matrix_size CPU_SLM_MATRIX_SIZE = { SIZE_Y, SIZE_X };
- const matrix_size CPU_NAIVE_MATRIX_SIZE = { SIZE_Y, SIZE_X };
-
- tbb::flow::gfx_buffer<float> A_MATRIX(A_MATRIX_SIZE.columns * A_MATRIX_SIZE.rows);
- tbb::flow::gfx_buffer<float> B_MATRIX(B_MATRIX_SIZE.columns * B_MATRIX_SIZE.rows);
- tbb::flow::gfx_buffer<float> GPU_SLM_MATRIX(GPU_SLM_MATRIX_SIZE.columns * GPU_SLM_MATRIX_SIZE.rows);
- tbb::flow::gfx_buffer<float> CPU_SLM_MATRIX(CPU_SLM_MATRIX_SIZE.columns * CPU_SLM_MATRIX_SIZE.rows);
- tbb::flow::gfx_buffer<float> CPU_NAIVE_MATRIX(CPU_NAIVE_MATRIX_SIZE.columns * CPU_NAIVE_MATRIX_SIZE.rows);
-
- // Intitialize input matrixes
- init_matrix(A_MATRIX_SIZE.columns, A_MATRIX_SIZE.rows, A_MATRIX.data());
- init_matrix(B_MATRIX_SIZE.columns, B_MATRIX_SIZE.rows, B_MATRIX.data());
-
- // Make tuples with input data for graph
- kernel_args_type GPU_SLM_INPUT = std::make_tuple(A_MATRIX, B_MATRIX, GPU_SLM_MATRIX);
- kernel_args_type CPU_SLM_INPUT = std::make_tuple(A_MATRIX, B_MATRIX, CPU_SLM_MATRIX);
- kernel_args_type CPU_NAIVE_INPUT = std::make_tuple(A_MATRIX, B_MATRIX, CPU_NAIVE_MATRIX);
-
- //-----------------------------------------
- // Send input to the graph and run it
- //-----------------------------------------
-
- gpu_slm_split_n.try_put(GPU_SLM_INPUT);
- cpu_slm_mat_mult_n.try_put(CPU_SLM_INPUT);
- cpu_naive_mat_mult_n.try_put(CPU_NAIVE_INPUT);
-
- // Run graph
- g.wait_for_all();
-}
-
-//---------------------------------------------------------------------------------
-
-int main(int argc, char* argv[]) {
- try {
- tbb::tick_count mainStartTime = tbb::tick_count::now();
-
- utility::parse_cli_arguments(argc, argv,
- utility::cli_argument_pack()
- //"-h" option for displaying help is present implicitly
- );
-
- // Compute matrices and verify result
- mat_multiplication();
-
- utility::report_elapsed_time((tbb::tick_count::now() - mainStartTime).seconds());
- return 0;
- } catch (std::exception& e) {
- std::cerr << "Error occurred. Error text is : \"" << e.what() << "\"\n";
- return -1;
- }
-}
-
-#else
-int main() {
- utility::report_skipped();
- return 0;
-}
-#endif /* __TBB_PREVIEW_GFX_FACTORY && __TBB_PREVIEW_STREAMING_NODE */
+++ /dev/null
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.40629.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matmult", "matmult.vcxproj", "{517E31A4-BEED-481A-A5A7-5B37B82A1C16}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {517E31A4-BEED-481A-A5A7-5B37B82A1C16}.Debug|Win32.ActiveCfg = Debug|Win32
- {517E31A4-BEED-481A-A5A7-5B37B82A1C16}.Debug|Win32.Build.0 = Debug|Win32
- {517E31A4-BEED-481A-A5A7-5B37B82A1C16}.Debug|x64.ActiveCfg = Debug|x64
- {517E31A4-BEED-481A-A5A7-5B37B82A1C16}.Debug|x64.Build.0 = Debug|x64
- {517E31A4-BEED-481A-A5A7-5B37B82A1C16}.Release|Win32.ActiveCfg = Release|Win32
- {517E31A4-BEED-481A-A5A7-5B37B82A1C16}.Release|Win32.Build.0 = Release|Win32
- {517E31A4-BEED-481A-A5A7-5B37B82A1C16}.Release|x64.ActiveCfg = Release|x64
- {517E31A4-BEED-481A-A5A7-5B37B82A1C16}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{517E31A4-BEED-481A-A5A7-5B37B82A1C16}</ProjectGuid>
- <RootNamespace>matmult</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(SolutionDir)$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(SolutionDir)$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(SolutionDir)$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <IntDir>$(SolutionDir)$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(TBBROOT)\include;$(SolutionDir)\..\..\..\..\include;</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(TBBROOT)\lib\ia32\vc_mt;$(TBBROOT)\lib\ia32\vc12;$(SolutionDir)\..\..\..\..\lib\ia32\vc_mt;$(SolutionDir)\..\..\..\..\lib\ia32\vc12;</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(TBBROOT)\include;$(SolutionDir)\..\..\..\..\include;</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(TBBROOT)\lib\intel64\vc_mt;$(TBBROOT)\lib\intel64\vc12;$(SolutionDir)\..\..\..\..\lib\intel64\vc_mt;$(SolutionDir)\..\..\..\..\lib\intel64\vc12;</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(TBBROOT)\include;$(SolutionDir)\..\..\..\..\include;</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(TBBROOT)\lib\ia32\vc_mt;$(TBBROOT)\lib\ia32\vc12;$(SolutionDir)\..\..\..\..\lib\ia32\vc_mt;$(SolutionDir)\..\..\..\..\lib\ia32\vc12;</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(TBBROOT)\include;$(SolutionDir)\..\..\..\..\include;</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(TBBROOT)\lib\intel64\vc_mt;$(TBBROOT)\lib\intel64\vc12;$(SolutionDir)\..\..\..\..\lib\intel64\vc_mt;$(SolutionDir)\..\..\..\..\lib\intel64\vc12;</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\matmult.cpp" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
-<head>
- <meta charset="UTF-8">
- <style>
- ::selection {
- background: #b7ffb7;
- }
- ::-moz-selection {
- background: #b7ffb7;
- }
-
- body {
- font-family: Arial, Helvetica, sans-serif;
- font-size: 16px;
- width: 800px;
- margin: 0 auto;
- }
- #banner {
- /* Div for banner */
- float:left;
- margin: 0px;
- margin-bottom: 10px;
- width: 100%;
- background-color: #0071C5;
- z-index: 0;
- }
- #banner .logo {
- /* Apply to logo in banner. Add as class to image tag. */
- float: left;
- margin-right: 20px;
- margin-left: 20px;
- margin-top: 15px;
- padding-bottom: 5px;
- }
- h1 {
- text-align: center;
- font-size: 36px;
- }
- h1.title {
- /* Add as class to H1 in banner */
- font-family: "Intel Clear", Verdana, Arial, sans-serif;
- font-weight:normal;
- color: #FFFFFF;
- font-size: 170%;
- margin-right: 40px;
- margin-left: 40px;
- padding-right: 20px;
- text-indent: 20px;
- }
- .h3-alike {
- display:inline;
- font-size: 1.17em;
- font-weight: bold;
- color: #0071C5;
- }
- h3 {
- font-size: 1.17em;
- font-weight: bold;
- color: #0071C5;
- }
- .h4-alike {
- display:inline;
- font-size: 1.05em;
- font-weight: bold;
- }
- pre {
- font-family: "Consolas", Monaco, monospace;
- font-size:small;
- background: #fafafa;
- margin: 0;
- padding-left:20px;
- }
- #footer {
- font-size: small;
- }
- code {
- font-family: "Consolas", Monaco, monospace;
- }
- .code-block
- {
- padding-left:20px;
- }
- .changes {
- margin: 1em 0;
- }
- .changes input:active {
- position: relative;
- top: 1px;
- }
- .changes input:hover:after {
- padding-left: 16px;
- font-size: 10px;
- content: 'More';
- }
- .changes input:checked:hover:after {
- content: 'Less';
- }
- .changes input + .show-hide {
- display: none;
- }
- .changes input:checked + .show-hide {
- display: block;
- }
-
- ul {
- margin: 0;
- padding: 0.5em 0 0.5em 2.5em;
- }
- ul li {
- margin-bottom: 3px;
- }
- ul li:last-child {
- margin-bottom: 0;
- }
- .disc {
- list-style-type:disc
- }
- .circ {
- list-style-type:circle
- }
-
- .single {
- padding: 0 0.5em;
- }
-
- /* ------------------------------------------------- */
- /* Table styles */
- table{
- margin-bottom:5pt;
- border-collapse:collapse;
- margin-left:0px;
- margin-top:0.3em;
- font-size:10pt;
- }
- tr{
- vertical-align:top;
- }
- th,
- th h3{
- padding:4px;
- text-align:left;
- background-color:#0071C5;
- font-weight:bold;
- margin-top:1px;
- margin-bottom:0;
- color:#FFFFFF;
- font-size:10pt;
- vertical-align:middle;
- }
- th{
- border:1px #dddddd solid;
- padding-top:2px;
- padding-bottom:0px;
- padding-right:3px;
- padding-left:3px;
- }
- td{
- border:1px #dddddd solid;
- vertical-align:top;
- font-size:100%;
- text-align:left;
- margin-bottom:0;
- }
- td,
- td p{
- margin-top:0;
- margin-left:0;
- text-align:left;
- font-size:inherit;
- line-height:120%;
- }
- td p{
- margin-bottom:0;
- padding-top:5px;
- padding-bottom:5px;
- padding-right:5px;
- padding-left:1px;
- }
- .noborder{
- border:0px none;
- }
- .noborder1stcol{
- border:0px none;
- padding-left:0pt;
- }
- td ol{
- font-size:inherit;
- margin-left:28px;
- }
- td ul{
- font-size:inherit;
- margin-left:24px;
- }
- .DefListTbl{
- width:90%;
- margin-left:-3pt;
- }
- .syntaxdiagramtbl{
- margin-left:-3pt;
- }
- .sdtbl{
- }
- .sdrow{
- }
- .sdtblp{
- border:0px none;
- font-size:inherit;
- line-height:120%;
- margin-bottom:0;
- padding-bottom:0px;
- padding-top:5px;
- padding-left:0px;
- padding-right:5px;
- vertical-align:top;
- }
- .idepara, .ide_para{
- border:0px none;
- font-size:inherit;
- line-height:120%;
- margin-bottom:0;
- padding-bottom:0px;
- padding-top:5px;
- padding-left:0px;
- padding-right:5px;
- vertical-align:top;
- }
-
- .specs {
- border-collapse:collapse;
- }
- .specs td, .specs th {
- font-size: 14px;
- }
- .specs td {
- border: 1px solid black;
- }
- .specs td td, .specs td th {
- border: none;
- }
- .specs td, .specs td td, .specs td th {
- padding: 0 0.2em 0.2em;
- text-align: center;
- }
- .specs td tr:last-child td,
- .specs td tr:last-child th {
- padding: 0 0.2em;
- }
- .serial-time {
- }
- .modified-time {
- width: 6.5em;
- }
- .compiler {
- }
- .comp-opt {
- }
- .sys-specs {
- width: 18em;
- }
- .note {
- font-size:small;
- font-style: italic;
- }
- </style>
- <title>Intel® Threading Building Blocks. matmult sample</title>
-</head>
-<body>
-
- <div id="banner">
- <img class="logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEMAAAAsCAYAAAA+aAX8AAAAAXNSR0IArs4c6QAAAARnQU1BAACx
- jwv8YQUAAAAJcEhZcwAALiIAAC4iAari3ZIAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVh
- ZHlxyWU8AAAIN0lEQVRoQ+WaCaxdUxSGW2ouatZWaVS15nkqkZhSVERQglLEPCam1BCixhqqCKUS
- NIiYpxhqHmouIeaY5ylFzA/v1fev8+/j3N5737v3vtf3buNP/uy9/7X2Ovuse4a997m9mgltbW2L
- wRHwcHgFfAx+AH+GCb/BT2fNmvUk5ZXwYOrrOsTcCU5CJ74pPBJeA5+Bn8LfOLmagf/f8Af4NrwD
- ngg3wdTHh2pOMMB1Gejx8AE4M85mNqD/A7+D78GXkXQFTIMPwUfhdPg6/AxWTRw29b8QruPD9zwY
- zPrwHPi2xxmg3QrfgDfD05BGU24EB1HvC3s7REXgtwDsDzeEY+Ak+AJsUfwE2sJdcBN37V4whiU4
- +KGUM2JEBtpzUInZEa5g9y4FcYfAo+GLPmwOND2HFrXrnAUHWgnq0vzDB2+Bt0H9coPs1m3gmNvD
- ZyITBu234Jp26XoQfCC80sfTAXVv7wOXskuPgnHoSvnTw9P49MDdyOauAQEXhWdC4Vd4ARxmc1OB
- cW0Gv3U+lJDvKFa0ufMg4GXwR3gs7J57sRNoaWnR2+znLB2RkKds6jwItvbckIQiGO+eTkSby71t
- qh100qtsUCJxmmpSw5i2gWebR1jWm2047T1gf0vyfViJEKi/TtHua7wMdNJs8U/zDzjUpqYA47k4
- O704wY+kUZ2P+glQc5ldac9j323sF1cH2EB6h8BxYZdbRDeDOJ16UBJiHDFuMMdYbhjEGA8DxJ4h
- jXIemmMpz6ccqbZ1JUlT/3SrHC+9XeB0MjzV9RHqKFAXVg2nBkH/lxxO8aZYbhjEKEuGQH1BuCKc
- z1IAN61jAtiut1wZ+ByIkwa6r9t6ZmhSFZw9eL0gxiMw4SLLDYMYFZNRDbhpcpgwzXI5MOqSEvKM
- Ue8D+xU4r/Xe+C8HB1ThkhFgNqAXk6FVqyZuA1LcItBXQd+WUvf6YMslwFZvMs7KvMP/SculwKa3
- hfYPPsZpfsvS9QD9PRHbcOmUC9J+H2qfoRJ/0MHgFhHIQC8mQ8twxZ0Ji099vSGegn/TP0BdD/Db
- Ycn0nna9yZiceQcetFwKDE/4oNtZCtDeXHoC7dWlU1Uyvs7U6sBHJ7FaBAPU82TYJUAzFnCU+1mq
- COyfwGLi6k3G05l34BrL/wFxjA/0mKUcaNqBKiJODHclQ3sLCVqZprfEvVCLtThhiskRDFAvXhnv
- QPlfi5uW7ytTL14Nr0Bd1pfDXy1Lv93h6koGLstCLR/SuPJ5SQBBD8hPZATbWs6BrdZk7B4dDNpT
- Mjkw3bL0YjLOsxygPUWDyExtD1GNV6JAeyTUBlDCKtbrScYxhfjyj1s+B9o+dnifIj94AnpNyaC9
- f3QwkNJCTnjOsvRiMi6xrHiaA3ycyYFNbcqBpisl/aoHWaspGdg03uIc43mb/gOilt3CREslQG80
- GedmlkC1KyNPBnU9wOPWMp6Aut0S74HfwIQJ7ldTMjBPdBIiGWC0TRkQlseWNmR2tlwC9DmZjEmW
- pQ/zOAKqtwdcrnW/DpOBPtp9Ii6F9lhL1yWIo2zUvVhxzYHeLVcG/QfT/iuTA3qwan+zGndVP8p2
- k4G8E/wLW4D6PxTlnxgwaDEjaMe6n+USYOvqZKTbUrjQcor3ZSYHRtjULvCrmgwkfY5oRc9B+3Cb
- S4FhIhS+gAtZLgH9Y6GWuQU6mwx9IEqYajlA+47CsZ6lGovFBDTNkA9xM4CmpXsAWySDUrPjqZQl
- QBsfnSoB41UKAvS9ouJmDfpaDpTQ2WRcXYinCZm+pdyEtDClPgLloP0unABPp3lrpoZ+KkWskSgP
- sVZMhlat2t7LQftE2aoCh0sVBOheXclyCYjTp7W19bUsZAQtJuPLTA39gOhg0D7PJtny1xj1tWA+
- sUpAG2j7mZaqAh9tzPSVP+XStL+w/qY1XRlfWdOSYXvp7QKnU6Ayqk4jLZcB2zD4gv1iu52qkvG5
- NKPsyrCuPs9aDtDeDr4EtS7RRyXNCgfYLPtYfoC33D0Hul6tE6jOfvsMhVqaT8PWG85PXR+WxlOP
- pHUIHPNXDsif7NWAT773STdlX6vK4ebi4WRgWybZqFe86tBXUAw4BL+S7UTautTXo9yFcjdKPbsq
- PuQTsKdbZ16YLzZrAgdRRvXLCF/Big/R/wXInn5dffdMt8opNs214Bz6cyqNbUDRcZwTIWjDt3m+
- XtcBxq3pvL6p6mFftlFUE+i8JPxRCRGoawVbcVepGcF4V4eTGPNPHv+7NjUGAhzmQOl20fyhphlg
- T4CxLcQw9WC9Gxb3P4Q37NY4CHJXCuhSW3JnwEXs0qNgSHqVbw210ZP2XwK0A65/6C6NgziaAU5X
- wCIUHB4H86227gKH1+JtL3gd1N5sCdACbgZo5rtgnQKx+hLs/ixsdjBXBd2TtyKNhUOp1/dprgMQ
- rx9x16fcn1KbttrIyf9OkICWw1KApvY2YyXbpSBobKf7OGXApFtI+5d3Qq1BDoL6V87GcDVc9Ivq
- E4D+bjTQbc1i9demreDu8Ch0ffG6hdnmDMrvFbsSsAXczIGk3fwb4VYe+pwBB9Angkd83ADtqgkq
- AjetdTTV1icDlfl+Qi3AP4elHEjaDXscHgFjPdNt4ID6S9B9sNLiKoelmuFuJbCpDJi+hvqz2qFw
- iIfWc2AQusxPgvq484vH2eUgtpYHH0Hteeqb75ZwMQ+j+cDg9PlwFDwd6o9sr0KtbWI/tSPgp32M
- 76H+s6mNX3030df5neGq1OtbZDUbOIlFoFaha0L9j0qfCHeAerDqVtODU8+hNThZfR1fHHbpG6kx
- 9Or1LzUmVVz+HJXDAAAAAElFTkSuQmCC">
- <h1 class="title">Intel® Threading Building Blocks.<br>matmult sample</h1>
- </div>
-
- <p>
- The Matmult is an example of a Gen kernel implementing matrix multiplication.
- <br>
- <br>
- It exemplifies support for compute offload to Intel® Graphics Technology in the flow graph API.
- <br><br>
- This example uses C++11 features. Specifying a compiler option such as -std=c++11 or similar might be necessary in order to build the example.
- For more information please refer to the documentation for the compiler you use.
- </p>
- <div class="changes">
- <div class="h3-alike">System Requirements</div>
- <input type="checkbox">
- <div class="show-hide">
- <p>
- For the most up to date system requirements, see the <a href="http://software.intel.com/en-us/articles/intel-threading-building-blocks-release-notes">release notes.</a>
- </p>
- <p> For detailed Intel® Graphics Technology requirements, please refer to article <a href="https://software.intel.com/en-us/articles/getting-started-with-compute-offload-to-intelr-graphics-technology">Getting Started With Compute Offload to Intel® Graphics Technology</a>
- </p>
- </div>
- </div>
-
- <div class="changes">
- <div class="h3-alike">Files</div>
- <input type="checkbox" checked="checked">
- <div class="show-hide">
- <dl>
- <dt><a href="matmult.cpp">matmult.cpp</a>
- <dd>Matrix multiplication Gen kernel implementation with the flow graph interface.
- <dt><a href="Makefile">Makefile</a>
- <dd>Makefile for building the example.
- </dl>
- </div>
- </div>
-
- <div class="changes">
- <div class="h3-alike">Directories</div>
- <input type="checkbox" checked="checked">
- <div class="show-hide">
- <dl>
- <dt><a href="msvs/">msvs</a>
- <dd>Contains Microsoft* Visual Studio* workspace for building and running the example (Windows* systems only).
- </dl>
- <p>For information about the minimum supported version of IDE, see <a href="http://software.intel.com/en-us/articles/intel-threading-building-blocks-release-notes">release notes.</a></p>
- </div>
- </div>
-
- <div class="changes">
- <div class="h3-alike">Build instructions</div>
- <input type="checkbox" checked="checked">
- <div class="show-hide">
- <p>General build directions can be found <a href="../../index.html">here</a>.</p>
- </div>
- </div>
-
- <div class="changes">
- <div class="h3-alike">Usage</div>
- <input type="checkbox" checked="checked">
- <div class="show-hide">
- <dl>
- <dt><tt>matmult <i>-h</i></tt>
- <dd>Prints the help for command line options
- <dt><tt>matmult [<i>-v</i>]</tt>
- <dt>To run a short version of this example, e.g., for use with Intel® Parallel Inspector:
- <dd>Build a <i>debug</i> version of the example
- (see the <a href="../../index.html">build instructions</a>).
- </dl>
- </div>
- </div>
-
- <br>
- <a href="../index.html">Up to parent directory</a>
- <hr>
- <a name="copyright"></a>
- <div class="changes">
- <div class="h3-alike">Legal Information</div>
- <input type="checkbox">
- <div class="show-hide">
- <p>
- Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.
- <br>* Other names and brands may be claimed as the property of others.
- <br>© 2019, Intel Corporation
- </p>
-
- <p>
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- </p>
- </div>
- </div>
-
-</body>
-</html>
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
NAME=som
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
__constant int redChannelOffset = 0;
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define TBB_PREVIEW_FLOW_GRAPH_NODES 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <iostream>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstdlib>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "Matrix.h"
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
class Matrix {
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* Example program that shows how to use parallel_do to do parallel preorder
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/parallel_do.h"
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//{{NO_DEPENDENCIES}}
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
using namespace System;
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __BOARD_H__
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/**
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _CONSOLE
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "Evolution.h"
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
NAME=pover
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//{{NO_DEPENDENCIES}}
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Polygon overlay
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "pover_global.h" // for declaration of DEFINE and INIT
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Polygon overlay
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*!
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Support for GUI display for Polygon overlay demo
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// support for GUI for polygon overlay demo
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// rpolygon.h
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
NAME=seismic
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define VIDEO_WINMAIN_ARGS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//{{NO_DEPENDENCIES}}
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "seismic_video.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef SEISMIC_VIDEO_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "../../common/gui/video.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef UNIVERSE_H_
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# The original source for this example is
# Copyright (c) 1994-2008 John E. Stone
endif # icc
# The default runtime arguments
-export ARGS = dat/balls.dat
-export PERF_RUN_ARGS = silent dat/balls3.dat
-export LIGHT_ARGS= dat/model2.dat
+DATASET = balls
+override ARGS := dat/$(DATASET).dat $(ARGS)
+PERF_RUN_ARGS = silent dat/balls3.dat
+LIGHT_ARGS = dat/model2.dat
# define name suffix
SUFFIX = .$(VERSION)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# The original source for this example is
# Copyright (c) 1994-2008 John E. Stone
XARCH = $(ARCH2:-=x86)
# The default runtime arguments
-ARGS = dat\balls.dat
+DATASET = balls
+override ARGS := dat\$(DATASET).dat $(ARGS)
PERF_RUN_ARGS = silent dat\balls3.dat
-LIGHT_ARGS=dat\model2.dat
+LIGHT_ARGS = dat\model2.dat
# Add these for tbb/tbb1d release builds
# /GL is a workaround to prevent run-time crash when built by VS2010
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define IDC_MYICON 2
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "DirectXPage.xaml.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "pch.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#pragma once
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#pragma once
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
-REM
-REM
-REM
-REM
:: Getting parameters
:: Architecture
if ("%1") == ("") goto error0
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#pragma once
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "pch.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#pragma once
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
PROG=convex_hull_bench
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __CONVEX_HULL_H__
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "primes.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Example program that computes number of prime numbers up to n,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef PRIMES_H_
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <stdlib.h>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "common.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "common.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "common.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef TREE_MAKER_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
typedef float Value;
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "common.h"
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
NAME=Fractal
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "fractal.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef FRACTAL_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef FRACTAL_VIDEO_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define VIDEO_WINMAIN_ARGS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define IDC_MYICON 2
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "../../common/utility/utility.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* Example program that computes Fibonacci numbers in different ways.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# GNU Makefile that builds and runs example.
run_cmd=
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Common Makefile that builds and runs example.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_SERIAL_parallel_for_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_annotate_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__aggregator_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_aligned_space_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_atomic_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_blocked_range_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_blocked_range2d_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_blocked_range3d_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_blocked_rangeNd_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_cache_aligned_allocator_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_combinable_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_condition_variable_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_compat_ppl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_thread_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tuple_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_concurrent_hash_map_H
for(size_type i = embedded_block; i < pointers_per_table; i++)
swap(this->my_table[i], table.my_table[i]);
}
+
+#if __TBB_CPP11_RVALUE_REF_PRESENT
+ void internal_move(hash_map_base&& other) {
+ my_mask = other.my_mask;
+ other.my_mask = embedded_buckets - 1;
+ my_size = other.my_size;
+ other.my_size = 0;
+
+ for(size_type i = 0; i < embedded_buckets; ++i) {
+ my_embedded_segment[i].node_list = other.my_embedded_segment[i].node_list;
+ other.my_embedded_segment[i].node_list = NULL;
+ }
+
+ for(size_type i = embedded_block; i < pointers_per_table; ++i) {
+ my_table[i] = other.my_table[i];
+ other.my_table[i] = NULL;
+ }
+ }
+#endif // __TBB_CPP11_RVALUE_REF_PRESENT
};
template<typename Iterator>
}
//! Copy constructor
- concurrent_hash_map( const concurrent_hash_map &table, const allocator_type &a = allocator_type() )
+ concurrent_hash_map( const concurrent_hash_map &table )
+ : internal::hash_map_base(),
+ my_allocator(node_allocator_traits::select_on_container_copy_construction(table.get_allocator()))
+ {
+ call_clear_on_leave scope_guard(this);
+ internal_copy(table);
+ scope_guard.dismiss();
+ }
+
+ concurrent_hash_map( const concurrent_hash_map &table, const allocator_type &a)
: internal::hash_map_base(), my_allocator(a)
{
call_clear_on_leave scope_guard(this);
concurrent_hash_map( concurrent_hash_map &&table )
: internal::hash_map_base(), my_allocator(std::move(table.get_allocator()))
{
- swap(table);
+ internal_move(std::move(table));
}
//! Move constructor
: internal::hash_map_base(), my_allocator(a)
{
if (a == table.get_allocator()){
- this->swap(table);
+ internal_move(std::move(table));
}else{
call_clear_on_leave scope_guard(this);
internal_copy(std::make_move_iterator(table.begin()), std::make_move_iterator(table.end()), table.size());
//! Assignment
concurrent_hash_map& operator=( const concurrent_hash_map &table ) {
if( this!=&table ) {
+ typedef typename node_allocator_traits::propagate_on_container_copy_assignment pocca_type;
clear();
+ tbb::internal::allocator_copy_assignment(my_allocator, table.my_allocator, pocca_type());
internal_copy(table);
}
return *this;
//! Move Assignment
concurrent_hash_map& operator=( concurrent_hash_map &&table ) {
if(this != &table) {
- typedef typename tbb::internal::allocator_traits<allocator_type>::propagate_on_container_move_assignment pocma_t;
- if(pocma_t::value || this->my_allocator == table.my_allocator) {
- concurrent_hash_map trash (std::move(*this));
- //TODO: swapping allocators here may be a problem, replace with single direction moving iff pocma is set
- this->swap(table);
- } else {
- //do per element move
- concurrent_hash_map moved_copy(std::move(table), this->my_allocator);
- this->swap(moved_copy);
- }
+ typedef typename node_allocator_traits::propagate_on_container_move_assignment pocma_type;
+ internal_move_assign(std::move(table), pocma_type());
}
return *this;
}
template<typename I>
void internal_copy( I first, I last, size_type reserve_size );
+#if __TBB_CPP11_RVALUE_REF_PRESENT
+ // A compile-time dispatch to allow move assignment of containers with non-movable value_type if POCMA is true_type
+ void internal_move_assign(concurrent_hash_map&& other, tbb::internal::traits_true_type) {
+ tbb::internal::allocator_move_assignment(my_allocator, other.my_allocator, tbb::internal::traits_true_type());
+ internal_move(std::move(other));
+ }
+
+ void internal_move_assign(concurrent_hash_map&& other, tbb::internal::traits_false_type) {
+ if (this->my_allocator == other.my_allocator) {
+ internal_move(std::move(other));
+ } else {
+ //do per element move
+ internal_copy(std::make_move_iterator(other.begin()), std::make_move_iterator(other.end()), other.size());
+ }
+ }
+#endif
+
//! Fast find when no concurrent erasure is used. For internal use inside TBB only!
/** Return pointer to item with given key, or NULL if no such item exists.
Must not be called concurrently with erasure operations. */
template<typename Key, typename T, typename HashCompare, typename A>
void concurrent_hash_map<Key,T,HashCompare,A>::swap(concurrent_hash_map<Key,T,HashCompare,A> &table) {
- //TODO: respect C++11 allocator_traits<A>::propogate_on_constainer_swap
- using std::swap;
- swap(this->my_allocator, table.my_allocator);
- swap(this->my_hash_compare, table.my_hash_compare);
- internal_swap(table);
+ typedef typename node_allocator_traits::propagate_on_container_swap pocs_type;
+ if (this != &table && (pocs_type::value || my_allocator == table.my_allocator)) {
+ using std::swap;
+ tbb::internal::allocator_swap(this->my_allocator, table.my_allocator, pocs_type());
+ swap(this->my_hash_compare, table.my_hash_compare);
+ internal_swap(table);
+ }
}
template<typename Key, typename T, typename HashCompare, typename A>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_concurrent_lru_cache_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_concurrent_priority_queue_H
#include "tbb_profiling.h"
#include "internal/_aggregator_impl.h"
#include "internal/_template_helpers.h"
+#include "internal/_allocator_traits.h"
#include <vector>
#include <iterator>
#include <functional>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_concurrent_queue_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* Container implementations in this header are based on PPL implementations
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* Container implementations in this header are based on PPL implementations
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_concurrent_vector_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_CRITICAL_SECTION_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_enumerable_thread_specific_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_flow_graph_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_flow_graph_abstractions_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_flow_graph_opencl_node_H
+++ /dev/null
-/*
- Copyright (c) 2005-2019 Intel Corporation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-
-
-*/
-
-#ifndef __TBB_flow_graph_gfx_factory_H
-#define __TBB_flow_graph_gfx_factory_H
-
-#include "tbb/tbb_config.h"
-
-#if __TBB_PREVIEW_GFX_FACTORY
-
-#include <vector>
-#include <future>
-#include <mutex>
-#include <iostream>
-
-#include <gfx/gfx_rt.h>
-#include <gfx/gfx_intrin.h>
-#include <gfx/gfx_types.h>
-
-namespace tbb {
-
-namespace flow {
-
-namespace interface9 {
-
-template <typename T>
-class gfx_buffer;
-
-namespace gfx_offload {
-
- typedef GfxTaskId task_id_type;
-
- //-----------------------------------------------------------------------
- // GFX errors checkers.
- // For more debug output, set GFX_LOG_OFFLOAD=2 macro
- //-----------------------------------------------------------------------
-
- // TODO: reconsider error handling approach. If exception is the right way
- // then need to define and document a specific exception type.
- inline void throw_gfx_exception() {
- std::string msg = "GFX error occurred: " + std::to_string(_GFX_get_last_error());
- std::cerr << msg << std::endl;
- throw msg;
- }
-
- inline void check_enqueue_retcode(task_id_type err) {
- if (err == 0) {
- throw_gfx_exception();
- }
- }
-
- inline void check_gfx_retcode(task_id_type err) {
- if (err != GFX_SUCCESS) {
- throw_gfx_exception();
- }
- }
-
- //---------------------------------------------------------------------
- // GFX asynchronous offload and share API
- //---------------------------------------------------------------------
-
- // Sharing and unsharing data API
- template<typename DataType, typename SizeType>
- void share(DataType* p, SizeType n) { check_gfx_retcode(_GFX_share(p, sizeof(*p)*n)); }
- template<typename DataType>
- void unshare(DataType* p) { check_gfx_retcode(_GFX_unshare(p)); }
-
- // Retrieving array pointer from shared gfx_buffer
- // Other types remain the same
- template <typename T>
- T* raw_data(gfx_buffer<T>& buffer) { return buffer.data(); }
- template <typename T>
- const T* raw_data(const gfx_buffer<T>& buffer) { return buffer.data(); }
- template <typename T>
- T& raw_data(T& data) { return data; }
- template <typename T>
- const T& raw_data(const T& data) { return data; }
-
- // Kernel enqueuing on device with arguments
- template <typename F, typename ...ArgType>
- task_id_type run_kernel(F ptr, ArgType&... args) {
- task_id_type id = _GFX_offload(ptr, raw_data(args)...);
-
- // Check if something during offload went wrong (ex: driver initialization failure)
- gfx_offload::check_enqueue_retcode(id);
-
- return id;
- }
-
- // Waiting for tasks completion
- void wait_for_task(task_id_type id) { check_gfx_retcode(_GFX_wait(id)); }
-
-} // namespace gfx_offload
-
-template <typename T>
-class gfx_buffer {
-public:
-
- typedef typename std::vector<T>::iterator iterator;
- typedef typename std::vector<T>::const_iterator const_iterator;
-
- typedef std::size_t size_type;
-
- gfx_buffer() : my_vector_ptr(std::make_shared< std::vector<T> >()) {}
- gfx_buffer(size_type size) : my_vector_ptr(std::make_shared< std::vector<T> >(size)) {}
-
- T* data() { return &(my_vector_ptr->front()); }
- const T* data() const { return &(my_vector_ptr->front()); }
-
- size_type size() const { return my_vector_ptr->size(); }
-
- const_iterator cbegin() const { return my_vector_ptr->cbegin(); }
- const_iterator cend() const { return my_vector_ptr->cend(); }
- iterator begin() { return my_vector_ptr->begin(); }
- iterator end() { return my_vector_ptr->end(); }
-
- T& operator[](size_type pos) { return (*my_vector_ptr)[pos]; }
- const T& operator[](size_type pos) const { return (*my_vector_ptr)[pos]; }
-
-private:
- std::shared_ptr< std::vector<T> > my_vector_ptr;
-};
-
-template<typename T>
-class gfx_async_msg : public tbb::flow::async_msg<T> {
-public:
- typedef gfx_offload::task_id_type kernel_id_type;
-
- gfx_async_msg() : my_task_id(0) {}
- gfx_async_msg(const T& input_data) : my_data(input_data), my_task_id(0) {}
-
- T& data() { return my_data; }
- const T& data() const { return my_data; }
-
- void set_task_id(kernel_id_type id) { my_task_id = id; }
- kernel_id_type task_id() const { return my_task_id; }
-
-private:
- T my_data;
- kernel_id_type my_task_id;
-};
-
-class gfx_factory {
-private:
-
- // Wrapper for GFX kernel which is just a function
- class func_wrapper {
- public:
-
- template <typename F>
- func_wrapper(F ptr) { my_ptr = reinterpret_cast<void*>(ptr); }
-
- template<typename ...Args>
- void operator()(Args&&... args) {}
-
- operator void*() { return my_ptr; }
-
- private:
- void* my_ptr;
- };
-
-public:
-
- // Device specific types
- template<typename T> using async_msg_type = gfx_async_msg<T>;
-
- typedef func_wrapper kernel_type;
-
- // Empty device type that is needed for Factory Concept
- // but is not used in gfx_factory
- typedef struct {} device_type;
-
- typedef gfx_offload::task_id_type kernel_id_type;
-
- gfx_factory(tbb::flow::graph& g) : m_graph(g), current_task_id(0) {}
-
- // Upload data to the device
- template <typename ...Args>
- void send_data(device_type /*device*/, Args&... args) {
- send_data_impl(args...);
- }
-
- // Run kernel on the device
- template <typename ...Args>
- void send_kernel(device_type /*device*/, const kernel_type& kernel, Args&... args) {
- // Get packed T data from async_msg<T> and pass it to kernel
- kernel_id_type id = gfx_offload::run_kernel(kernel, args.data()...);
-
- // Set id to async_msg
- set_kernel_id(id, args...);
-
- // Extend the graph lifetime until the callback completion.
- m_graph.reserve_wait();
-
- // Mutex for future assignment
- std::lock_guard<std::mutex> lock(future_assignment_mutex);
-
- // Set callback that waits for kernel execution
- callback_future = std::async(std::launch::async, &gfx_factory::callback<Args...>, this, id, args...);
- }
-
- // Finalization action after the kernel run
- template <typename FinalizeFn, typename ...Args>
- void finalize(device_type /*device*/, FinalizeFn fn, Args&... /*args*/) {
- fn();
- }
-
- // Empty device selector.
- // No way to choose a device with GFX API.
- class dummy_device_selector {
- public:
- device_type operator()(gfx_factory& /*factory*/) {
- return device_type();
- }
- };
-
-private:
-
- //---------------------------------------------------------------------
- // Callback for kernel result
- //---------------------------------------------------------------------
-
- template <typename ...Args>
- void callback(kernel_id_type id, Args... args) {
- // Waiting for specific tasks id to complete
- {
- std::lock_guard<std::mutex> lock(task_wait_mutex);
- if (current_task_id < id) {
- gfx_offload::wait_for_task(id);
- current_task_id = id;
- }
- }
-
- // Get result from device and set to async_msg (args)
- receive_data(args...);
-
- // Data was sent to the graph, release the reference
- m_graph.release_wait();
- }
-
- //---------------------------------------------------------------------
- // send_data() arguments processing
- //---------------------------------------------------------------------
-
- // GFX buffer shared data with device that will be executed on
- template <typename T>
- void share_data(T) {}
-
- template <typename T>
- void share_data(gfx_buffer<T>& buffer) {
- gfx_offload::share(buffer.data(), buffer.size());
- }
-
- template <typename T>
- void send_arg(T) {}
-
- template <typename T>
- void send_arg(async_msg_type<T>& msg) {
- share_data(msg.data());
- }
-
- void send_data_impl() {}
-
- template <typename T, typename ...Rest>
- void send_data_impl(T& arg, Rest&... args) {
- send_arg(arg);
- send_data_impl(args...);
- }
-
- //----------------------------------------------------------------------
- // send_kernel() arguments processing
- //----------------------------------------------------------------------
-
- template <typename T>
- void set_kernel_id_arg(kernel_id_type, T) {}
-
- template <typename T>
- void set_kernel_id_arg(kernel_id_type id, async_msg_type<T>& msg) {
- msg.set_task_id(id);
- }
-
- void set_kernel_id(kernel_id_type) {}
-
- template <typename T, typename ...Rest>
- void set_kernel_id(kernel_id_type id, T& arg, Rest&... args) {
- set_kernel_id_arg(id, arg);
- set_kernel_id(id, args...);
- }
-
- //-----------------------------------------------------------------------
- // Arguments processing after kernel execution.
- // Unsharing buffers and forwarding results to the graph
- //-----------------------------------------------------------------------
-
- // After kernel execution the data should be unshared
- template <typename T>
- void unshare_data(T) {}
-
- template <typename T>
- void unshare_data(gfx_buffer<T>& buffer) {
- gfx_offload::unshare(buffer.data());
- }
-
- template <typename T>
- void receive_arg(T) {}
-
- template <typename T>
- void receive_arg(async_msg_type<T>& msg) {
- unshare_data(msg.data());
- msg.set(msg.data());
- }
-
- void receive_data() {}
-
- template <typename T, typename ...Rest>
- void receive_data(T& arg, Rest&... args) {
- receive_arg(arg);
- receive_data(args...);
- }
-
- //-----------------------------------------------------------------------
- int current_task_id;
-
- std::future<void> callback_future;
- tbb::flow::graph& m_graph;
-
- std::mutex future_assignment_mutex;
- std::mutex task_wait_mutex;
-};
-
-} // namespace interface9
-
-using interface9::gfx_factory;
-using interface9::gfx_buffer;
-
-} // namespace flow
-
-} // namespace tbb
-
-#endif // __TBB_PREVIEW_GFX_FACTORY
-
-#endif // __TBB_flow_graph_gfx_factory_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_global_control_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__aggregator_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_allocator_traits_H
typedef tbb::internal::false_type traits_false_type;
#endif
+//! Copy assignment implementation for allocator if propagate_on_container_copy_assignment == true_type
+//! Noop if pocca == false_type
+template <typename MyAlloc, typename OtherAlloc>
+inline void allocator_copy_assignment(MyAlloc& my_allocator, OtherAlloc& other_allocator, traits_true_type) {
+ my_allocator = other_allocator;
+}
+template <typename MyAlloc, typename OtherAlloc>
+inline void allocator_copy_assignment(MyAlloc&, OtherAlloc&, traits_false_type) { /* NO COPY */}
+
#if __TBB_CPP11_RVALUE_REF_PRESENT
//! Move assignment implementation for allocator if propagate_on_container_move_assignment == true_type.
//! Noop if pocma == false_type.
p->~T();
tbb::internal::suppress_unused_warning(p);
}
+
+ static Alloc select_on_container_copy_construction(const Alloc& a) { return a; }
};
#endif // __TBB_ALLOCATOR_TRAITS_PRESENT
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__concurrent_queue_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* Container implementations in this header are based on PPL implementations
source_iterator where = it++;
if (allow_multimapping || find(get_key(*where)) == end()) {
std::pair<node_type, raw_iterator> extract_result = source.internal_extract(where);
-
+
// If the insertion fails, it returns ownership of the node to extract_result.first
// extract_result.first remains valid node handle
if (!insert(std::move(extract_result.first)).second) {
void swap(concurrent_unordered_base& right) {
if (this != &right) {
- std::swap(my_hash_compare, right.my_hash_compare); // TODO: check what ADL meant here
+ std::swap(my_hash_compare, right.my_hash_compare);
my_solist.swap(right.my_solist);
internal_swap_buckets(right);
std::swap(my_number_of_buckets, right.my_number_of_buckets);
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__flow_graph_async_msg_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__flow_graph_body_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__flow_graph_cache_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_flow_graph_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__flow_graph_indexer_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__flow_graph_item_buffer_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__flow_graph_join_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__flow_graph_node_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_flow_graph_streaming_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// a hash table buffer that can expand, and can support as many deletions as
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _FGT_GRAPH_TRACE_IMPL_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__flow_graph_types_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_mutex_padding_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_range_iterator_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// must be included outside namespaces.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
TBB_STRING_RESOURCE(FLOW_BROADCAST_NODE, "broadcast_node")
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _FGT_TBB_TRACE_IMPL_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbb_windef_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_template_helpers_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__x86_eliding_mutex_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB__x86_rtm_rw_mutex_impl_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_iterators_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_gcc_generic_H)
// __builtin_clz counts the number of leading zeroes
namespace tbb{ namespace internal { namespace gcc_builtins {
- inline int clz(unsigned int x){ return __builtin_clz(x); };
- inline int clz(unsigned long int x){ return __builtin_clzl(x); };
- inline int clz(unsigned long long int x){ return __builtin_clzll(x); };
+ inline int clz(unsigned int x){ return __builtin_clz(x); }
+ inline int clz(unsigned long int x){ return __builtin_clzl(x); }
+ inline int clz(unsigned long long int x){ return __builtin_clzll(x); }
}}}
// logarithm is the index of the most significant non-zero bit
static inline intptr_t __TBB_machine_lg( uintptr_t x ) {
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_machine_gcc_ia32_common_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_gcc_itsx_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// TODO: revise by comparing with mac_ppc.h
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_icc_generic_H)
#endif
#if ! __TBB_ICC_BUILTIN_ATOMICS_PRESENT
- #error "Intel C++ Compiler of at least 12.0 version is needed to use ICC intrinsics port"
+ #error "Intel(R) C++ Compiler of at least 12.0 version is needed to use ICC intrinsics port"
#endif
#define __TBB_machine_icc_generic_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_machine_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_linux_ia32_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_linux_ia64_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_linux_intel64_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_gcc_power_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_macos_common_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_mic_common_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_msvc_armv7_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_msvc_ia32_common_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_machine_windows_api_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_windows_ia32_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !defined(__TBB_machine_H) || defined(__TBB_machine_windows_intel64_H)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_memory_pool_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_mutex_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_null_mutex_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_null_rw_mutex_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_parallel_do_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_parallel_for_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_parallel_for_each_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_parallel_invoke_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_parallel_reduce_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_parallel_scan_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_parallel_sort_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_parallel_while
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_partitioner_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_pipeline_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_queuing_mutex_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_queuing_rw_mutex_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_reader_writer_lock_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_recursive_mutex_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_runtime_loader_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_scalable_allocator_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_spin_mutex_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_spin_rw_mutex_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_task_H
class task_scheduler_init;
namespace interface7 { class task_arena; }
+using interface7::task_arena;
//! Used to form groups of tasks
/** @ingroup task_scheduling
private:
friend class internal::generic_scheduler;
friend class task_scheduler_init;
- friend class interface7::task_arena;
+ friend class task_arena;
#if TBB_USE_CAPTURED_EXCEPTION
typedef tbb_exception exception_container_type;
}
#endif /* __TBB_TASK_PRIORITY */
+ //! Enqueue task in task_arena
+ //! The implementation is in task_arena.h
+ inline static void enqueue( task& t, task_arena& arena
+#if __TBB_TASK_PRIORITY
+ , priority_t p = priority_t(0)
+#endif
+ );
+
//! The innermost task being executed or destroyed by the current thread at the moment.
static task& __TBB_EXPORTED_FUNC self();
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_task_arena_H
*/
class task_arena : public internal::task_arena_base {
friend class tbb::internal::task_scheduler_observer_v3;
+ friend void task::enqueue(task&, task_arena&
+#if __TBB_TASK_PRIORITY
+ , priority_t
+#endif
+ );
friend int tbb::this_task_arena::max_concurrency();
bool my_initialized;
void mark_initialized() {
}
} // namespace this_task_arena
+//! Enqueue task in task_arena
+void task::enqueue( task& t, task_arena& arena
+#if __TBB_TASK_PRIORITY
+ , priority_t p
+#endif
+ ) {
+#if !__TBB_TASK_PRIORITY
+ intptr_t p = 0;
+#endif
+ arena.initialize();
+ //! Note: the context of the task may differ from the context instantiated by task_arena
+ arena.internal_enqueue(t, p);
+}
} // namespace tbb
#endif /* __TBB_task_arena_H */
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_task_group_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_task_scheduler_init_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_task_scheduler_observer_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbb_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbb_allocator_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbb_config_H
#define __INTEL_CXX11_MODE__ (__GXX_EXPERIMENTAL_CXX0X__ || (_MSC_VER && __STDC_HOSTED__))
#endif
-// Intel(R) C++ Compiler offloading API to the Intel(R) Graphics Technology presence macro
-// TODO: add support for ICC 15.00 _GFX_enqueue API and then decrease Intel C++ Compiler supported version
-// TODO: add linux support and restict it with (__linux__ && __TBB_x86_64 && !__ANDROID__) macro
-#if __INTEL_COMPILER >= 1600 && _WIN32
-#define __TBB_GFX_PRESENT 1
-#endif
-
#if __INTEL_COMPILER && (!_MSC_VER || __INTEL_CXX11_MODE__)
// On Windows, C++11 features supported by Visual Studio 2010 and higher are enabled by default,
// so in absence of /Qstd= use MSVC branch for feature detection.
#define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (_MSVC_LANG >= 201703L && _MSC_VER >= 1914)
#define __TBB_CPP17_INVOKE_RESULT_PRESENT (_MSVC_LANG >= 201703L && _MSC_VER >= 1911)
#else
- #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 0
- #define __TBB_CPP11_RVALUE_REF_PRESENT 0
- #define __TBB_IMPLICIT_MOVE_PRESENT 0
- #define __TBB_EXCEPTION_PTR_PRESENT 0
- #define __TBB_STATIC_ASSERT_PRESENT 0
- #define __TBB_CPP11_TUPLE_PRESENT 0
- #define __TBB_INITIALIZER_LISTS_PRESENT 0
- #define __TBB_CONSTEXPR_PRESENT 0
- #define __TBB_DEFAULTED_AND_DELETED_FUNC_PRESENT 0
- #define __TBB_NOEXCEPT_PRESENT 0
- #define __TBB_CPP11_STD_BEGIN_END_PRESENT 0
- #define __TBB_CPP11_AUTO_PRESENT 0
- #define __TBB_CPP11_DECLTYPE_PRESENT 0
- #define __TBB_CPP11_LAMBDAS_PRESENT 0
- #define __TBB_CPP11_DEFAULT_FUNC_TEMPLATE_ARGS_PRESENT 0
- #define __TBB_OVERRIDE_PRESENT 0
- #define __TBB_ALIGNAS_PRESENT 0
- #define __TBB_CPP11_TEMPLATE_ALIASES_PRESENT 0
+ #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_CPP11_RVALUE_REF_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_IMPLICIT_MOVE_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_EXCEPTION_PTR_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_STATIC_ASSERT_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_CPP11_TUPLE_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_INITIALIZER_LISTS_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_CONSTEXPR_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_DEFAULTED_AND_DELETED_FUNC_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_NOEXCEPT_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_CPP11_STD_BEGIN_END_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_CPP11_AUTO_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_CPP11_DECLTYPE_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_CPP11_LAMBDAS_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_CPP11_DEFAULT_FUNC_TEMPLATE_ARGS_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_OVERRIDE_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_ALIGNAS_PRESENT __TBB_CPP11_PRESENT
+ #define __TBB_CPP11_TEMPLATE_ALIASES_PRESENT __TBB_CPP11_PRESENT
#define __TBB_CPP14_INTEGER_SEQUENCE_PRESENT (__cplusplus >= 201402L)
- #define __TBB_CPP14_VARIABLE_TEMPLATES_PRESENT 0
- #define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT 0
- #define __TBB_CPP17_INVOKE_RESULT_PRESENT 0
+ #define __TBB_CPP14_VARIABLE_TEMPLATES_PRESENT (__cplusplus >= 201402L)
+ #define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (__cplusplus >= 201703L)
+ #define __TBB_CPP17_INVOKE_RESULT_PRESENT (__cplusplus >= 201703L)
#endif
// C++11 standard library features
#define __TBB_MOVE_IF_NOEXCEPT_PRESENT (__TBB_NOEXCEPT_PRESENT && (__TBB_GLIBCXX_VERSION >= 40700 || _MSC_VER >= 1900 || _LIBCPP_VERSION))
#define __TBB_ALLOCATOR_TRAITS_PRESENT (__cplusplus >= 201103L && _LIBCPP_VERSION || _MSC_VER >= 1800 || \
__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GLIBCXX_VERSION >= 40700 && !(__TBB_GLIBCXX_VERSION == 40700 && __TBB_DEFINE_MIC))
-#define __TBB_MAKE_EXCEPTION_PTR_PRESENT (__TBB_EXCEPTION_PTR_PRESENT && (_MSC_VER >= 1700 || __TBB_GLIBCXX_VERSION >= 40600 || _LIBCPP_VERSION))
+#define __TBB_MAKE_EXCEPTION_PTR_PRESENT (__TBB_EXCEPTION_PTR_PRESENT && (_MSC_VER >= 1700 || __TBB_GLIBCXX_VERSION >= 40600 || _LIBCPP_VERSION || __SUNPRO_CC))
// Due to libc++ limitations in C++03 mode, do not pass rvalues to std::make_shared()
#define __TBB_CPP11_SMART_POINTERS_PRESENT ( _MSC_VER >= 1600 || _LIBCPP_VERSION \
#define __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING (TBB_PREVIEW_FLOW_GRAPH_FEATURES || __TBB_PREVIEW_OPENCL_NODE)
#define __TBB_PREVIEW_ASYNC_MSG (TBB_PREVIEW_FLOW_GRAPH_FEATURES && __TBB_FLOW_GRAPH_CPP11_FEATURES)
-#define __TBB_PREVIEW_GFX_FACTORY (__TBB_GFX_PRESENT && TBB_PREVIEW_FLOW_GRAPH_FEATURES && !__TBB_MIC_OFFLOAD \
- && __TBB_FLOW_GRAPH_CPP11_FEATURES && __TBB_CPP11_TEMPLATE_ALIASES_PRESENT \
- && __TBB_CPP11_FUTURE_PRESENT)
-
#ifndef __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES
#define __TBB_PREVIEW_FLOW_GRAPH_PRIORITIES TBB_PREVIEW_FLOW_GRAPH_FEATURES
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//! To disable use of exceptions, include this header before any other header file from the library.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_exception_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_machine_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_profiling_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbb_stddef_H
#define TBB_VERSION_MINOR 0
// Engineering-focused interface version
-#define TBB_INTERFACE_VERSION 11005
+#define TBB_INTERFACE_VERSION 11006
#define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
// The oldest major interface version still supported
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbb_thread_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tick_count_H
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
export tbb_root?=$(NDK_PROJECT_PATH)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
ifndef tbb_os
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
tbb_root?=..
include $(tbb_root)/build/common.inc
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
from tbb import *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
.NOTPARALLEL:
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "rml_tbb.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "ipc_utils.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __IPC_UTILS_H
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# System imports
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
from __future__ import print_function
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
from . import _main
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
__all__ = ["task_arena", "task_group", "task_scheduler_init", "global_control", "default_num_threads"]
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Based on the software developed by:
# Copyright (c) 2008,2016 david decotigny (Pool of threads)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
# Based on the software developed by:
# Copyright (c) 2008,2016 david decotigny (Pool of threads)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
tbb_root?=..
examples_root:=$(tbb_root)/examples
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "concurrent_queue_v2.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_concurrent_queue_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "concurrent_vector_v2.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_concurrent_vector_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "spin_rw_mutex_v2.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_spin_rw_mutex_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* This compilation unit provides definition of task::destroy( task& )
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "old/concurrent_queue_v2.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "concurrent_vector_v2.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define __TBB_ARENA_OBSERVER 0
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef coarse_grained_raii_lru_cache_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstdlib>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstdio>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "perf.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __tbb_perf_h__
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "perf.h"
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-#
-#
-#
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
#setting output format .csv, 'pivot' - is pivot table mode, ++ means append
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "statistics.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Internal Intel tool
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
const char XMLBRow[]=
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/*
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_CUSTOM_MAIN 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstdio>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TIME_FRAMEWORK_H__
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// configuration:
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// configuration:
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
////// Test configuration ////////////////////////////////////////////////////
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "../examples/common/utility/utility.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <vector>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TIME_FRAMEWORK_H__
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <iostream>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//#define DO_SCALABLEALLOC
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef LIBRARY_ASSERT_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "omp_dynamic_link.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __KMP_omp_dynamic_link_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// No ifndef guard because this file is not a normal include file.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "rml_omp.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "../include/rml_tbb.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Header guard and namespace names follow rml conventions.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Header guard and namespace names follow OpenMP runtime conventions.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Header guard and namespace names follow TBB conventions.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstddef>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstddef>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstddef>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <cstddef>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Thread level recorder
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
// Microsoft Visual C++ generated resource script.
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __RML_job_automaton_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "rml_tbb.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// All platform-specific threading support is encapsulated here. */
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __RML_wait_counter_H
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
EXPORTS
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
EXPORTS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// This file is compiled with C++, but linked with a program written in C.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <tbb/tbb_config.h>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <tbb/tbb_config.h>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
void Cplusplus();
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <tbb/tbb_config.h>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* This header contains code shared by test_omp_server.cpp and test_tbb_server.cpp
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/global_control.h" // thread_stack_size
generic_scheduler* s = governor::local_scheduler_if_initialized();
__TBB_ASSERT(s, "Scheduler is not initialized"); // we allocated a task so can expect the scheduler
#if __TBB_TASK_GROUP_CONTEXT
- __TBB_ASSERT(my_arena->my_default_ctx == t.prefix().context, NULL);
- __TBB_ASSERT(!my_arena->my_default_ctx->is_group_execution_cancelled(), // TODO: any better idea?
+ // Is there a better place for checking the state of my_default_ctx?
+ __TBB_ASSERT(!(my_arena->my_default_ctx == t.prefix().context && my_arena->my_default_ctx->is_group_execution_cancelled()),
"The task will not be executed because default task_group_context of task_arena is cancelled. Has previously enqueued task thrown an exception?");
#endif
my_arena->enqueue_task( t, prio, s->my_random );
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_arena_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* The API to enable interoperability between Intel(R) Cilk(TM) Plus and
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/concurrent_hash_map.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "concurrent_monitor.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_concurrent_monitor_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_stddef.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if (_MSC_VER)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/critical_section.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_custom_scheduler_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "dynamic_link.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_dynamic_link
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <stdio.h>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_governor_H
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
.686
.model flat,c
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
.686
.model flat,c
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
; DO NOT EDIT - AUTOMATICALLY GENERATED FROM .s FILE
.686
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
// DO NOT EDIT - AUTOMATICALLY GENERATED FROM tools/generate_atomic/ipf_generate.sh
# 1 "<stdin>"
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
// RSE backing store pointer retrieval
.section .text
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
// Support for class TinyLock
.section .text
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
.section .text
.align 16
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
.section .text
.align 16
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <stdint.h>
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
; DO NOT EDIT - AUTOMATICALLY GENERATED FROM .s FILE
.code
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
.code
ALIGN 8
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
.code
ALIGN 8
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_intrusive_list_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if DO_ITT_NOTIFY
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_ITT_NOTIFY
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define __TBB_SYMBOL( sym ) _##sym
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define __TBB_SYMBOL( sym ) _##sym
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_mailbox_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_stddef.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_market_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _WIN32||_WIN64
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_observer_proxy_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/pipeline.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "../rml/include/rml_tbb.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/queuing_mutex.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/** Before making any changes in the implementation, please emulate algorithmic changes
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/reader_writer_lock.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/recursive_mutex.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "custom_scheduler.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_scheduler_H
the thread that creates the instance.
Class generic_scheduler is an abstract base class that contains most of the scheduler,
- except for tweaks specific to processors and tools (e.g. VTune).
+ except for tweaks specific to processors and tools (e.g. VTune(TM) Performance Tools).
The derived template class custom_scheduler<SchedulerTraits> fills in the tweaks. */
class generic_scheduler: public scheduler
, public ::rml::job
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_scheduler_common_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_scheduler_utility_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "semaphore.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbb_semaphore_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_machine.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/spin_rw_mutex.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Do not include task.h directly. Use scheduler_common.h instead
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "scheduler.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_task_stream_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_task_stream_extended_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_assert_impl_H
/*
- Copyright (c) 2005-2019 Intel Corporation
+ Copyright (c) 2018-2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbb_environment_H
#include <cstdlib>
#include <cstring>
+#include <cerrno>
+#include <cctype>
namespace tbb {
static inline bool GetBoolEnvironmentVariable( const char * ) {
return false;
}
+
+static inline long GetIntegralEnvironmentVariable( const char * ) {
+ return -1;
+}
#else /* __TBB_WIN8UI_SUPPORT */
static inline bool GetBoolEnvironmentVariable( const char * name ) {
if( const char* s = std::getenv(name) )
}
return false;
}
+
+static inline long GetIntegralEnvironmentVariable( const char * name ) {
+ if( const char* s = std::getenv(name) )
+ {
+ char* end = NULL;
+ errno = 0;
+ long value = std::strtol(s, &end, 10);
+
+ // We have exceeded the range, value is negative or string is incovertable
+ if ( errno == ERANGE || value < 0 || end==s )
+ {
+ return -1;
+ }
+
+ for ( ; *end != '\0'; end++ )
+ {
+ if ( !std::isspace(*end) )
+ return -1;
+ }
+
+ return value;
+ }
+ return -1;
+}
#endif /* __TBB_WIN8UI_SUPPORT */
} // namespace internal
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_tbb_main_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Source file for miscellaneous entities that are infrequently referenced by
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_tbb_misc_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Source file for miscellaneous entities that are infrequently referenced by
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
// Microsoft Visual C++ generated resource script.
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb_statistics.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_tbb_statistics_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _WIN32||_WIN64
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Please define version number in the file:
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_tls_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "ittnotify_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _ITTNOTIFY_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _ITTNOTIFY_CONFIG_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "ittnotify_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "ittnotify_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _ITTNOTIFY_TYPES_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _LEGACY_ITTNOTIFY_H_
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
EXPORTS
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
; This file is organized with a section for each .cpp file.
; Each of these sections is in alphabetical order.
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
// This file is organized with a section for each .cpp file.
// Each of these sections is in alphabetical order.
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_malloc_Customize_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _itt_shared_malloc_MapMemory_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define MAX_THREADS 1024
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_malloc_Synchronize_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _itt_shared_malloc_TypeDefinitions_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <string.h> /* for memset */
// valid only when block is in processing, i.e. one is not free and not
size_t sizeTmp; // used outside of backend
int myBin; // bin that is owner of the block
- bool aligned;
+ bool slabAligned;
bool blockInBin; // this block in myBin already
FreeBlock *rightNeig(size_t sz) const {
// split the block without removing it.
// If the free space should go to other bin(s), remove the block.
// alignedBin is true, if all blocks in the bin have slab-aligned right side.
-FreeBlock *Backend::IndexedBins::getFromBin(int binIdx, BackendSync *sync,
- size_t size, bool needAlignedRes, bool alignedBin, bool wait,
- int *binLocked)
+FreeBlock *Backend::IndexedBins::getFromBin(int binIdx, BackendSync *sync, size_t size,
+ bool needAlignedRes, bool alignedBin, bool wait, int *binLocked)
{
Bin *b = &freeBins[binIdx];
try_next:
goto try_next;
}
+ // GENERAL CASE
if (alignedBin || !needAlignedRes) {
size_t splitSz = szBlock - size;
- // If we got a block as split result,
- // it must have a room for control structures.
- if (szBlock >= size && (splitSz >= FreeBlock::minBlockSize ||
- !splitSz))
+ // If we got a block as split result, it must have a room for control structures.
+ if (szBlock >= size && (splitSz >= FreeBlock::minBlockSize || !splitSz))
fBlock = curr;
} else {
+ // SPECIAL CASE, to get aligned block from unaligned bin we have to cut the middle of a block
+ // and return remaining left and right part. Possible only in fixed pool scenario, assert for this
+ // is set inside splitBlock() function.
+
void *newB = alignUp(curr, slabSize);
uintptr_t rightNew = (uintptr_t)newB + size;
uintptr_t rightCurr = (uintptr_t)curr + szBlock;
- // appropriate size, and left and right split results
- // are either big enough or non-existent
+ // Check if the block size is sufficient,
+ // and also left and right split results are either big enough or non-existent
if (rightNew <= rightCurr
- && (newB==curr ||
- (uintptr_t)newB-(uintptr_t)curr >= FreeBlock::minBlockSize)
- && (rightNew==rightCurr ||
- rightCurr - rightNew >= FreeBlock::minBlockSize))
+ && (newB == curr || ((uintptr_t)newB - (uintptr_t)curr) >= FreeBlock::minBlockSize)
+ && (rightNew == rightCurr || (rightCurr - rightNew) >= FreeBlock::minBlockSize))
fBlock = curr;
}
+
if (fBlock) {
- // consume must be called before result of removing from a bin
- // is visible externally.
+ // consume must be called before result of removing from a bin is visible externally.
sync->blockConsumed();
- if (alignedBin && needAlignedRes &&
- Backend::sizeToBin(szBlock-size) == Backend::sizeToBin(szBlock)) {
- // free remainder of fBlock stay in same bin,
- // so no need to remove it from the bin
- // TODO: add more "still here" cases
- FreeBlock *newFBlock = fBlock;
- // return block from right side of fBlock
- fBlock = (FreeBlock*)((uintptr_t)newFBlock + szBlock - size);
- MALLOC_ASSERT(isAligned(fBlock, slabSize), "Invalid free block");
- fBlock->initHeader();
- fBlock->setLeftFree(szBlock - size);
- newFBlock->setMeFree(szBlock - size);
-
- fBlock->sizeTmp = size;
- } else {
- b->removeBlock(fBlock);
- if (freeBins[binIdx].empty())
- bitMask.set(binIdx, false);
- fBlock->sizeTmp = szBlock;
- }
+ // TODO: think about cases when block stays in the same bin
+ b->removeBlock(fBlock);
+ if (freeBins[binIdx].empty())
+ bitMask.set(binIdx, false);
+ fBlock->sizeTmp = szBlock;
break;
} else { // block size is not valid, search for next block in the bin
curr->setMeFree(szBlock);
void Backend::IndexedBins::addBlock(int binIdx, FreeBlock *fBlock, size_t blockSz, bool addToTail)
{
Bin *b = &freeBins[binIdx];
-
fBlock->myBin = binIdx;
- fBlock->aligned = toAlignedBin(fBlock, blockSz);
fBlock->next = fBlock->prev = NULL;
{
MallocMutex::scoped_lock scopedLock(b->tLock);
{
bool locked;
Bin *b = &freeBins[binIdx];
-
fBlock->myBin = binIdx;
- fBlock->aligned = toAlignedBin(fBlock, fBlock->sizeTmp);
if (addToTail) {
fBlock->next = NULL;
{
return !keepAllMemory && !delayRegsReleasing;
}
-FreeBlock *Backend::splitUnalignedBlock(FreeBlock *fBlock, int num, size_t size,
- bool needAlignedBlock)
+FreeBlock *Backend::splitBlock(FreeBlock *fBlock, int num, size_t size, bool blockIsAligned, bool needAlignedBlock)
{
- const size_t totalSize = num*size;
- if (needAlignedBlock) {
- size_t fBlockSz = fBlock->sizeTmp;
- uintptr_t fBlockEnd = (uintptr_t)fBlock + fBlockSz;
- FreeBlock *newB = alignUp(fBlock, slabSize);
- FreeBlock *rightPart = (FreeBlock*)((uintptr_t)newB + totalSize);
-
- // Space to use is in the middle,
- // ... return free right part
+ const size_t totalSize = num * size;
+
+ // SPECIAL CASE, for unaligned block we have to cut the middle of a block
+ // and return remaining left and right part. Possible only in a fixed pool scenario.
+ if (needAlignedBlock && !blockIsAligned) {
+ MALLOC_ASSERT(extMemPool->fixedPool,
+ "Aligned block request from unaligned bin possible only in fixed pool scenario.");
+
+ // Space to use is in the middle
+ FreeBlock *newBlock = alignUp(fBlock, slabSize);
+ FreeBlock *rightPart = (FreeBlock*)((uintptr_t)newBlock + totalSize);
+ uintptr_t fBlockEnd = (uintptr_t)fBlock + fBlock->sizeTmp;
+
+ // Return free right part
if ((uintptr_t)rightPart != fBlockEnd) {
rightPart->initHeader(); // to prevent coalescing rightPart with fBlock
- coalescAndPut(rightPart, fBlockEnd - (uintptr_t)rightPart);
+ size_t rightSize = fBlockEnd - (uintptr_t)rightPart;
+ coalescAndPut(rightPart, rightSize, toAlignedBin(rightPart, rightSize));
}
- // ... and free left part
- if (newB != fBlock) {
- newB->initHeader(); // to prevent coalescing fBlock with newB
- coalescAndPut(fBlock, (uintptr_t)newB - (uintptr_t)fBlock);
+ // And free left part
+ if (newBlock != fBlock) {
+ newBlock->initHeader(); // to prevent coalescing fBlock with newB
+ size_t leftSize = (uintptr_t)newBlock - (uintptr_t)fBlock;
+ coalescAndPut(fBlock, leftSize, toAlignedBin(fBlock, leftSize));
}
-
- fBlock = newB;
- MALLOC_ASSERT(isAligned(fBlock, slabSize), ASSERT_TEXT);
- } else {
- if (size_t splitSz = fBlock->sizeTmp - totalSize) {
- // split block and return free right part
- FreeBlock *splitB = (FreeBlock*)((uintptr_t)fBlock + totalSize);
- splitB->initHeader();
- coalescAndPut(splitB, splitSz);
- }
- }
- FreeBlock::markBlocks(fBlock, num, size);
- return fBlock;
-}
-
-FreeBlock *Backend::splitAlignedBlock(FreeBlock *fBlock, int num, size_t size,
- bool needAlignedBlock)
-{
- if (fBlock->sizeTmp != num*size) { // i.e., need to split the block
- FreeBlock *newAlgnd;
- size_t newSz;
-
+ fBlock = newBlock;
+ } else if (size_t splitSize = fBlock->sizeTmp - totalSize) { // need to split the block
+ // GENERAL CASE, cut the left or right part of the block
+ FreeBlock *splitBlock = NULL;
if (needAlignedBlock) {
- newAlgnd = fBlock;
- fBlock = (FreeBlock*)((uintptr_t)newAlgnd + newAlgnd->sizeTmp
- - num*size);
- MALLOC_ASSERT(isAligned(fBlock, slabSize), "Invalid free block");
+ // For slab aligned blocks cut the right side of the block
+ // and return it to a requester, original block returns to backend
+ splitBlock = fBlock;
+ fBlock = (FreeBlock*)((uintptr_t)splitBlock + splitSize);
fBlock->initHeader();
- newSz = newAlgnd->sizeTmp - num*size;
} else {
- newAlgnd = (FreeBlock*)((uintptr_t)fBlock + num*size);
- newSz = fBlock->sizeTmp - num*size;
- newAlgnd->initHeader();
+ // For large object blocks cut original block and put free righ part to backend
+ splitBlock = (FreeBlock*)((uintptr_t)fBlock + totalSize);
+ splitBlock->initHeader();
}
- coalescAndPut(newAlgnd, newSz);
+ // Mark free block as it`s parent only when the requested type (needAlignedBlock)
+ // and returned from Bins/OS block (isAligned) are equal (XOR operation used)
+ bool markAligned = (blockIsAligned ^ needAlignedBlock) ? toAlignedBin(splitBlock, splitSize) : blockIsAligned;
+ coalescAndPut(splitBlock, splitSize, markAligned);
}
- MALLOC_ASSERT(!needAlignedBlock || isAligned(fBlock, slabSize),
- "Expect to get aligned block, if one was requested.");
+ MALLOC_ASSERT(!needAlignedBlock || isAligned(fBlock, slabSize), "Expect to get aligned block, if one was requested.");
FreeBlock::markBlocks(fBlock, num, size);
return fBlock;
}
maxBinned_HugePage : maxBinned_SmallPage;
}
-inline bool Backend::MaxRequestComparator::operator()(size_t oldMaxReq,
- size_t requestSize) const
+inline bool Backend::MaxRequestComparator::operator()(size_t oldMaxReq, size_t requestSize) const
{
return requestSize > oldMaxReq && requestSize < backend->getMaxBinnedSize();
}
FreeBlock *Backend::askMemFromOS(size_t blockSize, intptr_t startModifiedCnt,
int *lockedBinsThreshold, int numOfLockedBins,
- bool *splittableRet)
+ bool *splittableRet, bool needSlabRegion)
{
FreeBlock *block;
// The block sizes can be divided into 3 groups:
// This must be done carefully, because blocks in bins can be released
// in releaseCachesToLimit().
const unsigned NUM_OF_REG = 3;
- block = addNewRegion(regSz_sizeBased, MEMREG_FLEXIBLE_SIZE, /*addToBin=*/false);
+ MemRegionType regType = needSlabRegion ? MEMREG_SLAB_BLOCKS : MEMREG_LARGE_BLOCKS;
+ block = addNewRegion(regSz_sizeBased, regType, /*addToBin=*/false);
if (block)
for (unsigned idx=0; idx<NUM_OF_REG; idx++)
- if (! addNewRegion(regSz_sizeBased, MEMREG_FLEXIBLE_SIZE, /*addToBin=*/true))
+ if (! addNewRegion(regSz_sizeBased, regType, /*addToBin=*/true))
break;
} else {
- block = addNewRegion(regSz_sizeBased, MEMREG_SEVERAL_BLOCKS, /*addToBin=*/false);
+ block = addNewRegion(regSz_sizeBased, MEMREG_LARGE_BLOCKS, /*addToBin=*/false);
}
memExtendingSema.signal();
// do this in several tries, because backend fragmentation can prevent
// region from releasing
for (int cleanLocal = 0; cleanLocal<2; cleanLocal++)
- while (cleanLocal?
- extMemPool->allLocalCaches.cleanup(extMemPool, /*cleanOnlyUnused=*/true)
- : extMemPool->loc.decreasingCleanup())
+ while (cleanLocal ?
+ extMemPool->allLocalCaches.cleanup(/*cleanOnlyUnused=*/true) :
+ extMemPool->loc.decreasingCleanup())
if ((locTotalMemSize = FencedLoad((intptr_t&)totalMemSize)) <=
(locMemSoftLimit = FencedLoad((intptr_t&)memSoftLimit)))
return;
extMemPool->hardCachesCleanup();
}
-FreeBlock *Backend::IndexedBins::
- findBlock(int nativeBin, BackendSync *sync, size_t size,
- bool resSlabAligned, bool alignedBin, int *numOfLockedBins)
+int Backend::IndexedBins::getMinNonemptyBin(unsigned startBin) const
+{
+ int p = bitMask.getMinTrue(startBin);
+ return p == -1 ? Backend::freeBinsNum : p;
+}
+
+FreeBlock *Backend::IndexedBins::findBlock(int nativeBin, BackendSync *sync, size_t size,
+ bool needAlignedBlock, bool alignedBin, int *numOfLockedBins)
{
for (int i=getMinNonemptyBin(nativeBin); i<freeBinsNum; i=getMinNonemptyBin(i+1))
- if (FreeBlock *block = getFromBin(i, sync, size, resSlabAligned, alignedBin,
- /*wait=*/false, numOfLockedBins))
+ if (FreeBlock *block = getFromBin(i, sync, size, needAlignedBlock, alignedBin, /*wait=*/false, numOfLockedBins))
return block;
return NULL;
bootsrapMemStatus = bootsrapMemInitializing;
// request some rather big region during bootstrap in advance
// ok to get NULL here, as later we re-do a request with more modest size
- addNewRegion(2*1024*1024, MEMREG_FLEXIBLE_SIZE, /*addToBin=*/true);
+ addNewRegion(2*1024*1024, MEMREG_SLAB_BLOCKS, /*addToBin=*/true);
bootsrapMemStatus = bootsrapMemDone;
}
do {
numOfLockedBins = 0;
-
- // TODO: try different bin search order
if (needAlignedBlock) {
- block = freeAlignedBins.findBlock(nativeBin, &bkndSync, num*size,
- /*needAlignedBlock=*/true, /*alignedBin=*/true,
- &numOfLockedBins);
- if (!block)
- block = freeLargeBins.findBlock(nativeBin, &bkndSync, num*size,
- /*needAlignedBlock=*/true, /*alignedBin=*/false,
- &numOfLockedBins);
+ block = freeSlabAlignedBins.findBlock(nativeBin, &bkndSync, num*size, needAlignedBlock,
+ /*alignedBin=*/true, &numOfLockedBins);
+ if (!block && extMemPool->fixedPool)
+ block = freeLargeBlockBins.findBlock(nativeBin, &bkndSync, num*size, needAlignedBlock,
+ /*alignedBin=*/false, &numOfLockedBins);
} else {
- block = freeLargeBins.findBlock(nativeBin, &bkndSync, num*size,
- /*needAlignedBlock=*/false, /*alignedBin=*/false,
- &numOfLockedBins);
- if (!block)
- block = freeAlignedBins.findBlock(nativeBin, &bkndSync, num*size,
- /*needAlignedBlock=*/false, /*alignedBin=*/true,
- &numOfLockedBins);
+ block = freeLargeBlockBins.findBlock(nativeBin, &bkndSync, num*size, needAlignedBlock,
+ /*alignedBin=*/false, &numOfLockedBins);
+ if (!block && extMemPool->fixedPool)
+ block = freeSlabAlignedBins.findBlock(nativeBin, &bkndSync, num*size, needAlignedBlock,
+ /*alignedBin=*/true, &numOfLockedBins);
}
} while (!block && numOfLockedBins>lockedBinsThreshold);
if (block)
break;
- if (!(scanCoalescQ(/*forceCoalescQDrop=*/true)
- | extMemPool->softCachesCleanup())) {
+ if (!(scanCoalescQ(/*forceCoalescQDrop=*/true) | extMemPool->softCachesCleanup())) {
// bins are not updated,
// only remaining possibility is to ask for more memory
- block =
- askMemFromOS(totalReqSize, startModifiedCnt, &lockedBinsThreshold,
- numOfLockedBins, &splittable);
+ block = askMemFromOS(totalReqSize, startModifiedCnt, &lockedBinsThreshold,
+ numOfLockedBins, &splittable, needAlignedBlock);
if (!block)
return NULL;
if (block != (FreeBlock*)VALID_BLOCK_IN_BIN) {
}
}
MALLOC_ASSERT(block, ASSERT_TEXT);
- if (splittable)
- block = toAlignedBin(block, block->sizeTmp)?
- splitAlignedBlock(block, num, size, needAlignedBlock) :
- splitUnalignedBlock(block, num, size, needAlignedBlock);
+ if (splittable) {
+ // At this point we have to be sure that slabAligned attribute describes the right block state
+ block = splitBlock(block, num, size, block->slabAligned, needAlignedBlock);
+ }
// matched blockConsumed() from startUseBlock()
bkndSync.blockReleased();
return lmb;
}
+BlockI *Backend::getSlabBlock(int num) {
+ BlockI *b = (BlockI*)genericGetBlock(num, slabSize, /*slabAligned=*/true);
+ MALLOC_ASSERT(isAligned(b, slabSize), ASSERT_TEXT);
+ return b;
+}
+
+void Backend::putSlabBlock(BlockI *block) {
+ genericPutBlock((FreeBlock *)block, slabSize, /*slabAligned=*/true);
+}
+
void *Backend::getBackRefSpace(size_t size, bool *rawMemUsed)
{
// This block is released only at shutdown, so it can prevent
void Backend::removeBlockFromBin(FreeBlock *fBlock)
{
if (fBlock->myBin != Backend::NO_BIN) {
- if (fBlock->aligned)
- freeAlignedBins.lockRemoveBlock(fBlock->myBin, fBlock);
+ if (fBlock->slabAligned)
+ freeSlabAlignedBins.lockRemoveBlock(fBlock->myBin, fBlock);
else
- freeLargeBins.lockRemoveBlock(fBlock->myBin, fBlock);
+ freeLargeBlockBins.lockRemoveBlock(fBlock->myBin, fBlock);
}
}
-void Backend::genericPutBlock(FreeBlock *fBlock, size_t blockSz)
+void Backend::genericPutBlock(FreeBlock *fBlock, size_t blockSz, bool slabAligned)
{
bkndSync.blockConsumed();
- coalescAndPut(fBlock, blockSz);
+ coalescAndPut(fBlock, blockSz, slabAligned);
bkndSync.blockReleased();
}
{
if (extMemPool->userPool())
extMemPool->lmbList.remove(lmb);
- genericPutBlock((FreeBlock *)lmb, lmb->unalignedSize);
+ genericPutBlock((FreeBlock *)lmb, lmb->unalignedSize, false);
}
void Backend::returnLargeObject(LargeMemoryBlock *lmb)
return resBlock;
}
-bool Backend::coalescAndPutList(FreeBlock *list, bool forceCoalescQDrop,
- bool reportBlocksProcessed)
+bool Backend::coalescAndPutList(FreeBlock *list, bool forceCoalescQDrop, bool reportBlocksProcessed)
{
bool regionReleased = false;
}
size_t currSz = toRet->sizeTmp;
int bin = sizeToBin(currSz);
- bool toAligned = toAlignedBin(toRet, currSz);
+ bool toAligned = extMemPool->fixedPool ? toAlignedBin(toRet, currSz) : toRet->slabAligned;
bool needAddToBin = true;
if (toRet->blockInBin) {
// Does it stay in same bin?
- if (toRet->myBin == bin && toRet->aligned == toAligned)
+ if (toRet->myBin == bin && toRet->slabAligned == toAligned)
needAddToBin = false;
else {
toRet->blockInBin = false;
if (needAddToBin) {
toRet->prev = toRet->next = toRet->nextToFree = NULL;
toRet->myBin = NO_BIN;
+ toRet->slabAligned = toAligned;
// If the block is too small to fit in any bin, keep it bin-less.
// It's not a leak because the block later can be coalesced.
if (currSz >= minBinnedSize) {
toRet->sizeTmp = currSz;
- IndexedBins *target = toAligned? &freeAlignedBins : &freeLargeBins;
+ IndexedBins *target = toRet->slabAligned ? &freeSlabAlignedBins : &freeLargeBlockBins;
if (forceCoalescQDrop) {
target->addBlock(bin, toRet, toRet->sizeTmp, addToTail);
} else if (!target->tryAddBlock(bin, toRet, addToTail)) {
// Coalesce fBlock and add it back to a bin;
// processing delayed coalescing requests.
-void Backend::coalescAndPut(FreeBlock *fBlock, size_t blockSz)
+void Backend::coalescAndPut(FreeBlock *fBlock, size_t blockSz, bool slabAligned)
{
fBlock->sizeTmp = blockSz;
fBlock->nextToFree = NULL;
+ fBlock->slabAligned = slabAligned;
coalescAndPutList(fBlock, /*forceCoalescQDrop=*/false, /*reportBlocksProcessed=*/false);
}
"Atomic applied on LastFreeBlock, and we put it at the end of region, that"
" is uintptr_t-aligned, so no unaligned atomic operations are possible.");
// right bound is slab-aligned, keep LastFreeBlock after it
- if (region->type==MEMREG_FLEXIBLE_SIZE) {
- fBlock = (FreeBlock *)alignUp((uintptr_t)region + sizeof(MemRegion),
- sizeof(uintptr_t));
+ if (region->type == MEMREG_SLAB_BLOCKS) {
+ fBlock = (FreeBlock *)alignUp((uintptr_t)region + sizeof(MemRegion), sizeof(uintptr_t));
fBlockEnd = alignDown(lastFreeBlock, slabSize);
} else {
- fBlock = (FreeBlock *)alignUp((uintptr_t)region + sizeof(MemRegion),
- largeObjectAlignment);
+ fBlock = (FreeBlock *)alignUp((uintptr_t)region + sizeof(MemRegion), largeObjectAlignment);
fBlockEnd = (uintptr_t)fBlock + exactBlockSize;
MALLOC_ASSERT(fBlockEnd <= lastFreeBlock, ASSERT_TEXT);
}
return fBlock;
}
-// startUseBlock adds free block to a bin, the block can be used and
+// startUseBlock may add the free block to a bin, the block can be used and
// even released after this, so the region must be added to regionList already
void Backend::startUseBlock(MemRegion *region, FreeBlock *fBlock, bool addToBin)
{
unsigned targetBin = sizeToBin(blockSz);
// during adding advance regions, register bin for a largest block in region
advRegBins.registerBin(targetBin);
- if (region->type!=MEMREG_ONE_BLOCK && toAlignedBin(fBlock, blockSz)) {
- freeAlignedBins.addBlock(targetBin, fBlock, blockSz, /*addToTail=*/false);
+ if (region->type == MEMREG_SLAB_BLOCKS) {
+ fBlock->slabAligned = true;
+ freeSlabAlignedBins.addBlock(targetBin, fBlock, blockSz, /*addToTail=*/false);
} else {
- freeLargeBins.addBlock(targetBin, fBlock, blockSz, /*addToTail=*/false);
+ fBlock->slabAligned = false;
+ freeLargeBlockBins.addBlock(targetBin, fBlock, blockSz, /*addToTail=*/false);
}
} else {
// to match with blockReleased() in genericGetBlock
bkndSync.blockConsumed();
+ // Understand our alignment for correct splitBlock operation
+ fBlock->slabAligned = region->type == MEMREG_SLAB_BLOCKS ? true : false;
fBlock->sizeTmp = fBlock->tryLockBlock();
- MALLOC_ASSERT(fBlock->sizeTmp >= FreeBlock::minBlockSize,
- "Locking must be successful");
+ MALLOC_ASSERT(fBlock->sizeTmp >= FreeBlock::minBlockSize, "Locking must be successful");
}
}
"Header must be not overwritten in used blocks");
MALLOC_ASSERT(FreeBlock::minBlockSize > GuardedSize::MAX_SPEC_VAL,
"Block length must not conflict with special values of GuardedSize");
- // If the region is not "flexible size" we should reserve some space for
+ // If the region is not "for slabs" we should reserve some space for
// a region header, the worst case alignment and the last block mark.
- const size_t requestSize = memRegType == MEMREG_FLEXIBLE_SIZE ? size :
+ const size_t requestSize = memRegType == MEMREG_SLAB_BLOCKS ? size :
size + sizeof(MemRegion) + largeObjectAlignment
+ FreeBlock::minBlockSize + sizeof(LastFreeBlock);
// no active threads are allowed in backend while reset() called
verify();
- freeLargeBins.reset();
- freeAlignedBins.reset();
+ freeLargeBlockBins.reset();
+ freeSlabAlignedBins.reset();
advRegBins.reset();
for (MemRegion *curr = regionList.head; curr; curr = curr->next) {
// no active threads are allowed in backend while destroy() called
verify();
if (!inUserPool()) {
- freeLargeBins.reset();
- freeAlignedBins.reset();
+ freeLargeBlockBins.reset();
+ freeSlabAlignedBins.reset();
}
while (regionList.head) {
MemRegion *helper = regionList.head->next;
// because such regions are added in advance (see askMemFromOS() and reset()),
// and never used. Release them all.
for (int i = advRegBins.getMinUsedBin(0); i != -1; i = advRegBins.getMinUsedBin(i+1)) {
- if (i == freeAlignedBins.getMinNonemptyBin(i))
- res |= freeAlignedBins.tryReleaseRegions(i, this);
- if (i == freeLargeBins.getMinNonemptyBin(i))
- res |= freeLargeBins.tryReleaseRegions(i, this);
+ if (i == freeSlabAlignedBins.getMinNonemptyBin(i))
+ res |= freeSlabAlignedBins.tryReleaseRegions(i, this);
+ if (i == freeLargeBlockBins.getMinNonemptyBin(i))
+ res |= freeLargeBlockBins.tryReleaseRegions(i, this);
}
return res;
#if MALLOC_DEBUG
scanCoalescQ(/*forceCoalescQDrop=*/false);
- freeLargeBins.verify();
- freeAlignedBins.verify();
+ freeLargeBlockBins.verify();
+ freeSlabAlignedBins.verify();
#endif // MALLOC_DEBUG
}
int regNum = regionList.reportStat(f);
fprintf(f, "\n%d regions, %lu KB in all regions\n free bins:\nlarge bins: ",
regNum, totalMemSize/1024);
- freeLargeBins.reportStat(f);
+ freeLargeBlockBins.reportStat(f);
fprintf(f, "\naligned bins: ");
- freeAlignedBins.reportStat(f);
+ freeSlabAlignedBins.reportStat(f);
fprintf(f, "\n");
}
#endif // __TBB_MALLOC_BACKEND_STAT
--- /dev/null
+/*
+ Copyright (c) 2005-2019 Intel Corporation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef __TBB_backend_H
+#define __TBB_backend_H
+
+// Included from namespace rml::internal
+
+// global state of blocks currently in processing
+class BackendSync {
+ // Class instances should reside in zero-initialized memory!
+ // The number of blocks currently removed from a bin and not returned back
+ intptr_t inFlyBlocks; // to another
+ intptr_t binsModifications; // incremented on every bin modification
+ Backend *backend;
+public:
+ void init(Backend *b) { backend = b; }
+ void blockConsumed() { AtomicIncrement(inFlyBlocks); }
+ void binsModified() { AtomicIncrement(binsModifications); }
+ void blockReleased() {
+#if __TBB_MALLOC_BACKEND_STAT
+ MALLOC_ITT_SYNC_RELEASING(&inFlyBlocks);
+#endif
+ AtomicIncrement(binsModifications);
+ intptr_t prev = AtomicAdd(inFlyBlocks, -1);
+ MALLOC_ASSERT(prev > 0, ASSERT_TEXT);
+ suppress_unused_warning(prev);
+ }
+ intptr_t getNumOfMods() const { return FencedLoad(binsModifications); }
+ // return true if need re-do the blocks search
+ inline bool waitTillBlockReleased(intptr_t startModifiedCnt);
+};
+
+class CoalRequestQ { // queue of free blocks that coalescing was delayed
+private:
+ FreeBlock *blocksToFree;
+ BackendSync *bkndSync;
+ // counted blocks in blocksToFree and that are leaved blocksToFree
+ // and still in active coalescing
+ intptr_t inFlyBlocks;
+public:
+ void init(BackendSync *bSync) { bkndSync = bSync; }
+ FreeBlock *getAll(); // return current list of blocks and make queue empty
+ void putBlock(FreeBlock *fBlock);
+ inline void blockWasProcessed();
+ intptr_t blocksInFly() const { return FencedLoad(inFlyBlocks); }
+};
+
+class MemExtendingSema {
+ intptr_t active;
+public:
+ bool wait() {
+ bool rescanBins = false;
+ // up to 3 threads can add more memory from OS simultaneously,
+ // rest of threads have to wait
+ for (;;) {
+ intptr_t prevCnt = FencedLoad(active);
+ if (prevCnt < 3) {
+ intptr_t n = AtomicCompareExchange(active, prevCnt+1, prevCnt);
+ if (n == prevCnt)
+ break;
+ } else {
+ SpinWaitWhileEq(active, prevCnt);
+ rescanBins = true;
+ break;
+ }
+ }
+ return rescanBins;
+ }
+ void signal() { AtomicAdd(active, -1); }
+};
+
+enum MemRegionType {
+ // The region holds only slabs
+ MEMREG_SLAB_BLOCKS = 0,
+ // The region can hold several large object blocks
+ MEMREG_LARGE_BLOCKS,
+ // The region holds only one block with a reqested size
+ MEMREG_ONE_BLOCK
+};
+
+class MemRegionList {
+ MallocMutex regionListLock;
+public:
+ MemRegion *head;
+ void add(MemRegion *r);
+ void remove(MemRegion *r);
+ int reportStat(FILE *f);
+};
+
+class Backend {
+private:
+/* Blocks in range [minBinnedSize; getMaxBinnedSize()] are kept in bins,
+ one region can contains several blocks. Larger blocks are allocated directly
+ and one region always contains one block.
+*/
+ enum {
+ minBinnedSize = 8*1024UL,
+ /* If huge pages are available, maxBinned_HugePage used.
+ If not, maxBinned_SmallPage is the threshold.
+ TODO: use pool's granularity for upper bound setting.*/
+ maxBinned_SmallPage = 1024*1024UL,
+ // TODO: support other page sizes
+ maxBinned_HugePage = 4*1024*1024UL
+ };
+ enum {
+ VALID_BLOCK_IN_BIN = 1 // valid block added to bin, not returned as result
+ };
+public:
+ static const int freeBinsNum =
+ (maxBinned_HugePage-minBinnedSize)/LargeObjectCache::largeBlockCacheStep + 1;
+
+ // if previous access missed per-thread slabs pool,
+ // allocate numOfSlabAllocOnMiss blocks in advance
+ static const int numOfSlabAllocOnMiss = 2;
+
+ enum {
+ NO_BIN = -1,
+ // special bin for blocks >= maxBinned_HugePage, blocks go to this bin
+ // when pool is created with keepAllMemory policy
+ // TODO: currently this bin is scanned using "1st fit", as it accumulates
+ // blocks of different sizes, "best fit" is preferred in terms of fragmentation
+ HUGE_BIN = freeBinsNum-1
+ };
+
+ // Bin keeps 2-linked list of free blocks. It must be 2-linked
+ // because during coalescing a block it's removed from a middle of the list.
+ struct Bin {
+ FreeBlock *head,
+ *tail;
+ MallocMutex tLock;
+
+ void removeBlock(FreeBlock *fBlock);
+ void reset() { head = tail = 0; }
+ bool empty() const { return !head; }
+
+ size_t countFreeBlocks();
+ size_t reportFreeBlocks(FILE *f);
+ void reportStat(FILE *f);
+ };
+
+ typedef BitMaskMin<Backend::freeBinsNum> BitMaskBins;
+
+ // array of bins supplemented with bitmask for fast finding of non-empty bins
+ class IndexedBins {
+ BitMaskBins bitMask;
+ Bin freeBins[Backend::freeBinsNum];
+ FreeBlock *getFromBin(int binIdx, BackendSync *sync, size_t size,
+ bool needAlignedBlock, bool alignedBin, bool wait, int *resLocked);
+ public:
+ FreeBlock *findBlock(int nativeBin, BackendSync *sync, size_t size,
+ bool needAlignedBlock, bool alignedBin,int *numOfLockedBins);
+ bool tryReleaseRegions(int binIdx, Backend *backend);
+ void lockRemoveBlock(int binIdx, FreeBlock *fBlock);
+ void addBlock(int binIdx, FreeBlock *fBlock, size_t blockSz, bool addToTail);
+ bool tryAddBlock(int binIdx, FreeBlock *fBlock, bool addToTail);
+ int getMinNonemptyBin(unsigned startBin) const;
+ void verify();
+ void reset();
+ void reportStat(FILE *f);
+ };
+
+private:
+ class AdvRegionsBins {
+ BitMaskBins bins;
+ public:
+ void registerBin(int regBin) { bins.set(regBin, 1); }
+ int getMinUsedBin(int start) const { return bins.getMinTrue(start); }
+ void reset() { bins.reset(); }
+ };
+ // auxiliary class to atomic maximum request finding
+ class MaxRequestComparator {
+ const Backend *backend;
+ public:
+ MaxRequestComparator(const Backend *be) : backend(be) {}
+ inline bool operator()(size_t oldMaxReq, size_t requestSize) const;
+ };
+
+#if CHECK_ALLOCATION_RANGE
+ // Keep min and max of all addresses requested from OS,
+ // use it for checking memory possibly allocated by replaced allocators
+ // and for debugging purposes. Valid only for default memory pool.
+ class UsedAddressRange {
+ static const uintptr_t ADDRESS_UPPER_BOUND = UINTPTR_MAX;
+
+ uintptr_t leftBound,
+ rightBound;
+ MallocMutex mutex;
+ public:
+ // rightBound is zero-initialized
+ void init() { leftBound = ADDRESS_UPPER_BOUND; }
+ void registerAlloc(uintptr_t left, uintptr_t right);
+ void registerFree(uintptr_t left, uintptr_t right);
+ // as only left and right bounds are kept, we can return true
+ // for pointer not allocated by us, if more than single region
+ // was requested from OS
+ bool inRange(void *ptr) const {
+ const uintptr_t p = (uintptr_t)ptr;
+ return leftBound<=p && p<=rightBound;
+ }
+ };
+#else
+ class UsedAddressRange {
+ public:
+ void init() { }
+ void registerAlloc(uintptr_t, uintptr_t) {}
+ void registerFree(uintptr_t, uintptr_t) {}
+ bool inRange(void *) const { return true; }
+ };
+#endif
+
+ ExtMemoryPool *extMemPool;
+ // used for release every region on pool destroying
+ MemRegionList regionList;
+
+ CoalRequestQ coalescQ; // queue of coalescing requests
+ BackendSync bkndSync;
+ // semaphore protecting adding more more memory from OS
+ MemExtendingSema memExtendingSema;
+ size_t totalMemSize,
+ memSoftLimit;
+ UsedAddressRange usedAddrRange;
+ // to keep 1st allocation large than requested, keep bootstrapping status
+ enum {
+ bootsrapMemNotDone = 0,
+ bootsrapMemInitializing,
+ bootsrapMemDone
+ };
+ intptr_t bootsrapMemStatus;
+ MallocMutex bootsrapMemStatusMutex;
+
+ // Using of maximal observed requested size allows decrease
+ // memory consumption for small requests and decrease fragmentation
+ // for workloads when small and large allocation requests are mixed.
+ // TODO: decrease, not only increase it
+ size_t maxRequestedSize;
+
+ // register bins related to advance regions
+ AdvRegionsBins advRegBins;
+ // Storage for splitted FreeBlocks
+ IndexedBins freeLargeBlockBins,
+ freeSlabAlignedBins;
+
+ // Our friends
+ friend class BackendSync;
+
+ /******************************** Backend methods ******************************/
+
+ /*--------------------------- Coalescing functions ----------------------------*/
+ void coalescAndPut(FreeBlock *fBlock, size_t blockSz, bool slabAligned);
+ bool coalescAndPutList(FreeBlock *head, bool forceCoalescQDrop, bool reportBlocksProcessed);
+
+ // Main coalescing operation
+ FreeBlock *doCoalesc(FreeBlock *fBlock, MemRegion **memRegion);
+
+ // Queue for conflicted blocks during coalescing
+ bool scanCoalescQ(bool forceCoalescQDrop);
+ intptr_t blocksInCoalescing() const { return coalescQ.blocksInFly(); }
+
+ /*--------------------- FreeBlock backend accessors ---------------------------*/
+ FreeBlock *genericGetBlock(int num, size_t size, bool slabAligned);
+ void genericPutBlock(FreeBlock *fBlock, size_t blockSz, bool slabAligned);
+
+ // Split the block and return remaining parts to backend if possible
+ FreeBlock *splitBlock(FreeBlock *fBlock, int num, size_t size, bool isAligned, bool needAlignedBlock);
+
+ void removeBlockFromBin(FreeBlock *fBlock);
+
+ // TODO: combine with returnLargeObject
+ void putLargeBlock(LargeMemoryBlock *lmb);
+
+ /*------------------- Starting point for OS allocation ------------------------*/
+ void requestBootstrapMem();
+ FreeBlock *askMemFromOS(size_t totalReqSize, intptr_t startModifiedCnt,
+ int *lockedBinsThreshold, int numOfLockedBins,
+ bool *splittable, bool needSlabRegion);
+
+ /*---------------------- Memory regions allocation ----------------------------*/
+ FreeBlock *addNewRegion(size_t size, MemRegionType type, bool addToBin);
+ void releaseRegion(MemRegion *region);
+
+ // TODO: combine in one initMemoryRegion function
+ FreeBlock *findBlockInRegion(MemRegion *region, size_t exactBlockSize);
+ void startUseBlock(MemRegion *region, FreeBlock *fBlock, bool addToBin);
+
+ /*------------------------- Raw memory accessors ------------------------------*/
+ void *allocRawMem(size_t &size);
+ bool freeRawMem(void *object, size_t size);
+
+ /*------------------------------ Cleanup functions ----------------------------*/
+ // Clean all memory from all caches (extMemPool hard cleanup)
+ FreeBlock *releaseMemInCaches(intptr_t startModifiedCnt, int *lockedBinsThreshold, int numOfLockedBins);
+ // Soft heap limit (regular cleanup, then maybe hard cleanup)
+ void releaseCachesToLimit();
+
+ /*---------------------------------- Utility ----------------------------------*/
+ // TODO: move inside IndexedBins class
+ static int sizeToBin(size_t size) {
+ if (size >= maxBinned_HugePage)
+ return HUGE_BIN;
+ else if (size < minBinnedSize)
+ return NO_BIN;
+
+ int bin = (size - minBinnedSize)/LargeObjectCache::largeBlockCacheStep;
+
+ MALLOC_ASSERT(bin < HUGE_BIN, "Invalid size.");
+ return bin;
+ }
+ static bool toAlignedBin(FreeBlock *block, size_t size) {
+ return isAligned((char*)block + size, slabSize) && size >= slabSize;
+ }
+
+public:
+ /*--------------------- Init, reset, destroy, verify -------------------------*/
+ void init(ExtMemoryPool *extMemoryPool);
+ bool destroy();
+
+ void verify();
+ void reset();
+ bool clean(); // clean on caches cleanup
+
+ /*------------------------- Slab block request --------------------------------*/
+ BlockI *getSlabBlock(int num);
+ void putSlabBlock(BlockI *block);
+
+ /*-------------------------- Large object request -----------------------------*/
+ LargeMemoryBlock *getLargeBlock(size_t size);
+ // TODO: make consistent with getLargeBlock
+ void returnLargeObject(LargeMemoryBlock *lmb);
+
+ /*-------------------------- Backreference memory request ----------------------*/
+ void *getBackRefSpace(size_t size, bool *rawMemUsed);
+ void putBackRefSpace(void *b, size_t size, bool rawMemUsed);
+
+ /*----------------------------- Remap object ----------------------------------*/
+ void *remap(void *ptr, size_t oldSize, size_t newSize, size_t alignment);
+
+ /*---------------------------- Validation -------------------------------------*/
+ bool inUserPool() const;
+ bool ptrCanBeValid(void *ptr) const { return usedAddrRange.inRange(ptr); }
+
+ /*-------------------------- Configuration API --------------------------------*/
+ // Soft heap limit
+ void setRecommendedMaxSize(size_t softLimit) {
+ memSoftLimit = softLimit;
+ releaseCachesToLimit();
+ }
+
+ /*------------------------------- Info ----------------------------------------*/
+ size_t getMaxBinnedSize() const;
+
+ /*-------------------------- Testing, statistics ------------------------------*/
+#if __TBB_MALLOC_WHITEBOX_TEST
+ size_t getTotalMemSize() const { return totalMemSize; }
+#endif
+#if __TBB_MALLOC_BACKEND_STAT
+ void reportStat(FILE *f);
+private:
+ static size_t binToSize(int bin) {
+ MALLOC_ASSERT(bin <= HUGE_BIN, "Invalid bin.");
+
+ return bin*LargeObjectCache::largeBlockCacheStep + minBinnedSize;
+ }
+#endif
+};
+
+#endif // __TBB_backend_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbbmalloc_internal.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
class Block : public LocalBlockFields,
Padding<2*blockHeaderAlignment - sizeof(LocalBlockFields)> {
public:
- bool empty() const { return allocatedCount==0 && !isSolidPtr(publicFreeList); }
+ bool empty() const {
+ if (allocatedCount > 0) return false;
+ MALLOC_ASSERT(!isSolidPtr(publicFreeList), ASSERT_TEXT);
+ return true;
+ }
inline FreeObject* allocate();
inline FreeObject *allocateFromFreeList();
- inline bool emptyEnoughToUse();
+
+ inline void adjustFullness();
+ void adjustPositionInBin(Bin* bin = NULL);
+
bool freeListNonNull() { return freeList; }
void freePublicObject(FreeObject *objectToFree);
inline void freeOwnObject(void *object);
void reset();
- void privatizePublicFreeList( bool cleanup = false );
+ void privatizePublicFreeList( bool reset = true );
void restoreBumpPtr();
void privatizeOrphaned(TLSData *tls, unsigned index);
+ bool readyToShare();
void shareOrphaned(intptr_t binTag, unsigned index);
unsigned int getSize() const {
MALLOC_ASSERT(isStartupAllocObject() || objectSize<minLargeObjectSize,
void cleanBlockHeader();
private:
- static const float emptyEnoughRatio; /* "Reactivate" a block if this share of its objects is free. */
+ static const float emptyEnoughRatio; /* Threshold on free space needed to "reactivate" a block */
inline FreeObject *allocateFromBumpPtr();
inline FreeObject *findAllocatedObject(const void *address) const;
"Defining USE_INTERNAL_TID may help to fix it.");
class Bin {
+private:
Block *activeBlk;
Block *mailbox;
MallocMutex mailLock;
public:
inline Block* getActiveBlock() const { return activeBlk; }
- void resetActiveBlock() { activeBlk = 0; }
+ void resetActiveBlock() { activeBlk = NULL; }
bool activeBlockUnused() const { return activeBlk && !activeBlk->allocatedCount; }
inline void setActiveBlock(Block *block);
inline Block* setPreviousBlockActive();
- Block* getPublicFreeListBlock();
+ Block* getPrivatizedFreeListBlock();
void moveBlockToFront(Block *block);
- void processLessUsedBlock(MemoryPool *memPool, Block *block);
+ bool cleanPublicFreeLists();
+ void processEmptyBlock(Block *block, bool poolTheBlock);
+ void addPublicFreeListBlock(Block* block);
void outofTLSBin(Block* block);
void verifyTLSBin(size_t size) const;
void pushTLSBin(Block* block);
void verifyInitState() const {
- MALLOC_ASSERT( activeBlk == 0, ASSERT_TEXT );
- MALLOC_ASSERT( mailbox == 0, ASSERT_TEXT );
+ MALLOC_ASSERT( !activeBlk, ASSERT_TEXT );
+ MALLOC_ASSERT( !mailbox, ASSERT_TEXT );
}
friend void Block::freePublicObject (FreeObject *objectToFree);
* threads memory that are likely in local cache(s) of our CPU.
*/
class FreeBlockPool {
+private:
Block *head;
int size;
Backend *backend;
template<int LOW_MARK, int HIGH_MARK>
class LocalLOCImpl {
+private:
static const size_t MAX_TOTAL_SIZE = 4*1024*1024;
// TODO: can single-linked list be faster here?
LargeMemoryBlock *head,
TLSData(MemoryPool *mPool, Backend *bknd) : memPool(mPool), freeSlabBlocks(bknd) {}
MemoryPool *getMemPool() const { return memPool; }
Bin* getAllocationBin(size_t size);
- void release(MemoryPool *mPool);
- bool externalCleanup(ExtMemoryPool *mPool, bool cleanOnlyUnused) {
+ void release();
+ bool externalCleanup(bool cleanOnlyUnused, bool cleanBins) {
if (!unused && cleanOnlyUnused) return false;
+ // Heavy operation in terms of synchronization complexity,
+ // should be called only for the current thread
+ bool released = cleanBins ? cleanupBlockBins() : false;
// both cleanups to be called, and the order is not important
- return lloc.externalCleanup(mPool) | freeSlabBlocks.externalCleanup();
+ return released | lloc.externalCleanup(&memPool->extMemPool) | freeSlabBlocks.externalCleanup();
}
- bool cleanUnusedActiveBlocks(Backend *backend, bool userPool);
+ bool cleanupBlockBins();
void markUsed() { unused = false; } // called by owner when TLS touched
void markUnused() { unused = true; } // can be called by not owner thread
};
return tls;
}
-bool TLSData::cleanUnusedActiveBlocks(Backend *backend, bool userPool)
+bool TLSData::cleanupBlockBins()
{
bool released = false;
- // active blocks can be not used, so return them to backend
- for (uint32_t i=0; i<numBlockBinLimit; i++)
- if (bin[i].activeBlockUnused()) {
- Block *block = bin[i].getActiveBlock();
+ for (uint32_t i = 0; i < numBlockBinLimit; i++) {
+ released |= bin[i].cleanPublicFreeLists();
+ // After cleaning public free lists, only the active block might be empty.
+ // Do not use processEmptyBlock because it will just restore bumpPtr.
+ Block *block = bin[i].getActiveBlock();
+ if (block && block->empty()) {
bin[i].outofTLSBin(block);
- // slab blocks in user's pools do not have valid backRefIdx
- if (!userPool)
- removeBackRef(*(block->getBackRefIdx()));
- backend->putSlabBlock(block);
-
+ memPool->returnEmptyBlock(block, /*poolTheBlock=*/false);
released = true;
}
+ }
return released;
}
bool ExtMemoryPool::releaseAllLocalCaches()
{
- bool released = allLocalCaches.cleanup(this, /*cleanOnlyUnused=*/false);
+ // Iterate all registred TLS data and clean LLOC and Slab pools
+ bool released = allLocalCaches.cleanup(/*cleanOnlyUnused=*/false);
+ // Bins privatization is done only for the current thread
if (TLSData *tlsData = tlsPointerKey.getThreadMallocTLS())
- // released only for current thread for now
- released |= tlsData->cleanUnusedActiveBlocks(&backend, userPool());
+ released |= tlsData->cleanupBlockBins();
return released;
}
MALLOC_ASSERT(!tls->next || tls->next->next!=tls->next, ASSERT_TEXT);
}
-bool AllLocalCaches::cleanup(ExtMemoryPool *extPool, bool cleanOnlyUnused)
+bool AllLocalCaches::cleanup(bool cleanOnlyUnused)
{
- bool total = false;
+ bool released = false;
{
MallocMutex::scoped_lock lock(listLock);
-
for (TLSRemote *curr=head; curr; curr=curr->next)
- total |= static_cast<TLSData*>(curr)->
- externalCleanup(extPool, cleanOnlyUnused);
+ released |= static_cast<TLSData*>(curr)->externalCleanup(cleanOnlyUnused, /*cleanBins=*/false);
}
- return total;
+ return released;
}
void AllLocalCaches::markUnused()
bool locked;
MallocMutex::scoped_lock lock(listLock, /*block=*/false, &locked);
if (!locked) // not wait for marking if someone doing something with it
- return;
+ return;
for (TLSRemote *curr=head; curr; curr=curr->next)
static_cast<TLSData*>(curr)->markUnused();
/* Return an empty uninitialized block in a non-blocking fashion. */
Block *MemoryPool::getEmptyBlock(size_t size)
{
- TLSData* tls = extMemPool.tlsPointerKey.getThreadMallocTLS();
+ TLSData* tls = getTLS(/*create=*/false);
// try to use per-thread cache, if TLS available
FreeBlockPool::ResOfGet resOfGet = tls?
tls->freeSlabBlocks.getBlock() : FreeBlockPool::ResOfGet(NULL, false);
{
block->reset();
if (poolTheBlock) {
- extMemPool.tlsPointerKey.getThreadMallocTLS()->freeSlabBlocks.returnBlock(block);
- }
- else {
+ getTLS(/*create=*/false)->freeSlabBlocks.returnBlock(block);
+ } else {
// slab blocks in user's pools do not have valid backRefIdx
if (!extMemPool.userPool())
removeBackRef(*(block->getBackRefIdx()));
void MemoryPool::onThreadShutdown(TLSData *tlsData)
{
if (tlsData) { // might be called for "empty" TLS
- tlsData->release(this);
+ tlsData->release();
bootStrapBlocks.free(tlsData);
clearTLS();
}
verifyTLSBin(size);
}
-Block* Bin::getPublicFreeListBlock()
+Block* Bin::getPrivatizedFreeListBlock()
{
Block* block;
MALLOC_ASSERT( this, ASSERT_TEXT );
if( block ) {
MALLOC_ASSERT( isSolidPtr(block->publicFreeList), ASSERT_TEXT );
block->privatizePublicFreeList();
+ block->adjustPositionInBin(this);
}
return block;
}
-bool Block::emptyEnoughToUse()
+void Bin::addPublicFreeListBlock(Block* block)
{
- const float threshold = (slabSize - sizeof(Block)) * (1-emptyEnoughRatio);
+ MallocMutex::scoped_lock scoped_cs(mailLock);
+ block->nextPrivatizable = mailbox;
+ mailbox = block;
+}
+
+// Process publicly freed objects in all blocks and return empty blocks
+// to the backend in order to reduce overall footprint.
+bool Bin::cleanPublicFreeLists()
+{
+ Block* block;
+ if (!FencedLoad((intptr_t&)mailbox))
+ return false;
+ else {
+ // Grab all the blocks in the mailbox
+ MallocMutex::scoped_lock scoped_cs(mailLock);
+ block = mailbox;
+ mailbox = NULL;
+ }
+ bool released = false;
+ while (block) {
+ MALLOC_ASSERT( block->isOwnedByCurrentThread(), ASSERT_TEXT );
+ Block* tmp = block->nextPrivatizable;
+ block->nextPrivatizable = (Block*) this;
+ block->privatizePublicFreeList();
+ if (block->empty()) {
+ processEmptyBlock(block, /*poolTheBlock=*/false);
+ released = true;
+ } else
+ block->adjustPositionInBin(this);
+ block = tmp;
+ }
+ return released;
+}
+
+void Block::adjustFullness()
+{
+ const float threshold = (slabSize - sizeof(Block)) * (1 - emptyEnoughRatio);
if (bumpPtr) {
/* If we are still using a bump ptr for this block it is empty enough to use. */
STAT_increment(getThreadId(), getIndex(objectSize), examineEmptyEnough);
isFull = false;
- return 1;
+ return;
}
/* allocatedCount shows how many objects in the block are in use; however it still counts
- blocks freed by other threads; so prior call to privatizePublicFreeList() is recommended */
- isFull = (allocatedCount*objectSize > threshold)? true: false;
+ * blocks freed by other threads; so prior call to privatizePublicFreeList() is recommended */
+ isFull = (allocatedCount*objectSize > threshold) ? true : false;
#if COLLECT_STATISTICS
if (isFull)
STAT_increment(getThreadId(), getIndex(objectSize), examineNotEmpty);
else
STAT_increment(getThreadId(), getIndex(objectSize), examineEmptyEnough);
#endif
- return !isFull;
+}
+
+// This method resides in class Block, and not in class Bin, in order to avoid
+// calling getAllocationBin on a reasonably hot path in Block::freeOwnObject
+void Block::adjustPositionInBin(Bin* bin/*=NULL*/)
+{
+ bool fullBefore = isFull;
+ adjustFullness();
+ if (fullBefore && !isFull) {
+ if (!bin)
+ bin = tlsPtr->getAllocationBin(objectSize);
+ bin->moveBlockToFront(this);
+ }
}
/* Restore the bump pointer for an empty block that is planned to use */
void Block::restoreBumpPtr()
{
MALLOC_ASSERT( allocatedCount == 0, ASSERT_TEXT );
- MALLOC_ASSERT( publicFreeList == NULL, ASSERT_TEXT );
+ MALLOC_ASSERT( !isSolidPtr(publicFreeList), ASSERT_TEXT );
STAT_increment(getThreadId(), getIndex(objectSize), freeRestoreBumpPtr);
bumpPtr = (FreeObject *)((uintptr_t)this + slabSize - objectSize);
freeList = NULL;
- isFull = 0;
+ isFull = false;
}
void Block::freeOwnObject(void *object)
STAT_increment(getThreadId(), getIndex(objectSize), freeToActiveBlock);
#endif
if (empty()) {
- // The bump pointer is about to be restored for the block,
- // no need to find objectToFree here (this is costly).
-
- // if the last object of a slab is freed, the slab cannot be marked full
+ // If the last object of a slab is freed, the slab cannot be marked full
MALLOC_ASSERT(!isFull, ASSERT_TEXT);
- tlsPtr->getAllocationBin(objectSize)->processLessUsedBlock(poolPtr, this);
- } else {
+ tlsPtr->getAllocationBin(objectSize)->processEmptyBlock(this, /*poolTheBlock=*/true);
+ } else { // hot path
FreeObject *objectToFree = findObjectToFree(object);
objectToFree->next = freeList;
freeList = objectToFree;
-
- if (isFull && emptyEnoughToUse())
- tlsPtr->getAllocationBin(objectSize)->moveBlockToFront(this);
+ adjustPositionInBin();
}
}
if( !isNotForUse(nextPrivatizable) ) {
MALLOC_ASSERT( nextPrivatizable!=NULL, ASSERT_TEXT );
Bin* theBin = (Bin*) nextPrivatizable;
- MallocMutex::scoped_lock scoped_cs(theBin->mailLock);
- nextPrivatizable = theBin->mailbox;
- theBin->mailbox = this;
+ theBin->addPublicFreeListBlock(this);
}
}
STAT_increment(getThreadId(), ThreadCommonCounters, freeToOtherThread);
STAT_increment(ownerTid, getIndex(objectSize), freeByOtherThread);
}
-void Block::privatizePublicFreeList( bool cleanup )
+// Make objects freed by other threads available for use again
+void Block::privatizePublicFreeList( bool reset )
{
- FreeObject *temp, *localPublicFreeList;
- const intptr_t endMarker = cleanup? UNUSABLE : 0;
+ FreeObject *localPublicFreeList;
+ // If reset is false, publicFreeList should not be zeroed but set to UNUSABLE
+ // to properly synchronize with other threads freeing objects to this slab.
+ const intptr_t endMarker = reset ? 0 : UNUSABLE;
- // During cleanup of orphaned blocks, the calling thread is not registered as the owner
- MALLOC_ASSERT( cleanup || isOwnedByCurrentThread(), ASSERT_TEXT );
+ // Only the owner thread may reset the pointer to NULL
+ MALLOC_ASSERT( isOwnedByCurrentThread() || !reset, ASSERT_TEXT );
#if FREELIST_NONBLOCKING
- temp = publicFreeList;
- do {
- localPublicFreeList = temp;
- temp = (FreeObject*)AtomicCompareExchange( (intptr_t&)publicFreeList,
- endMarker, (intptr_t)localPublicFreeList);
- // no backoff necessary because trying to make change, not waiting for a change
- } while( temp != localPublicFreeList );
+ localPublicFreeList = (FreeObject*)AtomicFetchStore( &publicFreeList, endMarker );
#else
STAT_increment(getThreadId(), ThreadCommonCounters, lockPublicFreeList);
{
localPublicFreeList = publicFreeList;
publicFreeList = endMarker;
}
- temp = localPublicFreeList;
#endif
MALLOC_ITT_SYNC_ACQUIRED(&publicFreeList);
+ MALLOC_ASSERT( !(reset && isNotForUse(publicFreeList)), ASSERT_TEXT );
- // publicFreeList must have been UNUSABLE (possible for orphaned blocks) or valid, but not NULL
+ // publicFreeList must have been UNUSABLE or valid, but not NULL
MALLOC_ASSERT( localPublicFreeList!=NULL, ASSERT_TEXT );
- MALLOC_ASSERT( localPublicFreeList==temp, ASSERT_TEXT );
- if( isSolidPtr(temp) ) {
+ if( isSolidPtr(localPublicFreeList) ) {
MALLOC_ASSERT( allocatedCount <= (slabSize-sizeof(Block))/objectSize, ASSERT_TEXT );
/* other threads did not change the counter freeing our blocks */
allocatedCount--;
+ FreeObject *temp = localPublicFreeList;
while( isSolidPtr(temp->next) ){ // the list will end with either NULL or UNUSABLE
temp = temp->next;
allocatedCount--;
nextPrivatizable = (Block*)bin;
// the next call is required to change publicFreeList to 0
privatizePublicFreeList();
- if( allocatedCount ) {
- emptyEnoughToUse(); // check its fullness and set result->isFull
- } else {
+ if( empty() ) {
restoreBumpPtr();
+ } else {
+ adjustFullness(); // check the block fullness and set isFull
}
MALLOC_ASSERT( !isNotForUse(publicFreeList), ASSERT_TEXT );
}
+
+bool Block::readyToShare()
+{
+ void* oldval;
+#if FREELIST_NONBLOCKING
+ oldval = (void*)AtomicCompareExchange((intptr_t&)publicFreeList, UNUSABLE, 0);
+#else
+ STAT_increment(getThreadId(), ThreadCommonCounters, lockPublicFreeList);
+ {
+ MallocMutex::scoped_lock scoped_cs(publicFreeListLock);
+ if ( (oldval=publicFreeList)==NULL )
+ (intptr_t&)(publicFreeList) = UNUSABLE;
+ }
+#endif
+ return oldval==NULL;
+}
+
void Block::shareOrphaned(intptr_t binTag, unsigned index)
{
MALLOC_ASSERT( binTag, ASSERT_TEXT );
STAT_increment(getThreadId(), index, freeBlockPublic);
markOrphaned();
- // need to set publicFreeList to non-zero, so other threads
- // will not change nextPrivatizable and it can be zeroed.
if ((intptr_t)nextPrivatizable==binTag) {
- void* oldval;
-#if FREELIST_NONBLOCKING
- oldval = (void*)AtomicCompareExchange((intptr_t&)publicFreeList, UNUSABLE, 0);
-#else
- STAT_increment(getThreadId(), ThreadCommonCounters, lockPublicFreeList);
- {
- MallocMutex::scoped_lock scoped_cs(publicFreeListLock);
- if ( (oldval=publicFreeList)==NULL )
- (intptr_t&)(publicFreeList) = UNUSABLE;
- }
-#endif
- if ( oldval!=NULL ) {
+ // First check passed: the block is not in mailbox yet.
+ // Need to set publicFreeList to non-zero, so other threads
+ // will not change nextPrivatizable and it can be zeroed.
+ if ( !readyToShare() ) {
// another thread freed an object; we need to wait until it finishes.
// There is no need for exponential backoff, as the wait here is not for a lock;
// but need to yield, so the thread we wait has a chance to run.
}
}
}
- } else {
- MALLOC_ASSERT( isSolidPtr(publicFreeList), ASSERT_TEXT );
}
MALLOC_ASSERT( publicFreeList!=NULL, ASSERT_TEXT );
// now it is safe to change our data
previous = NULL;
freeList = NULL;
allocatedCount = 0;
- isFull = 0;
+ isFull = false;
tlsPtr = NULL;
publicFreeList = NULL;
bool OrphanedBlocks::cleanup(Backend* backend)
{
- bool result = false;
+ bool released = false;
for (uint32_t i=0; i<numBlockBinLimit; i++) {
Block* block = bins[i].grab();
MALLOC_ITT_SYNC_ACQUIRED(bins+i);
while (block) {
Block* next = block->next;
- block->privatizePublicFreeList( /*cleanup=*/true );
+ block->privatizePublicFreeList( /*reset=*/false ); // do not set publicFreeList to NULL
if (block->empty()) {
block->reset();
// slab blocks in user's pools do not have valid backRefIdx
if (!backend->inUserPool())
removeBackRef(*(block->getBackRefIdx()));
backend->putSlabBlock(block);
- result = true;
+ released = true;
} else {
MALLOC_ITT_SYNC_RELEASING(bins+i);
bins[i].push(block);
block = next;
}
}
- return result;
+ return released;
}
FreeBlockPool::ResOfGet FreeBlockPool::getBlock()
bool FreeBlockPool::externalCleanup()
{
Block *helper;
- bool nonEmpty = false;
+ bool released = false;
for (Block *currBl=(Block*)AtomicFetchStore(&head, 0); currBl; currBl=helper) {
helper = currBl->next;
if (!backend->inUserPool())
removeBackRef(currBl->backRefIdx);
backend->putSlabBlock(currBl);
- nonEmpty = true;
+ released = true;
}
- return nonEmpty;
+ return released;
}
/* Prepare the block for returning to FreeBlockPool */
MALLOC_ASSERT( activeBlk, ASSERT_TEXT );
Block* temp = activeBlk->previous;
if( temp ) {
- MALLOC_ASSERT( temp->isFull == 0, ASSERT_TEXT );
+ MALLOC_ASSERT( !(temp->isFull), ASSERT_TEXT );
activeBlk = temp;
}
return temp;
return objectToFree;
}
-void TLSData::release(MemoryPool *mPool)
+void TLSData::release()
{
- mPool->extMemPool.allLocalCaches.unregisterThread(this);
- externalCleanup(&mPool->extMemPool, /*cleanOnlyUnused=*/false);
+ memPool->extMemPool.allLocalCaches.unregisterThread(this);
+ externalCleanup(/*cleanOnlyUnused=*/false, /*cleanBins=*/false);
for (unsigned index = 0; index < numBlockBins; index++) {
Block *activeBlk = bin[index].getActiveBlock();
Block *threadBlock = threadlessBlock->previous;
if (threadlessBlock->empty()) {
/* we destroy the thread, so not use its block pool */
- mPool->returnEmptyBlock(threadlessBlock, /*poolTheBlock=*/false);
+ memPool->returnEmptyBlock(threadlessBlock, /*poolTheBlock=*/false);
} else {
- mPool->extMemPool.orphanedBlocks.put(intptr_t(bin+index), threadlessBlock);
+ memPool->extMemPool.orphanedBlocks.put(intptr_t(bin+index), threadlessBlock);
}
threadlessBlock = threadBlock;
}
Block *threadBlock = threadlessBlock->next;
if (threadlessBlock->empty()) {
/* we destroy the thread, so not use its block pool */
- mPool->returnEmptyBlock(threadlessBlock, /*poolTheBlock=*/false);
+ memPool->returnEmptyBlock(threadlessBlock, /*poolTheBlock=*/false);
} else {
- mPool->extMemPool.orphanedBlocks.put(intptr_t(bin+index), threadlessBlock);
+ memPool->extMemPool.orphanedBlocks.put(intptr_t(bin+index), threadlessBlock);
}
threadlessBlock = threadBlock;
}
MALLOC_ASSERT( !bumpPtr, ASSERT_TEXT );
/* the block is considered full. */
- isFull = 1;
+ isFull = true;
return NULL;
}
pushTLSBin(block);
}
-void Bin::processLessUsedBlock(MemoryPool *memPool, Block *block)
+void Bin::processEmptyBlock(Block *block, bool poolTheBlock)
{
if (block != activeBlk) {
- /* We are not actively using this block; return it to the general block pool */
+ /* We are not using this block; return it to the pool */
outofTLSBin(block);
- memPool->returnEmptyBlock(block, /*poolTheBlock=*/true);
+ block->getMemPool()->returnEmptyBlock(block, poolTheBlock);
} else {
/* all objects are free - let's restore the bump pointer */
block->restoreBumpPtr();
/*
* else privatize publicly freed objects in some block and allocate from it
*/
- mallocBlock = bin->getPublicFreeListBlock();
+ mallocBlock = bin->getPrivatizedFreeListBlock();
if (mallocBlock) {
- if (mallocBlock->emptyEnoughToUse()) {
- bin->moveBlockToFront(mallocBlock);
- }
MALLOC_ASSERT( mallocBlock->freeListNonNull(), ASSERT_TEXT );
if ( FreeObject *result = mallocBlock->allocateFromFreeList() )
return result;
{
if (param)
return TBBMALLOC_INVALID_PARAM;
+
+ bool released = false;
switch(cmd) {
case TBBMALLOC_CLEAN_THREAD_BUFFERS:
if (TLSData *tls = defaultMemPool->getTLS(/*create=*/false))
- return tls->externalCleanup(&defaultMemPool->extMemPool,
- /*cleanOnlyUnused=*/false)?
- TBBMALLOC_OK : TBBMALLOC_NO_EFFECT;
- return TBBMALLOC_NO_EFFECT;
+ released = tls->externalCleanup(/*cleanOnlyUsed*/false, /*cleanBins=*/true);
+ break;
case TBBMALLOC_CLEAN_ALL_BUFFERS:
- return defaultMemPool->extMemPool.hardCachesCleanup()?
- TBBMALLOC_OK : TBBMALLOC_NO_EFFECT;
+ released = defaultMemPool->extMemPool.hardCachesCleanup();
+ break;
+ default:
+ return TBBMALLOC_INVALID_PARAM;
}
- return TBBMALLOC_INVALID_PARAM;
+ return released ? TBBMALLOC_OK : TBBMALLOC_NO_EFFECT;
}
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbbmalloc_internal.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
_scalable_calloc
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
_scalable_calloc
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __linux__ && !__ANDROID__
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef _TBB_malloc_proxy_H_
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// The original source for this code is
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_shared_utils_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_function_replacement_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "TypeDefinitions.h" // Customize.h and proxy.h get included
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-//
-//
-//
-//
// Microsoft Visual C++ generated resource script.
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbbmalloc_internal_H
public:
void registerThread(TLSRemote *tls);
void unregisterThread(TLSRemote *tls);
- bool cleanup(ExtMemoryPool *extPool, bool cleanOnlyUnused);
+ bool cleanup(bool cleanOnlyUnused);
void markUnused();
void reset() { head = NULL; }
};
BackRefIdx backRefIdx; // cached here, used copy is in LargeObjectHdr
};
-// global state of blocks currently in processing
-class BackendSync {
- // Class instances should reside in zero-initialized memory!
- // The number of blocks currently removed from a bin and not returned back
- intptr_t inFlyBlocks; // to another
- intptr_t binsModifications; // incremented on every bin modification
- Backend *backend;
-public:
- void init(Backend *b) { backend = b; }
- void blockConsumed() { AtomicIncrement(inFlyBlocks); }
- void binsModified() { AtomicIncrement(binsModifications); }
- void blockReleased() {
-#if __TBB_MALLOC_BACKEND_STAT
- MALLOC_ITT_SYNC_RELEASING(&inFlyBlocks);
-#endif
- AtomicIncrement(binsModifications);
- intptr_t prev = AtomicAdd(inFlyBlocks, -1);
- MALLOC_ASSERT(prev > 0, ASSERT_TEXT);
- suppress_unused_warning(prev);
- }
- intptr_t getNumOfMods() const { return FencedLoad(binsModifications); }
- // return true if need re-do the blocks search
- inline bool waitTillBlockReleased(intptr_t startModifiedCnt);
-};
-
-class CoalRequestQ { // queue of free blocks that coalescing was delayed
-private:
- FreeBlock *blocksToFree;
- BackendSync *bkndSync;
- // counted blocks in blocksToFree and that are leaved blocksToFree
- // and still in active coalescing
- intptr_t inFlyBlocks;
-public:
- void init(BackendSync *bSync) { bkndSync = bSync; }
- FreeBlock *getAll(); // return current list of blocks and make queue empty
- void putBlock(FreeBlock *fBlock);
- inline void blockWasProcessed();
- intptr_t blocksInFly() const { return FencedLoad(inFlyBlocks); }
-};
-
-class MemExtendingSema {
- intptr_t active;
-public:
- bool wait() {
- bool rescanBins = false;
- // up to 3 threads can add more memory from OS simultaneously,
- // rest of threads have to wait
- for (;;) {
- intptr_t prevCnt = FencedLoad(active);
- if (prevCnt < 3) {
- intptr_t n = AtomicCompareExchange(active, prevCnt+1, prevCnt);
- if (n == prevCnt)
- break;
- } else {
- SpinWaitWhileEq(active, prevCnt);
- rescanBins = true;
- break;
- }
- }
- return rescanBins;
- }
- void signal() { AtomicAdd(active, -1); }
-};
-
-enum MemRegionType {
- // The region does not guarantee the block size.
- MEMREG_FLEXIBLE_SIZE = 0,
- // The region can hold exact number of blocks with the size of the
- // first reqested block.
- MEMREG_SEVERAL_BLOCKS,
- // The region holds only one block with a reqested size.
- MEMREG_ONE_BLOCK
-};
-
-class MemRegionList {
- MallocMutex regionListLock;
-public:
- MemRegion *head;
- void add(MemRegion *r);
- void remove(MemRegion *r);
- int reportStat(FILE *f);
-};
-
-class Backend {
-private:
-/* Blocks in range [minBinnedSize; getMaxBinnedSize()] are kept in bins,
- one region can contains several blocks. Larger blocks are allocated directly
- and one region always contains one block.
-*/
- enum {
- minBinnedSize = 8*1024UL,
- /* If huge pages are available, maxBinned_HugePage used.
- If not, maxBinned_SmallPage is the threshold.
- TODO: use pool's granularity for upper bound setting.*/
- maxBinned_SmallPage = 1024*1024UL,
- // TODO: support other page sizes
- maxBinned_HugePage = 4*1024*1024UL
- };
- enum {
- VALID_BLOCK_IN_BIN = 1 // valid block added to bin, not returned as result
- };
-public:
- static const int freeBinsNum =
- (maxBinned_HugePage-minBinnedSize)/LargeObjectCache::largeBlockCacheStep + 1;
-
- // if previous access missed per-thread slabs pool,
- // allocate numOfSlabAllocOnMiss blocks in advance
- static const int numOfSlabAllocOnMiss = 2;
-
- enum {
- NO_BIN = -1,
- // special bin for blocks >= maxBinned_HugePage, blocks go to this bin
- // when pool is created with keepAllMemory policy
- // TODO: currently this bin is scanned using "1st fit", as it accumulates
- // blocks of different sizes, "best fit" is preferred in terms of fragmentation
- HUGE_BIN = freeBinsNum-1
- };
-
- // Bin keeps 2-linked list of free blocks. It must be 2-linked
- // because during coalescing a block it's removed from a middle of the list.
- struct Bin {
- FreeBlock *head,
- *tail;
- MallocMutex tLock;
-
- void removeBlock(FreeBlock *fBlock);
- void reset() { head = tail = 0; }
- bool empty() const { return !head; }
-
- size_t countFreeBlocks();
- size_t reportFreeBlocks(FILE *f);
- void reportStat(FILE *f);
- };
-
- typedef BitMaskMin<Backend::freeBinsNum> BitMaskBins;
-
- // array of bins supplemented with bitmask for fast finding of non-empty bins
- class IndexedBins {
- BitMaskBins bitMask;
- Bin freeBins[Backend::freeBinsNum];
- FreeBlock *getFromBin(int binIdx, BackendSync *sync, size_t size,
- bool resSlabAligned, bool alignedBin, bool wait,
- int *resLocked);
- public:
- FreeBlock *findBlock(int nativeBin, BackendSync *sync, size_t size,
- bool resSlabAligned, bool alignedBin, int *numOfLockedBins);
- bool tryReleaseRegions(int binIdx, Backend *backend);
- void lockRemoveBlock(int binIdx, FreeBlock *fBlock);
- void addBlock(int binIdx, FreeBlock *fBlock, size_t blockSz, bool addToTail);
- bool tryAddBlock(int binIdx, FreeBlock *fBlock, bool addToTail);
- int getMinNonemptyBin(unsigned startBin) const {
- int p = bitMask.getMinTrue(startBin);
- return p == -1 ? Backend::freeBinsNum : p;
- }
- void verify();
- void reset();
- void reportStat(FILE *f);
- };
-
-private:
- class AdvRegionsBins {
- BitMaskBins bins;
- public:
- void registerBin(int regBin) { bins.set(regBin, 1); }
- int getMinUsedBin(int start) const { return bins.getMinTrue(start); }
- void reset() { bins.reset(); }
- };
- // auxiliary class to atomic maximum request finding
- class MaxRequestComparator {
- const Backend *backend;
- public:
- MaxRequestComparator(const Backend *be) : backend(be) {}
- inline bool operator()(size_t oldMaxReq, size_t requestSize) const;
- };
-
-#if CHECK_ALLOCATION_RANGE
- // Keep min and max of all addresses requested from OS,
- // use it for checking memory possibly allocated by replaced allocators
- // and for debugging purposes. Valid only for default memory pool.
- class UsedAddressRange {
- static const uintptr_t ADDRESS_UPPER_BOUND = UINTPTR_MAX;
-
- uintptr_t leftBound,
- rightBound;
- MallocMutex mutex;
- public:
- // rightBound is zero-initialized
- void init() { leftBound = ADDRESS_UPPER_BOUND; }
- void registerAlloc(uintptr_t left, uintptr_t right);
- void registerFree(uintptr_t left, uintptr_t right);
- // as only left and right bounds are kept, we can return true
- // for pointer not allocated by us, if more than single region
- // was requested from OS
- bool inRange(void *ptr) const {
- const uintptr_t p = (uintptr_t)ptr;
- return leftBound<=p && p<=rightBound;
- }
- };
-#else
- class UsedAddressRange {
- public:
- void init() { }
- void registerAlloc(uintptr_t, uintptr_t) {}
- void registerFree(uintptr_t, uintptr_t) {}
- bool inRange(void *) const { return true; }
- };
-#endif
-
- ExtMemoryPool *extMemPool;
- // used for release every region on pool destroying
- MemRegionList regionList;
-
- CoalRequestQ coalescQ; // queue of coalescing requests
- BackendSync bkndSync;
- // semaphore protecting adding more more memory from OS
- MemExtendingSema memExtendingSema;
- size_t totalMemSize,
- memSoftLimit;
- UsedAddressRange usedAddrRange;
- // to keep 1st allocation large than requested, keep bootstrapping status
- enum {
- bootsrapMemNotDone = 0,
- bootsrapMemInitializing,
- bootsrapMemDone
- };
- intptr_t bootsrapMemStatus;
- MallocMutex bootsrapMemStatusMutex;
-
- // Using of maximal observed requested size allows decrease
- // memory consumption for small requests and decrease fragmentation
- // for workloads when small and large allocation requests are mixed.
- // TODO: decrease, not only increase it
- size_t maxRequestedSize;
-
- FreeBlock *addNewRegion(size_t size, MemRegionType type, bool addToBin);
- FreeBlock *findBlockInRegion(MemRegion *region, size_t exactBlockSize);
- void startUseBlock(MemRegion *region, FreeBlock *fBlock, bool addToBin);
- void releaseRegion(MemRegion *region);
-
- FreeBlock *releaseMemInCaches(intptr_t startModifiedCnt,
- int *lockedBinsThreshold, int numOfLockedBins);
- void requestBootstrapMem();
- FreeBlock *askMemFromOS(size_t totalReqSize, intptr_t startModifiedCnt,
- int *lockedBinsThreshold, int numOfLockedBins,
- bool *splittable);
- FreeBlock *genericGetBlock(int num, size_t size, bool resSlabAligned);
- void genericPutBlock(FreeBlock *fBlock, size_t blockSz);
- FreeBlock *splitUnalignedBlock(FreeBlock *fBlock, int num, size_t size,
- bool needAlignedRes);
- FreeBlock *splitAlignedBlock(FreeBlock *fBlock, int num, size_t size,
- bool needAlignedRes);
-
- FreeBlock *doCoalesc(FreeBlock *fBlock, MemRegion **memRegion);
- bool coalescAndPutList(FreeBlock *head, bool forceCoalescQDrop, bool reportBlocksProcessed);
- void coalescAndPut(FreeBlock *fBlock, size_t blockSz);
-
- void removeBlockFromBin(FreeBlock *fBlock);
-
- void *allocRawMem(size_t &size);
- bool freeRawMem(void *object, size_t size);
-
- void putLargeBlock(LargeMemoryBlock *lmb);
- void releaseCachesToLimit();
-public:
- bool scanCoalescQ(bool forceCoalescQDrop);
- intptr_t blocksInCoalescing() const { return coalescQ.blocksInFly(); }
- void verify();
- void init(ExtMemoryPool *extMemoryPool);
- void reset();
- bool destroy();
- bool clean(); // clean on caches cleanup
- void reportStat(FILE *f);
-
- BlockI *getSlabBlock(int num) {
- BlockI *b = (BlockI*)
- genericGetBlock(num, slabSize, /*resSlabAligned=*/true);
- MALLOC_ASSERT(isAligned(b, slabSize), ASSERT_TEXT);
- return b;
- }
- void putSlabBlock(BlockI *block) {
- genericPutBlock((FreeBlock *)block, slabSize);
- }
- void *getBackRefSpace(size_t size, bool *rawMemUsed);
- void putBackRefSpace(void *b, size_t size, bool rawMemUsed);
-
- bool inUserPool() const;
-
- LargeMemoryBlock *getLargeBlock(size_t size);
- void returnLargeObject(LargeMemoryBlock *lmb);
-
- void *remap(void *ptr, size_t oldSize, size_t newSize, size_t alignment);
-
- void setRecommendedMaxSize(size_t softLimit) {
- memSoftLimit = softLimit;
- releaseCachesToLimit();
- }
- size_t getMaxBinnedSize() const;
-
- bool ptrCanBeValid(void *ptr) const { return usedAddrRange.inRange(ptr); }
-
-#if __TBB_MALLOC_WHITEBOX_TEST
- size_t getTotalMemSize() const { return totalMemSize; }
-#endif
-private:
- static int sizeToBin(size_t size) {
- if (size >= maxBinned_HugePage)
- return HUGE_BIN;
- else if (size < minBinnedSize)
- return NO_BIN;
-
- int bin = (size - minBinnedSize)/LargeObjectCache::largeBlockCacheStep;
-
- MALLOC_ASSERT(bin < HUGE_BIN, "Invalid size.");
- return bin;
- }
-#if __TBB_MALLOC_BACKEND_STAT
- static size_t binToSize(int bin) {
- MALLOC_ASSERT(bin <= HUGE_BIN, "Invalid bin.");
-
- return bin*LargeObjectCache::largeBlockCacheStep + minBinnedSize;
- }
-#endif
- static bool toAlignedBin(FreeBlock *block, size_t size) {
- return isAligned((char*)block+size, slabSize)
- && size >= slabSize;
- }
-
- // register bins related to advance regions
- AdvRegionsBins advRegBins;
- IndexedBins freeLargeBins,
- freeAlignedBins;
-};
+// Classes and methods for backend.cpp
+#include "backend.h"
// An TBB allocator mode that can be controlled by user
// via API/environment variable. Must be placed in zero-initialized memory.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_tbbmalloc_internal_api_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
EXPORTS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
{
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
EXPORTS
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
-;
-;
-;
-;
// __TBB_STRING macro defined in "tbb_stddef.h". However, we cannot include "tbb_stddef.h"
// because it contains a lot of C/C++ definitions. So, we have to define __TBB_STRING here:
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
tbb::runtime_loader::error_code code = tbb::runtime_loader::ec_ok;
/*
- If these variables declared at the first usage, Intel C++ Compiler may issue warning(s):
+ If these variables declared at the first usage, Intel(R) C++ Compiler may issue warning(s):
transfer of control [goto error] bypasses initialization of: ...
Declaring variables at the beginning of the function eliminates warnings.
*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Declarations for rock-bottom simple test harness.
res = TestMain();
#if __TBB_MIC_OFFLOAD && __MIC__
// It is recommended not to use the __MIC__ macro directly in the offload block but it is Ok here
- // since it is not lead to an unexpected difference between host and target compilation phases.
- // We need to flush internals COI buffers to order output from the offload part before the host part.
+ // since it does not lead to an unexpected difference between host and target compilation phases.
+ // We need to flush internal Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) buffers
+ // to order output from the offload part before the host part.
// Also it is work-around for the issue with missed output.
COIProcessProxyFlush();
#endif
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Declarations for simple estimate of the memory being used by a program.
void* unique_pointer;
};
+#include "tbb/internal/_allocator_traits.h" // Need traits_true/false_type
+
+template <typename Allocator, typename POCMA = tbb::internal::traits_false_type,
+ typename POCCA = tbb::internal::traits_false_type, typename POCS = tbb::internal::traits_false_type>
+struct propagating_allocator : Allocator {
+ typedef POCMA propagate_on_container_move_assignment;
+ typedef POCCA propagate_on_container_copy_assignment;
+ typedef POCS propagate_on_container_swap;
+ bool* propagated_on_copy_assignment;
+ bool* propagated_on_move_assignment;
+ bool* propagated_on_swap;
+ bool* selected_on_copy_construction;
+
+ template <typename U>
+ struct rebind {
+ typedef propagating_allocator<typename tbb::internal::allocator_rebind<Allocator, U>::type,
+ POCMA, POCCA, POCS> other;
+ };
+
+ propagating_allocator() : propagated_on_copy_assignment(NULL),
+ propagated_on_move_assignment(NULL),
+ propagated_on_swap(NULL),
+ selected_on_copy_construction(NULL) {}
+
+ propagating_allocator(bool& poca, bool& poma, bool& pos, bool& soc)
+ : propagated_on_copy_assignment(&poca),
+ propagated_on_move_assignment(&poma),
+ propagated_on_swap(&pos),
+ selected_on_copy_construction(&soc) {}
+
+ propagating_allocator(const propagating_allocator& other)
+ : Allocator(other),
+ propagated_on_copy_assignment(other.propagated_on_copy_assignment),
+ propagated_on_move_assignment(other.propagated_on_move_assignment),
+ propagated_on_swap(other.propagated_on_swap),
+ selected_on_copy_construction(other.selected_on_copy_construction) {}
+
+ template <typename Allocator2>
+ propagating_allocator(const propagating_allocator<Allocator2, POCMA, POCCA, POCS>& other)
+ : Allocator(other),
+ propagated_on_copy_assignment(other.propagated_on_copy_assignment),
+ propagated_on_move_assignment(other.propagated_on_move_assignment),
+ propagated_on_swap(other.propagated_on_swap),
+ selected_on_copy_construction(other.selected_on_copy_construction) {}
+
+ propagating_allocator& operator=(const propagating_allocator&) {
+ ASSERT(POCCA::value, "Allocator should not copy assign if pocca is false");
+ if (propagated_on_copy_assignment)
+ *propagated_on_copy_assignment = true;
+ return *this;
+ }
+
+#if __TBB_CPP11_RVALUE_REF_PRESENT
+ propagating_allocator& operator=(propagating_allocator&&) {
+ ASSERT(POCMA::value, "Allocator should not move assign if pocma is false");
+ if (propagated_on_move_assignment)
+ *propagated_on_move_assignment = true;
+ return *this;
+ }
+#endif
+
+ propagating_allocator select_on_container_copy_construction() const {
+ if (selected_on_copy_construction)
+ *selected_on_copy_construction = true;
+ return *this;
+ }
+};
+
+template <typename Allocator, typename POCMA, typename POCCA, typename POCS>
+void swap(propagating_allocator<Allocator, POCMA, POCCA, POCS>& lhs,
+ propagating_allocator<Allocator, POCMA, POCCA, POCS>&) {
+ ASSERT(POCS::value, "Allocator should not swap if pocs is false");
+ if (lhs.propagated_on_swap)
+ *lhs.propagated_on_swap = true;
+}
+
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
// Workaround for overzealous compiler warnings
#pragma warning (pop)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef tbb_test_harness_allocator_overload_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Just the assertion portion of the harness.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Declarations for checking __TBB_ASSERT checks inside TBB.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/atomic.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef tbb_tests_harness_checktype_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef tbb_tests_harness_concurrency_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef tbb_tests_harness_concurrency_tracker_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Declarations for simple estimate of CPU time being used by a program.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_harness_defs_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include <typeinfo>
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// include system header to prevent standard library to be included under private=public first time
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/** @file harness_graph.cpp
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Used in tests that work with TBB scheduler but do not link to the TBB library.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef harness_iterator_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Header that sets HAVE_m128/HAVE_m256 if vector types (__m128/__m256) are available
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Declarations for simple estimate of the memory being used by a program.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef tbb_test_harness_mic_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// This file is intended for preloading (via compiler options such as -include) into every test.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Just the tracing portion of the harness.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef harness_runtime_loader_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Declarations for a class that can track operations applied to its objects.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/task.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef harness_tbb_independence_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef tbb_harness_test_cases_framework_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
class LimitTLSKeysTo {
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Header that includes Intel(R) Transactional Synchronization Extensions (Intel(R) TSX) specific test functions
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Test whether scalable_allocator complies with the requirements in 20.1.5 of ISO C++ Standard (1998).
}
result += TestMain(tbb::memory_pool_allocator<void>(pool) );
+ }{
+ // Two nested level allocators case with fixed pool allocator as an underlying layer
+ // serving allocRawMem requests for the top level scalable allocator
+ typedef tbb::memory_pool<tbb::memory_pool_allocator<char, tbb::fixed_pool> > NestedPool;
+
+ static char buffer[8*1024*1024];
+ tbb::fixed_pool fixedPool(buffer, sizeof(buffer));
+ // Underlying fixed pool allocator
+ tbb::memory_pool_allocator<char, tbb::fixed_pool> fixedPoolAllocator(fixedPool);
+ // Memory pool that handles fixed pool allocator
+ NestedPool nestedPool(fixedPoolAllocator);
+ // Top level memory pool allocator
+ tbb::memory_pool_allocator<char, NestedPool> nestedAllocator(nestedPool);
+
+ result += TestMain(nestedAllocator);
}
TestSmallFixedSizePool();
TestZeroSpaceMemoryPool();
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Test whether scalable_allocator works with some of the host's STL containers.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef TBB_PREVIEW_AGGREGATOR
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Basic testing of an allocator
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Tests for compatibility with the host's STL.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Program for basic correctness testing of assembly-language routines.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef TBB_PREVIEW_FLOW_GRAPH_FEATURES
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_defs.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/blocked_range.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/blocked_range2d.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/blocked_range3d.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define TBB_PREVIEW_BLOCKED_RANGE_ND 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Test whether cache_aligned_allocator works with some of the host's STL containers.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Test whether cache_aligned_allocator works with some of the host's STL containers.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// This file is a common part of test_cilk_interop and test_cilk_dynamic_load tests
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 0
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef TBB_USE_PERFORMANCE_WARNINGS
}
#endif
+// C++03 allocator doesn't have to be assignable or swappable, so
+// tbb::internal::allocator_traits defines POCCA and POCS as false_type
+#if __TBB_ALLOCATOR_TRAITS_PRESENT
+
+template<typename Allocator>
+void test_traits() {
+ typedef int key_type;
+
+ typedef int mapped_type;
+ typedef tbb::tbb_hash_compare<key_type> compare_type;
+
+ typedef typename Allocator::propagate_on_container_copy_assignment pocca;
+ typedef typename Allocator::propagate_on_container_swap pocs;
+
+ typedef tbb::concurrent_hash_map<key_type, mapped_type, compare_type, Allocator> container_type;
+ bool propagated_on_copy_assign = false;
+ bool propagated_on_move = false;
+ bool propagated_on_swap = false;
+ bool selected_on_copy_construct = false;
+
+ Allocator alloc(propagated_on_copy_assign, propagated_on_move, propagated_on_swap, selected_on_copy_construct);
+
+ container_type c1(alloc), c2(c1);
+ ASSERT(selected_on_copy_construct, "select_on_container_copy_construction function was not called");
+
+ c1 = c2;
+ ASSERT(propagated_on_copy_assign == pocca::value, "Unexpected allocator propagation on copy assignment");
+
+#if __TBB_CPP11_RVALUE_REF_PRESENT
+ typedef typename Allocator::propagate_on_container_move_assignment pocma;
+ c2 = std::move(c1);
+ ASSERT(propagated_on_move == pocma::value, "Unexpected allocator propagation on move assignment");
+#endif
+
+ c1.swap(c2);
+ ASSERT(propagated_on_swap == pocs::value, "Unexpected allocator propagation on swap");
+}
+
+#if __TBB_CPP11_RVALUE_REF_PRESENT
+class non_movable_object {
+ non_movable_object() {}
+private:
+ non_movable_object(non_movable_object&&);
+ non_movable_object& operator=(non_movable_object&&);
+};
+
+void test_non_movable_value_type() {
+ // Check, that if pocma is true, concurrent_hash_map allows move assignment without per-element move
+ typedef propagating_allocator<tbb::tbb_allocator<int>, /*POCMA=*/tbb::internal::traits_true_type> allocator_type;
+ typedef tbb::concurrent_hash_map<int, non_movable_object, tbb::tbb_hash_compare<int>, allocator_type> container_type;
+ allocator_type alloc;
+ container_type container1(alloc), container2(alloc);
+ container1 = std::move(container2);
+}
+
+#endif // __TBB_CPP11_RVALUE_REF_PRESENT
+
+void TestAllocatorTraits() {
+ typedef tbb::tbb_allocator<int> base_allocator;
+ typedef tbb::internal::traits_true_type true_type;
+ typedef tbb::internal::traits_true_type false_type;
+
+ typedef propagating_allocator<base_allocator, /*POCMA=*/true_type, /*POCCA=*/true_type, /*POCS=*/true_type>
+ always_propagating_allocator;
+ typedef propagating_allocator<base_allocator, false_type, false_type, false_type> never_propagating_allocator;
+ typedef propagating_allocator<base_allocator, true_type, false_type, false_type> pocma_allocator;
+ typedef propagating_allocator<base_allocator, false_type, true_type, false_type> pocca_allocator;
+ typedef propagating_allocator<base_allocator, false_type, false_type, true_type> pocs_allocator;
+
+ test_traits<always_propagating_allocator>();
+ test_traits<never_propagating_allocator>();
+ test_traits<pocca_allocator>();
+ test_traits<pocma_allocator>();
+ test_traits<pocs_allocator>();
+
+#if __TBB_CPP11_RVALUE_REF_PRESENT
+ test_non_movable_value_type();
+#endif
+}
+
+#endif // __TBB_ALLOCATOR_TRAITS_PRESENT
+
//------------------------------------------------------------------------
// Test driver
//------------------------------------------------------------------------
TestScopedAllocator();
#endif
+#if __TBB_ALLOCATOR_TRAITS_PRESENT
+ TestAllocatorTraits();
+#endif
+
return Harness::Done;
}
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _MSC_VER
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 6
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_defs.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define NOMINMAX
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFINE_PRIVATE_PUBLIC 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* Some tests in this source file are based on PPL tests provided by Microsoft. */
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define __TBB_EXTRA_DEBUG 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _MSC_VER
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _MSC_VER
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/compat/condition_variable"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_test_container_move_support_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_CPF_BUILD
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// test critical section
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
enum FOO_TYPE {
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 2
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 2
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 2
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 0
/*
- Copyright (c) 2005-2019 Intel Corporation
+ Copyright (c) 2018-2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
#include "../tbb/tbb_environment.h"
-#include <time.h>
#include <string>
#include <algorithm>
+#include <sstream>
+#include <climits>
+#include <utility>
+#include <vector>
+
+const char * environment_variable_name = "TEST_VARIABLE_NAME";
// For WIN8UI applications reading and writing the environment variables
// is prohibited due to the platform limitations
#if !__TBB_WIN8UI_SUPPORT
-void set_and_get_tbb_version(const char* value, bool expected_result){
- // TODO: consider to replace TBB_VERSION with test specific or arbitrary variable
- const char* name = "TBB_VERSION";
- Harness::SetEnv(name, value);
- bool result = tbb::internal::GetBoolEnvironmentVariable(name);
- ASSERT(result == expected_result, "Wrong GetBoolEnvironmentVariable return value");
- Harness::SetEnv(name, "");
+#if _WIN32 || _WIN64
+ // Environment variable length is limited by 32K on Windows systems
+ const size_t large_length = 32000;
+#else
+ const size_t large_length = 1000000;
+#endif
+
+template<typename T>
+void set_and_get_test_variable( T (*environment_variable_getter )(const char *),
+ std::pair<std::string, T> test_case ) {
+ Harness::SetEnv(environment_variable_name, test_case.first.c_str());
+ T result = environment_variable_getter(environment_variable_name);
+ ASSERT(result == test_case.second, "Wrong Get<Type>EnvironmentVariable return value");
+ Harness::SetEnv(environment_variable_name, "");
}
Harness::FastRandom rnd(12345);
}
};
-void test_random_environment_variable(size_t length) {
- ASSERT(length != 0, "Requested random string cannot be empty");
- std::string rand_string(length, ' ');
- std::generate(rand_string.begin(), rand_string.end(), random_character_generator());
- bool expected_result = false;
- for (unsigned i = 0; rand_string[i]; i++)
- if (rand_string[i] == '1') {
+bool alternative_env_variable_checker(const char * str, bool) {
+ bool result = false;
+ for (unsigned i = 0; str[i]; i++) {
+ if (str[i] == '1') {
// if we found more the one '1' character -> return false
- expected_result = !expected_result;
- if (!expected_result) break;
+ result = !result;
+ if (!result) return false;
}
- else if (rand_string[i] != ' ') {
+ else if (str[i] != ' ') {
// if we found some character other than ' ' and '1' -> return false
- expected_result = false;
- break;
+ return false;
}
+ }
+ return result;
+}
+
+// Suitable alternative checker for GetLongEnvVariable() was not found
+// So we use here code from GetLongEnvVariable() realization
+long alternative_env_variable_checker(const char * str, long) {
+ char* end;
+ errno=0;
+ long result = std::strtol(str, &end, 10);
- set_and_get_tbb_version(rand_string.c_str(), expected_result);
+ // We have exceeded the range, value is negative or string is incovertable
+ if (errno == ERANGE || result < 0 || end==str) {
+ result = -1;
+ }
+
+ for (; *end != '\0'; end++) {
+ if (!std::isspace(*end))
+ result = -1;
+ }
+ return result;
}
-void test_get_bool_environment_variable() {
- // Test undefined variable
- ASSERT(!tbb::internal::GetBoolEnvironmentVariable("TBB_VERSION"),
- "TBB_VERSION should not be defined in the beginning of the test");
-
- set_and_get_tbb_version("", false);
- set_and_get_tbb_version(" ", false);
- set_and_get_tbb_version("1", true);
- set_and_get_tbb_version(" 1 ", true);
- set_and_get_tbb_version("1 ", true);
- set_and_get_tbb_version(" 1 ", true);
- set_and_get_tbb_version(" 1", true);
- set_and_get_tbb_version(" 11", false);
- set_and_get_tbb_version("111111", false);
- set_and_get_tbb_version("1 1", false);
- set_and_get_tbb_version(" 1 abc?", false);
- set_and_get_tbb_version("1;", false);
- set_and_get_tbb_version(" d ", false);
- set_and_get_tbb_version("0", false);
- set_and_get_tbb_version("0 ", false);
- set_and_get_tbb_version("000000", false);
- set_and_get_tbb_version("01", false);
- set_and_get_tbb_version("00000001", false);
- set_and_get_tbb_version("ABCDEFG", false);
- set_and_get_tbb_version("2018", false);
- set_and_get_tbb_version("ABC_123", false);
- set_and_get_tbb_version("true", false);
+template <typename T>
+std::pair<std::string, T> create_random_case(size_t length){
+ ASSERT(length != 0, "Requested random string cannot be empty");
+ std::string rand_string(length, ' ');
+ std::generate(rand_string.begin(), rand_string.end(), random_character_generator());
+
+ T expected_result = alternative_env_variable_checker(rand_string.c_str(), T());
+
+ return std::make_pair(rand_string, expected_result);
+}
+template <typename T>
+void prepare_random_cases(std::vector<std::pair<std::string, T> >& cases){
+ // Random cases
size_t length = 10000;
for(size_t i =0; i < 10; ++i) {
- test_random_environment_variable((rnd.get() % length) + 1);
+ cases.push_back(create_random_case<T>((rnd.get() % length) + 1 ));
}
-#if _WIN32 || _WIN64
- // Environment variable length is limited by 32K on Windows systems
- size_t large_length = 32000;
-#else
- size_t large_length = 1000000;
-#endif
- set_and_get_tbb_version(std::string(large_length, 'A').c_str(), false);
- set_and_get_tbb_version((std::string(large_length, ' ')+'1').c_str(), true);
- test_random_environment_variable(large_length);
+ // Random case with large string
+ cases.push_back(create_random_case<T>(large_length));
}
+std::vector<std::pair<std::string, bool> > initialize_cases( bool wrong_result ){
+ std::vector<std::pair<std::string, bool> > cases;
+ // Valid cases
+ cases.push_back(std::make_pair("1", true));
+ cases.push_back(std::make_pair(" 1 ", true));
+ cases.push_back(std::make_pair("1 ", true));
+ cases.push_back(std::make_pair(" 1 ", true));
+ cases.push_back(std::make_pair(" 1", true));
+ cases.push_back(std::make_pair((std::string(large_length, ' ')+'1').c_str(), true));
+
+ // Invalid cases
+
+ cases.push_back(std::make_pair("", wrong_result));
+ cases.push_back(std::make_pair(" ", wrong_result));
+ cases.push_back(std::make_pair(" 11", wrong_result));
+ cases.push_back(std::make_pair("111111", wrong_result));
+ cases.push_back(std::make_pair("1 1", wrong_result));
+ cases.push_back(std::make_pair(" 1 abc?", wrong_result));
+ cases.push_back(std::make_pair("1;", wrong_result));
+ cases.push_back(std::make_pair(" d ", wrong_result));
+ cases.push_back(std::make_pair("0", wrong_result));
+ cases.push_back(std::make_pair("0 ", wrong_result));
+ cases.push_back(std::make_pair("000000", wrong_result));
+ cases.push_back(std::make_pair("01", wrong_result));
+ cases.push_back(std::make_pair("00000001", wrong_result));
+ cases.push_back(std::make_pair("ABCDEFG", wrong_result));
+ cases.push_back(std::make_pair("2018", wrong_result));
+ cases.push_back(std::make_pair("ABC_123", wrong_result));
+ cases.push_back(std::make_pair("true", wrong_result));
+ cases.push_back(std::make_pair(std::string(large_length, 'A').c_str(), wrong_result));
+
+ prepare_random_cases(cases);
+
+ return cases;
+}
+
+std::vector<std::pair<std::string, long> > initialize_cases( long wrong_result ){
+ std::vector<std::pair<std::string, long> > cases;
+ std::stringstream ss;
+ // Valid cases
+ for (long i = 0; i < 100; i++) {
+ ss << i;
+ cases.push_back(std::make_pair(ss.str().c_str(), i));
+ ss.str("");
+
+ ss << " " << i << " ";
+ cases.push_back(std::make_pair(ss.str().c_str(), i));
+ ss.str("");
+
+ ss << i << " ";
+ cases.push_back(std::make_pair(ss.str().c_str(),i));
+ ss.str("");
+
+ ss << " " << i;
+ cases.push_back(std::make_pair(ss.str().c_str(),i));
+ ss.str("");
+ }
+
+ ss << LONG_MAX;
+ cases.push_back(std::make_pair(ss.str().c_str(),LONG_MAX));
+ ss.str("");
+
+ cases.push_back(std::make_pair((std::string(large_length, ' ')+'1').c_str(), 1L));
+
+ // Invalid cases
+ cases.push_back(std::make_pair("", wrong_result));
+ cases.push_back(std::make_pair(" ", wrong_result));
+ cases.push_back(std::make_pair("a", wrong_result));
+ cases.push_back(std::make_pair("^&*", wrong_result));
+ cases.push_back(std::make_pair(" 10 e", wrong_result));
+ cases.push_back(std::make_pair("a 12", wrong_result));
+ cases.push_back(std::make_pair("eeeeeeeeeeeeeeeeeeeeeeeeee", wrong_result));
+ cases.push_back(std::make_pair("200000000000000000000000000", wrong_result));
+ cases.push_back(std::make_pair("-1", wrong_result));
+ cases.push_back(std::make_pair("-100", wrong_result));
+ cases.push_back(std::make_pair("-20000000000000000000000000", wrong_result));
+ cases.push_back(std::make_pair("ABBDDRR", wrong_result));
+ cases.push_back(std::make_pair("10 10", wrong_result));
+ cases.push_back(std::make_pair("true", wrong_result));
+ cases.push_back(std::make_pair("false", wrong_result));
+ cases.push_back(std::make_pair("1A", wrong_result));
+ cases.push_back(std::make_pair("_123", wrong_result));
+ cases.push_back(std::make_pair(std::string(large_length, 'A').c_str(), wrong_result));
+
+ // Prepare string with LONG_MAX + 1 value
+ ss << LONG_MAX / 10 << (LONG_MAX % 10 + 1);
+ cases.push_back(std::make_pair(ss.str().c_str(),-1));
+ ss.str("");
+
+ prepare_random_cases(cases);
+ return cases;
+}
+
+template <typename T>
+void test_environment_variable( T (*environment_variables_handler )(const char *), T wrong_result ) {
+ ASSERT(environment_variables_handler (environment_variable_name) == wrong_result,
+ "Tested environment variable should not be defined in the beginning of the test");
+
+ // Every pair is a test case:
+ // pair.first -> value of environment variable
+ // pair.second -> expected result
+ std::vector< std::pair<std::string, T> > cases = initialize_cases(wrong_result);
+
+ for (size_t i = 0; i != cases.size(); i++) {
+ set_and_get_test_variable(environment_variables_handler, cases[i]);
+ }
+}
+
+
#else // __TBB_WIN8UI_SUPPORT
-void test_get_bool_environment_variable() {
+template <typename T>
+void test_environment_variable(T (*environment_variables_handler )(const char *), T wrong_result) {
for(size_t i = 0; i < 100; ++i) {
- ASSERT(!tbb::internal::GetBoolEnvironmentVariable("TBB_VERSION"),
- "GetBoolEnvironmentVariable should always return false for UWP applications");
+ ASSERT(environment_variables_handler(environment_variable_name) == wrong_result,
+ "Get<Type>EnvironmentVariable should always return false for UWP applications");
}
}
+
#endif // __TBB_WIN8UI_SUPPORT
int TestMain() {
- test_get_bool_environment_variable();
+ test_environment_variable(tbb::internal::GetBoolEnvironmentVariable, false);
+ test_environment_variable(tbb::internal::GetIntegralEnvironmentVariable, -1L);
return Harness::Done;
}
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_TEST_USE_WSUGGEST_OVERRIDE
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/**
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_graph.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_defs.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 3
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/** This test checks the automatic propagation of master thread FPU settings
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_CPF_BUILD
+++ /dev/null
-/*
- Copyright (c) 2005-2019 Intel Corporation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-
-
-*/
-
-#define TBB_PREVIEW_FLOW_GRAPH_NODES 1
-#define TBB_PREVIEW_FLOW_GRAPH_FEATURES 1
-
-#include "tbb/tbb_config.h"
-
-#if __TBB_PREVIEW_GFX_FACTORY && __TBB_PREVIEW_STREAMING_NODE
-
-#if _MSC_VER
-#pragma warning (disable: 4503) // Suppress "decorated name length exceeded, name was truncated" warning
-#endif
-
-#include "tbb/flow_graph.h"
-#include "tbb/gfx_factory.h"
-
-#include <cilk/cilk.h>
-
-#include "harness.h"
-#include "harness_assert.h"
-
-using namespace tbb::flow;
-
-//---------------------------------------------------------------------------------------------------------------------------------
-// Helpers
-//---------------------------------------------------------------------------------------------------------------------------------
-
-typedef tuple< gfx_buffer<int>, size_t > kernel_args;
-typedef streaming_node< kernel_args, queueing, gfx_factory > gfx_node;
-
-template <typename T>
-void init_random_buffer(gfx_buffer<T>& buf) {
- Harness::FastRandom rnd(42);
- std::generate(buf.begin(), buf.end(), [&rnd]() { return rnd.get(); });
-}
-
-template <typename T>
-void copy_buffer_to_vector(gfx_buffer<T>& buf, std::vector<T>& vect) {
- std::copy(buf.begin(), buf.end(), std::back_inserter(vect));
-}
-
-//---------------------------------------------------------------------------------------------------------------------------------
-
-// GFX functions to offload
-static __declspec(target(gfx_kernel))
-void sq_vec(int *v, size_t n) {
- cilk_for(size_t i = 0; i < n; ++i) {
- v[i] = v[i] * v[i];
- }
-}
-
-// Reference function
-void sq_vec_ref(std::vector<int>& v) {
- for (size_t i = 0; i < v.size(); ++i) {
- v[i] = v[i] * v[i];
- }
-}
-
-//---------------------------------------------------------------------------------------------------------------------------------
-
-void TestDynamicKernelArgs_finalize() {
- REMARK(" TestDynamicKernelArgs_finalize: ");
-
- // Initialize input data
- const size_t array_size = 1000;
- gfx_buffer<int> buffer(array_size);
-
- // Generate random buffer values
- init_random_buffer(buffer);
-
- // Copy buffer to vector for the next validation
- std::vector<int> check_vec;
- copy_buffer_to_vector(buffer, check_vec);
-
- // Obtain reference result
- sq_vec_ref(check_vec);
-
- graph g;
- gfx_factory factory(g);
-
- gfx_node streaming_n(g, sq_vec, gfx_factory::dummy_device_selector(), factory);
-
- streaming_n.set_args(port_ref<0, 1>);
- input_port<0>(streaming_n).try_put(buffer);
- input_port<1>(streaming_n).try_put(array_size);
-
- g.wait_for_all();
-
- ASSERT((buffer.size() == check_vec.size()), "Validation has failed");
- ASSERT((std::equal(buffer.begin(), buffer.end(), check_vec.begin())), "Validation has failed");
- REMARK("done\n");
-}
-
-void TestConstantKernelArgs_finalize() {
- REMARK(" TestConstantKernelArgs_finalize: ");
-
- // Initialize input data
- const size_t array_size = 1000;
- gfx_buffer<int> buffer(array_size);
-
- // Generate random buffer values
- init_random_buffer(buffer);
-
- // Copy buffer to vector for the next validation
- std::vector<int> check_vec;
- copy_buffer_to_vector(buffer, check_vec);
-
- // Obtain reference result
- sq_vec_ref(check_vec);
-
- graph g;
- gfx_factory factory(g);
-
- streaming_node< tuple< gfx_buffer<int> >, queueing, gfx_factory > streaming_n(g, sq_vec, gfx_factory::dummy_device_selector(), factory);
-
- streaming_n.set_args(port_ref<0>(), array_size);
- input_port<0>(streaming_n).try_put(buffer);
-
- g.wait_for_all();
-
- ASSERT((buffer.size() == check_vec.size()), "Validation has failed");
- ASSERT((std::equal(buffer.begin(), buffer.end(), check_vec.begin())), "Validation has failed");
-
- REMARK("done\n");
-}
-
-void TestGfxStreamingFactory_finalize() {
- REMARK("TestGfxStreamingFactory_finalize: ");
- TestDynamicKernelArgs_finalize();
- TestConstantKernelArgs_finalize();
- REMARK("done\n");
-}
-
-//---------------------------------------------------------------------------------------------------------------------------------
-
-void TestDynamicKernelArgs_send_kernel() {
- REMARK(" TestDynamicKernelArgs_send_kernel: ");
-
- // Initialize input data
- const size_t array_size = 1000;
- gfx_buffer<int> buffer(array_size);
-
- // Generate random buffer values
- init_random_buffer(buffer);
-
- // Copy buffer to vector for the next validation
- std::vector<int> check_vec;
- copy_buffer_to_vector(buffer, check_vec);
-
- // Obtain reference result
- sq_vec_ref(check_vec);
-
- graph g;
- gfx_factory factory(g);
-
- gfx_node streaming_n(g, sq_vec, gfx_factory::dummy_device_selector(), factory);
-
- join_node< kernel_args > join_n(g);
- function_node< kernel_args > function_n(g, unlimited, [&check_vec](const kernel_args& result) {
- gfx_buffer<int> buffer = get<0>(result);
-
- ASSERT((buffer.size() == check_vec.size()), "Validation has failed");
- ASSERT((std::equal(buffer.begin(), buffer.end(), check_vec.begin())), "Validation has failed");
- });
-
- make_edge(output_port<0>(streaming_n), input_port<0>(join_n));
- make_edge(output_port<1>(streaming_n), input_port<1>(join_n));
- make_edge(join_n, function_n);
-
- streaming_n.set_args(port_ref<0, 1>);
- input_port<0>(streaming_n).try_put(buffer);
- input_port<1>(streaming_n).try_put(array_size);
-
- g.wait_for_all();
-
- REMARK("done\n");
-}
-
-void TestConstantKernelArgs_send_kernel() {
- REMARK(" TestConstantKernelArgs_send_kernel: ");
-
- // Initialize input data
- const size_t array_size = 1000;
- gfx_buffer<int> buffer(array_size);
-
- // Generate random buffer values
- init_random_buffer(buffer);
-
- // Copy buffer to vector for the next validation
- std::vector<int> check_vec;
- copy_buffer_to_vector(buffer, check_vec);
-
- // Obtain reference result
- sq_vec_ref(check_vec);
-
- graph g;
- gfx_factory factory(g);
-
- streaming_node< tuple< gfx_buffer<int> >, queueing, gfx_factory > streaming_n(g, sq_vec, gfx_factory::dummy_device_selector(), factory);
-
- join_node< tuple< gfx_buffer<int> > > join_n(g);
- function_node< tuple< gfx_buffer<int> > > function_n(g, unlimited, [&check_vec](const tuple< gfx_buffer<int> >& result) {
- gfx_buffer<int> buffer = get<0>(result);
-
- ASSERT((buffer.size() == check_vec.size()), "Validation has failed");
- ASSERT((std::equal(buffer.begin(), buffer.end(), check_vec.begin())), "Validation has failed");
- });
-
- make_edge(output_port<0>(streaming_n), input_port<0>(join_n));
- make_edge(join_n, function_n);
-
- streaming_n.set_args(port_ref<0>(), array_size);
- input_port<0>(streaming_n).try_put(buffer);
-
- g.wait_for_all();
-
- REMARK("done\n");
-}
-
-void TestGfxStreamingFactory_send_kernel() {
- REMARK("TestGfxStreamingFactory_send_kernel:\n");
- TestDynamicKernelArgs_send_kernel();
- TestConstantKernelArgs_send_kernel();
- REMARK("done\n");
-}
-
-//---------------------------------------------------------------------------------------------------------------------------------
-
-void ConcurrencyTest() {
- REMARK("ConcurrencyTest: ");
-
- // Initialize input data
- const size_t array_size = 1000;
- gfx_buffer<int> buffer(array_size);
-
- // Generate random buffer values
- init_random_buffer(buffer);
-
- // Copy buffer to vector for the next validation
- std::vector<int> check_vec;
- copy_buffer_to_vector(buffer, check_vec);
-
- // Obtain reference result
- sq_vec_ref(check_vec);
-
- graph g;
- gfx_factory factory(g);
-
- streaming_node< tuple< gfx_buffer<int> >, queueing, gfx_factory > streaming_n(g, sq_vec, gfx_factory::dummy_device_selector(), factory);
-
- join_node< tuple< gfx_buffer<int> > > join_n(g);
- function_node< tuple< gfx_buffer<int> > > function_n(g, unlimited, [&check_vec](const tuple< gfx_buffer<int> >& result) {
- gfx_buffer<int> buffer = get<0>(result);
-
- ASSERT((buffer.size() == check_vec.size()), "Validation has failed");
- ASSERT((std::equal(buffer.begin(), buffer.end(), check_vec.begin())), "Validation has failed");
- });
-
- make_edge(output_port<0>(streaming_n), input_port<0>(join_n));
- make_edge(join_n, function_n);
-
- streaming_n.set_args(port_ref<0>(), array_size);
-
- for (int i = 0; i < 100; i++) {
- gfx_buffer<int> input(array_size);
-
- for (int i = 0; i < buffer.size(); i++) {
- input[i] = buffer[i];
- }
-
- input_port<0>(streaming_n).try_put(input);
- }
-
- g.wait_for_all();
-
- REMARK("done\n");
-}
-
-//---------------------------------------------------------------------------------------------------------------------------------
-
-int TestMain() {
- TestGfxStreamingFactory_finalize();
- TestGfxStreamingFactory_send_kernel();
- ConcurrencyTest();
- return Harness::Done;
-}
-
-#else
-#define HARNESS_SKIP_TEST 1
-#include "harness.h"
-#endif
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define TBB_PREVIEW_WAITING_FOR_WORKERS 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFINE_PRIVATE_PUBLIC 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 4
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Program for basic correctness of handle_perror, which is internal
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_defs.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_CPF_BUILD
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_test_initializer_list_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __APPLE__
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_NO_PARSE_COMMAND_LINE 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 2
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_CPF_BUILD
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef tbb_test_join_node_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_CPF_BUILD
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Message based key matching is a preview feature
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define NOMINMAX
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* Regression test against a bug in TBB allocator manifested when
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
bool __tbb_test_errno = false;
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/scalable_allocator.h"
// test releasing memory from pthread key destructor
void TestKeyDtor() {
+ // Allocate region for large objects to prevent whole region release
+ // on scalable_free(currLarge) call, which result in wrong assert inside intersectingObjects check
+ void* preventLargeRelease = scalable_malloc(32*1024);
for (int i=0; i<4; i++)
NativeParallelFor( 1, TestThread(1) );
+ scalable_free(preventLargeRelease);
}
#endif // _WIN32||_WIN64
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _USRDLL
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_allocator_overload.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_allocator_overload.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/scalable_allocator.h"
void *ptrLarge = pool_malloc(pool[id], lrgSz);
ASSERT(ptrLarge, NULL);
memset(ptrLarge, 1, lrgSz);
-
// consume all small objects
- while (pool_malloc(pool[id], 5*1024))
- ;
- // releasing of large object can give a chance to allocate more
+ while (pool_malloc(pool[id], 5 * 1024));
+ // releasing of large object will not give a chance to allocate more
+ // since only fixed pool can look at other bins aligned/notAligned
pool_free(pool[id], ptrLarge);
-
- ASSERT(pool_malloc(pool[id], 5*1024), NULL);
+ ASSERT(!pool_malloc(pool[id], 5*1024), NULL);
}
barrier.wait();
return NULL;
}
ASSERT(o, "Created pool must be useful.");
- ASSERT(getMemSuccessful == 1 || getMemAll > getMemSuccessful,
- "Multiple requests are allowed only when unsuccessful request occurred.");
+ ASSERT(getMemSuccessful == 1 || getMemSuccessful == 5 || getMemAll > getMemSuccessful,
+ "Multiple requests are allowed when unsuccessful request occurred or cannot search in bootstrap memory. ");
ASSERT(!putMemAll, NULL);
pool_free(pool, o);
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifdef __cplusplus
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_NO_PARSE_COMMAND_LINE 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_CUSTOM_MAIN 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _USRDLL
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* to prevent loading dynamic TBBmalloc at startup, that is not needed
for (int i=0; i<ITERS; i++) {
BlockI *slabBlock = backend->getSlabBlock(1);
ASSERT(slabBlock, "Memory was not allocated");
- LargeMemoryBlock *lmb = backend->getLargeBlock(8*1024);
+ uintptr_t prevBlock = (uintptr_t)slabBlock;
backend->putSlabBlock(slabBlock);
- backend->putLargeBlock(lmb);
+
+ LargeMemoryBlock *largeBlock = backend->getLargeBlock(16*1024);
+ ASSERT(largeBlock, "Memory was not allocated");
+ ASSERT((uintptr_t)largeBlock != prevBlock,
+ "Large block cannot be reused from slab memory, only in fixed_pool case.");
+ backend->putLargeBlock(largeBlock);
}
}
};
rml::MemPoolPolicy pol(getMallocMem, putMallocMem);
rml::MemoryPool *mPool;
pool_create_v1(0, &pol, &mPool);
- rml::internal::ExtMemoryPool *ePool =
- &((rml::internal::MemoryPool*)mPool)->extMemPool;
+ rml::internal::ExtMemoryPool *ePool = &((rml::internal::MemoryPool*)mPool)->extMemPool;
rml::internal::Backend *backend = &ePool->backend;
for( int p=MaxThread; p>=MinThread; --p ) {
void *ptrs[num_allocs];
tbb::atomic<int> alloc_counter;
+void multiThreadAlloc(size_t alloc_size) {
+ for( int i = alloc_counter++; i < num_allocs; i = alloc_counter++ ) {
+ ptrs[i] = scalable_malloc( alloc_size );
+ ASSERT( ptrs[i] != NULL, "scalable_malloc returned zero." );
+ }
+}
+void crossThreadDealloc() {
+ for( int i = --alloc_counter; i >= 0; i = --alloc_counter ) {
+ if (i < num_allocs) scalable_free( ptrs[i] );
+ }
+}
+
template<int AllocSize>
struct TestCleanAllBuffersBody : public SimpleBarrier {
void operator() ( int ) const {
barrier.wait();
- for( int i = alloc_counter++; i < num_allocs; i = alloc_counter++ ) {
- ptrs[i] = scalable_malloc( AllocSize );
- ASSERT( ptrs[i] != NULL, "scalable_malloc returned zero." );
- }
+ multiThreadAlloc(AllocSize);
barrier.wait();
- for( int i = --alloc_counter; i >= 0; i = --alloc_counter )
- if (i<num_allocs) scalable_free( ptrs[i] );
+ crossThreadDealloc();
}
};
size_t memory_in_use_before = getMemSize();
alloc_counter = 0;
TestCleanAllBuffersBody<AllocSize>::initBarrier(num_threads);
+
NativeParallelFor(num_threads, TestCleanAllBuffersBody<AllocSize>());
// TODO: reproduce the bug conditions more reliably
if ( defaultMemPool->extMemPool.backend.coalescQ.blocksToFree == NULL )
REMARK( "memory_in_use_before = %ld\nmemory_in_use_after = %ld\n", memory_in_use_before, memory_in_use_after );
ASSERT( memory_leak == 0, "Cleanup was unable to release all allocated memory." );
}
+
+//! Force cross thread deallocation of small objects to create a set of privatizable slab blocks.
+//! TBBMALLOC_CLEAN_THREAD_BUFFERS command have to privatize all the block.
+struct TestCleanThreadBuffersBody : public SimpleBarrier {
+ void operator() ( int ) const {
+ barrier.wait();
+ multiThreadAlloc(2*1024);
+ barrier.wait();
+ crossThreadDealloc();
+ barrier.wait();
+ int result = scalable_allocation_command(TBBMALLOC_CLEAN_THREAD_BUFFERS,0);
+ ASSERT(result == TBBMALLOC_OK, "Per-thread clean request has not cleaned anything.");
+
+ // Check that TLS was cleaned fully
+ TLSData *tlsCurr = defaultMemPool->getTLS(/*create=*/false);
+ for (int i = 0; i < numBlockBinLimit; i++) {
+ ASSERT(!(tlsCurr->bin[i].activeBlk), "Some bin was not cleaned.");
+ }
+ ASSERT(!(tlsCurr->lloc.head), "Local LOC was not cleaned.");
+ ASSERT(!(tlsCurr->freeSlabBlocks.head), "Free Block pool was not cleaned.");
+ }
+};
+
+void TestCleanThreadBuffers() {
+ const int num_threads = 8;
+ // Clean up if something was allocated before the test
+ scalable_allocation_command(TBBMALLOC_CLEAN_ALL_BUFFERS,0);
+
+ alloc_counter = 0;
+ TestCleanThreadBuffersBody::initBarrier(num_threads);
+ NativeParallelFor(num_threads, TestCleanThreadBuffersBody());
+}
+
/*---------------------------------------------------------------------------*/
/*------------------------- Large Object Cache tests ------------------------*/
#if _MSC_VER==1600 || _MSC_VER==1500
TestBackRef();
TestCleanAllBuffers<4*1024>();
TestCleanAllBuffers<16*1024>();
+ TestCleanThreadBuffers();
TestPools();
TestBackend();
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 4
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_CPF_BUILD
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//------------------------------------------------------------------------
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/spin_mutex.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
static size_t my_strlen( __constant char* str ) {
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define TBB_PREVIEW_FLOW_GRAPH_NODES 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Test mixing OpenMP and TBB
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_CPF_BUILD
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/parallel_do.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Test for function template parallel_for.h
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _MSC_VER && !defined(__INTEL_COMPILER)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// The test checks if the vectorization happens when PPL-style parallel_for is
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _MSC_VER && !defined(__INTEL_COMPILER)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Before including pipeline.h, set up the variable to count heap allocated
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/parallel_scan.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/parallel_sort.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/parallel_while.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if _MSC_VER==1500 && !__INTEL_COMPILER
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_assert.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* Common part for the partitioner whitebox tests */
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_stddef.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/pipeline.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// TO DO: Add overlapping put / receive tests
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// TO DO: Add overlapping put / receive tests
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#ifndef __TBB_test_range_based_for_H
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// test reader_writer_lock
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if !(_WIN32||_WIN64) || (__MINGW64__||__MINGW32__)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define HARNESS_DEFAULT_MIN_THREADS 4
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// have to expose the reset_node method to be able to reset a function_body
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_stddef.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define TBB_IMPLEMENT_CPP0X 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define TBB_PREVIEW_FLOW_GRAPH_NODES 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define _VARIADIC_MAX 10 // Visual Studio 2012
try {
int *iip = cast_to<int *>(counted_array_tagged_msg);
ASSERT(false, "did not throw on invalid cast");
- *iip = 2; // avoids "ipp set but not used" warning
+ *iip = 2; // avoids "iip set but not used" warning
}
catch(std::runtime_error &re) {
REMARK("attempt to cast to invalid type caught %s\n", re.what());
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_task.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define __TBB_EXTRA_DEBUG 1
}
}
+class CheckArenaNumThreads : public tbb::task {
+public:
+ static Harness::SpinBarrier m_barrier;
+
+ CheckArenaNumThreads(int nt, int rm): num_threads(nt), reserved_for_masters(rm) {
+ m_barrier.initialize(2);
+ }
+
+ tbb::task* execute() __TBB_override {
+ ASSERT( tbb::this_task_arena::max_concurrency() == num_threads, "Wrong concurrency of current arena" );
+ ASSERT( tbb::this_task_arena::current_thread_index() >= reserved_for_masters, "Thread shouldn't attach to master's slots" );
+ m_barrier.wait();
+ return NULL;
+ }
+
+private:
+ const int num_threads;
+ const int reserved_for_masters;
+};
+
+Harness::SpinBarrier CheckArenaNumThreads::m_barrier;
+
+void TestTaskEnqueueInArena()
+{
+ int pp[8]={3, 4, 5, 7, 8, 11, 13, 17};
+ for(int i = 0; i < 8; ++i)
+ {
+ int p = pp[i];
+ int reserved_for_masters = p - 1;
+ tbb::task_arena a(p, reserved_for_masters);
+ a.initialize();
+ CheckArenaNumThreads& t = *new( tbb::task::allocate_root() ) CheckArenaNumThreads(p, reserved_for_masters);
+ tbb::task::enqueue(t, a);
+ CheckArenaNumThreads::m_barrier.wait();
+ a.debug_wait_until_empty();
+ }
+}
+
//--------------------------------------------------//
int TestMain() {
TestMoveSemantics();
TestReturnValue();
TestArenaWorkersMigration();
+ TestTaskEnqueueInArena();
return Harness::Done;
}
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Test correctness of forceful TBB initialization before any dynamic initialization
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Testing automatic initialization of TBB task scheduler, so do not use task_scheduler_init anywhere.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_task.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "harness_defs.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/* The test uses "single produces multiple consumers" (SPMC )pattern to check
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// We want to test waiting for workers feature with non-preview binaries. However,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// undefine __TBB_CPF_BUILD to simulate user's setup
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/task.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_config.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#define TBB_PREVIEW_WAITING_FOR_WORKERS 1
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
/**
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_thread.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tbb_stddef.h"
void initialize_strings_vector(std::vector <string_pair>* vector)
{
vector->push_back(string_pair("TBB: VERSION\t\t2019.0", required)); // check TBB_VERSION
- vector->push_back(string_pair("TBB: INTERFACE VERSION\t11005", required)); // check TBB_INTERFACE_VERSION
+ vector->push_back(string_pair("TBB: INTERFACE VERSION\t11006", required)); // check TBB_INTERFACE_VERSION
vector->push_back(string_pair("TBB: BUILD_DATE", required));
vector->push_back(string_pair("TBB: BUILD_HOST", required));
vector->push_back(string_pair("TBB: BUILD_OS", required));
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/atomic.h"
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#include "tbb/tick_count.h"
//! Test that average timer overhead is within acceptable limit.
/** The 'tolerance' value inside the test specifies the limit. */
void TestSimpleDelay( int ntrial, double duration, double tolerance ) {
- double total_worktime = 0;
+ int error_count = 0;
+ double delta = 0;
// Iteration -1 warms up the code cache.
for( int trial=-1; trial<ntrial; ++trial ) {
- tbb::tick_count t0 = tbb::tick_count::now();
+ tbb::tick_count t = tbb::tick_count::now();
if( duration ) WaitForDuration(duration);
- tbb::tick_count t1 = tbb::tick_count::now();
- if( trial>=0 ) {
- total_worktime += (t1-t0).seconds();
+ delta = (tbb::tick_count::now() - t).seconds() - duration;
+ if( trial>=0 && delta > tolerance ) {
+ error_count++;
}
+ ASSERT(delta >= 0,"Delta is negative");
}
- // Compute average worktime and average delta
- double worktime = total_worktime/ntrial;
- double delta = worktime-duration;
- REMARK("worktime=%g delta=%g tolerance=%g\n", worktime, delta, tolerance);
-
- // Check that delta is acceptable
- if( delta<0 )
- REPORT("ERROR: delta=%g < 0\n",delta);
- if( delta>tolerance )
- REPORT("%s: delta=%g > %g=tolerance where duration=%g\n",delta>3*tolerance?"ERROR":"Warning",delta,tolerance,duration);
+ ASSERT(error_count < ntrial / 4, "The number of errors exceeded the threshold");
}
//------------------------------------------------------------------------
// During 5 seconds we are trying to get 10 successful trials.
} while ( ++num_trials < 10 && (tbb::tick_count::now() - start_time).seconds() < 5 );
REMARK( "Difference test time: %g sec\n", (tbb::tick_count::now() - start_time).seconds() );
- ASSERT( num_trials == 10, "The machine seems to be heavily oversubscibed, difference test was skipped." );
+ // TODO: Find the cause of the machine high load, fix it and upgrade ASSERT_WARNING to ASSERT
+ ASSERT_WARNING( num_trials == 10, "The machine seems to be heavily oversubscibed, difference test was skipped." );
delete[] tick_count_array;
}
REMARK( "tolerance_multiplier = %g \n", tolerance_multiplier );
tbb::tick_count t0 = tbb::tick_count::now();
- TestSimpleDelay(/*ntrial=*/1000000,/*duration=*/0, /*tolerance=*/2E-6 * tolerance_multiplier);
+ TestSimpleDelay(/*ntrial=*/1000000,/*duration=*/0, /*tolerance=*/6E-6 * tolerance_multiplier);
tbb::tick_count t1 = tbb::tick_count::now();
- TestSimpleDelay(/*ntrial=*/1000, /*duration=*/0.001,/*tolerance=*/5E-6 * tolerance_multiplier);
+ TestSimpleDelay(/*ntrial=*/1000, /*duration=*/0.001,/*tolerance=*/15E-6 * tolerance_multiplier);
tbb::tick_count t2 = tbb::tick_count::now();
TestArithmetic(t0,t1,t2);
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// tbb::flow::tuple (implementation used in tbb::flow)
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
#if __TBB_CPF_BUILD
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
-
-
-
*/
// Test that __TBB_Yield works.