Skip to content

Commit 4c73c3b

Browse files
committed
Committing Intel(R) TBB 2018 Update 2 source code
1 parent e8b3e24 commit 4c73c3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2856
-522
lines changed

CHANGES

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22
The list of most significant changes made over time in
33
Intel(R) Threading Building Blocks (Intel(R) TBB).
44

5+
Intel TBB 2018 Update 2
6+
TBB_INTERFACE_VERSION == 10002
7+
8+
Changes (w.r.t. Intel TBB 2018 Update 1):
9+
10+
- Added support for Android* NDK r16, macOS* 10.13, Fedora* 26.
11+
- Binaries for Universal Windows Driver (vc14_uwd) now link with static
12+
Microsoft* runtime libraries, and are only available in commercial
13+
releases.
14+
- Extended flow graph documentation with more code samples.
15+
16+
Preview Features:
17+
18+
- Added a Python* module for multi-processing computations in numeric
19+
Python* libraries.
20+
21+
Bugs fixed:
22+
23+
- Fixed constructors of concurrent_hash_map to be exception-safe.
24+
- Fixed auto-initialization in the main thread to be cleaned up at
25+
shutdown.
26+
- Fixed a crash when tbbmalloc_proxy is used together with dbghelp.
27+
- Fixed static_partitioner to assign tasks properly in case of nested
28+
parallelism.
29+
30+
------------------------------------------------------------------------
531
Intel TBB 2018 Update 1
632
TBB_INTERFACE_VERSION == 10001
733

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ rml: mkdir
5050
$(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.rml cfg=debug
5151
$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.rml cfg=release
5252

53-
5453
examples: tbb tbbmalloc
5554
$(MAKE) -C examples -r -f Makefile tbb_root=.. release test
5655

57-
python: mkdir
58-
$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbb cfg=release
59-
bash -c ". $(work_dir)_release$(SLASH)tbbvars.sh && $(MAKE) -rC '$(full_tbb_root)/python' CXX=$(compiler) install test-install"
56+
python: tbb
57+
$(MAKE) -C "$(work_dir)_release" -rf $(tbb_root)/python/Makefile install
6058

6159
.PHONY: clean clean_examples mkdir info
6260

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Intel(R) Threading Building Blocks 2018 Update 1
2-
[![Stable release](https://img.shields.io/badge/version-2018_U1-green.svg)](https://github.com/01org/tbb/releases/tag/2018_U1)
1+
# Intel(R) Threading Building Blocks 2018 Update 2
2+
[![Stable release](https://img.shields.io/badge/version-2018_U2-green.svg)](https://github.com/01org/tbb/releases/tag/2018_U2)
33
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
44

55
Intel(R) Threading Building Blocks (Intel(R) TBB) lets you easily write parallel C++ programs that take

build/android.clang.inc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,20 @@ ifeq (0, $(dynamic_load))
6868
endif
6969

7070
# Paths to the NDK prebuilt tools and libraries
71-
CPLUS_FLAGS += --sysroot=$(SYSROOT)
71+
ifneq (,$(findstring $(ndk_version),r16 r16b))
72+
# Since Android* NDK r16 another sysroot and isystem paths have to be specified
73+
CPLUS_FLAGS += --sysroot=$(NDK_ROOT)/sysroot -isystem $(NDK_ROOT)/sysroot/usr/include/$(TRIPLE)
74+
# Android* version flag required since r16
75+
CPLUS_FLAGS += -D__ANDROID_API__=$(API_LEVEL)
76+
else
77+
CPLUS_FLAGS += --sysroot=$(SYSROOT)
78+
endif
79+
80+
# Library sysroot flag
7281
LIB_LINK_FLAGS += --sysroot=$(SYSROOT)
82+
# Flag for test executables
83+
LINK_FLAGS += --sysroot=$(SYSROOT)
84+
7385
LIBS = -L$(CPLUS_LIB_PATH) -lc++_shared
7486
ifeq (,$(findstring $(ndk_version),$(foreach v, 7 8 9 10 11,r$(v) r$(v)b r$(v)c r$(v)d r$(v)e)))
7587
LIBS += -lc++abi

build/build.py

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright (c) 2017 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
#
18+
#
19+
#
20+
21+
# Provides unified tool for preparing TBB for packaging
22+
23+
from __future__ import print_function
24+
import os
25+
import re
26+
import sys
27+
import shutil
28+
import platform
29+
import argparse
30+
from glob import glob
31+
from collections import OrderedDict
32+
33+
jp = os.path.join
34+
is_win = (platform.system() == 'Windows')
35+
is_lin = (platform.system() == 'Linux')
36+
is_mac = (platform.system() == 'Darwin')
37+
38+
default_prefix = os.getenv('PREFIX', 'install_prefix')
39+
if is_win:
40+
default_prefix = jp(default_prefix, 'Library') # conda-specific by default on Windows
41+
42+
parser = argparse.ArgumentParser()
43+
parser.add_argument('--tbbroot', default='.', help='Take Intel TBB from here')
44+
parser.add_argument('--prefix', default=default_prefix, help='Prefix')
45+
parser.add_argument('--no-rebuild', default=False, action='store_true', help='do not rebuild')
46+
parser.add_argument('--install', default=False, action='store_true', help='install all')
47+
parser.add_argument('--install-libs', default=False, action='store_true', help='install libs')
48+
parser.add_argument('--install-devel', default=False, action='store_true', help='install devel')
49+
parser.add_argument('--install-docs', default=False, action='store_true', help='install docs')
50+
parser.add_argument('--install-python',default=False, action='store_true', help='install python module')
51+
parser.add_argument('--make-tool', default='make', help='Use different make command instead')
52+
parser.add_argument('--copy-tool', default=None, help='Use this command for copying ($ tool file dest-dir)')
53+
parser.add_argument('--build-args', default="", help='specify extra build args')
54+
parser.add_argument('--build-prefix', default='local', help='build dir prefix')
55+
if is_win:
56+
parser.add_argument('--msbuild', default=False, action='store_true', help='Use msbuild')
57+
parser.add_argument('--vs', default="2012", help='select VS version for build')
58+
parser.add_argument('--vs-platform', default="x64", help='select VS platform for build')
59+
parser.add_argument('ignore', nargs='?', help="workaround conda-build issue #2512")
60+
61+
args = parser.parse_args()
62+
63+
if args.install:
64+
args.install_libs = True
65+
args.install_devel = True
66+
args.install_docs = True
67+
args.install_python= True
68+
69+
def custom_cp(src, dst):
70+
assert os.system(' '.join([args.copy_tool, src, dst])) == 0
71+
72+
if args.copy_tool:
73+
install_cp = custom_cp # e.g. to use install -p -D -m 755 on Linux
74+
else:
75+
install_cp = shutil.copy
76+
77+
bin_dir = jp(args.prefix, "bin")
78+
lib_dir = jp(args.prefix, "lib")
79+
inc_dir = jp(args.prefix, 'include')
80+
doc_dir = jp(args.prefix, 'share', 'doc', 'tbb')
81+
if is_win:
82+
os.environ["OS"] = "Windows_NT" # make sure TBB will interpret it corretly
83+
libext = '.dll'
84+
libpref = ''
85+
dll_dir = bin_dir
86+
else:
87+
libext = '.dylib' if is_mac else '.so.2'
88+
libpref = 'lib'
89+
dll_dir = lib_dir
90+
91+
tbb_names = ["tbb", "tbbmalloc", "tbbmalloc_proxy"]
92+
93+
##############################################################
94+
95+
os.chdir(args.tbbroot)
96+
if is_win and args.msbuild:
97+
preview_release_dir = release_dir = jp(args.tbbroot, 'build', 'vs'+args.vs, args.vs_platform, 'Release')
98+
if not args.no_rebuild or not os.path.isdir(release_dir):
99+
assert os.system('msbuild /m /p:Platform=%s /p:Configuration=Release %s build/vs%s/makefile.sln'% \
100+
(args.vs_platform, args.build_args, args.vs)) == 0
101+
preview_debug_dir = debug_dir = jp(args.tbbroot, 'build', 'vs'+args.vs, args.vs_platform, 'Debug')
102+
if not args.no_rebuild or not os.path.isdir(debug_dir):
103+
assert os.system('msbuild /m /p:Platform=%s /p:Configuration=Debug %s build/vs%s/makefile.sln'% \
104+
(args.vs_platform, args.build_args, args.vs)) == 0
105+
else:
106+
release_dir = jp(args.tbbroot, 'build', args.build_prefix+'_release')
107+
debug_dir = jp(args.tbbroot, 'build', args.build_prefix+'_debug')
108+
if not args.no_rebuild or not (os.path.isdir(release_dir) and os.path.isdir(debug_dir)):
109+
assert os.system('%s -j tbb_build_prefix=%s %s'% \
110+
(args.make_tool, args.build_prefix, args.build_args)) == 0
111+
preview_release_dir = jp(args.tbbroot, 'build', args.build_prefix+'_preview_release')
112+
preview_debug_dir = jp(args.tbbroot, 'build', args.build_prefix+'_preview_debug')
113+
if not args.no_rebuild or not (os.path.isdir(preview_release_dir) and os.path.isdir(preview_debug_dir)):
114+
assert os.system('%s -j tbb_build_prefix=%s_preview %s tbb_cpf=1 tbb'% \
115+
(args.make_tool, args.build_prefix, args.build_args)) == 0
116+
117+
118+
filemap = OrderedDict()
119+
def append_files(files, dst):
120+
global filemap
121+
filemap.update(dict(zip(files, [dst]*len(files))))
122+
123+
if args.install_libs:
124+
files = [jp(release_dir, libpref+f+libext) for f in tbb_names]
125+
append_files(files, dll_dir)
126+
127+
if args.install_devel:
128+
dll_files = [jp(debug_dir, libpref+f+'_debug'+libext) for f in tbb_names] # adding debug libraries
129+
if not is_win or not args.msbuild:
130+
dll_files += [jp(preview_release_dir, libpref+"tbb_preview"+libext),
131+
jp(preview_debug_dir, libpref+"tbb_preview_debug"+libext)]
132+
if is_win:
133+
dll_files += sum( [glob(jp(d, 'tbb*.pdb')) for d in # copying debug info
134+
(release_dir, debug_dir, preview_release_dir, preview_debug_dir)], [])
135+
if is_lin:
136+
dll_files += sum( [glob(jp(d, 'libtbb*.so')) for d in # copying linker scripts
137+
(release_dir, debug_dir, preview_release_dir, preview_debug_dir)], [])
138+
# symlinks .so -> .so.2 should not be created instead
139+
# since linking with -ltbb when using links can result in
140+
# incorrect dependence upon unversioned .so files
141+
append_files(dll_files, dll_dir)
142+
if is_win:
143+
lib_files = sum([glob(jp(d,e)) for d in (release_dir, debug_dir) for e in ('*.lib', '*.def')], [])
144+
append_files(lib_files, lib_dir) # copying linker libs and defs
145+
for rootdir, dirnames, filenames in os.walk(jp(args.tbbroot,'include')):
146+
files = [jp(rootdir, f) for f in filenames if not '.html' in f]
147+
append_files(files, jp(inc_dir, rootdir.split('include')[1][1:]))
148+
149+
if args.install_python:
150+
assert os.system('%s -j tbb_build_prefix=%s %s python'% \
151+
(args.make_tool, args.build_prefix, args.build_args)) == 0
152+
if is_lin:
153+
append_files([jp(release_dir, 'libirml.so.1')], dll_dir)
154+
155+
if args.install_docs:
156+
files = [jp(args.tbbroot, *f) for f in (
157+
('CHANGES',),
158+
('LICENSE',),
159+
('README',),
160+
('README.md',),
161+
('doc','Release_Notes.txt'),
162+
)]
163+
append_files(files, doc_dir)
164+
165+
for f in filemap.keys():
166+
assert os.path.exists(f)
167+
assert os.path.isfile(f)
168+
169+
if filemap:
170+
print("Copying to prefix =", args.prefix)
171+
for f, dest in filemap.items():
172+
if not os.path.isdir(dest):
173+
os.makedirs(dest)
174+
print("+ %s to $prefix%s"%(f,dest.replace(args.prefix, '')))
175+
install_cp(f, dest)
176+
177+
print("done")

build/common_rules.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ ifeq ($(origin LIB_LINK_LIBS), undefined)
6363
LIB_LINK_LIBS = $(LIBDL) $(LIBS)
6464
endif
6565

66+
# Define C & C++ compilers according to platform defaults or CXX & CC environment variables
67+
ifneq (,$(findstring environment, $(origin CXX)))
68+
CPLUS = $(CXX)
69+
endif
6670
CONLY ?= $(CPLUS)
71+
ifneq (,$(findstring environment, $(origin CC)))
72+
CONLY = $(CC)
73+
endif
6774

6875
# The most generic rules
6976
#$(1) - is the target pattern

build/macos.clang.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ else
4444
CPLUS_FLAGS = -g -O0 -DTBB_USE_DEBUG
4545
endif
4646

47-
CPLUS_FLAGS += -DUSE_PTHREAD
47+
CPLUS_FLAGS += -DUSE_PTHREAD $(ITT_NOTIFY)
4848

4949
# For Clang, we add the option to support RTM intrinsics *iff* xtest is found in <immintrin.h>
5050
ifneq (,$(shell grep xtest `echo "\#include<immintrin.h>" | clang -E -M - 2>&1 | grep immintrin.h` 2>/dev/null))
@@ -57,12 +57,14 @@ ifneq (,$(stdlib))
5757
endif
5858

5959
ifeq (intel64,$(arch))
60+
ITT_NOTIFY = -DDO_ITT_NOTIFY
6061
CPLUS_FLAGS += -m64 $(RTM_KEY)
6162
LINK_FLAGS += -m64
6263
LIB_LINK_FLAGS += -m64
6364
endif
6465

6566
ifeq (ia32,$(arch))
67+
ITT_NOTIFY = -DDO_ITT_NOTIFY
6668
CPLUS_FLAGS += -m32 $(RTM_KEY)
6769
LINK_FLAGS += -m32
6870
LIB_LINK_FLAGS += -m32

build/macos.gcc.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ else
4444
CPLUS_FLAGS = -g -O0 -DTBB_USE_DEBUG
4545
endif
4646

47-
CPLUS_FLAGS += -DUSE_PTHREAD
47+
CPLUS_FLAGS += -DUSE_PTHREAD $(ITT_NOTIFY)
4848

4949
ifeq (intel64,$(arch))
50+
ITT_NOTIFY = -DDO_ITT_NOTIFY
5051
CPLUS_FLAGS += -m64
5152
LINK_FLAGS += -m64
5253
LIB_LINK_FLAGS += -m64
5354
endif
5455

5556
ifeq (ia32,$(arch))
57+
ITT_NOTIFY = -DDO_ITT_NOTIFY
5658
CPLUS_FLAGS += -m32
5759
LINK_FLAGS += -m32
5860
LIB_LINK_FLAGS += -m32

build/macos.icc.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ else
5858
CPLUS_FLAGS = -g -O0 -DTBB_USE_DEBUG
5959
endif
6060

61-
CPLUS_FLAGS += -DUSE_PTHREAD
61+
ITT_NOTIFY = -DDO_ITT_NOTIFY
62+
CPLUS_FLAGS += -DUSE_PTHREAD $(ITT_NOTIFY)
6263

6364
ifneq (,$(codecov))
6465
CPLUS_FLAGS += -prof-gen=srcpos

build/windows.cl.inc

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ else
4343
endif
4444
EH_FLAGS = $(if $(no_exceptions),/EHs-,/EHsc /GR)
4545

46+
# UWD binaries have to use static CRT linkage
47+
ifeq ($(target_app), uwd)
48+
MS_CRT_KEY = /MT$(if $(findstring debug,$(cfg)),d)
49+
endif
50+
4651
ifeq ($(cfg), release)
4752
CPLUS_FLAGS = $(MS_CRT_KEY) /O2 /Zi $(EH_FLAGS) /Zc:forScope /Zc:wchar_t /D__TBB_LIB_NAME=$(TBB.LIB)
4853
ASM_FLAGS =
@@ -54,17 +59,20 @@ endif
5459

5560
ZW_KEY = /ZW:nostdlib
5661

57-
ifneq (,$(filter win8ui,$(target_app) $(target_ui)))
58-
CPLUS_FLAGS += $(ZW_KEY) /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP"
62+
# These flags are general for Windows* universal applications
63+
ifneq (,$(target_app))
64+
CPLUS_FLAGS += $(ZW_KEY) /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP"
65+
endif
66+
67+
ifeq ($(target_app), win8ui)
5968
_WIN32_WINNT = 0x0602
60-
else ifneq (,$(filter uwp,$(target_app) $(target_ui)))
61-
CPLUS_FLAGS += $(ZW_KEY) /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP"
69+
else ifneq (,$(filter $(target_app),uwp uwd))
6270
_WIN32_WINNT = 0x0A00
6371
LIB_LINK_FLAGS += /NODEFAULTLIB:kernel32.lib OneCore.lib
6472
else
6573
CPLUS_FLAGS += /DDO_ITT_NOTIFY
6674
endif
67-
ifneq (,$(filter store,$(target_mode) $(target_ui_mode)))
75+
ifeq ($(target_mode), store)
6876
# it is necessary to source vcvars with 'store' argument in production
6977
LIB_LINK_FLAGS += /APPCONTAINER
7078
endif

0 commit comments

Comments
 (0)