From 003b08693b749c8d1e01ec754244a3d67350b3c7 Mon Sep 17 00:00:00 2001 From: tbbdev Date: Thu, 2 May 2024 05:17:01 -0500 Subject: [PATCH] Commit oneTBB source code 2539ba6a --- .bazelversion | 2 +- .github/CODEOWNERS | 7 + .github/workflows/ci.yml | 37 +- .github/workflows/issue_labeler.yml | 4 +- .github/workflows/labeler.yml | 4 +- BUILD.bazel | 15 +- CMakeLists.txt | 5 +- MODULE.bazel | 2 +- RELEASE_NOTES.md | 15 +- SECURITY.md | 69 ++- WORKSPACE.bazel | 4 +- cmake/README.md | 1 + cmake/compilers/Clang.cmake | 4 +- cmake/compilers/GNU.cmake | 7 +- cmake/compilers/Intel.cmake | 8 +- cmake/compilers/MSVC.cmake | 4 +- cmake/utils.cmake | 8 +- cmake/vars_utils.cmake | 12 +- doc/Makefile | 2 +- .../tbb_userguide/concurrent_hash_map.rst | 6 +- doc/make.bat | 2 +- .../count_strings/count_strings.cpp | 4 +- examples/parallel_for/tachyon/CMakeLists.txt | 3 +- examples/parallel_for/tachyon/src/imageio.cpp | 5 +- include/oneapi/tbb/detail/_machine.h | 4 +- include/oneapi/tbb/parallel_for.h | 10 +- include/oneapi/tbb/parallel_reduce.h | 49 ++- include/oneapi/tbb/parallel_scan.h | 4 +- include/oneapi/tbb/version.h | 6 +- python/tbb/pool.py | 48 +- src/tbb/CMakeLists.txt | 12 +- src/tbb/arena.cpp | 25 +- src/tbb/arena.h | 6 +- src/tbb/dynamic_link.cpp | 5 +- src/tbb/global_control.cpp | 24 +- src/tbb/governor.cpp | 6 +- src/tbb/governor.h | 4 +- src/tbb/misc.cpp | 17 +- src/tbb/misc.h | 3 +- src/tbb/scheduler_common.h | 7 +- src/tbb/tbb.rc | 4 +- src/tbb/thread_dispatcher.cpp | 14 +- src/tbb/thread_dispatcher.h | 3 +- src/tbb/thread_dispatcher_client.h | 7 +- src/tbb/thread_request_serializer.cpp | 10 +- src/tbb/thread_request_serializer.h | 6 +- src/tbb/threading_control.cpp | 10 +- src/tbb/threading_control.h | 4 +- src/tbb/tools_api/ittnotify.h | 17 +- src/tbb/tools_api/ittnotify_config.h | 18 +- src/tbb/tools_api/ittnotify_static.c | 4 +- src/tbb/tools_api/legacy/ittnotify.h | 4 +- src/tbb/waiters.h | 20 +- src/tbbbind/tbb_bind.rc | 4 +- src/tbbmalloc/CMakeLists.txt | 14 +- src/tbbmalloc/frontend.cpp | 4 +- src/tbbmalloc/tbbmalloc.rc | 4 +- src/tbbmalloc/tbbmalloc_internal.h | 6 +- src/tbbmalloc_proxy/CMakeLists.txt | 12 +- src/tbbmalloc_proxy/tbbmalloc_proxy.rc | 4 +- test/CMakeLists.txt | 70 +-- test/common/utils_dynamic_libs.h | 19 +- .../conformance_blocked_rangeNd.cpp | 4 +- test/conformance/conformance_parallel_for.cpp | 4 +- .../conformance_parallel_reduce.cpp | 162 ++++++- test/tbb/test_collaborative_call_once.cpp | 7 +- test/tbb/test_eh_algorithms.cpp | 22 +- test/tbb/test_eh_flow_graph.cpp | 5 +- test/tbb/test_flow_graph_priorities.cpp | 5 +- test/tbb/test_global_control.cpp | 4 +- test/tbb/test_mutex.cpp | 9 +- test/tbb/test_resumable_tasks.cpp | 6 +- test/tbb/test_scheduler_mix.cpp | 27 +- test/tbbmalloc/test_malloc_whitebox.cpp | 6 +- third-party-programs.txt | 413 +++++------------- 75 files changed, 845 insertions(+), 547 deletions(-) create mode 100644 .github/CODEOWNERS diff --git a/.bazelversion b/.bazelversion index 66ce77b7ea..21c8c7b46b 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.0.0 +7.1.1 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..3180579750 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,7 @@ +# Lines starting with '#' are comments. +# Each line is a file pattern followed by one or more owners. + +# More details are here: https://help.github.com/articles/about-codeowners/ + +src/tbbmalloc @ldorau @lplewa @kfilipek +src/tbbmalloc_proxy @ldorau @lplewa @kfilipek diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d758aee050..a65de62241 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,10 @@ jobs: pages: if: ${{ github.ref == 'refs/heads/master' }} + permissions: + contents: write + pages: write + id-token: write runs-on: ubuntu-latest needs: [documentation] steps: @@ -142,7 +146,7 @@ jobs: ctest -R python_test --output-on-failure --timeout ${TEST_TIMEOUT} linux-testing: - name: ${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }} + name: ${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }}${{ matrix.cmake_static }} runs-on: ['${{ matrix.os }}'] timeout-minutes: 45 strategy: @@ -167,6 +171,13 @@ jobs: std: 20 build_type: debug preview: 'ON' + - os: ubuntu-22.04 + c_compiler: gcc-11 + cxx_compiler: g++-11 + std: 20 + build_type: release + preview: 'ON' + cmake_static: -DBUILD_SHARED_LIBS=OFF steps: - uses: actions/checkout@v2 - name: Run testing @@ -174,13 +185,13 @@ jobs: run: | set -x mkdir build && cd build - cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.cmake_static }} \ -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DTBB_CPF=${{ matrix.preview }} .. make VERBOSE=1 -j${BUILD_CONCURRENCY} ctest --timeout ${TEST_TIMEOUT} --output-on-failure macos-testing: - name: ${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }} + name: ${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }}${{ matrix.cmake_static }} runs-on: ['${{ matrix.os }}'] timeout-minutes: 45 strategy: @@ -193,6 +204,13 @@ jobs: std: 14 build_type: relwithdebinfo preview: 'ON' + - os: macos-13 + c_compiler: clang + cxx_compiler: clang++ + std: 20 + build_type: release + preview: 'ON' + cmake_static: -DBUILD_SHARED_LIBS=OFF steps: - uses: actions/checkout@v2 - name: Run testing @@ -200,7 +218,7 @@ jobs: run: | set -x mkdir build && cd build - cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.cmake_static }} \ -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DTBB_CPF=${{ matrix.preview }} .. make VERBOSE=1 -j${MACOS_BUILD_CONCURRENCY} ctest --timeout ${TEST_TIMEOUT} --output-on-failure @@ -221,6 +239,15 @@ jobs: build_type: relwithdebinfo preview: 'ON' job_name: windows_cl2019_cxx14_relwithdebinfo_preview=ON + - os: windows-2019 + generator: Visual Studio 16 2019 + c_compiler: cl + cxx_compiler: cl + std: 20 + build_type: release + preview: 'ON' + job_name: windows_cl2019_cxx20_release_preview=ON-DBUILD_SHARED_LIBS=OFF + cmake_static: -DBUILD_SHARED_LIBS=OFF - os: windows-2022 generator: Visual Studio 17 2022 c_compiler: cl @@ -235,7 +262,7 @@ jobs: run: | mkdir build cd build - cmake -G "${{ matrix.generator }}" -A x64 -DCMAKE_CXX_STANDARD=${{ matrix.std }} ` + cmake -G "${{ matrix.generator }}" -A x64 -DCMAKE_CXX_STANDARD=${{ matrix.std }} ${{ matrix.cmake_static }} ` -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} ` -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DTBB_CPF=${{ matrix.preview }} .. cmake --build . --config ${{ matrix.build_type }} -j -v diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.yml index 418d7baca1..80591aa974 100644 --- a/.github/workflows/issue_labeler.yml +++ b/.github/workflows/issue_labeler.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Intel Corporation +# Copyright (c) 2023-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. @@ -19,6 +19,8 @@ on: pull_request: types: [opened, edited] +permissions: read-all + jobs: triage: runs-on: ubuntu-latest diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 8dbb096247..36812ebd62 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Intel Corporation +# Copyright (c) 2023-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. @@ -15,6 +15,8 @@ name: "Pull Request Labeler" on: - pull_request_target +permissions: read-all + jobs: triage: permissions: diff --git a/BUILD.bazel b/BUILD.bazel index 3881d6843d..34f98eba10 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Intel Corporation +# 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. @@ -116,3 +116,16 @@ cc_library( ":tbbmalloc", ], ) + +cc_test( + name = "test_task", + srcs = [ + "test/tbb/test_task.cpp", + ] + glob([ + "test/common/*.h", + ]), + includes = ["test"], + deps = [ + ":tbb", + ], +) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32dcf1e2c4..19232a9920 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,9 @@ option(TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg 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(APPLE) +option(TBB_BUILD_APPLE_FRAMEWORKS "Build as Apple Frameworks" OFF) +endif() if (NOT DEFINED BUILD_SHARED_LIBS) set(BUILD_SHARED_LIBS ON) @@ -230,7 +233,7 @@ else() message(WARNING "TBB compiler settings not found ${TBB_COMPILER_SETTINGS_FILE}") endif() -if (TBB_FIND_PACKAGE OR TBB_DIR) +if (TBB_FIND_PACKAGE AND TBB_DIR) # Allow specifying external TBB to test with. # Do not add main targets and installation instructions in that case. message(STATUS "Using external TBB for testing") diff --git a/MODULE.bazel b/MODULE.bazel index 393dc0ac42..cc6698f0de 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -21,4 +21,4 @@ module( compatibility_level = 1, ) -bazel_dep(name = "platforms", version = "0.0.8") +bazel_dep(name = "platforms", version = "0.0.9") diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 24687d1ffd..c9b8e97135 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -26,14 +26,17 @@ This document contains changes of oneTBB compared to the last release. - 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. -- 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/`` +- 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. +- When CPU resource coordination is enabled, tasks from a lower-priority ``task_arena`` might be executed before tasks from a higher-priority ``task_arena``. > **_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 ``parallel_for_each`` algorithm behavior for iterators defining ``iterator_concept`` trait instead of ``iterator_category``. +- Fixed the redefinition issue for ``std::min`` and ``std::max`` on Windows* OS ([GitHub* #832](https://github.com/oneapi-src/oneTBB/issues/832)). +- Fixed the incorrect binary search order in ``TBBConfig.cmake``. +- Enabled the oneTBB library search using the pkg-config tool in Conda packages. + +## :octocat: Open-source Contributions Integrated +- Fixed the compiler warning for missing virtual destructor. Contributed by Elias Engelbert Plank (https://github.com/oneapi-src/oneTBB/pull/1215). diff --git a/SECURITY.md b/SECURITY.md index c4a49dd553..4926041fc2 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,7 +1,66 @@ # Security Policy -Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, -impact, severity and mitigation. +As an open-source project, we understand the importance of and responsibility +for security. This Security Policy outlines our guidelines and procedures to +ensure the highest level of security and trust for oneTBB users. -## Reporting a Vulnerability -Please report any security vulnerabilities in this project -[utilizing the guidelines here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html). +## Supported Versions +Security vulnerabilities are fixed in the [latest version][1] +and delivered as a patch release. We don't guarantee security fixes to be +back-ported to older oneTBB versions. + +## Report a Vulnerability +We are very grateful to the security researchers and users that report back +security vulnerabilities. We investigate every report thoroughly. +We strongly encourage you to report security vulnerabilities to us privately, +before disclosing them on public forums or opening a public GitHub* issue. + +Report a vulnerability to us in one of two ways: +* Open a draft **[GitHub* Security Advisory][2]** +* Send an e-mail to: **security@uxlfoundation.org**. +Along with the report, provide the following info: + * A descriptive title. + * Your name and affiliation (if any). + * A description of the technical details of the vulnerabilities. + * A minimal example of the vulnerability so we can reproduce your findings. + * An explanation of who can exploit this vulnerability, and what they gain + doing so. + * Whether this vulnerability is public or known to third parties. If it is, + provide details. + +### When Should I Report a Vulnerability? +* You think you discovered a potential security vulnerability in oneTBB. +* You are unsure how the potential vulnerability affects oneTBB. +* You think you discovered a vulnerability in another project or 3rd party +component on which oneTBB depends. If the issue is not fixed in the 3rd party +component, try to report directly there first. + +### When Should I NOT Report a Vulnerability? +* You got an automated scan hit and are unable to provide details. +* You need help using oneTBB for security. +* You need help applying security-related updates. +* Your issue is not security-related. + +## Security Reports Review Process +We aim to respond quickly to your inquiry and coordinate a fix and +disclosure with you. All confirmed security vulnerabilities will be addressed +according to severity level and impact on oneTBB. Normally, security issues +are fixed in the next planned release. + +## Disclosure Policy +We will publish security advisories using the +[**GitHub Security Advisories feature**][3] +to keep our community well-informed, and will credit you for your findings +unless you prefer to stay anonymous. We request that you refrain from +exploiting the vulnerability or making it public before the official disclosure. + +We will disclose the vulnerabilities and bugs as soon as possible once +mitigation is implemented and available. + +## Feedback on This Policy +If you have any suggestions on how this Policy could be improved, submit +an issue or a pull request to this repository. **Do not** report +potential vulnerabilities or security flaws via a pull request. + +[1]: https://github.com/oneapi-src/oneTBB/releases/latest +[2]: https://github.com/oneapi-src/oneTBB/security/advisories/new +[3]: https://github.com/oneapi-src/oneTBB/security/advisories diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 6431b29bc7..59ba39f706 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Intel Corporation +# 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. @@ -16,4 +16,4 @@ # use Bazel internally. The Bazel build can have security risks or # optimization gaps. -workspace(name = "oneTBB") +# WORKSPACE marker file needed by Bazel diff --git a/cmake/README.md b/cmake/README.md index 9a68f730f3..aa811b0fc0 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -19,6 +19,7 @@ TBB_INSTALL_VARS:BOOL - Enable auto-generated vars installation(packages generat 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) TBB_ENABLE_IPO - Enable Interprocedural Optimization (IPO) during the compilation (ON by default) +TBB_BUILD_APPLE_FRAMEWORKS - Enable the Apple* frameworks instead of dylibs, only available on the Apple platform. (OFF by default) ``` ## Configure, Build, and Test diff --git a/cmake/compilers/Clang.cmake b/cmake/compilers/Clang.cmake index e90629b8fe..f56b5fba0f 100644 --- a/cmake/compilers/Clang.cmake +++ b/cmake/compilers/Clang.cmake @@ -68,7 +68,9 @@ endif() set(TBB_COMMON_LINK_LIBS ${CMAKE_DL_LIBS}) -set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$>:-D_FORTIFY_SOURCE=2>) +if (NOT CMAKE_CXX_FLAGS MATCHES "_FORTIFY_SOURCE") + set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$>:-D_FORTIFY_SOURCE=2>) +endif () if (MINGW) list(APPEND TBB_COMMON_COMPILE_FLAGS -U__STRICT_ANSI__) diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake index 871b72a712..6fd8d9808d 100644 --- a/cmake/compilers/GNU.cmake +++ b/cmake/compilers/GNU.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Intel Corporation +# Copyright (c) 2020-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. @@ -75,8 +75,9 @@ set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -Wformat -Wformat-secur if (NOT APPLE AND NOT MINGW) 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} $<$>:-D_FORTIFY_SOURCE=2> ) - +if (NOT CMAKE_CXX_FLAGS MATCHES "_FORTIFY_SOURCE") + set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$>:-D_FORTIFY_SOURCE=2> ) +endif () # TBB malloc settings set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions) diff --git a/cmake/compilers/Intel.cmake b/cmake/compilers/Intel.cmake index 582f9a8473..531e078ec0 100644 --- a/cmake/compilers/Intel.cmake +++ b/cmake/compilers/Intel.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Intel Corporation +# Copyright (c) 2020-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. @@ -21,7 +21,11 @@ if (MSVC) elseif (APPLE) include(${CMAKE_CURRENT_LIST_DIR}/AppleClang.cmake) set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -fstack-protector -Wformat -Wformat-security - $<$>:-fno-omit-frame-pointer -qno-opt-report-embed -D_FORTIFY_SOURCE=2>) + $<$>:-fno-omit-frame-pointer -qno-opt-report-embed>) + if (NOT CMAKE_CXX_FLAGS MATCHES "_FORTIFY_SOURCE") + set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} $<$>:-D_FORTIFY_SOURCE=2>) + endif () + set(TBB_OPENMP_FLAG -qopenmp) set(TBB_IPO_COMPILE_FLAGS $<$>:-ipo>) else() diff --git a/cmake/compilers/MSVC.cmake b/cmake/compilers/MSVC.cmake index addb15ca46..6568ec7eb8 100644 --- a/cmake/compilers/MSVC.cmake +++ b/cmake/compilers/MSVC.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Intel Corporation +# Copyright (c) 2020-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. @@ -35,7 +35,7 @@ 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_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} /DYNAMICBASE /NXCOMPAT) +set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} /DEPENDENTLOADFLAG:0x2000 /DYNAMICBASE /NXCOMPAT) if (TBB_ARCH EQUAL 32) set(TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} /SAFESEH ) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 078a0c742b..211019896f 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Intel Corporation +# Copyright (c) 2020-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. @@ -35,7 +35,11 @@ macro(tbb_install_target target) COMPONENT runtime ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT devel) + COMPONENT devel + FRAMEWORK + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT runtime + OPTIONAL) if (BUILD_SHARED_LIBS) install(TARGETS ${target} diff --git a/cmake/vars_utils.cmake b/cmake/vars_utils.cmake index 989fea267c..54a9fda18b 100644 --- a/cmake/vars_utils.cmake +++ b/cmake/vars_utils.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021 Intel Corporation +# Copyright (c) 2020-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. @@ -26,12 +26,20 @@ get_filename_component(TBB_VARS_TEMPLATE_NAME ${PROJECT_SOURCE_DIR}/integration/ string(REPLACE ".in" "" TBB_VARS_NAME ${TBB_VARS_TEMPLATE_NAME}) macro(tbb_gen_vars target) + if (NOT TBB_BUILD_APPLE_FRAMEWORKS) + set(BIN_PATH $) + else() + # For Apple* frameworks, the binaries are placed in a framework bundle. + # When using an Apple* framework, you refer to the bundle, not the binary inside, so we take the bundle's path and go up one level. + # This path will then be used to generate the vars file, and the contents of the vars file will use the bundle's parent directory. + set(BIN_PATH $/..) + endif() if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -DBINARY_DIR=${CMAKE_BINARY_DIR} -DSOURCE_DIR=${PROJECT_SOURCE_DIR} - -DBIN_PATH=$ + -DBIN_PATH=${BIN_PATH} -DVARS_TEMPLATE=${TBB_VARS_TEMPLATE} -DVARS_NAME=${TBB_VARS_NAME} -DTBB_INSTALL_VARS=${TBB_INSTALL_VARS} diff --git a/doc/Makefile b/doc/Makefile index 3ac68fcfb6..95bfc7c8eb 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -21,7 +21,7 @@ # from the environment for the first two. SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build -SOURCEDIR = doc +SOURCEDIR = . BUILDDIR = build # Put it first so that "make" without argument is like "make help". diff --git a/doc/main/tbb_userguide/concurrent_hash_map.rst b/doc/main/tbb_userguide/concurrent_hash_map.rst index cd8482ffff..8d9ba3a1b7 100644 --- a/doc/main/tbb_userguide/concurrent_hash_map.rst +++ b/doc/main/tbb_userguide/concurrent_hash_map.rst @@ -30,14 +30,14 @@ string occurs in the array ``Data``. // Structure that defines hashing and comparison operations for user's type. struct MyHashCompare { - static size_t hash( const string& x ) { + size_t hash( const string& x ) const { size_t h = 0; for( const char* s = x.c_str(); *s; ++s ) h = (h*17)^*s; return h; } //! True if strings are equal - static bool equal( const string& x, const string& y ) { + bool equal( const string& x, const string& y ) const { return x==y; } }; @@ -128,4 +128,4 @@ any other extant accesses on ``key``. .. toctree:: :maxdepth: 4 - ../tbb_userguide/More_on_HashCompare \ No newline at end of file + ../tbb_userguide/More_on_HashCompare diff --git a/doc/make.bat b/doc/make.bat index 557ecc5b62..14d399a501 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -25,7 +25,7 @@ REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) -set SOURCEDIR=doc +set SOURCEDIR=. set BUILDDIR=build if "%1" == "" goto help diff --git a/examples/concurrent_hash_map/count_strings/count_strings.cpp b/examples/concurrent_hash_map/count_strings/count_strings.cpp index 2b563cd505..0a230846a0 100644 --- a/examples/concurrent_hash_map/count_strings/count_strings.cpp +++ b/examples/concurrent_hash_map/count_strings/count_strings.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-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. @@ -42,7 +42,7 @@ class hash> { (sizeof(std::size_t) == sizeof(unsigned)) ? 2654435769U : 11400714819323198485ULL); std::hash char_hash; -}; // strunt hash +}; // struct hash } // namespace std diff --git a/examples/parallel_for/tachyon/CMakeLists.txt b/examples/parallel_for/tachyon/CMakeLists.txt index 6cd4169bc0..752fddeff1 100644 --- a/examples/parallel_for/tachyon/CMakeLists.txt +++ b/examples/parallel_for/tachyon/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Intel Corporation +# Copyright (c) 2020-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. @@ -39,7 +39,6 @@ add_executable( src/imageio.cpp src/imap.cpp src/intersect.cpp - src/jpeg.cpp src/light.cpp src/objbound.cpp src/parse.cpp diff --git a/examples/parallel_for/tachyon/src/imageio.cpp b/examples/parallel_for/tachyon/src/imageio.cpp index 30c61d7f1a..c1c9d7620c 100644 --- a/examples/parallel_for/tachyon/src/imageio.cpp +++ b/examples/parallel_for/tachyon/src/imageio.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -59,7 +59,6 @@ #include "imageio.hpp" #include "ppm.hpp" /* PPM files */ #include "tgafile.hpp" /* Truevision Targa files */ -#include "jpeg.hpp" /* JPEG files */ static int fakeimage(char *name, int *xres, int *yres, unsigned char **imgdata) { int i, imgsize; @@ -90,7 +89,7 @@ int readimage(rawimage *img) { rc = readtga(name, &xres, &yres, &imgdata); } else if (strstr(name, ".jpg")) { - rc = readjpeg(name, &xres, &yres, &imgdata); + rc = IMAGEUNSUP; } else if (strstr(name, ".gif")) { rc = IMAGEUNSUP; diff --git a/include/oneapi/tbb/detail/_machine.h b/include/oneapi/tbb/detail/_machine.h index 7a4a1e31cb..ca481380c5 100644 --- a/include/oneapi/tbb/detail/_machine.h +++ b/include/oneapi/tbb/detail/_machine.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -96,7 +96,7 @@ static inline void machine_pause(int32_t delay) { #if __TBB_x86_64 || __TBB_x86_32 while (delay-- > 0) { _mm_pause(); } #elif __ARM_ARCH_7A__ || __aarch64__ - while (delay-- > 0) { __asm__ __volatile__("yield" ::: "memory"); } + while (delay-- > 0) { __asm__ __volatile__("isb sy" ::: "memory"); } #else /* Generic */ (void)delay; // suppress without including _template_helpers.h yield(); diff --git a/include/oneapi/tbb/parallel_for.h b/include/oneapi/tbb/parallel_for.h index 91c7c44c87..37a2613508 100644 --- a/include/oneapi/tbb/parallel_for.h +++ b/include/oneapi/tbb/parallel_for.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -319,7 +319,7 @@ void parallel_for_impl(Index first, Index last, Index step, const Function& f, P template __TBB_requires(parallel_for_index && parallel_for_function) void parallel_for(Index first, Index last, Index step, const Function& f) { - parallel_for_impl(first, last, step, f, auto_partitioner()); + parallel_for_impl(first, last, step, f, __TBB_DEFAULT_PARTITIONER()); } //! Parallel iteration over a range of integers with a step provided and simple partitioner template @@ -350,7 +350,7 @@ void parallel_for(Index first, Index last, Index step, const Function& f, affini template __TBB_requires(parallel_for_index && parallel_for_function) void parallel_for(Index first, Index last, const Function& f) { - parallel_for_impl(first, last, static_cast(1), f, auto_partitioner()); + parallel_for_impl(first, last, static_cast(1), f, __TBB_DEFAULT_PARTITIONER()); } //! Parallel iteration over a range of integers with a default step value and simple partitioner template @@ -395,7 +395,7 @@ void parallel_for_impl(Index first, Index last, Index step, const Function& f, P template __TBB_requires(parallel_for_index && parallel_for_function) void parallel_for(Index first, Index last, Index step, const Function& f, task_group_context &context) { - parallel_for_impl(first, last, step, f, auto_partitioner(), context); + parallel_for_impl(first, last, step, f, __TBB_DEFAULT_PARTITIONER(), context); } //! Parallel iteration over a range of integers with explicit step, task group context, and simple partitioner template @@ -426,7 +426,7 @@ void parallel_for(Index first, Index last, Index step, const Function& f, affini template __TBB_requires(parallel_for_index && parallel_for_function) void parallel_for(Index first, Index last, const Function& f, task_group_context &context) { - parallel_for_impl(first, last, static_cast(1), f, auto_partitioner(), context); + parallel_for_impl(first, last, static_cast(1), f, __TBB_DEFAULT_PARTITIONER(), context); } //! Parallel iteration over a range of integers with a default step value, explicit task group context, and simple partitioner template diff --git a/include/oneapi/tbb/parallel_reduce.h b/include/oneapi/tbb/parallel_reduce.h index 401ad00467..205c97ef95 100644 --- a/include/oneapi/tbb/parallel_reduce.h +++ b/include/oneapi/tbb/parallel_reduce.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -42,16 +42,16 @@ concept parallel_reduce_body = splittable && template concept parallel_reduce_function = std::invocable&, - const Range&, const Value&> && + const Range&, Value&&> && std::convertible_to&, - const Range&, const Value&>, + const Range&, Value&&>, Value>; template concept parallel_reduce_combine = std::invocable&, - const Value&, const Value&> && + Value&&, Value&&> && std::convertible_to&, - const Value&, const Value&>, + Value&&, Value&&>, Value>; } // namespace d0 @@ -390,14 +390,15 @@ class lambda_reduce_body { , my_value(other.my_identity_element) { } void operator()(Range& range) { - my_value = tbb::detail::invoke(my_real_body, range, const_cast(my_value)); + my_value = tbb::detail::invoke(my_real_body, range, std::move(my_value)); } + void join( lambda_reduce_body& rhs ) { - my_value = tbb::detail::invoke(my_reduction, const_cast(my_value), - const_cast(rhs.my_value)); + my_value = tbb::detail::invoke(my_reduction, std::move(my_value), std::move(rhs.my_value)); } - Value result() const { - return my_value; + + __TBB_nodiscard Value&& result() && noexcept { + return std::move(my_value); } }; @@ -514,7 +515,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,const __TBB_DEFAULT_PARTITIONER> ::run(range, body, __TBB_DEFAULT_PARTITIONER() ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with reduction and simple_partitioner. @@ -527,7 +528,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,const simple_partitioner> ::run(range, body, partitioner ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with reduction and auto_partitioner @@ -540,7 +541,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,const auto_partitioner> ::run( range, body, partitioner ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with reduction and static_partitioner @@ -553,7 +554,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,const static_partitioner> ::run( range, body, partitioner ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with reduction and affinity_partitioner @@ -566,7 +567,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,affinity_partitioner> ::run( range, body, partitioner ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with reduction, default partitioner and user-supplied context. @@ -579,7 +580,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,const __TBB_DEFAULT_PARTITIONER> ::run( range, body, __TBB_DEFAULT_PARTITIONER(), context ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with reduction, simple partitioner and user-supplied context. @@ -592,7 +593,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,const simple_partitioner> ::run( range, body, partitioner, context ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with reduction, auto_partitioner and user-supplied context @@ -605,7 +606,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,const auto_partitioner> ::run( range, body, partitioner, context ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with reduction, static_partitioner and user-supplied context @@ -618,7 +619,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,const static_partitioner> ::run( range, body, partitioner, context ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with reduction, affinity_partitioner and user-supplied context @@ -631,7 +632,7 @@ Value parallel_reduce( const Range& range, const Value& identity, const RealBody lambda_reduce_body body(identity, real_body, reduction); start_reduce,affinity_partitioner> ::run( range, body, partitioner, context ); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with deterministic reduction and default simple partitioner. @@ -704,7 +705,7 @@ Value parallel_deterministic_reduce( const Range& range, const Value& identity, lambda_reduce_body body(identity, real_body, reduction); start_deterministic_reduce, const simple_partitioner> ::run(range, body, partitioner); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with deterministic reduction and static partitioner. @@ -716,7 +717,7 @@ Value parallel_deterministic_reduce( const Range& range, const Value& identity, lambda_reduce_body body(identity, real_body, reduction); start_deterministic_reduce, const static_partitioner> ::run(range, body, partitioner); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with deterministic reduction, default simple partitioner and user-supplied context. @@ -739,7 +740,7 @@ Value parallel_deterministic_reduce( const Range& range, const Value& identity, lambda_reduce_body body(identity, real_body, reduction); start_deterministic_reduce, const simple_partitioner> ::run(range, body, partitioner, context); - return body.result(); + return std::move(body).result(); } //! Parallel iteration with deterministic reduction, static partitioner and user-supplied context. @@ -752,7 +753,7 @@ Value parallel_deterministic_reduce( const Range& range, const Value& identity, lambda_reduce_body body(identity, real_body, reduction); start_deterministic_reduce, const static_partitioner> ::run(range, body, partitioner, context); - return body.result(); + return std::move(body).result(); } //@} diff --git a/include/oneapi/tbb/parallel_scan.h b/include/oneapi/tbb/parallel_scan.h index 6d2a4d6401..d624f7ebdb 100644 --- a/include/oneapi/tbb/parallel_scan.h +++ b/include/oneapi/tbb/parallel_scan.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -562,7 +562,7 @@ class lambda_scan_body { template __TBB_requires(tbb_range && parallel_scan_body) void parallel_scan( const Range& range, Body& body ) { - start_scan::run(range,body,__TBB_DEFAULT_PARTITIONER()); + start_scan::run(range,body,__TBB_DEFAULT_PARTITIONER()); } //! Parallel prefix with simple_partitioner diff --git a/include/oneapi/tbb/version.h b/include/oneapi/tbb/version.h index 52ab98e7bc..fff3e7e2f9 100644 --- a/include/oneapi/tbb/version.h +++ b/include/oneapi/tbb/version.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -29,7 +29,7 @@ // Product version #define TBB_VERSION_MAJOR 2021 // Update version -#define TBB_VERSION_MINOR 12 +#define TBB_VERSION_MINOR 13 // "Patch" version for custom releases #define TBB_VERSION_PATCH 0 // Suffix string @@ -44,7 +44,7 @@ // OneAPI oneTBB specification version #define ONETBB_SPEC_VERSION "1.0" // Full interface version -#define TBB_INTERFACE_VERSION 12120 +#define TBB_INTERFACE_VERSION 12130 // Major interface version #define TBB_INTERFACE_VERSION_MAJOR (TBB_INTERFACE_VERSION/1000) // Minor interface version diff --git a/python/tbb/pool.py b/python/tbb/pool.py index a372324d2e..dd5c819062 100644 --- a/python/tbb/pool.py +++ b/python/tbb/pool.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2023 Intel Corporation +# Copyright (c) 2016-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. @@ -89,8 +89,8 @@ class Pool(object): def __init__(self, nworkers=0, name="Pool"): """ - \param nworkers (integer) number of worker threads to start - \param name (string) prefix for the worker threads' name + :param nworkers (integer) number of worker threads to start + :param name (string) prefix for the worker threads' name """ self._closed = False self._tasks = task_group() @@ -268,8 +268,8 @@ class Job: def __init__(self, func, args, kwds, apply_result): """ - \param func/args/kwds used to call the function - \param apply_result ApplyResult object that holds the result + :param func/args/kwds used to call the function + :param apply_result ApplyResult object that holds the result of the function call """ self._func = func @@ -317,10 +317,10 @@ class ApplyResult(object): def __init__(self, collector=None, callback=None): """ - \param collector when not None, the notify_ready() method of + :param collector when not None, the notify_ready() method of the collector will be called when the result from the Job is ready - \param callback when not None, function to call when the + :param callback when not None, function to call when the result becomes available (this is the parameter passed to the Pool::*_async() methods. """ @@ -404,7 +404,7 @@ class AbstractResultCollector(object): def __init__(self, to_notify): """ - \param to_notify ApplyResult object to notify when all the + :param to_notify ApplyResult object to notify when all the results we're waiting for become available. Can be None. """ self._to_notify = to_notify @@ -414,7 +414,7 @@ def register_result(self, apply_result): always be called BEFORE the Jobs get submitted to the work queue, and BEFORE the __iter__ and _get_result() methods can be called - \param apply_result ApplyResult object to add in our collection + :param apply_result ApplyResult object to add in our collection """ raise NotImplementedError("Children classes must implement it") @@ -422,7 +422,7 @@ def notify_ready(self, apply_result): """Called by the ApplyResult object (already registered via register_result()) that it is now ready (ie. the Job's result is available or an exception has been raised). - \param apply_result ApplyResult object telling us that the job + :param apply_result ApplyResult object telling us that the job has been processed """ raise NotImplementedError("Children classes must implement it") @@ -431,8 +431,8 @@ def _get_result(self, idx, timeout=None): """Called by the CollectorIterator object to retrieve the result's values one after another (order defined by the implementation) - \param idx The index of the result we want, wrt collector's order - \param timeout integer telling how long to wait (in seconds) + :param idx The index of the result we want, wrt collector's order + :param timeout integer telling how long to wait (in seconds) for the result at index idx to be available, or None (wait forever) """ @@ -450,7 +450,7 @@ class CollectorIterator(object): AbstractResultCollector::__iter__() method""" def __init__(self, collector): - """\param AbstractResultCollector instance""" + """:param AbstractResultCollector instance""" self._collector = collector self._idx = 0 @@ -486,7 +486,7 @@ class UnorderedResultCollector(AbstractResultCollector): def __init__(self, to_notify=None): """ - \param to_notify ApplyResult object to notify when all the + :param to_notify ApplyResult object to notify when all the results we're waiting for become available. Can be None. """ AbstractResultCollector.__init__(self, to_notify) @@ -499,7 +499,7 @@ def register_result(self, apply_result): always be called BEFORE the Jobs get submitted to the work queue, and BEFORE the __iter__ and _get_result() methods can be called - \param apply_result ApplyResult object to add in our collection + :param apply_result ApplyResult object to add in our collection """ self._expected += 1 @@ -507,8 +507,8 @@ def _get_result(self, idx, timeout=None): """Called by the CollectorIterator object to retrieve the result's values one after another, in the order the results have become available. - \param idx The index of the result we want, wrt collector's order - \param timeout integer telling how long to wait (in seconds) + :param idx The index of the result we want, wrt collector's order + :param timeout integer telling how long to wait (in seconds) for the result at index idx to be available, or None (wait forever) """ @@ -535,7 +535,7 @@ def notify_ready(self, apply_result=None): """Called by the ApplyResult object (already registered via register_result()) that it is now ready (ie. the Job's result is available or an exception has been raised). - \param apply_result ApplyResult object telling us that the job + :param apply_result ApplyResult object telling us that the job has been processed """ first_item = False @@ -560,9 +560,9 @@ class OrderedResultCollector(AbstractResultCollector): def __init__(self, to_notify=None, as_iterator=True): """ - \param to_notify ApplyResult object to notify when all the + :param to_notify ApplyResult object to notify when all the results we're waiting for become available. Can be None. - \param as_iterator boolean telling whether the result value + :param as_iterator boolean telling whether the result value set on to_notify should be an iterator (available as soon as 1 result arrived) or a list (available only after the last result arrived) @@ -578,7 +578,7 @@ def register_result(self, apply_result): always be called BEFORE the Jobs get submitted to the work queue, and BEFORE the __iter__ and _get_result() methods can be called - \param apply_result ApplyResult object to add in our collection + :param apply_result ApplyResult object to add in our collection """ self._results.append(apply_result) self._remaining += 1 @@ -587,8 +587,8 @@ def _get_result(self, idx, timeout=None): """Called by the CollectorIterator object to retrieve the result's values one after another (order defined by the implementation) - \param idx The index of the result we want, wrt collector's order - \param timeout integer telling how long to wait (in seconds) + :param idx The index of the result we want, wrt collector's order + :param timeout integer telling how long to wait (in seconds) for the result at index idx to be available, or None (wait forever) """ @@ -600,7 +600,7 @@ def notify_ready(self, apply_result): """Called by the ApplyResult object (already registered via register_result()) that it is now ready (ie. the Job's result is available or an exception has been raised). - \param apply_result ApplyResult object telling us that the job + :param apply_result ApplyResult object telling us that the job has been processed """ got_first = False diff --git a/src/tbb/CMakeLists.txt b/src/tbb/CMakeLists.txt index 4003d7b47e..b996c736a7 100644 --- a/src/tbb/CMakeLists.txt +++ b/src/tbb/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Intel Corporation +# Copyright (c) 2020-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. @@ -126,6 +126,16 @@ target_link_libraries(tbb ${TBB_COMMON_LINK_LIBS} ) +if(TBB_BUILD_APPLE_FRAMEWORKS) + set_target_properties(tbb PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION ${TBB_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION} + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.intel.tbb + MACOSX_FRAMEWORK_IDENTIFIER com.intel.tbb + MACOSX_FRAMEWORK_BUNDLE_VERSION ${TBB_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION} + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${TBB_BINARY_VERSION}) +endif() + tbb_install_target(tbb) if (TBB_INSTALL) diff --git a/src/tbb/arena.cpp b/src/tbb/arena.cpp index 41770fe5e7..0e7cf43c3b 100644 --- a/src/tbb/arena.cpp +++ b/src/tbb/arena.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -60,7 +60,6 @@ numa_binding_observer* construct_binding_observer( d1::task_arena* ta, int num_s if ((core_type >= 0 && core_type_count() > 1) || (numa_id >= 0 && numa_node_count() > 1) || max_threads_per_core > 0) { binding_observer = new(allocate_memory(sizeof(numa_binding_observer))) numa_binding_observer(ta, num_slots, numa_id, core_type, max_threads_per_core); __TBB_ASSERT(binding_observer, "Failure during NUMA binding observer allocation and construction"); - binding_observer->observe(true); } return binding_observer; } @@ -396,7 +395,7 @@ bool arena::is_top_priority() const { } bool arena::try_join() { - if (num_workers_active() < my_num_workers_allotted.load(std::memory_order_relaxed)) { + if (is_joinable()) { my_references += arena::ref_worker; return true; } @@ -545,7 +544,7 @@ void task_arena_impl::initialize(d1::task_arena_base& ta) { .set_max_threads_per_core(ta.max_threads_per_core()) .set_numa_id(ta.my_numa_id); #endif /*__TBB_ARENA_BINDING*/ - + if (ta.my_max_concurrency < 1) { #if __TBB_ARENA_BINDING ta.my_max_concurrency = (int)default_concurrency(arena_constraints); @@ -554,6 +553,17 @@ void task_arena_impl::initialize(d1::task_arena_base& ta) { #endif /*!__TBB_ARENA_BINDING*/ } +#if __TBB_CPUBIND_PRESENT + numa_binding_observer* observer = construct_binding_observer( + static_cast(&ta), arena::num_arena_slots(ta.my_max_concurrency, ta.my_num_reserved_slots), + ta.my_numa_id, ta.core_type(), ta.max_threads_per_core()); + if (observer) { + // TODO: Consider lazy initialization for internal arena so + // the direct calls to observer might be omitted until actual initialization. + observer->on_scheduler_entry(true); + } +#endif /*__TBB_CPUBIND_PRESENT*/ + __TBB_ASSERT(ta.my_arena.load(std::memory_order_relaxed) == nullptr, "Arena already initialized"); unsigned priority_level = arena_priority_level(ta.my_priority); threading_control* thr_control = threading_control::register_public_reference(); @@ -561,8 +571,11 @@ void task_arena_impl::initialize(d1::task_arena_base& ta) { ta.my_arena.store(&a, std::memory_order_release); #if __TBB_CPUBIND_PRESENT - a.my_numa_binding_observer = construct_binding_observer( - static_cast(&ta), a.my_num_slots, ta.my_numa_id, ta.core_type(), ta.max_threads_per_core()); + a.my_numa_binding_observer = observer; + if (observer) { + observer->on_scheduler_exit(true); + observer->observe(true); + } #endif /*__TBB_CPUBIND_PRESENT*/ } diff --git a/src/tbb/arena.h b/src/tbb/arena.h index ab218eeaee..1e95f117b2 100644 --- a/src/tbb/arena.h +++ b/src/tbb/arena.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -385,6 +385,10 @@ class arena: public padded bool is_top_priority() const; + bool is_joinable() const { + return num_workers_active() < my_num_workers_allotted.load(std::memory_order_relaxed); + } + bool try_join(); void set_allotment(unsigned allotment); diff --git a/src/tbb/dynamic_link.cpp b/src/tbb/dynamic_link.cpp index 2d88f8bc5d..a21beb5aeb 100644 --- a/src/tbb/dynamic_link.cpp +++ b/src/tbb/dynamic_link.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -34,7 +34,8 @@ // Unify system calls #define dlopen( name, flags ) LoadLibrary( name ) #define dlsym( handle, name ) GetProcAddress( handle, name ) - #define dlclose( handle ) ( ! FreeLibrary( handle ) ) + // FreeLibrary return bool value that is not used. + #define dlclose( handle ) (void)( ! FreeLibrary( handle ) ) #define dlerror() GetLastError() #ifndef PATH_MAX #define PATH_MAX MAX_PATH diff --git a/src/tbb/global_control.cpp b/src/tbb/global_control.cpp index b8dd6b34f8..127fc92db3 100644 --- a/src/tbb/global_control.cpp +++ b/src/tbb/global_control.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -17,6 +17,7 @@ #include "oneapi/tbb/detail/_config.h" #include "oneapi/tbb/detail/_template_helpers.h" +#include "oneapi/tbb/cache_aligned_allocator.h" #include "oneapi/tbb/global_control.h" #include "oneapi/tbb/tbb_allocator.h" #include "oneapi/tbb/spin_mutex.h" @@ -139,11 +140,22 @@ class alignas(max_nfs_size) lifetime_control : public control_storage { } }; -static allowed_parallelism_control allowed_parallelism_ctl; -static stack_size_control stack_size_ctl; -static terminate_on_exception_control terminate_on_exception_ctl; -static lifetime_control lifetime_ctl; -static control_storage *controls[] = {&allowed_parallelism_ctl, &stack_size_ctl, &terminate_on_exception_ctl, &lifetime_ctl}; +static control_storage* controls[] = {nullptr, nullptr, nullptr, nullptr}; + +void global_control_acquire() { + controls[0] = new (cache_aligned_allocate(sizeof(allowed_parallelism_control))) allowed_parallelism_control{}; + controls[1] = new (cache_aligned_allocate(sizeof(stack_size_control))) stack_size_control{}; + controls[2] = new (cache_aligned_allocate(sizeof(terminate_on_exception_control))) terminate_on_exception_control{}; + controls[3] = new (cache_aligned_allocate(sizeof(lifetime_control))) lifetime_control{}; +} + +void global_control_release() { + for (auto& ptr : controls) { + ptr->~control_storage(); + cache_aligned_deallocate(ptr); + ptr = nullptr; + } +} void global_control_lock() { for (auto& ctl : controls) { diff --git a/src/tbb/governor.cpp b/src/tbb/governor.cpp index 1a66f5decd..55175196b2 100644 --- a/src/tbb/governor.cpp +++ b/src/tbb/governor.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -42,6 +42,8 @@ namespace detail { namespace r1 { void clear_address_waiter_table(); +void global_control_acquire(); +void global_control_release(); //! global_control.cpp contains definition bool remove_and_check_if_empty(d1::global_control& gc); @@ -60,6 +62,7 @@ namespace system_topology { //------------------------------------------------------------------------ void governor::acquire_resources () { + global_control_acquire(); #if __TBB_USE_POSIX int status = theTLS.create(auto_terminate); #else @@ -85,6 +88,7 @@ void governor::release_resources () { system_topology::destroy(); dynamic_unlink_all(); + global_control_release(); } rml::tbb_server* governor::create_rml_server ( rml::tbb_client& client ) { diff --git a/src/tbb/governor.h b/src/tbb/governor.h index 9d5e94d308..573443d729 100644 --- a/src/tbb/governor.h +++ b/src/tbb/governor.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -138,6 +138,8 @@ class governor { static bool wait_package_enabled() { return cpu_features.waitpkg_enabled; } #endif + static bool hybrid_cpu() { return cpu_features.hybrid; } + static bool rethrow_exception_broken() { return is_rethrow_broken; } static bool is_itt_present() { diff --git a/src/tbb/misc.cpp b/src/tbb/misc.cpp index 17da1238f8..115a5f3885 100644 --- a/src/tbb/misc.cpp +++ b/src/tbb/misc.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-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. @@ -92,6 +92,8 @@ void PrintExtraVersionInfo( const char* category, const char* format, ... ) { //! check for transaction support. #if _MSC_VER #include // for __cpuid +#elif __APPLE__ +#include #endif #if __TBB_x86_32 || __TBB_x86_64 @@ -131,13 +133,22 @@ void detect_cpu_features(cpu_features_type& cpu_features) { #if __TBB_x86_32 || __TBB_x86_64 const int rtm_ebx_mask = 1 << 11; const int waitpkg_ecx_mask = 1 << 5; + const int hybrid_edx_mask = 1 << 15; int registers[4] = {0}; - // Check RTM and WAITPKG + // Check RTM, WAITPKG, HYBRID check_cpuid(7, 0, registers); cpu_features.rtm_enabled = (registers[1] & rtm_ebx_mask) != 0; cpu_features.waitpkg_enabled = (registers[2] & waitpkg_ecx_mask) != 0; -#endif /* (__TBB_x86_32 || __TBB_x86_64) */ + cpu_features.hybrid = (registers[3] & hybrid_edx_mask) != 0; +#elif __APPLE__ + // Check HYBRID (hw.nperflevels > 1) + uint64_t nperflevels = 0; + size_t nperflevels_size = sizeof(nperflevels); + if (!sysctlbyname("hw.nperflevels", &nperflevels, &nperflevels_size, nullptr, 0)) { + cpu_features.hybrid = (nperflevels > 1); + } +#endif } } // namespace r1 diff --git a/src/tbb/misc.h b/src/tbb/misc.h index b11c0029ef..988c29b17b 100644 --- a/src/tbb/misc.h +++ b/src/tbb/misc.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2022 Intel Corporation + Copyright (c) 2005-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. @@ -211,6 +211,7 @@ T1 atomic_update(std::atomic& dst, T1 newValue, Pred compare) { struct cpu_features_type { bool rtm_enabled{false}; bool waitpkg_enabled{false}; + bool hybrid{false}; }; void detect_cpu_features(cpu_features_type& cpu_features); diff --git a/src/tbb/scheduler_common.h b/src/tbb/scheduler_common.h index 56610ffe41..f9e8a68d37 100644 --- a/src/tbb/scheduler_common.h +++ b/src/tbb/scheduler_common.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -268,12 +268,7 @@ class stealing_loop_backoff { // no worse than 2x the optimal spin time. Or perhaps a time-slice quantum is the right amount. stealing_loop_backoff(int num_workers, int yields_multiplier) : my_pause_threshold{ 2 * (num_workers + 1) } -#if __APPLE__ - // threshold value tuned separately for macOS due to high cost of sched_yield there - , my_yield_threshold{10 * yields_multiplier} -#else , my_yield_threshold{100 * yields_multiplier} -#endif , my_pause_count{} , my_yield_count{} {} diff --git a/src/tbb/tbb.rc b/src/tbb/tbb.rc index 6c8b99fc74..57e9d391db 100644 --- a/src/tbb/tbb.rc +++ b/src/tbb/tbb.rc @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2023 Intel Corporation +// Copyright (c) 2005-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. @@ -54,7 +54,7 @@ BEGIN VALUE "CompanyName", "Intel Corporation\0" VALUE "FileDescription", "oneAPI Threading Building Blocks (oneTBB) library\0" VALUE "FileVersion", TBB_VERSION "\0" - VALUE "LegalCopyright", "Copyright 2005-2023 Intel Corporation. All Rights Reserved.\0" + VALUE "LegalCopyright", "Copyright 2005-2024 Intel Corporation. All Rights Reserved.\0" VALUE "LegalTrademarks", "\0" #ifndef TBB_USE_DEBUG VALUE "OriginalFilename", "tbb12.dll\0" diff --git a/src/tbb/thread_dispatcher.cpp b/src/tbb/thread_dispatcher.cpp index 8f33dc065f..69a108d6f2 100644 --- a/src/tbb/thread_dispatcher.cpp +++ b/src/tbb/thread_dispatcher.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2022-2023 Intel Corporation + Copyright (c) 2022-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. @@ -164,6 +164,18 @@ thread_dispatcher_client* thread_dispatcher::client_in_need(thread_dispatcher_cl return client_in_need(my_client_list, my_next_client); } +bool thread_dispatcher::is_any_client_in_need() { + client_list_mutex_type::scoped_lock lock(my_list_mutex, /*is_writer=*/false); + for (auto& priority_list : my_client_list) { + for (auto& client : priority_list) { + if (client.is_joinable()) { + return true; + } + } + } + return false; +} + void thread_dispatcher::adjust_job_count_estimate(int delta) { my_server->adjust_job_count_estimate(delta); } diff --git a/src/tbb/thread_dispatcher.h b/src/tbb/thread_dispatcher.h index f11344ca1d..e511e2b737 100644 --- a/src/tbb/thread_dispatcher.h +++ b/src/tbb/thread_dispatcher.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2022-2023 Intel Corporation + Copyright (c) 2022-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. @@ -44,6 +44,7 @@ class thread_dispatcher : no_copy, rml::tbb_client { thread_dispatcher_client* create_client(arena& a); void register_client(thread_dispatcher_client* client); bool try_unregister_client(thread_dispatcher_client* client, std::uint64_t aba_epoch, unsigned priority); + bool is_any_client_in_need(); void adjust_job_count_estimate(int delta); void release(bool blocking_terminate); diff --git a/src/tbb/thread_dispatcher_client.h b/src/tbb/thread_dispatcher_client.h index c93ff31d0a..f7c199cb86 100644 --- a/src/tbb/thread_dispatcher_client.h +++ b/src/tbb/thread_dispatcher_client.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2022-2023 Intel Corporation + Copyright (c) 2022-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. @@ -32,6 +32,11 @@ class thread_dispatcher_client : public d1::intrusive_list_node /* Need for list bool try_join() { return my_arena.try_join(); } + + bool is_joinable() { + return my_arena.is_joinable(); + } + void process(thread_data& td) { my_arena.process(td); } diff --git a/src/tbb/thread_request_serializer.cpp b/src/tbb/thread_request_serializer.cpp index 5973f14c68..6019f732b4 100644 --- a/src/tbb/thread_request_serializer.cpp +++ b/src/tbb/thread_request_serializer.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2022-2023 Intel Corporation + Copyright (c) 2022-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. @@ -37,8 +37,8 @@ void thread_request_serializer::update(int delta) { if (prev_pending_delta == pending_delta_base) { delta = int(my_pending_delta.exchange(pending_delta_base) & delta_mask) - int(pending_delta_base); mutex_type::scoped_lock lock(my_mutex); - my_total_request += delta; - delta = limit_delta(delta, my_soft_limit, my_total_request); + my_total_request.store(my_total_request.load(std::memory_order_relaxed) + delta, std::memory_order_relaxed); + delta = limit_delta(delta, my_soft_limit, my_total_request.load(std::memory_order_relaxed)); my_thread_dispatcher.adjust_job_count_estimate(delta); } } @@ -46,7 +46,7 @@ void thread_request_serializer::update(int delta) { void thread_request_serializer::set_active_num_workers(int soft_limit) { mutex_type::scoped_lock lock(my_mutex); int delta = soft_limit - my_soft_limit; - delta = limit_delta(delta, my_total_request, soft_limit); + delta = limit_delta(delta, my_total_request.load(std::memory_order_relaxed), soft_limit); my_thread_dispatcher.adjust_job_count_estimate(delta); my_soft_limit = soft_limit; } @@ -109,6 +109,8 @@ void thread_request_serializer_proxy::set_active_num_workers(int soft_limit) { } } +int thread_request_serializer_proxy::num_workers_requested() { return my_serializer.num_workers_requested(); } + void thread_request_serializer_proxy::update(int delta) { my_serializer.update(delta); } void thread_request_serializer_proxy::enable_mandatory_concurrency(mutex_type::scoped_lock& lock) { diff --git a/src/tbb/thread_request_serializer.h b/src/tbb/thread_request_serializer.h index 261a46d777..9dc9799e1a 100644 --- a/src/tbb/thread_request_serializer.h +++ b/src/tbb/thread_request_serializer.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2022-2023 Intel Corporation + Copyright (c) 2022-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. @@ -39,6 +39,7 @@ class thread_request_serializer : public thread_request_observer { public: thread_request_serializer(thread_dispatcher& td, int soft_limit); void set_active_num_workers(int soft_limit); + int num_workers_requested() { return my_total_request.load(std::memory_order_relaxed); } bool is_no_workers_avaliable() { return my_soft_limit == 0; } private: @@ -48,7 +49,7 @@ class thread_request_serializer : public thread_request_observer { thread_dispatcher& my_thread_dispatcher; int my_soft_limit{ 0 }; - int my_total_request{ 0 }; + std::atomic my_total_request{ 0 }; // my_pending_delta is set to pending_delta_base to have ability to hold negative values // consider increase base since thead number will be bigger than 1 << 15 static constexpr std::uint64_t pending_delta_base = 1 << 15; @@ -63,6 +64,7 @@ class thread_request_serializer_proxy : public thread_request_observer { thread_request_serializer_proxy(thread_dispatcher& td, int soft_limit); void register_mandatory_request(int mandatory_delta); void set_active_num_workers(int soft_limit); + int num_workers_requested(); private: void update(int delta) override; diff --git a/src/tbb/threading_control.cpp b/src/tbb/threading_control.cpp index f253c83d43..1ca1837826 100644 --- a/src/tbb/threading_control.cpp +++ b/src/tbb/threading_control.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2022-2023 Intel Corporation + Copyright (c) 2022-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. @@ -164,6 +164,10 @@ void threading_control_impl::adjust_demand(threading_control_client tc_client, i my_permit_manager->adjust_demand(c, mandatory_delta, workers_delta); } +bool threading_control_impl::is_any_other_client_active() { + return my_thread_request_serializer->num_workers_requested() > 0 ? my_thread_dispatcher->is_any_client_in_need() : false; +} + thread_control_monitor& threading_control_impl::get_waiting_threads_monitor() { return *my_waiting_threads_monitor; } @@ -389,6 +393,10 @@ void threading_control::adjust_demand(threading_control_client client, int manda my_pimpl->adjust_demand(client, mandatory_delta, workers_delta); } +bool threading_control::is_any_other_client_active() { + return my_pimpl->is_any_other_client_active(); +} + thread_control_monitor& threading_control::get_waiting_threads_monitor() { return my_pimpl->get_waiting_threads_monitor(); } diff --git a/src/tbb/threading_control.h b/src/tbb/threading_control.h index 55347189ca..7381b2978d 100644 --- a/src/tbb/threading_control.h +++ b/src/tbb/threading_control.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2022-2023 Intel Corporation + Copyright (c) 2022-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. @@ -69,6 +69,7 @@ class threading_control_impl { unsigned max_num_workers(); void adjust_demand(threading_control_client, int mandatory_delta, int workers_delta); + bool is_any_other_client_active(); thread_control_monitor& get_waiting_threads_monitor(); @@ -116,6 +117,7 @@ class threading_control { static unsigned max_num_workers(); void adjust_demand(threading_control_client client, int mandatory_delta, int workers_delta); + bool is_any_other_client_active(); thread_control_monitor& get_waiting_threads_monitor(); diff --git a/src/tbb/tools_api/ittnotify.h b/src/tbb/tools_api/ittnotify.h index d15aae26ff..eb1571dc8b 100644 --- a/src/tbb/tools_api/ittnotify.h +++ b/src/tbb/tools_api/ittnotify.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -101,6 +101,11 @@ The same ID may not be reused for different instances, unless a previous # define ITT_OS_FREEBSD 4 #endif /* ITT_OS_FREEBSD */ +#ifndef ITT_OS_OPENBSD +# define ITT_OS_OPENBSD 5 +#endif /* ITT_OS_OPENBSD */ + + #ifndef ITT_OS # if defined WIN32 || defined _WIN32 # define ITT_OS ITT_OS_WIN @@ -108,6 +113,8 @@ The same ID may not be reused for different instances, unless a previous # define ITT_OS ITT_OS_MAC # elif defined( __FreeBSD__ ) # define ITT_OS ITT_OS_FREEBSD +# elif defined( __OpenBSD__ ) +# define ITT_OS ITT_OS_OPENBSD # else # define ITT_OS ITT_OS_LINUX # endif @@ -129,6 +136,10 @@ The same ID may not be reused for different instances, unless a previous # define ITT_PLATFORM_FREEBSD 4 #endif /* ITT_PLATFORM_FREEBSD */ +#ifndef ITT_PLATFORM_OPENBSD +# define ITT_PLATFORM_OPENBSD 5 +#endif /* ITT_PLATFORM_OPENBSD */ + #ifndef ITT_PLATFORM # if ITT_OS==ITT_OS_WIN # define ITT_PLATFORM ITT_PLATFORM_WIN @@ -136,6 +147,8 @@ The same ID may not be reused for different instances, unless a previous # define ITT_PLATFORM ITT_PLATFORM_MAC # elif ITT_OS==ITT_OS_FREEBSD # define ITT_PLATFORM ITT_PLATFORM_FREEBSD +# elif ITT_OS==ITT_OS_OPENBSD +# define ITT_PLATFORM ITT_PLATFORM_OPENBSD # else # define ITT_PLATFORM ITT_PLATFORM_POSIX # endif @@ -305,7 +318,7 @@ extern "C" { * only pauses tracing and analyzing memory access. * It does not pause tracing or analyzing threading APIs. * . - * - Intel(R) Parallel Amplifier and Intel(R) VTune(TM) Amplifier XE: + * Intel(R) VTune(TM) Profiler: * - Does continue to record when new threads are started. * . * - Other effects: diff --git a/src/tbb/tools_api/ittnotify_config.h b/src/tbb/tools_api/ittnotify_config.h index 44edfd6781..001d42e0e5 100644 --- a/src/tbb/tools_api/ittnotify_config.h +++ b/src/tbb/tools_api/ittnotify_config.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -34,6 +34,10 @@ # define ITT_OS_FREEBSD 4 #endif /* ITT_OS_FREEBSD */ +#ifndef ITT_OS_OPENBSD +# define ITT_OS_OPENBSD 5 +#endif /* ITT_OS_OPENBSD */ + #ifndef ITT_OS # if defined WIN32 || defined _WIN32 # define ITT_OS ITT_OS_WIN @@ -41,6 +45,8 @@ # define ITT_OS ITT_OS_MAC # elif defined( __FreeBSD__ ) # define ITT_OS ITT_OS_FREEBSD +# elif defined( __OpenBSD__ ) +# define ITT_OS ITT_OS_OPENBSD # else # define ITT_OS ITT_OS_LINUX # endif @@ -62,6 +68,10 @@ # define ITT_PLATFORM_FREEBSD 4 #endif /* ITT_PLATFORM_FREEBSD */ +#ifndef ITT_PLATFORM_OPENBSD +# define ITT_PLATFORM_OPENBSD 5 +#endif /* ITT_PLATFORM_OPENBSD */ + #ifndef ITT_PLATFORM # if ITT_OS==ITT_OS_WIN # define ITT_PLATFORM ITT_PLATFORM_WIN @@ -69,6 +79,8 @@ # define ITT_PLATFORM ITT_PLATFORM_MAC # elif ITT_OS==ITT_OS_FREEBSD # define ITT_PLATFORM ITT_PLATFORM_FREEBSD +# elif ITT_OS==ITT_OS_OPENBSD +# define ITT_PLATFORM ITT_PLATFORM_OPENBSD # else # define ITT_PLATFORM ITT_PLATFORM_POSIX # endif @@ -235,7 +247,7 @@ #define API_VERSION_BUILD 20230630 #ifndef API_VERSION_NUM -#define API_VERSION_NUM 3.24.2 +#define API_VERSION_NUM 3.24.4 #endif /* API_VERSION_NUM */ #define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \ @@ -634,7 +646,7 @@ typedef struct ___itt_global h->nameA = NULL; \ h->nameW = name ? _wcsdup(name) : NULL; \ h->domainA = NULL; \ - h->domainW = name ? _wcsdup(domain) : NULL; \ + h->domainW = domain ? _wcsdup(domain) : NULL; \ h->type = type; \ h->index = 0; \ h->next = NULL; \ diff --git a/src/tbb/tools_api/ittnotify_static.c b/src/tbb/tools_api/ittnotify_static.c index ab396d2066..c3a53bf0a6 100644 --- a/src/tbb/tools_api/ittnotify_static.c +++ b/src/tbb/tools_api/ittnotify_static.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -81,7 +81,7 @@ static const char api_version[] = API_VERSION "\0\n@(#) $Revision$\n"; #if ITT_OS==ITT_OS_WIN static const char* ittnotify_lib_name = "libittnotify.dll"; -#elif ITT_OS==ITT_OS_LINUX || ITT_OS==ITT_OS_FREEBSD +#elif ITT_OS==ITT_OS_LINUX || ITT_OS==ITT_OS_FREEBSD|| ITT_OS==ITT_OS_OPENBSD static const char* ittnotify_lib_name = "libittnotify.so"; #elif ITT_OS==ITT_OS_MAC static const char* ittnotify_lib_name = "libittnotify.dylib"; diff --git a/src/tbb/tools_api/legacy/ittnotify.h b/src/tbb/tools_api/legacy/ittnotify.h index b5999c2a78..837bc48008 100644 --- a/src/tbb/tools_api/legacy/ittnotify.h +++ b/src/tbb/tools_api/legacy/ittnotify.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -245,7 +245,7 @@ extern "C" { * only pauses tracing and analyzing memory access. * It does not pause tracing or analyzing threading APIs. * . - * - Intel(R) Parallel Amplifier and Intel(R) VTune(TM) Amplifier XE: + * - Intel(R) VTune(TM) Profiler: * - Does continue to record when new threads are started. * . * - Other effects: diff --git a/src/tbb/waiters.h b/src/tbb/waiters.h index dba43f0de3..8ed431f857 100644 --- a/src/tbb/waiters.h +++ b/src/tbb/waiters.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -58,6 +58,24 @@ class outermost_worker_waiter : public waiter_base { __TBB_ASSERT(t == nullptr, nullptr); if (is_worker_should_leave(slot)) { + if (!governor::hybrid_cpu()) { + static constexpr std::chrono::microseconds worker_wait_leave_duration(1000); + static_assert(worker_wait_leave_duration > std::chrono::steady_clock::duration(1), "Clock resolution is not enough for measured interval."); + + for (auto t1 = std::chrono::steady_clock::now(), t2 = t1; + std::chrono::duration_cast(t2 - t1) < worker_wait_leave_duration; + t2 = std::chrono::steady_clock::now()) + { + if (!my_arena.is_empty() && !my_arena.is_recall_requested()) { + return true; + } + + if (my_arena.my_threading_control->is_any_other_client_active()) { + break; + } + d0::yield(); + } + } // Leave dispatch loop return false; } diff --git a/src/tbbbind/tbb_bind.rc b/src/tbbbind/tbb_bind.rc index bc060353dc..2d2b806e28 100644 --- a/src/tbbbind/tbb_bind.rc +++ b/src/tbbbind/tbb_bind.rc @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2023 Intel Corporation +// Copyright (c) 2005-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. @@ -54,7 +54,7 @@ BEGIN VALUE "CompanyName", "Intel Corporation\0" VALUE "FileDescription", "oneAPI Threading Building Blocks (oneTBB) library\0" VALUE "FileVersion", TBB_VERSION "\0" - VALUE "LegalCopyright", "Copyright 2005-2023 Intel Corporation. All Rights Reserved.\0" + VALUE "LegalCopyright", "Copyright 2005-2024 Intel Corporation. All Rights Reserved.\0" VALUE "LegalTrademarks", "\0" #ifndef TBB_USE_DEBUG VALUE "OriginalFilename", "tbbbind.dll\0" diff --git a/src/tbbmalloc/CMakeLists.txt b/src/tbbmalloc/CMakeLists.txt index 0386daa364..76044fce30 100644 --- a/src/tbbmalloc/CMakeLists.txt +++ b/src/tbbmalloc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Intel Corporation +# Copyright (c) 2020-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. @@ -109,5 +109,15 @@ target_link_libraries(tbbmalloc ${TBB_COMMON_LINK_LIBS} ) -tbb_install_target(tbbmalloc) +if(TBB_BUILD_APPLE_FRAMEWORKS) + set_target_properties(tbbmalloc PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION ${TBBMALLOC_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION} + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.intel.tbbmalloc + MACOSX_FRAMEWORK_IDENTIFIER com.intel.tbbmalloc + MACOSX_FRAMEWORK_BUNDLE_VERSION ${TBBMALLOC_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION} + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${TBBMALLOC_BINARY_VERSION} + ) +endif() +tbb_install_target(tbbmalloc) diff --git a/src/tbbmalloc/frontend.cpp b/src/tbbmalloc/frontend.cpp index c657d8044d..77f9d6594e 100644 --- a/src/tbbmalloc/frontend.cpp +++ b/src/tbbmalloc/frontend.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -1521,7 +1521,7 @@ bool Block::readyToShare() { MallocMutex::scoped_lock scoped_cs(publicFreeListLock); if ( (oldVal=publicFreeList)==nullptr ) - (intptr_t&)(publicFreeList) = UNUSABLE; + publicFreeList = reinterpret_cast(UNUSABLE); } #endif return oldVal==nullptr; diff --git a/src/tbbmalloc/tbbmalloc.rc b/src/tbbmalloc/tbbmalloc.rc index 77e87ff550..2821addab4 100644 --- a/src/tbbmalloc/tbbmalloc.rc +++ b/src/tbbmalloc/tbbmalloc.rc @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2023 Intel Corporation +// Copyright (c) 2005-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. @@ -54,7 +54,7 @@ BEGIN VALUE "CompanyName", "Intel Corporation\0" VALUE "FileDescription", "oneAPI Threading Building Blocks (oneTBB) library\0" VALUE "FileVersion", TBB_VERSION "\0" - VALUE "LegalCopyright", "Copyright 2005-2023 Intel Corporation. All Rights Reserved.\0" + VALUE "LegalCopyright", "Copyright 2005-2024 Intel Corporation. All Rights Reserved.\0" VALUE "LegalTrademarks", "\0" #ifndef TBB_USE_DEBUG VALUE "OriginalFilename", "tbbmalloc.dll\0" diff --git a/src/tbbmalloc/tbbmalloc_internal.h b/src/tbbmalloc/tbbmalloc_internal.h index c81dc06003..44fa47aaab 100644 --- a/src/tbbmalloc/tbbmalloc_internal.h +++ b/src/tbbmalloc/tbbmalloc_internal.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -102,7 +102,11 @@ void suppress_unused_warning( const T& ) {} /* * Default huge page size */ +#if defined __loongarch64 +static const size_t HUGE_PAGE_SIZE = 32 * 1024 * 1024; +#else static const size_t HUGE_PAGE_SIZE = 2 * 1024 * 1024; +#endif /********** End of global default constants *********/ diff --git a/src/tbbmalloc_proxy/CMakeLists.txt b/src/tbbmalloc_proxy/CMakeLists.txt index 5c23f15d89..554ddc85f3 100644 --- a/src/tbbmalloc_proxy/CMakeLists.txt +++ b/src/tbbmalloc_proxy/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 Intel Corporation +# Copyright (c) 2020-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. @@ -90,4 +90,14 @@ target_link_libraries(tbbmalloc_proxy ${TBB_COMMON_LINK_LIBS} ) +if(TBB_BUILD_APPLE_FRAMEWORKS) + set_target_properties(tbbmalloc_proxy PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION ${TBBMALLOC_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION} + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.intel.tbbmalloc-proxy + MACOSX_FRAMEWORK_IDENTIFIER com.intel.tbbmalloc-proxy + MACOSX_FRAMEWORK_BUNDLE_VERSION ${TBBMALLOC_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION} + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${TBBMALLOC_BINARY_VERSION}) +endif() + tbb_install_target(tbbmalloc_proxy) diff --git a/src/tbbmalloc_proxy/tbbmalloc_proxy.rc b/src/tbbmalloc_proxy/tbbmalloc_proxy.rc index 20b3b480fa..1884b119a8 100644 --- a/src/tbbmalloc_proxy/tbbmalloc_proxy.rc +++ b/src/tbbmalloc_proxy/tbbmalloc_proxy.rc @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2023 Intel Corporation +// Copyright (c) 2005-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. @@ -54,7 +54,7 @@ BEGIN VALUE "CompanyName", "Intel Corporation\0" VALUE "FileDescription", "oneAPI Threading Building Blocks (oneTBB) library\0" VALUE "FileVersion", TBB_VERSION "\0" - VALUE "LegalCopyright", "Copyright 2005-2023 Intel Corporation. All Rights Reserved.\0" + VALUE "LegalCopyright", "Copyright 2005-2024 Intel Corporation. All Rights Reserved.\0" VALUE "LegalTrademarks", "\0" #ifndef TBB_USE_DEBUG VALUE "OriginalFilename", "tbbmalloc_proxy.dll\0" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5c6cbb676a..cfde681bd6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Intel Corporation +# Copyright (c) 2020-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. @@ -43,6 +43,10 @@ function(tbb_add_test) ${TBB_COMMON_COMPILE_FLAGS} ) + if (TBB_BUILD_APPLE_FRAMEWORKS) + add_compile_definitions(TBB_USE_APPLE_FRAMEWORKS) + endif() + if (ANDROID_PLATFORM) # Expand the linker rpath by the CMAKE_LIBRARY_OUTPUT_DIRECTORY path since clang compiler from Android SDK # doesn't respect the -L flag. @@ -593,39 +597,39 @@ if (TARGET TBB::tbbmalloc) endif() # ---------------------------------------------------------------------------------------- # Whitebox testing - - add_executable(test_malloc_whitebox tbbmalloc/test_malloc_whitebox.cpp) - - target_include_directories(test_malloc_whitebox - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/../include - ${CMAKE_CURRENT_SOURCE_DIR}/.. - ${CMAKE_CURRENT_SOURCE_DIR}) - target_compile_definitions(test_malloc_whitebox PRIVATE __TBBMALLOC_BUILD) - target_compile_options(test_malloc_whitebox - PRIVATE - ${TBB_CXX_STD_FLAG} - ${TBB_WARNING_SUPPRESS} - ${TBB_TEST_COMPILE_FLAGS} - ${TBB_COMMON_COMPILE_FLAGS} - ${TBBMALLOC_LIB_COMPILE_FLAGS} - ) - if (ANDROID_PLATFORM) - add_test(NAME test_malloc_whitebox - COMMAND ${CMAKE_COMMAND} - -DBINARIES_PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DTEST_NAME=test_malloc_whitebox - -P ${PROJECT_SOURCE_DIR}/cmake/android/test_launcher.cmake) - else() - add_test(NAME test_malloc_whitebox COMMAND test_malloc_whitebox --force-colors=1) - endif() - if (COMMAND target_link_options) - target_link_options(test_malloc_whitebox PRIVATE ${TBB_COMMON_LINK_FLAGS}) - else() - target_link_libraries(test_malloc_whitebox PRIVATE ${TBB_COMMON_LINK_FLAGS}) + if (NOT TBB_EMSCRIPTEN) + add_executable(test_malloc_whitebox tbbmalloc/test_malloc_whitebox.cpp) + + target_include_directories(test_malloc_whitebox + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../include + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_CURRENT_SOURCE_DIR}) + target_compile_definitions(test_malloc_whitebox PRIVATE __TBBMALLOC_BUILD) + target_compile_options(test_malloc_whitebox + PRIVATE + ${TBB_CXX_STD_FLAG} + ${TBB_WARNING_SUPPRESS} + ${TBB_TEST_COMPILE_FLAGS} + ${TBB_COMMON_COMPILE_FLAGS} + ${TBBMALLOC_LIB_COMPILE_FLAGS} + ) + if (ANDROID_PLATFORM) + add_test(NAME test_malloc_whitebox + COMMAND ${CMAKE_COMMAND} + -DBINARIES_PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + -DTEST_NAME=test_malloc_whitebox + -P ${PROJECT_SOURCE_DIR}/cmake/android/test_launcher.cmake) + else() + add_test(NAME test_malloc_whitebox COMMAND test_malloc_whitebox --force-colors=1) + endif() + if (COMMAND target_link_options) + target_link_options(test_malloc_whitebox PRIVATE ${TBB_COMMON_LINK_FLAGS}) + else() + target_link_libraries(test_malloc_whitebox PRIVATE ${TBB_COMMON_LINK_FLAGS}) + endif() + target_link_libraries(test_malloc_whitebox PRIVATE Threads::Threads ${TBB_COMMON_LINK_LIBS}) endif() - target_link_libraries(test_malloc_whitebox PRIVATE Threads::Threads ${TBB_COMMON_LINK_LIBS}) - # ------------------------------------------------------------------------------------------ # Define TBB malloc conformance tests diff --git a/test/common/utils_dynamic_libs.h b/test/common/utils_dynamic_libs.h index c84beac73f..5e5365fc8f 100644 --- a/test/common/utils_dynamic_libs.h +++ b/test/common/utils_dynamic_libs.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-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. @@ -46,9 +46,17 @@ namespace utils { #endif #define EXT ".dll" #else +#if TBB_USE_APPLE_FRAMEWORKS +#define PREFIX // When built as Apple* Framework, the binary has no lib prefix +#else #define PREFIX "lib" +#endif #if __APPLE__ +#if TBB_USE_APPLE_FRAMEWORKS +#define EXT // When built as Apple* Framework, the binary has no extension +#else #define EXT ".dylib" +#endif // Android SDK build system does not support .so file name versioning #elif __FreeBSD__ || __NetBSD__ || __sun || _AIX || __ANDROID__ #define EXT ".so" @@ -58,10 +66,15 @@ namespace utils { #error Unknown OS #endif #endif +#if TBB_USE_APPLE_FRAMEWORKS +#define MALLOCFRAMEWORK "tbbmalloc.framework/" +#else +#define MALLOCFRAMEWORK +#endif // Form the names of the TBB memory allocator binaries. -#define MALLOCLIB_NAME1 PREFIX "tbbmalloc" SUFFIX1 EXT -#define MALLOCLIB_NAME2 PREFIX "tbbmalloc" SUFFIX2 EXT +#define MALLOCLIB_NAME1 MALLOCFRAMEWORK PREFIX "tbbmalloc" SUFFIX1 EXT +#define MALLOCLIB_NAME2 MALLOCFRAMEWORK PREFIX "tbbmalloc" SUFFIX2 EXT #if _WIN32 || _WIN64 using LIBRARY_HANDLE = HMODULE; diff --git a/test/conformance/conformance_blocked_rangeNd.cpp b/test/conformance/conformance_blocked_rangeNd.cpp index de54169cd9..52faac52ca 100644 --- a/test/conformance/conformance_blocked_rangeNd.cpp +++ b/test/conformance/conformance_blocked_rangeNd.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2017-2021 Intel Corporation + Copyright (c) 2017-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. @@ -245,6 +245,7 @@ TEST_CASE("Serial test") { SerialTest(); } +#if !EMSCRIPTEN //! Testing blocked_rangeNd interface with parallel_for //! \brief \ref requirement TEST_CASE("Parallel test") { @@ -253,6 +254,7 @@ TEST_CASE("Parallel test") { ParallelTest(); } } +#endif //! Testing blocked_rangeNd with proportional splitting //! \brief \ref interface \ref requirement diff --git a/test/conformance/conformance_parallel_for.cpp b/test/conformance/conformance_parallel_for.cpp index 44903f06c4..463ea5266d 100644 --- a/test/conformance/conformance_parallel_for.cpp +++ b/test/conformance/conformance_parallel_for.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -399,7 +399,9 @@ TEST_CASE("Flog test") { Flog(); Flog(); Flog(); +#if !EMSCRIPTEN Flog(); +#endif } //! Testing parallel for with different types and step diff --git a/test/conformance/conformance_parallel_reduce.cpp b/test/conformance/conformance_parallel_reduce.cpp index cf3aee9ba2..0214bfd970 100644 --- a/test/conformance/conformance_parallel_reduce.cpp +++ b/test/conformance/conformance_parallel_reduce.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -19,6 +19,7 @@ #include "common/test_invoke.h" #include "../tbb/test_partitioner.h" +#include //! \file conformance_parallel_reduce.cpp //! \brief Test for [algorithms.parallel_reduce algorithms.parallel_deterministic_reduce] specification @@ -56,6 +57,59 @@ struct ReduceBody { } }; +template +class MoveOnlyWrapper { +public: + MoveOnlyWrapper() = default; + MoveOnlyWrapper(const T& obj) : my_obj(obj) {} + + MoveOnlyWrapper(MoveOnlyWrapper&&) = default; + MoveOnlyWrapper& operator=(MoveOnlyWrapper&&) = default; + + MoveOnlyWrapper(const MoveOnlyWrapper&) = delete; + MoveOnlyWrapper& operator=(const MoveOnlyWrapper&) = delete; + + bool operator==(const MoveOnlyWrapper& other) const { return my_obj == other.my_obj; } +private: + T my_obj; +}; // class MoveOnlyWrapper + +// The container wrapper that is copyable but the copy constructor fails if the source container is non-empty +// If such an empty container is provided as an identity into parallel reduce algorithm with rvalue-friendly body, +// it should only call the copy constructor while broadcasting the identity element into the leafs +// and the identity element is an empty container for the further test +template +class EmptyCopyList { +public: + EmptyCopyList() = default; + + EmptyCopyList(EmptyCopyList&&) = default; + EmptyCopyList& operator=(EmptyCopyList&&) = default; + + EmptyCopyList(const EmptyCopyList& other) { + REQUIRE_MESSAGE(other.my_list.empty(), "reduce copied non-identity list"); + } + EmptyCopyList& operator=(const EmptyCopyList& other) { + REQUIRE_MESSAGE(other.my_list.empty(), "reduce copied non-identity list"); + return *this; + } + + typename std::list::iterator insert(typename std::list::const_iterator pos, T&& item) { + return my_list.insert(pos, std::move(item)); + } + + void splice(typename std::list::const_iterator pos, EmptyCopyList&& other) { + my_list.splice(pos, std::move(other.my_list)); + } + + typename std::list::const_iterator end() const { return my_list.end(); } + + bool operator==(const EmptyCopyList& other) const { return my_list == other.my_list; } + +private: + std::list my_list; +}; // class EmptyCopyList + template void TestDeterministicReductionFor() { const int N = 1000; @@ -174,3 +228,109 @@ TEST_CASE("parallel_[deterministic_]reduce and std::invoke") { } #endif + +template +void test_vector_of_lists_rvalue_reduce_basic(const Runner& runner, PartitionerContext&&... args) { + constexpr std::size_t n_vectors = 10000; + + using inner_type = MoveOnlyWrapper; + using list_type = EmptyCopyList; + using vector_of_lists_type = std::vector; + + vector_of_lists_type vector_of_lists; + + vector_of_lists.reserve(n_vectors); + for (std::size_t i = 0; i < n_vectors; ++i) { + list_type list; + + list.insert(list.end(), inner_type{1}); + list.insert(list.end(), inner_type{2}); + list.insert(list.end(), inner_type{3}); + list.insert(list.end(), inner_type{4}); + list.insert(list.end(), inner_type{5}); + vector_of_lists.emplace_back(std::move(list)); + } + + oneapi::tbb::blocked_range range(0, n_vectors, n_vectors * 2); + + auto reduce_body = [&](const decltype(range)& range_obj, list_type&& x) { + list_type new_list = std::move(x); + + for (std::size_t index = range_obj.begin(); index != range_obj.end(); ++index) { + new_list.splice(new_list.end(), std::move(vector_of_lists[index])); + } + return new_list; + }; + + auto join_body = [&](list_type&& x, list_type&& y) { + list_type new_list = std::move(x); + + new_list.splice(new_list.end(), std::move(y)); + return new_list; + }; + + list_type result = runner(range, list_type{}, reduce_body, join_body, std::forward(args)...); + + list_type expected_result; + + for (std::size_t i = 0; i < n_vectors; ++i) { + expected_result.insert(expected_result.end(), inner_type{1}); + expected_result.insert(expected_result.end(), inner_type{2}); + expected_result.insert(expected_result.end(), inner_type{3}); + expected_result.insert(expected_result.end(), inner_type{4}); + expected_result.insert(expected_result.end(), inner_type{5}); + } + + REQUIRE_MESSAGE(expected_result == result, "Incorrect reduce result"); +} + +struct ReduceRunner { + template + auto operator()(Args&&... args) const -> decltype(oneapi::tbb::parallel_reduce(std::forward(args)...)) { + return oneapi::tbb::parallel_reduce(std::forward(args)...); + } +}; + +struct DeterministicReduceRunner { + template + auto operator()(Args&&... args) const -> decltype(oneapi::tbb::parallel_deterministic_reduce(std::forward(args)...)) { + return oneapi::tbb::parallel_deterministic_reduce(std::forward(args)...); + } +}; + +void test_vector_of_lists_rvalue_reduce() { + ReduceRunner runner; + oneapi::tbb::affinity_partitioner af_partitioner; + oneapi::tbb::task_group_context context; + + test_vector_of_lists_rvalue_reduce_basic(runner); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::auto_partitioner{}); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::simple_partitioner{}); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::static_partitioner{}); + test_vector_of_lists_rvalue_reduce_basic(runner, af_partitioner); + + test_vector_of_lists_rvalue_reduce_basic(runner, context); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::auto_partitioner{}, context); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::simple_partitioner{}, context); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::static_partitioner{}, context); + test_vector_of_lists_rvalue_reduce_basic(runner, af_partitioner, context); +} + +void test_vector_of_lists_rvalue_deterministic_reduce() { + DeterministicReduceRunner runner; + oneapi::tbb::task_group_context context; + + test_vector_of_lists_rvalue_reduce_basic(runner); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::simple_partitioner{}); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::static_partitioner{}); + + test_vector_of_lists_rvalue_reduce_basic(runner, context); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::simple_partitioner{}, context); + test_vector_of_lists_rvalue_reduce_basic(runner, oneapi::tbb::static_partitioner{}, context); +} + +//! \brief \ref interface \ref requirement +TEST_CASE("test rvalue optimization") { + test_vector_of_lists_rvalue_reduce(); + test_vector_of_lists_rvalue_deterministic_reduce(); +} diff --git a/test/tbb/test_collaborative_call_once.cpp b/test/tbb/test_collaborative_call_once.cpp index d8ee09fda0..11a04a10d3 100644 --- a/test/tbb/test_collaborative_call_once.cpp +++ b/test/tbb/test_collaborative_call_once.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2022 Intel Corporation + Copyright (c) 2022-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. @@ -206,6 +206,7 @@ TEST_CASE("only calls once - move only argument") { } } +#if !EMSCRIPTEN //! Stress test for functor to be called only once //! \brief \ref interface \ref requirement \ref stress TEST_CASE("only calls once - stress test") { @@ -246,7 +247,7 @@ TEST_CASE("only calls once - stress test") { }); } } - +#endif #if TBB_USE_EXCEPTIONS //! Test for collaborative_call_once exception handling @@ -324,6 +325,7 @@ TEST_CASE("handles exceptions - stress test") { #endif +#if !EMSCRIPTEN //! Test for multiple help from moonlighting threads //! \brief \ref interface \ref requirement TEST_CASE("multiple help") { @@ -341,6 +343,7 @@ TEST_CASE("multiple help") { }); }); } +#endif //! Test for collaborative work from different arenas //! \brief \ref interface \ref requirement diff --git a/test/tbb/test_eh_algorithms.cpp b/test/tbb/test_eh_algorithms.cpp index 75c0381d09..7a2b59b400 100644 --- a/test/tbb/test_eh_algorithms.cpp +++ b/test/tbb/test_eh_algorithms.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -401,7 +401,7 @@ TEST_CASE("parallel_for and parallel_reduce exception handling test #0") { } } } - +#if !EMSCRIPTEN //! Testing parallel_for and parallel_reduce exception handling //! \brief \ref error_guessing TEST_CASE("parallel_for and parallel_reduce exception handling test #1") { @@ -486,8 +486,8 @@ TEST_CASE("parallel_for and parallel_reduce exception handling test #4") { } } +#endif #endif /* TBB_USE_EXCEPTIONS */ - class ParForBodyToCancel { public: void operator()( const range_type& ) const { @@ -698,6 +698,7 @@ TEST_CASE("parallel_for and parallel_reduce cancellation test #1") { } } +#if !EMSCRIPTEN //! Testing parallel_for and parallel_reduce cancellation //! \brief \ref error_guessing TEST_CASE("parallel_for and parallel_reduce cancellation test #2") { @@ -718,6 +719,7 @@ TEST_CASE("parallel_for and parallel_reduce cancellation test #2") { } } } +#endif //! Testing parallel_for and parallel_reduce cancellation //! \brief \ref error_guessing @@ -1033,6 +1035,7 @@ void Test5_parallel_for_each () { } } // void Test5_parallel_for_each () +#if !EMSCRIPTEN //! Testing parallel_for_each exception handling //! \brief \ref error_guessing TEST_CASE("parallel_for_each exception handling test #1") { @@ -1053,6 +1056,7 @@ TEST_CASE("parallel_for_each exception handling test #1") { } } } +#endif //! Testing parallel_for_each exception handling //! \brief \ref error_guessing @@ -1075,6 +1079,7 @@ TEST_CASE("parallel_for_each exception handling test #2") { } } +#if !EMSCRIPTEN //! Testing parallel_for_each exception handling //! \brief \ref error_guessing TEST_CASE("parallel_for_each exception handling test #3") { @@ -1095,6 +1100,7 @@ TEST_CASE("parallel_for_each exception handling test #3") { } } } +#endif //! Testing parallel_for_each exception handling //! \brief \ref error_guessing @@ -1117,6 +1123,7 @@ TEST_CASE("parallel_for_each exception handling test #4") { } } +#if !EMSCRIPTEN //! Testing parallel_for_each exception handling //! \brief \ref error_guessing TEST_CASE("parallel_for_each exception handling test #5") { @@ -1139,7 +1146,7 @@ TEST_CASE("parallel_for_each exception handling test #5") { } } } - +#endif #endif /* TBB_USE_EXCEPTIONS */ class ParForEachBodyToCancel { @@ -1217,6 +1224,7 @@ void TestCancelation2_parallel_for_each () { RunCancellationTest, Cancellator2>(); } +#if !EMSCRIPTEN //! Testing parallel_for_each cancellation test //! \brief \ref error_guessing TEST_CASE("parallel_for_each cancellation test #1") { @@ -1257,6 +1265,7 @@ TEST_CASE("parallel_for_each cancellation test #2") { } } } +#endif //////////////////////////////////////////////////////////////////////////////// // Tests for tbb::parallel_pipeline @@ -1608,6 +1617,7 @@ void TestWithDifferentFiltersAndConcurrency() { #endif } +#if !EMSCRIPTEN //! Testing parallel_pipeline exception handling //! \brief \ref error_guessing TEST_CASE("parallel_pipeline exception handling test #1") { @@ -1631,7 +1641,7 @@ TEST_CASE("parallel_pipeline exception handling test #3") { TEST_CASE("parallel_pipeline exception handling test #4") { TestWithDifferentFiltersAndConcurrency(); } - +#endif #endif /* TBB_USE_EXCEPTIONS */ class FilterToCancel { @@ -1727,6 +1737,7 @@ TEST_CASE("parallel_pipeline cancellation test #1") { } } +#if !EMSCRIPTEN //! Testing parallel_pipeline cancellation //! \brief \ref error_guessing TEST_CASE("parallel_pipeline cancellation test #2") { @@ -1748,3 +1759,4 @@ TEST_CASE("parallel_pipeline cancellation test #2") { } } } +#endif diff --git a/test/tbb/test_eh_flow_graph.cpp b/test/tbb/test_eh_flow_graph.cpp index 71f381566c..015d196eaf 100644 --- a/test/tbb/test_eh_flow_graph.cpp +++ b/test/tbb/test_eh_flow_graph.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -2017,6 +2017,7 @@ void TestOneThreadNum(int nThread) { ); } +#if !EMSCRIPTEN //! Test exceptions with parallelism //! \brief \ref error_guessing TEST_CASE("Testing several threads"){ @@ -2026,5 +2027,5 @@ TEST_CASE("Testing several threads"){ TestOneThreadNum(nThread); } } - +#endif #endif // TBB_USE_EXCEPTIONS diff --git a/test/tbb/test_flow_graph_priorities.cpp b/test/tbb/test_flow_graph_priorities.cpp index 5c798063ab..483daadb18 100644 --- a/test/tbb/test_flow_graph_priorities.cpp +++ b/test/tbb/test_flow_graph_priorities.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2018-2021 Intel Corporation + Copyright (c) 2018-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. @@ -842,6 +842,7 @@ TEST_CASE("Priority nodes take precedence"){ } } +#if !EMSCRIPTEN //! Test thread eager reaction //! \brief \ref error_guessing TEST_CASE("Thread eager reaction"){ @@ -849,6 +850,7 @@ TEST_CASE("Thread eager reaction"){ ThreadsEagerReaction::test( static_cast(p) ); } } +#endif //! Test prioritization under concurrency limits //! \brief \ref error_guessing @@ -888,3 +890,4 @@ TEST_CASE("Exceptions") { Exceptions::test(); } #endif + diff --git a/test/tbb/test_global_control.cpp b/test/tbb/test_global_control.cpp index 0c3df3bf83..fddbbaf691 100644 --- a/test/tbb/test_global_control.cpp +++ b/test/tbb/test_global_control.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -245,11 +245,13 @@ TEST_CASE("prolong lifetime advanced") { } #endif +#if !EMSCRIPTEN //! Testing multiple wait //! \brief \ref error_guessing TEST_CASE("prolong lifetime multiple wait") { TestBlockingTerminateNS::TestMultpleWait(); } +#endif //! \brief \ref regression TEST_CASE("test concurrent task_scheduler_handle destruction") { diff --git a/test/tbb/test_mutex.cpp b/test/tbb/test_mutex.cpp index bc7b79e334..5b78f17321 100644 --- a/test/tbb/test_mutex.cpp +++ b/test/tbb/test_mutex.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-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. @@ -109,7 +109,6 @@ void TestTransaction(const char* name) REQUIRE_MESSAGE(n_transactions_attempted.load(std::memory_order_relaxed), "ERROR for " << name << ": transactions were never attempted"); } - //! \brief \ref error_guessing TEST_CASE("Transaction test") { if (have_TSX()) { @@ -119,6 +118,7 @@ TEST_CASE("Transaction test") { } #endif /* __TBB_TSX_TESTING_ENABLED_FOR_THIS_COMPILER */ + //! \brief \ref error_guessing TEST_CASE("test upgrade/downgrade with spin_rw_mutex") { test_rwm_upgrade_downgrade(); @@ -144,10 +144,12 @@ TEST_CASE("test spin_mutex with native threads") { test_with_native_threads::test(); } +#if !EMSCRIPTEN //! \brief \ref error_guessing TEST_CASE("test queuing_mutex with native threads") { test_with_native_threads::test(); } +#endif //! \brief \ref error_guessing TEST_CASE("test mutex with native threads") { @@ -160,11 +162,13 @@ TEST_CASE("test spin_rw_mutex with native threads") { test_with_native_threads::test_rw(); } +#if !EMSCRIPTEN //! \brief \ref error_guessing TEST_CASE("test queuing_rw_mutex with native threads") { test_with_native_threads::test(); test_with_native_threads::test_rw(); } +#endif //! \brief \ref error_guessing TEST_CASE("test rw_mutex with native threads") { @@ -197,3 +201,4 @@ TEST_CASE("internal mutex concepts") { tbb::null_rw_mutex, tbb::queuing_rw_mutex>); } #endif // __TBB_CPP20_CONCEPTS_PRESENT + diff --git a/test/tbb/test_resumable_tasks.cpp b/test/tbb/test_resumable_tasks.cpp index a363a9ca5e..0cba977274 100644 --- a/test/tbb/test_resumable_tasks.cpp +++ b/test/tbb/test_resumable_tasks.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2022 Intel Corporation + Copyright (c) 2005-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. @@ -423,6 +423,7 @@ class TestCaseGuard { thread_local bool TestCaseGuard::m_local = false; +#if !EMSCRIPTEN //! Nested test for suspend and resume //! \brief \ref error_guessing TEST_CASE("Nested test for suspend and resume") { @@ -436,6 +437,7 @@ TEST_CASE("Nested arena") { TestCaseGuard guard; TestNestedArena(); } +#endif //! Test with external threads //! \brief \ref error_guessing @@ -443,11 +445,13 @@ TEST_CASE("External threads") { TestNativeThread(); } +#if !EMSCRIPTEN //! Stress test with external threads //! \brief \ref stress TEST_CASE("Stress test with external threads") { TestCleanupMaster(); } +#endif //! Test with an arena observer //! \brief \ref error_guessing diff --git a/test/tbb/test_scheduler_mix.cpp b/test/tbb/test_scheduler_mix.cpp index c2c02bb7a9..8d8e0e3768 100644 --- a/test/tbb/test_scheduler_mix.cpp +++ b/test/tbb/test_scheduler_mix.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2021-2022 Intel Corporation + 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. @@ -522,7 +522,7 @@ enum ACTIONS { num_actions }; -void global_actor(); +void global_actor(size_t arenaAfterStealing); template struct actor; @@ -543,8 +543,13 @@ struct actor { template <> struct actor { - static void do_it(Random& r) { + static void do_it(Random& r, size_t arenaAfterStealing) { static thread_local std::size_t arenaLevel = 0; + + // treat arenas index as priority: we own some resource already, + // so may pretend only to low-priority resource + arenaLevel = std::max(arenaLevel, arenaAfterStealing); + ArenaTable::ScopedLock lock; auto entry = arenaTable.acquire(r, lock); if (entry.first) { @@ -561,11 +566,13 @@ struct actor { tbb::this_task_arena::enqueue([&wctx] { wctx.release(); }); tbb::detail::d1::wait(wctx, ctx); } else { - global_actor(); + global_actor(0); } }; switch (r.get() % (16*num_arena_actions)) { case arena_execute: + // to prevent deadlock, potentially blocking operation + // may be called only for arenas with larger index if (entry.second > arenaLevel) { gStats.notify(Statistics::ArenaExecute); auto oldArenaLevel = arenaLevel; @@ -579,7 +586,9 @@ struct actor { utils_fallthrough; default: gStats.notify(Statistics::ArenaEnqueue); - entry.first->enqueue([] { global_actor(); }); + // after stealing by a worker, the task will run in arena + // with index entry.second + entry.first->enqueue([ entry ] { global_actor(entry.second); }); break; } arenaTable.release(lock); @@ -601,7 +610,7 @@ struct actor { auto doGlbAction = rnd.get() % 1000 == 42; auto body = [doGlbAction, sz](int i) { if (i == sz / 2 && doGlbAction) { - global_actor(); + global_actor(0); } }; @@ -621,7 +630,7 @@ struct actor { } }; -void global_actor() { +void global_actor(size_t arenaAfterStealing) { static thread_local std::uint64_t localNumActions{}; while (globalNumActions < maxNumActions) { @@ -629,7 +638,7 @@ void global_actor() { switch (rnd.get() % num_actions) { case arena_create: gStats.notify(Statistics::ArenaCreate); actor::do_it(rnd); break; case arena_destroy: gStats.notify(Statistics::ArenaDestroy); actor::do_it(rnd); break; - case arena_action: gStats.notify(Statistics::ArenaAcquire); actor::do_it(rnd); break; + case arena_action: gStats.notify(Statistics::ArenaAcquire); actor::do_it(rnd, arenaAfterStealing); break; case parallel_algorithm: gStats.notify(Statistics::ParallelAlgorithm); actor::do_it(rnd); break; } @@ -656,7 +665,7 @@ TEST_CASE("Stress test with mixing functionality") { utils::SpinBarrier startBarrier{numExtraThreads}; utils::NativeParallelFor(numExtraThreads, [&startBarrier](std::size_t) { startBarrier.wait(); - global_actor(); + global_actor(0); }); arenaTable.shutdown(); diff --git a/test/tbbmalloc/test_malloc_whitebox.cpp b/test/tbbmalloc/test_malloc_whitebox.cpp index 0f37e9f4e2..9de151e0cf 100644 --- a/test/tbbmalloc/test_malloc_whitebox.cpp +++ b/test/tbbmalloc/test_malloc_whitebox.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-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. @@ -1257,7 +1257,11 @@ void TestTHP() { scalable_allocation_mode(USE_HUGE_PAGES, 1); REQUIRE_MESSAGE(hugePages.isEnabled, "Huge pages should be enabled via scalable_allocation_mode"); +#if defined __loongarch64 + const int HUGE_PAGE_SIZE = 32 * 1024 * 1024; +#else const int HUGE_PAGE_SIZE = 2 * 1024 * 1024; +#endif // allocCount transparent huge pages should be allocated const int allocCount = 10; diff --git a/third-party-programs.txt b/third-party-programs.txt index b555450a92..c088429c2e 100644 --- a/third-party-programs.txt +++ b/third-party-programs.txt @@ -1,58 +1,55 @@ oneAPI Threading Building Blocks (oneTBB) Third Party Programs File -This file contains the list of third party software ("third party programs") -contained in the Intel software and their required notices and/or license terms. -This third party software, even if included with the distribution of the Intel -software, may be governed by separate license terms, including without limitation, -third party license terms, other Intel software license terms, and open source -software license terms. These separate license terms govern your use of the third -party programs as set forth in the "third-party-programs.txt" or other similarlynamed text file. +This file is the "third-party-programs.txt" file specified in the associated Intel end user license +agreement for the Intel software you are licensing. The third party programs and their corresponding required notices and/or license terms are listed below. _______________________________________________________________________________________________________ -1. Intel(R) Instrumentation and Tracing Technology (ITT) - Copyright (c) 2022 Intel Corporation. All rights reserved. +1. Instrumentation and Tracing Technology (ITT) Notify User API: + Copyright (c) 2005-2023 Intel Corporation. All rights reserved. - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holder nor the names of its contributors may be - used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. _______________________________________________________________________________________________________ -2. ActiveState Thread pool with same API as (multi) processing.Pool (Python recipe): - Copyright (c) 2008,2016 david decotigny (this file) - Copyright (c) 2006-2008, R Oudkerk (multiprocessing.Pool) +2. Portable Hardware Locality (hwloc): - Portable Hardware Locality (hwloc) - Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana University Research and Technology Corporation. All rights reserved. - Copyright (c) 2004-2005 The University of Tennessee and The University of Tennessee Research Foundation. All rights reserved. - Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved. + Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana University Research and + Technology Corporation. All rights reserved. + Copyright (c) 2004-2005 The University of Tennessee and The University of Tennessee Research + Foundation. All rights reserved. + Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, University of Stuttgart. + All rights reserved. Copyright (c) 2004-2005 The Regents of the University of California. All rights reserved. Copyright (c) 2009 CNRS Copyright (c) 2009-2016 Inria. All rights reserved. - Copyright (c) 2009-2015 Université Bordeaux + Copyright (c) 2009-2015 Université Bordeaux Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved. Copyright (c) 2010 IBM @@ -60,35 +57,32 @@ ________________________________________________________________________________ Copyright (c) 2012 Aleksej Saushev, The NetBSD Foundation Copyright (c) 2012 Blue Brain Project, EPFL. All rights reserved. Copyright (c) 2013-2014 University of Wisconsin-La Crosse. All rights reserved. - Copyright (c) 2015 Research Organization for Information Science and Technology (RIST). All rights reserved. + Copyright (c) 2015 Research Organization for Information Science and Technology (RIST). + All rights reserved. Copyright (c) 2015-2016 Intel, Inc. All rights reserved. - - BSD 3-clause "New" or "Revised" License + See COPYING in top-level directory. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. Neither the name of author nor the names of any contributors may be - used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. _______________________________________________________________________________________________________ 3. gperftools: Copyright (c) 2011, Google Inc. @@ -126,268 +120,60 @@ ________________________________________________________________________________ 4. Mateusz Kwiatkowski Workaround for bug 62258 in libstdc++ - GPL 3.0 with GCC Runtime Library Exception 3.1 - - GNU GENERAL PUBLIC LICENSE - - Version 3, 29 June 2007 - - Copyright (c) 2007 Free Software Foundation, Inc. - - Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - - Preamble - The GNU General Public License is a free, copyleft license for software and other kinds of works. - - The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. - - When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - - Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. - - Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and modification follow. - - TERMS AND CONDITIONS - 0. Definitions. - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based on the Program. - - To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. - - 1. Source Code. - The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. - - A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. - - The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. - - The Corresponding Source for a work in source code form is that same work. - - 2. Basic Permissions. - All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. - - When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. - - 4. Conveying Verbatim Copies. - You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified it, and giving a relevant date. - b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". - c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. - d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. - A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. - - 6. Conveying Non-Source Forms. - You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: - - a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. - b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. - c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. - d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. - e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. - A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. - - If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). - - The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. - - 7. Additional Terms. - "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or - b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or - c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or - d) Limiting the use for publicity purposes of names of licensors or authors of the material; or - e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or - f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. - All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. - - 8. Termination. - You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). - - However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - - Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. - - 9. Acceptance Not Required for Having Copies. - You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. - - 11. Patents. - A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - - If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - - A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. - - 14. Revised Versions of this License. - The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - - Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. - - 15. Disclaimer of Warranty. - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . - - The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . - - - GCC RUNTIME LIBRARY EXCEPTION - - Version 3.1, 31 March 2009 - - Copyright (c) 2009 Free Software Foundation, Inc. - - Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - - This GCC Runtime Library Exception ("Exception") is an additional permission under section 7 of the GNU General Public License, version 3 ("GPLv3"). It applies to a given file (the "Runtime Library") that bears a notice placed by the copyright holder of the file stating that the file is governed by GPLv3 along with this Exception. - - When you use GCC to compile a program, GCC may combine portions of certain GCC header files and runtime libraries with the compiled program. The purpose of this Exception is to allow compilation of non-GPL (including proprietary) programs to use, in this way, the header files and runtime libraries covered by this Exception. - - 0. Definitions. - A file is an "Independent Module" if it either requires the Runtime Library for execution after a Compilation Process, or makes use of an interface provided by the Runtime Library, but is not otherwise based on the Runtime Library. - - "GCC" means a version of the GNU Compiler Collection, with or without modifications, governed by version 3 (or a specified later version) of the GNU General Public License (GPL) with the option of using any subsequent versions published by the FSF. - - "GPL-compatible Software" is software whose conditions of propagation, modification and use would permit combination with GCC in accord with the license of GCC. - - "Target Code" refers to output from any compiler for a real or virtual target processor architecture, in executable form or suitable for input to an assembler, loader, linker and/or execution phase. Notwithstanding that, Target Code does not include data in any format that is used as a compiler intermediate representation, or used for producing a compiler intermediate representation. - - The "Compilation Process" transforms code entirely represented in non-intermediate languages designed for human-written code, and/or in Java Virtual Machine byte code, into Target Code. Thus, for example, use of source code generators and preprocessors need not be considered part of the Compilation Process, since the Compilation Process can be understood as starting with the output of the generators or preprocessors. - - A Compilation Process is "Eligible" if it is done using GCC, alone or with other GPL-compatible software, or if it is done without using any work based on GCC. For example, using non-GPL-compatible Software to optimize any GCC intermediate representations would not qualify as an Eligible Compilation Process. - - 1. Grant of Additional Permission. - You have permission to propagate a work of Target Code formed by combining the Runtime Library with Independent Modules, even if such propagation would otherwise violate the terms of GPLv3, provided that all Target Code was generated by Eligible Compilation Processes. You may then convey such a combination under terms of your choice, consistent with the licensing of the Independent Modules. + ******************************************************************************** + * Author: Mateusz Kwiatkowski * + * * + * I hereby renounce all copyright to this file and my rights resulting from * + * it, to the broadest extent permitted by law. It may be treated as public * + * domain. * + * * + * However, as this file interfaces with GCC internal ABI, it may be subject to * + * the terms and conditions of the GNU General Public License. Please consult * + * the GCC licensing terms and/or a lawyer for details. * + * * + * Note that libstdc++ licensing terms grant additional permissions described * + * in the GCC Runtime Library Exception, version 3.1, as published by the * + * Free Software Foundation. * + *******************************************************************************/ +_______________________________________________________________________________________________________ - 2. No Weakening of GCC Copyleft. - The availability of this Exception does not imply any general presumption that third-party software is unaffected by the copyleft requirements of the license of GCC. +5. ActiveState Thread pool with same API as (multi) processing. Pool (Python recipe) + + # + # Copyright (c) 2008,2016 david decotigny (this file) + # Copyright (c) 2006-2008, R Oudkerk (multiprocessing.Pool) + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions + # are met: + # + # 1. Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # 2. Redistributions in binary form must reproduce the above copyright + # notice, this list of conditions and the following disclaimer in the + # documentation and/or other materials provided with the distribution. + # 3. Neither the name of author nor the names of any contributors may be + # used to endorse or promote products derived from this software + # without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND + # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + # SUCH DAMAGE. _______________________________________________________________________________________________________ -5. Doctest - - Copyright (c) 2016-2021 Viktor Kirilov +6. doctest - The MIT License (MIT) + Copyright (c) 2016-2023 Viktor Kirilov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -406,6 +192,7 @@ ________________________________________________________________________________ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + _______________________________________________________________________________________________________ -*Other names and brands may be claimed as the property of others. +*Other names and brands may be claimed as the property of others. \ No newline at end of file