Revert "Upgrade OneTBB in ./third-party to version 2021.12.0"

This reverts commit ddc63ba9b2 because it
broke macOS build.
This commit is contained in:
Rui Ueyama 2024-04-19 14:31:27 +09:00
parent fdc935718d
commit c65121a370
81 changed files with 324 additions and 934 deletions

View File

@ -1 +1 @@
7.0.0
6.0.0

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2024 Intel Corporation
# Copyright (c) 2021-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -25,8 +25,6 @@ on:
- synchronize
- reopened
permissions: read-all
env:
BUILD_CONCURRENCY: 2
MACOS_BUILD_CONCURRENCY: 3
@ -59,7 +57,7 @@ jobs:
needs: [codespell]
env:
BUILD_TYPE: oss
runs-on: [ubuntu-22.04]
runs-on: [ubuntu-20.04]
timeout-minutes: 10
steps:
- uses: actions/checkout@v2

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2024 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,15 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
# Enable CMake policies
if (POLICY CMP0068)
# RPATH settings do not affect install_name on macOS since CMake 3.9
cmake_policy(SET CMP0068 NEW)
endif()
if (POLICY CMP0091)
# The NEW behavior for this policy is to not place MSVC runtime library flags in the default
# CMAKE_<LANG>_FLAGS_<CONFIG> cache entries and use CMAKE_MSVC_RUNTIME_LIBRARY abstraction instead.
@ -43,6 +38,12 @@ if (APPLE)
endif()
endif()
# Until CMake 3.4.0 FindThreads.cmake requires C language enabled.
# Enable C language before CXX to avoid possible override of CMAKE_SIZEOF_VOID_P.
if (CMAKE_VERSION VERSION_LESS 3.4)
enable_language(C)
endif()
file(READ include/oneapi/tbb/version.h _tbb_version_info)
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_version_info}")
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_version_info}")
@ -103,10 +104,9 @@ option(TBBMALLOC_BUILD "Enable tbbmalloc build" ON)
cmake_dependent_option(TBBMALLOC_PROXY_BUILD "Enable tbbmalloc_proxy build" ON "TBBMALLOC_BUILD" OFF)
option(TBB_CPF "Enable preview features of the library" OFF)
option(TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF)
option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" ${CMAKE_CROSSCOMPILING})
option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" OFF)
option(TBB_ENABLE_IPO "Enable Interprocedural Optimization (IPO) during the compilation" ON)
option(TBB_FUZZ_TESTING "Enable fuzz testing" OFF)
option(TBB_INSTALL "Enable installation" ON)
if (NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
@ -194,7 +194,7 @@ endif()
# -------------------------------------------------------------------
# Common dependencies
#force -pthread during compilation for Emscripten
if (EMSCRIPTEN AND NOT EMSCRIPTEN_WITHOUT_PTHREAD)
if (EMSCRIPTEN)
set(THREADS_HAVE_PTHREAD_ARG TRUE)
endif()
@ -250,39 +250,34 @@ else()
else()
add_subdirectory(src/tbbbind)
endif()
if (TBB_INSTALL)
# -------------------------------------------------------------------
# Installation instructions
include(CMakePackageConfigHelpers)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT devel)
# -------------------------------------------------------------------
# Installation instructions
include(CMakePackageConfigHelpers)
install(EXPORT ${PROJECT_NAME}Targets
NAMESPACE TBB::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake)\n")
if (NOT BUILD_SHARED_LIBS)
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(CMakeFindDependencyMacro)\nfind_dependency(Threads)\n")
endif()
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT devel)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion)
install(EXPORT ${PROJECT_NAME}Targets
NAMESPACE TBB::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake)\n")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion)
install(FILES "README.md"
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT devel)
# -------------------------------------------------------------------
endif()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
install(FILES "README.md"
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT devel)
# -------------------------------------------------------------------
endif()
if (TBB_TEST)

View File

@ -29,6 +29,11 @@ The DCO is an attestation attached to every contribution made by every developer
As a contributor, youll want to be familiar with the oneTBB project and the repository layout. You should also know how to use it as explained in the [oneTBB documentation](https://oneapi-src.github.io/oneTBB/) and how to set up your build development environment to configure, build, and test oneTBB as explained in the [oneTBB Build System Description](cmake/README.md).
## Issues
If you face a problem, first check out open [oneTBB GitHub issues](https://github.com/oneapi-src/oneTBB/issues) to see if the issue youd like to address is already reported. You may find users that have encountered the bug youre finding or have similar ideas for changes or additions.
You can use issues to report a problem, make a feature request, or add comments on an existing issue.
## Pull Requests
You can find all [open oneTBB pull requests](https://github.com/oneapi-src/oneTBB/pulls) on GitHub.

View File

@ -61,7 +61,7 @@ You can use the ``install`` components for partial installation.
The following install components are supported:
- `runtime` - oneTBB runtime package (core shared libraries and `.dll` files on Windows* OS).
- `devel` - oneTBB development package (header files, CMake integration files, library symbolic links, and `.lib` files on Windows* OS).
- `tbb4py` - [oneTBB Module for Python](https://github.com/oneapi-src/oneTBB/blob/master/python/README.md).
- `tbb4py` - [oneTBB Module for Python](#onetbb-python-module-support).
If you want to install specific components after configuration and build, run:

View File

@ -1,24 +0,0 @@
# Copyright (c) 2021-2024 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.
# DISCLAIMER: Bazel support is community-based. The maintainers do not
# use Bazel internally. The Bazel build can have security risks or
# optimization gaps.
module(
name = "onetbb",
compatibility_level = 1,
)
bazel_dep(name = "platforms", version = "0.0.8")

View File

@ -23,8 +23,7 @@ oneTBB is a part of [oneAPI](https://oneapi.io). The current branch implements v
> **_NOTE:_** Threading Building Blocks (TBB) is now called oneAPI Threading Building Blocks (oneTBB) to highlight that the tool is a part of the oneAPI ecosystem.
## Release Information
See [Release Notes](RELEASE_NOTES.md) and [System Requirements](SYSTEM_REQUIREMENTS.md).
Here are [Release Notes](RELEASE_NOTES.md) and [System Requirements](SYSTEM_REQUIREMENTS.md).
## Documentation
* [oneTBB Specification](https://spec.oneapi.com/versions/latest/elements/oneTBB/source/nested-index.html)
@ -40,7 +39,7 @@ See [Release Notes](RELEASE_NOTES.md) and [System Requirements](SYSTEM_REQUIREME
See [Installation from Sources](INSTALL.md) to learn how to install oneTBB.
## Support
See our [documentation](./SUPPORT.md) to learn how to request help.
Please report issues and suggestions via [GitHub issues](https://github.com/oneapi-src/oneTBB/issues). See our [documentation](./CONTRIBUTING.md##Issues) to learn how to work with them.
## How to Contribute
We welcome community contributions, so check our [Contributing Guidelines](CONTRIBUTING.md)
@ -50,6 +49,7 @@ to learn more.
oneAPI Threading Building Blocks is licensed under [Apache License, Version 2.0](LICENSE.txt).
By its terms, contributions submitted to the project are also done under that license.
## Engineering team contacts
* [Email us.](mailto:inteltbbdevelopers@intel.com)

View File

@ -18,22 +18,26 @@
This document contains changes of oneTBB compared to the last release.
## Table of Contents <!-- omit in toc -->
- [New Features](#new-features)
- [Known Limitations](#known-limitations)
- [Fixed Issues](#fixed-issues)
## :tada: New Features
- Since C++17, parallel algorithms and Flow Graph nodes are allowed to accept pointers to the member functions and member objects as the user-provided callables.
- Added missed member functions, such as assignment operators and swap function, to the ``concurrent_queue`` and ``concurrent_bounded_queue`` containers.
## :rotating_light: Known Limitations
- The ``oneapi::tbb::info`` namespace interfaces might unexpectedly change the process affinity mask on Windows* OS systems (see https://github.com/open-mpi/hwloc/issues/366 for details) when using hwloc version lower than 2.5.
- Using a hwloc version other than 1.11, 2.0, or 2.5 may cause an undefined behavior on Windows OS. See https://github.com/open-mpi/hwloc/issues/477 for details.
- The NUMA topology may be detected incorrectly on Windows* OS machines where the number of NUMA node threads exceeds the size of 1 processor group.
- On Windows OS on ARM64*, when compiling an application using oneTBB with the Microsoft* Compiler, the compiler issues a warning C4324 that a structure was padded due to the alignment specifier. Consider suppressing the warning by specifying /wd4324 to the compiler command line.
- A static assert will cause compilation failures in oneTBB headers when compiling with clang 12.0.0 or newer if using the LLVM standard library with ``-ffreestanding`` and C++11/14 compiler options.
- An application using Parallel STL algorithms in libstdc++ versions 9 and 10 may fail to compile due to incompatible interface changes between earlier versions of Threading Building Blocks (TBB) and oneAPI Threading Building Blocks (oneTBB). Disable support for Parallel STL algorithms by defining ``PSTL_USE_PARALLEL_POLICIES`` (in libstdc++ 9) or ``_GLIBCXX_USE_TBB_PAR_BACKEND`` (in libstdc++ 10) macro to zero before inclusion of the first standard header file in each translation unit.
- On Linux* OS, if oneAPI Threading Building Blocks (oneTBB) or Threading Building Blocks (TBB) are installed in a system folder like ``/usr/lib64``, the application may fail to link due to the order in which the linker searches for libraries. Use the ``-L`` linker option to specify the correct location of oneTBB library. This issue does not affect the program execution.
- The ``oneapi::tbb::info`` namespace interfaces might unexpectedly change the process affinity mask on Windows* OS systems (see https://github.com/open-mpi/hwloc/issues/366 for details) when using hwloc* version lower than 2.5.
- Using a hwloc* version other than 1.11, 2.0, or 2.5 may cause an undefined behavior on Windows* OS. See https://github.com/open-mpi/hwloc/issues/477 for details.
- The NUMA* topology may be detected incorrectly on Windows* OS machines where the number of NUMA* node threads exceeds the size of 1 processor group.
- On Windows* OS on ARM64*, when compiling an application using oneTBB with the Microsoft* Compiler, the compiler issues a warning C4324 that a structure was padded due to the alignment specifier. Consider suppressing the warning by specifying ``/wd4324`` to the compiler command line.
- oneTBB does not support ``fork()``, to work-around the issue, consider using task_scheduler_handle to join oneTBB worker threads before using fork().
- C++ exception handling mechanism on Windows* OS on ARM64* might corrupt memory if an exception is thrown from any oneTBB parallel algorithm (see Windows* OS on ARM64* compiler issue: https://developercommunity.visualstudio.com/t/ARM64-incorrect-stack-unwinding-for-alig/1544293).
- Using ``TBBConfig.cmake`` in 32-bit environment may cause incorrect linkage with 64-bit oneTBB library. As a workaround, set ``CMAKE_PREFIX_PATH``:
- On Linux* OS: to ``TBBROOT/lib32/``
- On Windows* OS: to ``TBBROOT/lib32/;TBBROOT/bin32/``
> **_NOTE:_** To see known limitations that impact all versions of oneTBB, refer to [oneTBB Documentation](https://oneapi-src.github.io/oneTBB/main/intro/limitations.html).
## :hammer: Fixed Issues
- Fixed ``tbb::this_task_arena()`` behavior for specific ``tbb::task_arena{1,0}``.
- Restored performance on systems with a high number of CPU cores that support ``_tpause``.
- Fixed the hang in the reserve method of concurrent unordered containers ([GitHub* #1056](http://github.com/oneapi-src/oneTBB/issues/1056)).
- Fixed the C++20 three-way comparison feature detection ([GitHub* #1093](http://github.com/oneapi-src/oneTBB/issues/1093)).
- Fixed oneTBB integration with CMake* in the Conda* environment.

View File

@ -1,35 +0,0 @@
<!--
******************************************************************************
* 
* 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.
*******************************************************************************/-->
# oneTBB Support
We are committed to providing support and assistance to help you make the most out of oneTBB.
Use the following methods if you face any challenges.
## Issues
If you have a problem, check out the [GitHub Issues](https://github.com/oneapi-src/oneTBB/issues) to see if the issue you want to address is already reported.
You may find users that have encountered the same bug or have similar ideas for changes or updates.
You can use issues to report a problem, make a feature request, or add comments on an existing issue.
## Discussions
Visit the [GitHub Discussions](https://github.com/oneapi-src/oneTBB/discussions) to engage with the community, ask questions, or help others.
## Email
Reach out to us privately via [email](mailto:inteltbbdevelopers@intel.com).

View File

@ -16,45 +16,16 @@
# WASM Support
oneTBB extends its capabilities by offering robust support for ``WASM``.
``WASM`` stands for WebAssembly, a low-level binary format for executing code in web browsers.
It is designed to be a portable target for compilers and efficient to parse and execute.
It is designed to be a portable target for compilers and to be efficient to parse and execute.
Using oneTBB with WASM, you can take full advantage of parallelism and concurrency while working on web-based applications, interactive websites, and a variety of other WASM-compatible platforms.
WebAssembly aims to provide a fast, efficient, and safe way to run code in web browsers without needing plugins or other software. Code written in a variety of programming languages, including C, C++, Rust and others, can be compiled into WebAssembly format for use in web pages. This allows you to write high-performance applications that run directly in the browser.
oneTBB offers WASM support through the integration with [Emscripten*](https://emscripten.org/docs/introducing_emscripten/index.html), a powerful toolchain for compiling C and C++ code into WASM-compatible runtimes.
We currently have an [under development branch that provides you with WASM support](https://github.com/oneapi-src/oneTBB/tree/tbb_wasm).
## Build
**Prerequisites:** Download and install Emscripten*. See the [instructions](https://emscripten.org/docs/getting_started/downloads.html).
To build the system, run:
```
mkdir build && cd build
emcmake cmake .. -DCMAKE_CXX_COMPILER=em++ -DCMAKE_C_COMPILER=emcc -DTBB_STRICT=OFF -DCMAKE_CXX_FLAGS=-Wno-unused-command-line-argument -DTBB_DISABLE_HWLOC_AUTOMATIC_SEARCH=ON -DBUILD_SHARED_LIBS=ON -DTBB_EXAMPLES=ON -DTBB_TEST=ON
```
To compile oneTBB without ``pthreads``, set the flag ``-DEMSCRIPTEN_WITHOUT_PTHREAD=true`` in the command above. By default, oneTBB uses the ``pthreads``.
```
cmake --build . <options>
cmake --install . <options>
```
Where:
* ``emcmake`` - a tool that sets up the environment for Emscripten*.
* ``-DCMAKE_CXX_COMPILER=em++`` - specifies the C++ compiler as Emscripten* C++ compiler.
* ``-DCMAKE_C_COMPILER=emcc`` - specifies the C compiler as Emscripten* C compiler.
By using WASM, you can:
* Create highly performant and scalable applications that can meet the demands of modern web-based systems.
* Take advantage of oneTBB features to optimize the performance of your web-based applications.
> **_NOTE:_** See [CMake documentation](https://github.com/oneapi-src/oneTBB/blob/master/cmake/README.md) to learn about other options.
## Run Test
To run tests, use:
```
ctest
```

View File

@ -14,7 +14,6 @@ TBBMALLOC_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB)
TBBMALLOC_PROXY_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) memory allocator proxy build (requires TBBMALLOC_BUILD. ON by default)
TBB4PY_BUILD:BOOL - Enable Intel(R) oneAPI Threading Building Blocks (oneTBB) Python module build (OFF by default)
TBB_CPF:BOOL - Enable preview features of the library (OFF by default)
TBB_INSTALL:BOOL - Enable installation (ON by default)
TBB_INSTALL_VARS:BOOL - Enable auto-generated vars installation(packages generated by `cpack` and `make install` will also include the vars script)(OFF by default)
TBB_VALGRIND_MEMCHECK:BOOL - Enable scan for memory leaks using Valgrind (OFF by default)
TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH - Disable HWLOC automatic search by pkg-config tool (OFF by default)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2024 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -16,9 +16,7 @@ if (EMSCRIPTEN)
set(TBB_EMSCRIPTEN 1)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -fexceptions)
set(TBB_TEST_LINK_FLAGS ${TBB_COMMON_LINK_FLAGS} -fexceptions -sINITIAL_MEMORY=65536000 -sALLOW_MEMORY_GROWTH=1 -sEXIT_RUNTIME=1)
if (NOT EMSCRIPTEN_WITHOUT_PTHREAD)
set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "-pthread")
endif()
set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "-pthread")
endif()
if (MINGW)
@ -54,7 +52,7 @@ if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
endif()
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)" AND NOT EMSCRIPTEN)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)")
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},12.0>>:-mwaitpkg>)
endif()

View File

@ -71,8 +71,8 @@ endif ()
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -Wformat -Wformat-security -Werror=format-security
-fstack-protector-strong )
# -z switch is not supported on MacOS and MinGW
if (NOT APPLE AND NOT MINGW)
# -z switch is not supported on MacOS
if (NOT APPLE)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} -Wl,-z,relro,-z,now,-z,noexecstack)
endif()
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2> )

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -14,12 +14,10 @@
if (WIN32)
include(${CMAKE_CURRENT_LIST_DIR}/MSVC.cmake)
set(TBB_OPENMP_FLAG /Qopenmp)
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:/Qipo>)
set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:/INCREMENTAL:NO>)
else()
include(${CMAKE_CURRENT_LIST_DIR}/Clang.cmake)
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-ipo>)
set(TBB_OPENMP_FLAG -qopenmp)
endif()
set(TBB_IPO_LINK_FLAGS ${TBB_IPO_LINK_FLAGS} ${TBB_IPO_COMPILE_FLAGS})

View File

@ -33,7 +33,7 @@ if (MSVC_VERSION LESS_EQUAL 1900)
set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} /wd4503)
endif()
set(TBB_LIB_COMPILE_FLAGS -D_CRT_SECURE_NO_WARNINGS /GS)
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} /volatile:iso /FS /EHsc)
set(TBB_COMMON_COMPILE_FLAGS /volatile:iso /FS /EHsc)
set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} /DYNAMICBASE /NXCOMPAT)

View File

@ -92,7 +92,6 @@ set(_tbbbind_bin_version ${tbb_gen_cfg_TBBBIND_BINARY_VERSION})
NAMES \${_tbb_component}\${_bin_version}.dll
PATHS \${_tbb_root}
PATH_SUFFIXES \"redist/\${_tbb_intel_arch}/\${_tbb_subdir}\" \"bin\${_tbb_arch_suffix}/\${_tbb_subdir}\" \"bin\${_tbb_arch_suffix}/\" \"bin\"
NO_DEFAULT_PATH
)
if (EXISTS \"\${_tbb_debug_lib}\")
@ -100,7 +99,6 @@ set(_tbbbind_bin_version ${tbb_gen_cfg_TBBBIND_BINARY_VERSION})
NAMES \${_tbb_component}\${_bin_version}_debug.dll
PATHS \${_tbb_root}
PATH_SUFFIXES \"redist/\${_tbb_intel_arch}/\${_tbb_subdir}\" \"bin\${_tbb_arch_suffix}/\${_tbb_subdir}\" \"bin\${_tbb_arch_suffix}/\" \"bin\"
NO_DEFAULT_PATH
)
endif()
")

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -46,6 +46,8 @@ endforeach()
unset(HWLOC_TARGET_NAME)
if (NOT HWLOC_TARGET_EXPLICITLY_DEFINED AND
# No hwloc auto detection for cross compilation
NOT CMAKE_CROSSCOMPILING AND
NOT TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH
)
find_package(PkgConfig QUIET)

View File

@ -65,7 +65,6 @@ foreach (_tbb_component ${TBB_FIND_COMPONENTS})
NAMES @TBB_LIB_PREFIX@${_tbb_component}${_bin_version}.@TBB_LIB_EXT@
PATHS ${_tbb_root}
PATH_SUFFIXES "@TBB_LIB_REL_PATH@/${_tbb_intel_arch}/${_tbb_subdir}" "@TBB_LIB_REL_PATH@${_tbb_arch_suffix}/${_tbb_subdir}" "@TBB_LIB_REL_PATH@${_tbb_arch_suffix}" "@TBB_LIB_REL_PATH@"
NO_DEFAULT_PATH
)
if (NOT TBB_FIND_RELEASE_ONLY)
@ -73,7 +72,6 @@ foreach (_tbb_component ${TBB_FIND_COMPONENTS})
NAMES @TBB_LIB_PREFIX@${_tbb_component}${_bin_version}_debug.@TBB_LIB_EXT@
PATHS ${_tbb_root}
PATH_SUFFIXES "@TBB_LIB_REL_PATH@/${_tbb_intel_arch}/${_tbb_subdir}" "@TBB_LIB_REL_PATH@${_tbb_arch_suffix}/${_tbb_subdir}" "@TBB_LIB_REL_PATH@${_tbb_arch_suffix}" "@TBB_LIB_REL_PATH@"
NO_DEFAULT_PATH
)
endif()

View File

@ -23,33 +23,31 @@ macro(tbb_remove_compile_flag flag)
endmacro()
macro(tbb_install_target target)
if (TBB_INSTALL)
install(TARGETS ${target}
EXPORT TBBTargets
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_SKIP
COMPONENT runtime
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT runtime
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT devel)
if (BUILD_SHARED_LIBS)
install(TARGETS ${target}
EXPORT TBBTargets
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_SKIP
COMPONENT runtime
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT runtime
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_ONLY
COMPONENT devel)
if (BUILD_SHARED_LIBS)
install(TARGETS ${target}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
NAMELINK_ONLY
COMPONENT devel)
endif()
if (MSVC AND BUILD_SHARED_LIBS)
install(FILES $<TARGET_PDB_FILE:${target}>
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT devel
OPTIONAL)
endif()
endif()
if (MSVC AND BUILD_SHARED_LIBS)
install(FILES $<TARGET_PDB_FILE:${target}>
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT devel
OPTIONAL)
endif()
endmacro()

View File

@ -137,14 +137,10 @@ else:
'use_issues_button': True,
'use_edit_page_button': True,
'repository_branch': 'master',
'extra_footer': '<p align="right"><a href="https://www.intel.com/content/www/us/en/privacy/intel-cookie-notice.html">Cookies</a></p>'
}
if BUILD_TYPE != 'oneapi' and BUILD_TYPE != 'dita':
html_theme_options = {
"extra_footer": "<div><a href='https://www.intel.com/content/www/us/en/privacy/intel-cookie-notice.html' data-cookie-notice='true'>Cookies</a> <a href='https://www.intel.com/content/www/us/en/privacy/intel-privacy-notice.html'>| Privacy</a> <a data-wap_ref='dns' id='wap_dns' href='https://www.intel.com/content/www/us/en/privacy/intel-cookie- notice.html'>| Do Not Share My Personal Information</a> </div><div>&copy; Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others. No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document, with the sole exception that code included in this document is licensed subject to the Zero-Clause BSD open source license (OBSD), <a href='http://opensource.org/licenses/0BSD'>http://opensource.org/licenses/0BSD</a>. </div><br><div>oneTBB is licensed under Apache License Version 2.0. Refer to the <a href='https://github.com/oneapi-src/oneTBB/blob/master/LICENSE.txt'>LICENSE </a> file for the full license text and copyright notice.</div>"
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".

View File

@ -20,7 +20,7 @@ it with any compiler supporting ISO C++. The library differs from
typical threading packages in the following ways:
- **oneTBB enables you to specify logical parallelism instead of
- **oneTBB enables you to specify logical paralleism instead of
threads**. Most threading packages require you to specify threads.
Programming directly in terms of threads can be tedious and lead to
inefficient programs, because threads are low-level, heavy constructs

View File

@ -63,7 +63,7 @@ messages and do not support ``try_get()`` or ``try_reserve()``.
broadcast_node<int> bn(g);
buffer_node<int> buf1(g);
buffer_node<int> buf2(g);
typedef join_node<tuple<int,int>, reserving> join_type;
typedef join_node<tuple<int,int> reserving> join_type;
join_type jn(g);
buffer_node<join_type::output_type> buf_out(g);
join_type::output_type tuple_out;
@ -71,9 +71,9 @@ messages and do not support ``try_get()`` or ``try_reserve()``.
// join_node predecessors are both reservable buffer_nodes
make_edge(buf1,input_port<0>(jn));
make_edge(bn,input_port<0>(jn)); // attach a broadcast_node
make_edge(buf2,input_port<1>(jn));
make_edge(buf1,input_port<0>jn));
make_edge(bn,input_port<0>jn)); // attach a broadcast_node
make_edge(buf2,input_port<1>jn));
make_edge(jn, buf_out);
bn.try_put(2);
buf1.try_put(3);
@ -81,7 +81,7 @@ messages and do not support ``try_get()`` or ``try_reserve()``.
buf2.try_put(7);
g.wait_for_all();
while (buf_out.try_get(tuple_out)) {
printf("join_node output == (%d,%d)\n",get<0>(tuple_out), get<1>(tuple_out) );
printf("join_node output == (%d,%d)\n",get<0>tuple_out), get<1>tuple_out) );
}
if(buf1.try_get(icnt)) printf("buf1 had %d\n", icnt);
else printf("buf1 was empty\n");

View File

@ -46,4 +46,3 @@ TBB possible output:
TBB: RML private
TBB: Tools support disabled
.. note:: The ``tbbmalloc`` library in oneTBB is fully binary compatible with TBB.

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(tbb_examples CXX)
@ -66,7 +66,6 @@ tbb_add_example(parallel_for_each parallel_preorder)
tbb_add_example(parallel_pipeline square)
tbb_add_example(parallel_reduce convex_hull)
tbb_add_example(parallel_reduce pi)
tbb_add_example(parallel_reduce primes)
tbb_add_example(task_arena fractal)

View File

@ -19,7 +19,6 @@ This directory contains example usages of oneAPI Threading Building Blocks.
| parallel_for_each/parallel_preorder | Parallel preorder traversal of a graph.
| parallel_pipeline/square | Another string transformation example that squares numbers read from a file.
| parallel_reduce/convex_hull | Parallel version of convex hull algorithm (quick hull).
| parallel_reduce/pi | Parallel version of calculating &pi; by numerical integration.
| parallel_reduce/primes | Parallel version of the Sieve of Eratosthenes.
| task_arena/fractal |The example calculates two classical Mandelbrot fractals with different concurrency limits.
| task_group/sudoku | Compute all solutions for a Sudoku board.

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
set(EXAMPLES_UI_MODE "con" CACHE STRING "EXAMPLES_UI_MODE")

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(count_strings CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(shortpath CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(sub_string_finder_simple CXX)
project(sub_string_finder_extended CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(binpack CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(cholesky CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(dining_philosophers CXX)

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(fgbzip2 CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(logic_sim CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
include(../../common/cmake/common.cmake)
project(som CXX)

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(recursive_fibonacci CXX)
@ -33,7 +33,7 @@ set(EXECUTABLE "$<TARGET_FILE:recursive_fibonacci>")
# `N` - specifies the fibonacci number which would be calculated.
# `C` - cutoff that will be used to stop recursive split.
# `I` - number of iteration to measure benchmark time.
set(ARGS 30 16 20 1)
set(ARGS 30 16 20)
set(PERF_ARGS 50 5 20)
add_execution_target(run_recursive_fibonacci recursive_fibonacci ${EXECUTABLE} "${ARGS}")

View File

@ -9,15 +9,14 @@ cmake --build .
## Running the sample
### Predefined make targets
* `make run_recursive_fibonacci` - executes the example with predefined parameters (extended testing enabled).
* `make run_recursive_fibonacci` - executes the example with predefined parameters.
* `make perf_run_recursive_fibonacci` - executes the example with suggested parameters to measure the oneTBB performance.
### Application parameters
Usage:
```
recursive_fibonacci N C I T
recursive_fibonacci N C I
```
* `N` - specifies the fibonacci number which would be calculated.
* `C` - cutoff that will be used to stop recursive split.
* `I` - number of iteration to measure benchmark time.
* `T` - enables extended testing (recycle task in a loop).

View File

@ -22,7 +22,6 @@
#include <utility>
int cutoff;
bool testing_enabled;
template <typename F>
std::pair</* result */ unsigned long, /* time */ unsigned long> measure(F&& f,
@ -49,7 +48,6 @@ int main(int argc, char* argv[]) {
int numbers = argc > 1 ? strtol(argv[1], nullptr, 0) : 50;
cutoff = argc > 2 ? strtol(argv[2], nullptr, 0) : 16;
unsigned long ntrial = argc > 3 ? (unsigned long)strtoul(argv[3], nullptr, 0) : 20;
testing_enabled = argc > 4 ? (bool)strtol(argv[4], nullptr, 0) : false;
auto res = measure(fibonacci_two_tasks, numbers, ntrial);
std::cout << "Fibonacci two tasks impl N = " << res.first << " Avg time = " << res.second

View File

@ -24,7 +24,6 @@
#include <utility>
extern int cutoff;
extern bool testing_enabled;
long serial_fib_1(int n) {
return n < 2 ? n : serial_fib_1(n - 1) + serial_fib_1(n - 2);
@ -39,43 +38,39 @@ struct single_fib_task : task_emulation::base_task {
single_fib_task(int n, int* x) : n(n), x(x), s(state::compute)
{}
task_emulation::base_task* execute() override {
task_emulation::base_task* bypass = nullptr;
void execute() override {
switch (s) {
case state::compute : {
bypass = compute_impl();
compute_impl();
break;
}
case state::sum : {
*x = x_l + x_r;
if (testing_enabled) {
if (n == cutoff && num_recycles > 0) {
--num_recycles;
bypass = compute_impl();
}
}
break;
}
}
return bypass;
}
task_emulation::base_task* compute_impl() {
task_emulation::base_task* bypass = nullptr;
void compute_impl() {
if (n < cutoff) {
*x = serial_fib_1(n);
}
else {
bypass = this->allocate_child_and_increment<single_fib_task>(n - 2, &x_r);
auto bypass = this->allocate_child_and_increment<single_fib_task>(n - 2, &x_r);
task_emulation::run_task(this->allocate_child_and_increment<single_fib_task>(n - 1, &x_l));
// Recycling
this->s = state::sum;
this->recycle_as_continuation();
// Bypass is not supported by task_emulation and next_task executed directly.
// However, the old-TBB bypass behavior can be achieved with
// `return task_group::defer()` (check Migration Guide).
// Consider submit another task if recursion call is not acceptable
// i.e. instead of Direct Body call
// submit task_emulation::run_task(this->allocate_child_and_increment<single_fib_task>(n - 2, &x_r));
bypass->operator()();
}
return bypass;
}
@ -84,7 +79,6 @@ struct single_fib_task : task_emulation::base_task {
state s;
int x_l{ 0 }, x_r{ 0 };
int num_recycles{5};
};
int fibonacci_single_task(int n) {

View File

@ -33,9 +33,8 @@ long serial_fib(int n) {
struct fib_continuation : task_emulation::base_task {
fib_continuation(int& s) : sum(s) {}
task_emulation::base_task* execute() override {
void execute() override {
sum = x + y;
return nullptr;
}
int x{ 0 }, y{ 0 };
@ -45,8 +44,7 @@ struct fib_continuation : task_emulation::base_task {
struct fib_computation : task_emulation::base_task {
fib_computation(int n, int* x) : n(n), x(x) {}
task_emulation::base_task* execute() override {
task_emulation::base_task* bypass = nullptr;
void execute() override {
if (n < cutoff) {
*x = serial_fib(n);
}
@ -59,9 +57,15 @@ struct fib_computation : task_emulation::base_task {
this->recycle_as_child_of(c);
n = n - 2;
x = &c.y;
bypass = this;
// Bypass is not supported by task_emulation and next_task executed directly.
// However, the old-TBB bypass behavior can be achieved with
// `return task_group::defer()` (check Migration Guide).
// Consider submit another task if recursion call is not acceptable
// i.e. instead of Recycling + Direct Body call
// submit task_emulation::run_task(c.create_child<fib_computation>(n - 2, &c.y));
this->operator()();
}
return bypass;
}
int n;

View File

@ -47,45 +47,32 @@ class base_task {
public:
base_task() = default;
base_task(const base_task& t) : m_type(t.m_type), m_parent(t.m_parent), m_child_counter(t.m_child_counter.load())
base_task(const base_task& t) : m_parent(t.m_parent), m_child_counter(t.m_child_counter.load())
{}
virtual ~base_task() = default;
void operator() () const {
task_type type_snapshot = m_type;
base_task* bypass = const_cast<base_task*>(this)->execute();
if (m_parent && m_type != task_type::recycled) {
if (m_parent->remove_child_reference() == 0) {
base_task* parent_snapshot = m_parent;
const_cast<base_task*>(this)->execute();
if (m_parent && parent_snapshot == m_parent && m_child_counter == 0) {
if (m_parent->remove_reference() == 0) {
m_parent->operator()();
delete m_parent;
}
}
if (m_type == task_type::allocated) {
if (m_child_counter == 0 && m_type == task_type::allocated) {
delete this;
}
if (bypass != nullptr) {
m_type = type_snapshot;
// Bypass is not supported by task_emulation and next_task executed directly.
// However, the old-TBB bypass behavior can be achieved with
// `return task_group::defer()` (check Migration Guide).
// Consider submit another task if recursion call is not acceptable
// i.e. instead of Direct Body call
// submit task_emulation::run_task();
bypass->operator()();
}
}
virtual base_task* execute() = 0;
virtual void execute() = 0;
template <typename C, typename... Args>
C* allocate_continuation(std::uint64_t ref, Args&&... args) {
C* continuation = new C{std::forward<Args>(args)...};
continuation->m_type = task_type::allocated;
continuation->m_type = task_type::continuation;
continuation->reset_parent(reset_parent());
continuation->m_child_counter = ref;
return continuation;
@ -98,7 +85,7 @@ public:
template <typename F, typename... Args>
F create_child_and_increment(Args&&... args) {
add_child_reference();
add_reference();
return create_child_impl<F>(std::forward<Args>(args)...);
}
@ -109,36 +96,35 @@ public:
template <typename F, typename... Args>
F* allocate_child_and_increment(Args&&... args) {
add_child_reference();
add_reference();
return allocate_child_impl<F>(std::forward<Args>(args)...);
}
template <typename C>
void recycle_as_child_of(C& c) {
m_type = task_type::recycled;
reset_parent(&c);
}
void recycle_as_continuation() {
m_type = task_type::recycled;
m_type = task_type::continuation;
}
void add_child_reference() {
void add_reference() {
++m_child_counter;
}
std::uint64_t remove_child_reference() {
std::uint64_t remove_reference() {
return --m_child_counter;
}
protected:
enum class task_type {
stack_based,
created,
allocated,
recycled
continuation
};
mutable task_type m_type;
task_type m_type;
private:
template <typename F, typename... Args>
@ -150,7 +136,7 @@ private:
template <typename F, typename... Args>
F create_child_impl(Args&&... args) {
F obj{std::forward<Args>(args)...};
obj.m_type = task_type::stack_based;
obj.m_type = task_type::created;
obj.reset_parent(this);
return obj;
}
@ -176,14 +162,13 @@ private:
class root_task : public base_task {
public:
root_task(tbb::task_group& tg) : m_tg(tg), m_callback(m_tg.defer([] { /* Create empty callback to preserve reference for wait. */})) {
add_child_reference();
m_type = base_task::task_type::allocated;
add_reference();
m_type = base_task::task_type::continuation;
}
private:
base_task* execute() override {
void execute() override {
m_tg.run(std::move(m_callback));
return nullptr;
}
tbb::task_group& m_tg;
@ -193,7 +178,7 @@ private:
template <typename F, typename... Args>
F create_root_task(tbb::task_group& tg, Args&&... args) {
F obj{std::forward<Args>(args)...};
obj.m_type = base_task::task_type::stack_based;
obj.m_type = base_task::task_type::created;
obj.reset_parent(new root_task{tg});
return obj;
}

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(game_of_life CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(polygon_overlay CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(seismic CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(tachyon CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(parallel_preorder CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(square CXX)

View File

@ -4,5 +4,4 @@ Examples using `parallel_reduce` algorithm.
| Code sample name | Description
|:--- |:---
| convex_hull | Parallel version of convex hull algorithm (quick hull).
| pi | Parallel version of calculating &pi; by numerical integration.
| primes | Parallel version of the Sieve of Eratosthenes.

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(convex_hull_bench CXX)
project(convex_hull_sample CXX)

View File

@ -1,33 +0,0 @@
# Copyright (c) 2023 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.
cmake_minimum_required(VERSION 3.5)
project(pi CXX)
include(../../common/cmake/common.cmake)
set_common_project_settings(tbb)
add_executable(pi main.cpp pi.cpp)
target_link_libraries(pi TBB::tbb Threads::Threads)
target_compile_options(pi PRIVATE ${TBB_CXX_STD_FLAG})
set(EXECUTABLE "$<TARGET_FILE:pi>")
set(ARGS "")
set(PERF_ARGS auto 100000000000)
add_execution_target(run_pi pi ${EXECUTABLE} "${ARGS}")
add_execution_target(perf_run_pi pi ${EXECUTABLE} "${PERF_ARGS}")

View File

@ -1,24 +0,0 @@
# Pi Sample
Parallel version of calculating &pi; by numerical integration.
## Build
To build the sample, run the following commands:
```
cmake <path_to_example>
cmake --build .
```
## Run
### Predefined Make Targets
* `make run_pi` - executes the example with predefined parameters
* `make perf_run_pi` - executes the example with suggested parameters to measure the oneTBB performance
### Application Parameters
You can use the following application parameters:
```
pi [n-of-threads=value] [n-of-intervals=value] [silent] [-h] [n-of-threads [n-of-intervals]]
```
* `-h` - prints the help for command-line options.
* `n-of-threads` - the number of threads to use. This number is specified in the low\[:high\] range format, where both ``low`` and, optionally, ``high`` are non-negative integers. You can also use ``auto`` to let the system choose a default number of threads suitable for the platform.
* `n-of-intervals` - the number of intervals to subdivide into. Must be a positive integer.
* `silent` - no output except the elapsed time.

View File

@ -1,51 +0,0 @@
/*
Copyright (c) 2023 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_examples_pi_H
#define TBB_examples_pi_H
#include <cstdlib>
typedef std::size_t number_t;
typedef double pi_t;
extern const number_t chunk_size;
extern number_t num_intervals;
extern pi_t step;
extern bool silent;
inline pi_t pi_kernel(number_t i) {
pi_t dx = (pi_t(i) + pi_t(0.5)) * step;
return pi_t(4.0) / (pi_t(1.0) + dx * dx);
}
inline double pi_slice_kernel(number_t slice, number_t slice_size = chunk_size) {
pi_t pi = pi_t(0.0);
for (number_t i = slice; i < slice + slice_size; ++i) {
pi += pi_kernel(i);
}
return pi;
}
struct threading {
threading(int p);
~threading();
};
double compute_pi_parallel();
#endif // TBB_examples_pi_H

View File

@ -1,100 +0,0 @@
/*
Copyright (c) 2023 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.
*/
#include "oneapi/tbb/tick_count.h"
#include "common/utility/get_default_num_threads.hpp"
#include "common/utility/utility.hpp"
#include "common.h"
const number_t chunk_size = 4096; // Multiple of 16, to fit float datatype to a vector register.
// number of intervals
number_t num_intervals = 1000000000;
pi_t step = pi_t(0.0);
bool silent = false;
double compute_pi_serial() {
double ret = 0;
step = pi_t(1.0) / num_intervals;
number_t tail = num_intervals % chunk_size;
number_t last = num_intervals - tail;
for (number_t slice = 0; slice < last; slice += chunk_size) {
ret += pi_slice_kernel(slice);
}
ret += pi_slice_kernel(last, tail);
ret *= step;
return ret;
}
int main(int argc, char* argv[]) {
try {
tbb::tick_count main_start_time = tbb::tick_count::now();
// zero number of threads means to run serial version
utility::thread_number_range threads(utility::get_default_num_threads, 0);
utility::parse_cli_arguments(
argc,
argv,
utility::cli_argument_pack()
//"-h" option for for displaying help is present implicitly
.positional_arg(threads, "n-of-threads", utility::thread_number_range_desc)
.positional_arg(num_intervals, "n-of-intervals", "number of intervals")
.arg(silent, "silent", "no output except time elapsed"));
for (int p = threads.first; p <= threads.last; p = threads.step(p)) {
pi_t pi;
double compute_time;
if (p == 0) {
//run a serial version
tbb::tick_count compute_start_time = tbb::tick_count::now();
pi = compute_pi_serial();
compute_time = (tbb::tick_count::now() - compute_start_time).seconds();
}
else {
//run a parallel version
threading tp(p);
tbb::tick_count compute_start_time = tbb::tick_count::now();
pi = compute_pi_parallel();
compute_time = (tbb::tick_count::now() - compute_start_time).seconds();
}
if (!silent) {
if (p == 0) {
std::cout << "Serial run:\tpi = " << pi << "\tcompute time = " << compute_time
<< " sec\n";
}
else {
std::cout << "Parallel run:\tpi = " << pi << "\tcompute time = " << compute_time
<< " sec\t on " << p << " threads\n";
}
}
}
utility::report_elapsed_time((tbb::tick_count::now() - main_start_time).seconds());
return 0;
}
catch (std::exception& e) {
std::cerr << "error occurred. error text is :\"" << e.what() << "\"\n";
return 1;
}
}

View File

@ -1,55 +0,0 @@
/*
Copyright (c) 2023 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.
*/
#include "common.h"
#include "oneapi/tbb/blocked_range.h"
#include "oneapi/tbb/global_control.h"
#include "oneapi/tbb/parallel_reduce.h"
struct reduce_body {
double my_pi;
reduce_body() : my_pi(0) {}
reduce_body(reduce_body& x, tbb::split) : my_pi(0) {}
void operator()(const tbb::blocked_range<number_t>& r) {
my_pi += pi_slice_kernel(r.begin(), r.size());
}
void join(const reduce_body& y) {
my_pi += y.my_pi;
}
};
double compute_pi_parallel() {
step = pi_t(1.0) / num_intervals;
double ret = 0.0;
reduce_body body;
tbb::parallel_reduce(tbb::blocked_range<number_t>(0, num_intervals), body);
ret = body.my_pi * step;
return ret;
}
static std::unique_ptr<tbb::global_control> gc;
threading::threading(int p) {
gc.reset(new tbb::global_control(tbb::global_control::max_allowed_parallelism, p));
}
threading::~threading() {
gc.reset();
}

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(primes CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(fractal CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020-2023 Intel Corporation
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(sudoku CXX)

View File

@ -1,4 +1,4 @@
# Copyright (c) 2019-2023 Intel Corporation
# Copyright (c) 2019-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.1)
project(fibonacci CXX)

View File

@ -921,7 +921,7 @@ private:
node_allocator_traits::deallocate(dummy_node_allocator, node, 1);
} else {
// GCC 11.1 issues a warning here that incorrect destructor might be called for dummy_nodes
#if (__TBB_GCC_VERSION >= 110100 && __TBB_GCC_VERSION < 140000 ) && !__clang__ && !__INTEL_COMPILER
#if (__TBB_GCC_VERSION >= 110100 && __TBB_GCC_VERSION < 130000 ) && !__clang__ && !__INTEL_COMPILER
volatile
#endif
value_node_ptr val_node = static_cast<value_node_ptr>(node);

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2005-2024 Intel Corporation
Copyright (c) 2005-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -36,15 +36,7 @@
#include "task.h" // for task::suspend_point
#if _WIN32 || _WIN64
#ifndef NOMINMAX
#define NOMINMAX
#define __TBB_DEFINED_NOMINMAX 1
#endif
#include <windows.h>
#if __TBB_DEFINED_NOMINMAX
#undef NOMINMAX
#undef __TBB_DEFINED_NOMINMAX
#endif
#else
#include <pthread.h>
#endif

View File

@ -407,34 +407,6 @@ public:
template<typename It>
using tag = typename std::iterator_traits<It>::iterator_category;
#if __TBB_CPP20_PRESENT
template <typename It>
struct move_iterator_dispatch_helper {
using type = It;
};
// Until C++23, std::move_iterator::iterator_concept always defines
// to std::input_iterator_tag and hence std::forward_iterator concept
// always evaluates to false, so std::move_iterator dispatch should be
// made according to the base iterator type.
template <typename It>
struct move_iterator_dispatch_helper<std::move_iterator<It>> {
using type = It;
};
template <typename It>
using iterator_tag_dispatch_impl =
std::conditional_t<std::random_access_iterator<It>,
std::random_access_iterator_tag,
std::conditional_t<std::forward_iterator<It>,
std::forward_iterator_tag,
std::input_iterator_tag>>;
template <typename It>
using iterator_tag_dispatch =
iterator_tag_dispatch_impl<typename move_iterator_dispatch_helper<It>::type>;
#else
template<typename It>
using iterator_tag_dispatch = typename
std::conditional<
@ -446,7 +418,6 @@ using iterator_tag_dispatch = typename
std::input_iterator_tag
>::type
>::type;
#endif // __TBB_CPP20_PRESENT
template <typename Body, typename Iterator, typename Item>
using feeder_is_required = tbb::detail::void_t<decltype(tbb::detail::invoke(std::declval<const Body>(),

View File

@ -29,22 +29,18 @@
// Product version
#define TBB_VERSION_MAJOR 2021
// Update version
#define TBB_VERSION_MINOR 12
#define TBB_VERSION_MINOR 11
// "Patch" version for custom releases
#define TBB_VERSION_PATCH 0
// Suffix string
#define __TBB_VERSION_SUFFIX ""
// Full official version string
#define TBB_VERSION_STRING \
__TBB_STRING(TBB_VERSION_MAJOR) "." \
__TBB_STRING(TBB_VERSION_MINOR) "." \
__TBB_STRING(TBB_VERSION_PATCH) \
__TBB_VERSION_SUFFIX
#define TBB_VERSION_STRING __TBB_STRING(TBB_VERSION_MAJOR) "." __TBB_STRING(TBB_VERSION_MINOR) __TBB_VERSION_SUFFIX
// OneAPI oneTBB specification version
#define ONETBB_SPEC_VERSION "1.0"
// Full interface version
#define TBB_INTERFACE_VERSION 12120
#define TBB_INTERFACE_VERSION 12110
// Major interface version
#define TBB_INTERFACE_VERSION_MAJOR (TBB_INTERFACE_VERSION/1000)
// Minor interface version
@ -55,37 +51,37 @@
#define __TBB_BINARY_VERSION 12
//! TBB_VERSION support
#ifndef TBB_ENDL
#define TBB_ENDL "\n"
#ifndef ENDL
#define ENDL "\n"
#endif
//TBB_REVAMP_TODO: consider enabling version_string.ver generation
//TBB_REVAMP_TODO: #include "version_string.ver"
#define __TBB_ONETBB_SPEC_VERSION(N) #N ": SPECIFICATION VERSION\t" ONETBB_SPEC_VERSION TBB_ENDL
#define __TBB_VERSION_NUMBER(N) #N ": VERSION\t\t" TBB_VERSION_STRING TBB_ENDL
#define __TBB_INTERFACE_VERSION_NUMBER(N) #N ": INTERFACE VERSION\t" __TBB_STRING(TBB_INTERFACE_VERSION) TBB_ENDL
#define __TBB_ONETBB_SPEC_VERSION(N) #N ": SPECIFICATION VERSION\t" ONETBB_SPEC_VERSION ENDL
#define __TBB_VERSION_NUMBER(N) #N ": VERSION\t\t" TBB_VERSION_STRING ENDL
#define __TBB_INTERFACE_VERSION_NUMBER(N) #N ": INTERFACE VERSION\t" __TBB_STRING(TBB_INTERFACE_VERSION) ENDL
#ifndef TBB_USE_DEBUG
#define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\tundefined" TBB_ENDL
#define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\tundefined" ENDL
#elif TBB_USE_DEBUG==0
#define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t0" TBB_ENDL
#define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t0" ENDL
#elif TBB_USE_DEBUG==1
#define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t1" TBB_ENDL
#define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t1" ENDL
#elif TBB_USE_DEBUG==2
#define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t2" TBB_ENDL
#define __TBB_VERSION_USE_DEBUG(N) #N ": TBB_USE_DEBUG\t2" ENDL
#else
#error Unexpected value for TBB_USE_DEBUG
#endif
#ifndef TBB_USE_ASSERT
#define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\tundefined" TBB_ENDL
#define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\tundefined" ENDL
#elif TBB_USE_ASSERT==0
#define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t0" TBB_ENDL
#define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t0" ENDL
#elif TBB_USE_ASSERT==1
#define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t1" TBB_ENDL
#define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t1" ENDL
#elif TBB_USE_ASSERT==2
#define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t2" TBB_ENDL
#define __TBB_VERSION_USE_ASSERT(N) #N ": TBB_USE_ASSERT\t2" ENDL
#else
#error Unexpected value for TBB_USE_ASSERT
#endif

View File

@ -66,4 +66,3 @@ prepend-path CPATH "$tbbroot/include"
prepend-path LIBRARY_PATH "$tbbroot/lib"
prepend-path LD_LIBRARY_PATH "$tbbroot/lib"
prepend-path CMAKE_PREFIX_PATH "$tbbroot"
prepend-path PKG_CONFIG_PATH "$tbbroot/lib/pkgconfig"

View File

@ -66,4 +66,3 @@ prepend-path CPATH "$tbbroot/include32:$tbbroot/include"
prepend-path LIBRARY_PATH "$tbbroot/lib32"
prepend-path LD_LIBRARY_PATH "$tbbroot/lib32"
prepend-path CMAKE_PREFIX_PATH "$tbbroot"
prepend-path PKG_CONFIG_PATH "$tbbroot/lib32/pkgconfig"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2019-2023 Intel Corporation
Copyright (c) 2019-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -19,7 +19,7 @@
<!-- include files -->
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\build\native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\lib\native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)' == 'Debug'">TBB_USE_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
@ -27,25 +27,25 @@
<!-- .lib files -->
<ItemDefinitionGroup Condition="$(Configuration.ToLower().Contains('release')) AND '$(Platform)' == 'Win32'">
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\build\native\win-x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\lib\native\win-x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>tbb12.lib;tbbmalloc.lib;tbbmalloc_proxy.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="$(Configuration.ToLower().Contains('release')) AND '$(Platform)' == 'x64'">
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\build\native\win-x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\lib\native\win-x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>tbb12.lib;tbbmalloc.lib;tbbmalloc_proxy.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="$(Configuration.ToLower().Contains('debug')) AND '$(Platform)' == 'Win32'">
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\build\native\win-x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\lib\native\win-x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>tbb12_debug.lib;tbbmalloc_debug.lib;tbbmalloc_proxy_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="$(Configuration.ToLower().Contains('debug')) AND '$(Platform)' == 'x64'">
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\build\native\win-x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\lib\native\win-x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>tbb12_debug.lib;tbbmalloc_debug.lib;tbbmalloc_proxy_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

View File

@ -128,59 +128,57 @@ target_link_libraries(tbb
tbb_install_target(tbb)
if (TBB_INSTALL)
if (MSVC)
# Create a copy of target linker file (tbb<ver>[_debug].lib) with legacy name (tbb[_debug].lib)
# to support previous user experience for linkage.
install(FILES
$<TARGET_LINKER_FILE:tbb>
DESTINATION lib
CONFIGURATIONS RelWithDebInfo Release MinSizeRel
RENAME tbb.lib
COMPONENT devel
)
if (MSVC)
# Create a copy of target linker file (tbb<ver>[_debug].lib) with legacy name (tbb[_debug].lib)
# to support previous user experience for linkage.
install(FILES
$<TARGET_LINKER_FILE:tbb>
DESTINATION lib
CONFIGURATIONS RelWithDebInfo Release MinSizeRel
RENAME tbb.lib
COMPONENT devel
)
install(FILES
$<TARGET_LINKER_FILE:tbb>
DESTINATION lib
CONFIGURATIONS Debug
RENAME tbb_debug.lib
COMPONENT devel
)
endif()
set(_tbb_pc_lib_name tbb)
if (WIN32)
set(_tbb_pc_lib_name ${_tbb_pc_lib_name}${TBB_BINARY_VERSION})
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(TBB_PC_NAME tbb)
else()
set(TBB_PC_NAME tbb32)
endif()
set(_prefix_for_pc_file "${CMAKE_INSTALL_PREFIX}")
if (IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(_libdir_for_pc_file "${CMAKE_INSTALL_LIBDIR}")
else()
set(_libdir_for_pc_file "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()
if (IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(_includedir_for_pc_file "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(_includedir_for_pc_file "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
configure_file(${PROJECT_SOURCE_DIR}/integration/pkg-config/tbb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${TBB_PC_NAME}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TBB_PC_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/
COMPONENT devel)
install(FILES
$<TARGET_LINKER_FILE:tbb>
DESTINATION lib
CONFIGURATIONS Debug
RENAME tbb_debug.lib
COMPONENT devel
)
endif()
set(_tbb_pc_lib_name tbb)
if (WIN32)
set(_tbb_pc_lib_name ${_tbb_pc_lib_name}${TBB_BINARY_VERSION})
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(TBB_PC_NAME tbb)
else()
set(TBB_PC_NAME tbb32)
endif()
set(_prefix_for_pc_file "${CMAKE_INSTALL_PREFIX}")
if (IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(_libdir_for_pc_file "${CMAKE_INSTALL_LIBDIR}")
else()
set(_libdir_for_pc_file "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()
if (IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(_includedir_for_pc_file "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(_includedir_for_pc_file "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
configure_file(${PROJECT_SOURCE_DIR}/integration/pkg-config/tbb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${TBB_PC_NAME}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TBB_PC_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/
COMPONENT devel)
if (COMMAND tbb_gen_vars)
tbb_gen_vars(tbb)
endif()

View File

@ -429,7 +429,8 @@ void arena::advertise_new_work() {
workers_delta = 1;
}
request_workers(mandatory_delta, workers_delta, /* wakeup_threads = */ true);
bool wakeup_workers = is_mandatory_needed || are_workers_needed;
request_workers(mandatory_delta, workers_delta, wakeup_workers);
}
}

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2005-2023 Intel Corporation
Copyright (c) 2005-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -290,17 +290,7 @@ public:
n = my_waitset.front();
if (n != end) {
my_waitset.remove(*n);
// GCC 12.x-13.x issues a warning here that to_wait_node(n)->my_is_in_list might have size 0, since n is
// a base_node pointer. (This cannot happen, because only wait_node pointers are added to my_waitset.)
#if (__TBB_GCC_VERSION >= 120100 && __TBB_GCC_VERSION < 140000 ) && !__clang__ && !__INTEL_COMPILER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
to_wait_node(n)->my_is_in_list.store(false, std::memory_order_relaxed);
#if (__TBB_GCC_VERSION >= 120100 && __TBB_GCC_VERSION < 140000 ) && !__clang__ && !__INTEL_COMPILER
#pragma GCC diagnostic pop
#endif
}
}

View File

@ -49,7 +49,6 @@ protected:
std::set<d1::global_control*, control_storage_comparator, tbb_allocator<d1::global_control*>> my_list{};
spin_mutex my_list_mutex{};
public:
virtual ~control_storage() = default;
virtual std::size_t default_value() const = 0;
virtual void apply_active(std::size_t new_active) {
my_active_value = new_active;

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2023-2024 Intel Corporation
Copyright (c) 2023 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -137,9 +137,11 @@ public:
// The permit has changed during the reading, so the callback will be invoked soon one more time and
// we can just skip this renegotiation iteration.
if (!new_permit.flags.stale) {
// If there is no other demand in TCM, the permit may still have granted concurrency but
// be in the deactivated state thus we enforce 0 allotment to preserve arena invariants.
delta = update_concurrency(new_permit.state != TCM_PERMIT_STATE_INACTIVE ? new_concurrency : 0);
__TBB_ASSERT(
new_permit.state != TCM_PERMIT_STATE_INACTIVE || new_concurrency == 0,
"TCM did not nullify resources while deactivating the permit"
);
delta = update_concurrency(new_concurrency);
}
}
if (delta) {

View File

@ -114,7 +114,6 @@ protected:
void sleep(std::uintptr_t uniq_tag, Pred wakeup_condition) {
my_arena.get_waiting_threads_monitor().wait<thread_control_monitor::thread_context>(wakeup_condition,
market_context{uniq_tag, &my_arena});
reset_wait();
}
};
@ -140,6 +139,7 @@ public:
auto wakeup_condition = [&] { return !my_arena.is_empty() || !my_wait_ctx.continue_execution(); };
sleep(std::uintptr_t(&my_wait_ctx), wakeup_condition);
my_backoff.reset_wait();
}
d1::wait_context* wait_ctx() {
@ -176,6 +176,11 @@ public:
auto wakeup_condition = [&] { return !my_arena.is_empty() || sp->m_is_owner_recalled.load(std::memory_order_relaxed); };
sleep(std::uintptr_t(sp), wakeup_condition);
my_backoff.reset_wait();
}
void reset_wait() {
my_backoff.reset_wait();
}
d1::wait_context* wait_ctx() {

View File

@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if (DEFINED CMAKE_SKIP_BUILD_RPATH)
set(CMAKE_SKIP_BUILD_RPATH_OLD_VALUE ${CMAKE_SKIP_BUILD_RPATH})
endif()
set(CMAKE_SKIP_BUILD_RPATH TRUE)
function(tbbbind_build TBBBIND_NAME REQUIRED_HWLOC_TARGET)
@ -103,3 +106,10 @@ else()
tbbbind_build(tbbbind_2_5 HWLOC::hwloc_2_5 )
endif()
if (DEFINED CMAKE_SKIP_BUILD_RPATH_OLD_VALUE)
set(CMAKE_SKIP_BUILD_RPATH ${CMAKE_SKIP_BUILD_RPATH_OLD_VALUE})
unset(CMAKE_SKIP_BUILD_RPATH_OLD_VALUE)
else()
unset(CMAKE_SKIP_BUILD_RPATH)
endif()

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2005-2023 Intel Corporation
Copyright (c) 2005-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -25,7 +25,7 @@
# define __ARCH_ipf 1
# elif defined(_M_IX86)||defined(__i386__) // the latter for MinGW support
# define __ARCH_x86_32 1
# elif defined(_M_ARM) || defined(_M_ARM64) || defined(__aarch64__) // the latter for MinGW support
# elif defined(_M_ARM) || defined(_M_ARM64)
# define __ARCH_other 1
# else
# error Unknown processor architecture for Windows

View File

@ -29,9 +29,6 @@ function(tbb_add_test)
add_executable(${_tbb_test_TARGET_NAME} ${_tbb_test_SUBDIR}/${_tbb_test_NAME}.cpp)
target_include_directories(${_tbb_test_TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR})
# cmake>=3.4 no longer adds flags to export symbols from executables (CMP0065)
set_property(TARGET ${_tbb_test_TARGET_NAME} PROPERTY ENABLE_EXPORTS TRUE)
target_compile_options(${_tbb_test_TARGET_NAME}
PRIVATE
${TBB_CXX_STD_FLAG}
@ -561,7 +558,7 @@ if (TARGET TBB::tbb)
target_include_directories(test_implicit_linkage_on_windows PRIVATE
$<TARGET_PROPERTY:TBB::tbb,INTERFACE_INCLUDE_DIRECTORIES>)
set_target_properties(test_implicit_linkage_on_windows PROPERTIES
LINK_OPTIONS LINKER:/LIBPATH:$<TARGET_LINKER_FILE_DIR:TBB::tbb>)
LINK_OPTIONS /LIBPATH:$<TARGET_LINKER_FILE_DIR:TBB::tbb>)
add_dependencies(test_implicit_linkage_on_windows TBB::tbb)
endif()
endif()

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2020-2023 Intel Corporation
Copyright (c) 2020-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -287,44 +287,27 @@ bool can_change_thread_priority() {
return false;
}
void increase_thread_priority() {
#if __unix__
class increased_priority_guard {
public:
increased_priority_guard() : m_backup(get_current_schedparam()) {
increase_thread_priority();
}
~increased_priority_guard() {
// restore priority on destruction
pthread_t this_thread = pthread_self();
int err = pthread_setschedparam(this_thread,
/*policy*/ m_backup.first, /*sched_param*/ &m_backup.second);
ASSERT(err == 0, nullptr);
}
private:
std::pair<int, sched_param> get_current_schedparam() {
pthread_t this_thread = pthread_self();
sched_param params;
int policy = 0;
int err = pthread_getschedparam(this_thread, &policy, &params);
ASSERT(err == 0, nullptr);
return std::make_pair(policy, params);
}
void increase_thread_priority() {
pthread_t this_thread = pthread_self();
sched_param params;
params.sched_priority = sched_get_priority_max(SCHED_FIFO);
ASSERT(params.sched_priority != -1, nullptr);
int err = pthread_setschedparam(this_thread, SCHED_FIFO, &params);
ASSERT(err == 0, "Can not change thread priority.");
}
std::pair<int, sched_param> m_backup;
};
#else
class increased_priority_guard{};
pthread_t this_thread = pthread_self();
sched_param params;
params.sched_priority = sched_get_priority_max(SCHED_FIFO);
ASSERT(params.sched_priority != -1, nullptr);
int err = pthread_setschedparam(this_thread, SCHED_FIFO, &params);
ASSERT(err == 0, "Can not change thread priority.");
#endif
}
void decrease_thread_priority() {
#if __unix__
pthread_t this_thread = pthread_self();
sched_param params;
params.sched_priority = sched_get_priority_min(SCHED_FIFO);
ASSERT(params.sched_priority != -1, nullptr);
int err = pthread_setschedparam(this_thread, SCHED_FIFO, &params);
ASSERT(err == 0, "Can not change thread priority.");
#endif
}
} // namespace utils

View File

@ -102,8 +102,10 @@ public:
void do_action_and_feed(oneapi::tbb::feeder<ForEachInvokeItem>& feeder) const {
CHECK_MESSAGE(change_vector.size() % 2 == 0, "incorrect test setup");
std::size_t shift = change_vector.size() / 2;
std::cout << "Process " << real_value << std::endl;
++change_vector[real_value];
if (real_value < shift) {
std::cout << "Add " << real_value + shift << std::endl;
feeder.add(ForEachInvokeItem(real_value + shift, change_vector));
}
}

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2020-2023 Intel Corporation
Copyright (c) 2020-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -75,7 +75,7 @@ public:
mValid = false;
pthread_attr_t attr;
// Limit the stack size not to consume all virtual memory on 32 bit platforms.
std::size_t stacksize = utils::max(std::size_t(128*1024), std::size_t(PTHREAD_STACK_MIN));
std::size_t stacksize = utils::max(128*1024, PTHREAD_STACK_MIN);
if (pthread_attr_init(&attr) == 0 && pthread_attr_setstacksize(&attr, stacksize) == 0) {
mValid = pthread_create(&mHandle, &attr, thread_routine, /* arg = */ nullptr) == 0;
}

View File

@ -15,7 +15,7 @@
*/
//! \file test_fuzzing.cpp
//! \brief Test the [internal] of environment variables
//! \brief Test the [fuzzing] of environment variables
#include <fuzzer/FuzzedDataProvider.h>

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2005-2023 Intel Corporation
Copyright (c) 2005-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -22,105 +22,6 @@
//! \file test_parallel_for_each.cpp
//! \brief Test for [algorithms.parallel_for_each]
#if __TBB_CPP20_PRESENT
// Fancy iterator type that models the C++20 iterator type
// that defines the real iterator category using iterator_concept type
// and iterator_category is always std::input_iterator_type
// Similar iterators are used by C++20 ranges (e.g. std::ranges::iota_view::iterator)
// parallel_for_each algorithm should detect such iterators with respect to iterator_concept value
template <typename T, typename Category>
struct cpp20_iterator {
static_assert(std::derived_from<Category, std::forward_iterator_tag>,
"cpp20_iterator should be of at least forward iterator category");
using iterator_concept = Category;
using iterator_category = std::input_iterator_tag;
using value_type = T;
using difference_type = std::ptrdiff_t;
cpp20_iterator() = default;
explicit cpp20_iterator(T* ptr) : my_ptr(ptr) {}
T& operator*() const { return *my_ptr; }
cpp20_iterator& operator++() {
++my_ptr;
return *this;
}
cpp20_iterator operator++(int) {
auto it = *this;
++*this;
return it;
}
cpp20_iterator& operator--()
requires std::derived_from<Category, std::bidirectional_iterator_tag>
{
--my_ptr;
return *this;
}
cpp20_iterator operator--(int)
requires std::derived_from<Category, std::bidirectional_iterator_tag>
{
auto it = *this;
--*this;
return it;
}
cpp20_iterator& operator+=(difference_type n)
requires std::derived_from<Category, std::random_access_iterator_tag>
{
my_ptr += n;
return *this;
}
cpp20_iterator& operator-=(difference_type n)
requires std::derived_from<Category, std::random_access_iterator_tag>
{
my_ptr -= n;
return *this;
}
T& operator[](difference_type n) const
requires std::derived_from<Category, std::random_access_iterator_tag>
{
return my_ptr[n];
}
friend bool operator==(const cpp20_iterator&, const cpp20_iterator&) = default;
friend auto operator<=>(const cpp20_iterator&, const cpp20_iterator&)
requires std::derived_from<Category, std::random_access_iterator_tag> = default;
friend cpp20_iterator operator+(cpp20_iterator i, difference_type n)
requires std::derived_from<Category, std::random_access_iterator_tag>
{
return cpp20_iterator(i.my_ptr + n);
}
friend cpp20_iterator operator+(difference_type n, cpp20_iterator i)
requires std::derived_from<Category, std::random_access_iterator_tag>
{
return i + n;
}
friend cpp20_iterator operator-(cpp20_iterator i, difference_type n)
requires std::derived_from<Category, std::random_access_iterator_tag>
{
return cpp20_iterator(i.my_ptr - n);
}
friend difference_type operator-(const cpp20_iterator& x, const cpp20_iterator& y) {
return x.my_ptr - y.my_ptr;
}
private:
T* my_ptr = nullptr;
}; // class cpp20_iterator
#endif // __TBB_CPP20_PRESENT
//! Test forward access iterator support
//! \brief \ref error_guessing \ref interface
TEST_CASE("Forward iterator support") {
@ -271,65 +172,3 @@ TEST_CASE("parallel_for_each constraints") {
}
#endif // __TBB_CPP20_CONCEPTS_PRESENT
#if __TBB_CPP20_PRESENT
struct no_copy_move {
no_copy_move() = default;
no_copy_move(const no_copy_move&) = delete;
no_copy_move(no_copy_move&&) = delete;
no_copy_move& operator=(const no_copy_move&) = delete;
no_copy_move& operator=(no_copy_move&&) = delete;
int item = 0;
};
template <typename Category>
void test_with_cpp20_iterator() {
constexpr std::size_t n = 1'000'000;
std::vector<no_copy_move> elements(n);
cpp20_iterator<no_copy_move, Category> begin(elements.data());
cpp20_iterator<no_copy_move, Category> end(elements.data() + n);
oneapi::tbb::parallel_for_each(begin, end, [](no_copy_move& element) {
element.item = 42;
});
for (std::size_t index = 0; index < n; ++index) {
CHECK(elements[index].item == 42);
}
}
//! \brief \ref error_guessing \ref regression
TEST_CASE("parallel_for_each with cpp20 iterator") {
// Test that parallel_for_each threats ignores iterator_category type
// if iterator_concept type is defined for iterator
// For input iterators parallel_for_each requires element to be
// copyable or movable so since cpp20_iterator is at least forward
// parallel_for_each should work with cpp20_iterator
// on non-copyable and non-movable type
// test cpp20_iterator implementation
using cpp20_forward_iterator = cpp20_iterator<int, std::forward_iterator_tag>;
using cpp20_bidirectional_iterator = cpp20_iterator<int, std::bidirectional_iterator_tag>;
using cpp20_random_access_iterator = cpp20_iterator<int, std::random_access_iterator_tag>;
static_assert(std::forward_iterator<cpp20_forward_iterator>);
static_assert(!std::bidirectional_iterator<cpp20_forward_iterator>);
static_assert(std::bidirectional_iterator<cpp20_bidirectional_iterator>);
static_assert(!std::random_access_iterator<cpp20_bidirectional_iterator>);
static_assert(std::random_access_iterator<cpp20_random_access_iterator>);
test_with_cpp20_iterator<std::forward_iterator_tag>();
test_with_cpp20_iterator<std::bidirectional_iterator_tag>();
test_with_cpp20_iterator<std::random_access_iterator_tag>();
}
#endif // __TBB_CPP20_PRESENT

View File

@ -771,8 +771,7 @@ TEST_CASE("Test with priority inversion") {
auto high_priority_thread_func = [&] {
// Increase external threads priority
utils::increased_priority_guard guard{};
utils::suppress_unused_warning(guard);
utils::increase_thread_priority();
// pin external threads
test_arena.execute([]{});
while (task_counter++ < critical_task_counter) {
@ -797,8 +796,7 @@ TEST_CASE("Test with priority inversion") {
high_priority_threads.emplace_back(high_priority_thread_func);
}
utils::increased_priority_guard guard{};
utils::suppress_unused_warning(guard);
utils::increase_thread_priority();
while (task_counter++ < critical_task_counter) {
submit(critical_task, test_arena, test_context, true);
std::this_thread::sleep_for(std::chrono::milliseconds(1));

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2005-2023 Intel Corporation
Copyright (c) 2005-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -30,10 +30,6 @@
#include "oneapi/tbb/detail/_config.h"
// There is no RLIMIT_AS on OpenBSD.
// Therefore, the tests for memory limit is unreasonable.
#if !__OpenBSD__
#define __TBB_NO_IMPLICIT_LINKAGE 1
#include "tbb/scalable_allocator.h"
@ -1095,4 +1091,3 @@ TEST_CASE("MAIN TEST") {
}
#endif /* __TBB_WIN8UI_SUPPORT */
#endif /* Enable test */