Skip to content

Add starvation avoidance based on priorities #5874

Add starvation avoidance based on priorities

Add starvation avoidance based on priorities #5874

Workflow file for this run

# Copyright (c) 2021-2025 Intel Corporation
# Copyright (c) 2026 UXL Foundation Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: oneTBB CI
on:
push:
branches: [master]
pull_request:
branches: [master]
types:
- opened
- synchronize
- reopened
permissions: read-all
env:
BUILD_CONCURRENCY: 2
MACOS_BUILD_CONCURRENCY: 3
TEST_TIMEOUT: 180
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'refs/heads/master') }}
jobs:
codespell:
runs-on: [ubuntu-22.04]
timeout-minutes: 10
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run scan
run: |
set -e -x -o pipefail
sudo apt update && sudo apt install -y codespell
${GITHUB_WORKSPACE}/.github/scripts/codespell.sh `pwd`
examples_clang-format:
runs-on: [ubuntu-22.04]
timeout-minutes: 10
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run scan
run: |
set -e -x -o pipefail
command -v clang-format
cp -r examples examples_formatted
find examples_formatted -regex '.*\.\(cpp\|hpp\)' -exec clang-format -style=file -i {} \;
diff -r examples examples_formatted
documentation:
needs: [codespell]
env:
BUILD_TYPE: oss
runs-on: [ubuntu-latest]
timeout-minutes: 10
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install prerequisites
run: |
set -e -x -o pipefail
pip3 install -U Jinja2
pip3 install git+https://github.com/executablebooks/sphinx-book-theme.git
pip3 install sphinx_design
echo GITHUB_SHA_SHORT=${GITHUB_SHA::8} >> $GITHUB_ENV
mkdir html
- name: Build documentation
run: |
set -e -x -o pipefail
export BUILD_TYPE=${BUILD_TYPE} && sphinx-build doc html
tar -czvf html.tar.gz html/
- name: Save docs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: oneTBB-html-docs-${{ env.GITHUB_SHA_SHORT }}
path: html.tar.gz
pages:
if: ${{ github.ref == 'refs/heads/master' }}
permissions:
contents: write
pages: write
id-token: write
runs-on: ubuntu-latest
needs: [documentation]
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Checkout gh-pages
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: gh-pages
path: gh-pages
- name: Set env
run: echo GITHUB_SHA_SHORT=${GITHUB_SHA::8} >> $GITHUB_ENV
- name: Download documetation
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: oneTBB-html-docs-${{ env.GITHUB_SHA_SHORT }}
- name: Publish to github pages
run: |
set -e -x -o pipefail
tar -xvf html.tar.gz
cd gh-pages
rm -rf *
touch .nojekyll # https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/
cp -r ../html/* .
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit --reset-author --amend -m "Update from GitHub Actions"
git push --force origin gh-pages
copyright_check:
if: ${{ github.ref != 'refs/heads/master' }}
runs-on: [ubuntu-latest]
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Run check
run: |
set -e -x -o pipefail
base_sha=${{ github.event.pull_request.base.sha }}
current_year=$(date +%Y)
apache_copyright_line="Licensed under the Apache License"
uxl_copyright_re="Copyright \(c\) [0-9]+ UXL Foundation Contributors"
intel_copyright_re="Copyright.*[0-9]\{4\}.*Intel"
check_failed=false
new_files=$(git diff --find-renames --diff-filter=A --name-only "$base_sha" || true)
modified_files=$(git diff --find-renames --diff-filter=M --name-only "$base_sha" || true)
if [ -n "$new_files" ]; then
new_with_apache=$(grep -lF "$apache_copyright_line" $new_files || true)
for file in $new_with_apache; do
uxl_match=$(grep -cE "$uxl_copyright_re" "$file" || true)
if [ "$uxl_match" -eq 0 ]; then
echo "ERROR: New file is missing UXL copyright: $file"
check_failed=true
else
year_match=$(grep -cE "Copyright \(c\) ${current_year} UXL Foundation Contributors" "$file" || true)
if [ "$year_match" -eq 0 ]; then
echo "ERROR: New file must have current year (${current_year}) in UXL copyright: $file"
check_failed=true
fi
fi
done
fi
if [ -n "$modified_files" ]; then
modified_with_apache=$(grep -lF "$apache_copyright_line" $modified_files || true)
for file in $modified_with_apache; do
uxl_match=$(grep -cE "$uxl_copyright_re" "$file" || true)
if [ "$uxl_match" -eq 0 ]; then
echo "ERROR: Modified file is missing single year UXL copyright: $file"
check_failed=true
continue
fi
original_uxl=$(git show "${base_sha}:${file}" 2>/dev/null | grep -oE "$uxl_copyright_re" || true)
current_uxl=$(grep -oE "$uxl_copyright_re" "$file" || true)
if [ -n "$original_uxl" ] && [ "$original_uxl" != "$current_uxl" ]; then
echo "ERROR: UXL copyright year must not be changed in: $file"
check_failed=true
fi
done
fi
all_changed_files=$(git diff --find-renames --diff-filter=AM --name-only "$base_sha" || true)
if [ -n "$all_changed_files" ]; then
all_with_apache=$(grep -lF "$apache_copyright_line" $all_changed_files || true)
for file in $all_with_apache; do
original_intel=$(git show "${base_sha}:${file}" 2>/dev/null | grep "$intel_copyright_re" || true)
current_intel=$(grep "$intel_copyright_re" "$file" || true)
if [ -n "$original_intel" ] && [ "$original_intel" != "$current_intel" ]; then
echo "ERROR: Intel copyright must not be modified in: $file"
check_failed=true
fi
done
fi
if [ "$check_failed" = true ]; then
exit 1
fi
python_module_test_ubuntu_latest:
runs-on: [ubuntu-latest]
timeout-minutes: 15
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run testing
run: |
set -e -x -o pipefail
mkdir build && cd build
cmake -DTBB4PY_BUILD=ON -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc ..
make VERBOSE=1 -j${BUILD_CONCURRENCY} python_build
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 }}${{ matrix.cmake_static }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
c_compiler: gcc
cxx_compiler: g++
std: 14
build_type: relwithdebinfo
preview: 'OFF'
- os: ubuntu-22.04
c_compiler: gcc
cxx_compiler: g++
std: 17
build_type: release
preview: 'ON'
- os: ubuntu-24.04-arm
c_compiler: gcc-14
cxx_compiler: g++-14
std: 20
build_type: debug
preview: 'ON'
- os: ubuntu-24.04-arm
c_compiler: clang
cxx_compiler: clang++
std: 20
build_type: release
preview: 'ON'
- os: ubuntu-22.04-arm
c_compiler: gcc
cxx_compiler: g++
std: 20
build_type: release
preview: 'ON'
cmake_static: -DBUILD_SHARED_LIBS=OFF
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install dependencies
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y pkg-config libhwloc-dev hwloc
- name: Run testing
shell: bash
run: |
set -e -x -o pipefail
mkdir build && cd build
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_TEST_PREVIEW=${{ 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 }}${{ matrix.cmake_static }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
c_compiler: clang
cxx_compiler: clang++
std: 17
build_type: debug
preview: 'ON'
- os: macos-14
c_compiler: clang
cxx_compiler: clang++
std: 14
build_type: relwithdebinfo
preview: 'ON'
- os: macos-15-intel
c_compiler: clang
cxx_compiler: clang++
std: 20
build_type: release
preview: 'ON'
cmake_static: -DBUILD_SHARED_LIBS=OFF
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run testing
shell: bash
run: |
set -e -x -o pipefail
mkdir build && cd build
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_TEST_PREVIEW=${{ matrix.preview }} ..
make VERBOSE=1 -j${MACOS_BUILD_CONCURRENCY}
ctest --timeout ${TEST_TIMEOUT} --output-on-failure
windows-testing:
name: ${{ matrix.job_name }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- os: windows-2025
generator: Visual Studio 18 2026
c_compiler: cl
cxx_compiler: cl
std: 14
build_type: relwithdebinfo
preview: 'ON'
job_name: windows_cl2026_cxx14_relwithdebinfo_preview=ON
- os: windows-11-arm
generator: Visual Studio 17 2022
c_compiler: cl
cxx_compiler: cl
std: 20
build_type: release
preview: 'ON'
job_name: windows_11_arm_cl2022_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
cxx_compiler: cl
std: 17
build_type: relwithdebinfo
preview: 'OFF'
job_name: windows_cl2022_cxx17_relwithdebinfo_preview=OFF
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run testing
run: |
mkdir build
cd build
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_TEST_PREVIEW=${{ matrix.preview }} ..
if (!$?) {
throw "CMake configuration step failed, exit code $LastExitCode"
}
cmake --build . --config ${{ matrix.build_type }} -j -v
if (!$?) {
throw "CMake build step failed, exit code $LastExitCode"
}
ctest -C ${{ matrix.build_type }} --timeout ${env:TEST_TIMEOUT} --output-on-failure
if (!$?) {
throw "CTest failed, exit code $LastExitCode"
}
linux-examples-testing:
name: examples_${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
c_compiler: gcc
cxx_compiler: g++
std: 14
build_type: relwithdebinfo
preview: 'OFF'
- os: ubuntu-22.04
c_compiler: gcc
cxx_compiler: g++
std: 17
build_type: release
preview: 'ON'
- os: ubuntu-24.04
c_compiler: gcc
cxx_compiler: g++
std: 20
build_type: debug
preview: 'ON'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run testing
shell: bash
run: |
set -e -x -o pipefail
mkdir build && cd build
cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
-DTBB_TEST_PREVIEW=${{ matrix.preview }} -DTBB_TEST=OFF -DTBB_EXAMPLES=ON ..
cmake --build . -v --target light_test_examples
macos-examples-testing:
name: examples_${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_preview=${{ matrix.preview }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
c_compiler: clang
cxx_compiler: clang++
std: 14
build_type: relwithdebinfo
preview: 'ON'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run testing
shell: bash
run: |
set -e -x -o pipefail
mkdir build && cd build
cmake -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
-DTBB_TEST_PREVIEW=${{ matrix.preview }} -DTBB_TEST=OFF -DTBB_EXAMPLES=ON ..
cmake --build . -v --target light_test_examples
windows-examples-testing:
name: ${{ matrix.job_name }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- os: windows-11-arm
generator: Visual Studio 17 2022
c_compiler: cl
cxx_compiler: cl
std: 14
build_type: relwithdebinfo
preview: 'ON'
job_name: examples_windows_11_arm_cl2022_cxx14_relwithdebinfo_preview=ON
- os: windows-2022
generator: Visual Studio 17 2022
c_compiler: cl
cxx_compiler: cl
std: 17
build_type: relwithdebinfo
preview: 'OFF'
job_name: examples_windows_cl2022_cxx17_relwithdebinfo_preview=OFF
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run testing
run: |
mkdir build
cd build
cmake -G "${{ matrix.generator }}" -A x64 -DCMAKE_CXX_STANDARD=${{ matrix.std }} `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} `
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DTBB_TEST_PREVIEW=${{ matrix.preview }} -DTBB_TEST=OFF -DTBB_EXAMPLES=ON ..
if (!$?) {
throw "CMake configuration step of examples failed, exit code $LastExitCode"
}
cmake --build . -v --target light_test_examples
if (!$?) {
throw "CMake build step of examples failed, exit code $LastExitCode"
}
linux-doc-examples-testing:
name: doc_examples_${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_${{ matrix.cmake_extra }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
c_compiler: clang
cxx_compiler: clang++
generator: Ninja
std: 20
build_type: relwithdebinfo
cmake_extra: -DTBB_TEST_CXX20_MODULES=ON
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install dependencies
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y ninja-build
if [[ "${{ matrix.cxx_compiler }}" == "clang++" ]]; then
sudo apt-get install -y libomp-dev
fi
- name: Test doc examples
run: |
set -e -x -o pipefail
mkdir build && cd build
cmake -G "${{ matrix.generator }}" -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type}} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
${{ matrix.cmake_extra }} -DTBB_TEST=OFF -DTBB_DOC_EXAMPLES=ON ..
cmake --build . -v --parallel --target build-doc-examples
ctest -C ${{ matrix.build_type }} --timeout ${env:TEST_TIMEOUT} --output-on-failure -L doc-examples
windows-doc-examples-testing:
name: doc_examples_${{ matrix.os }}_${{ matrix.cxx_compiler }}_cxx${{ matrix.std }}_${{ matrix.build_type }}_${{ matrix.cmake_extra }}
runs-on: ['${{ matrix.os }}']
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
generator: "Visual Studio 17 2022"
c_compiler: cl
cxx_compiler: cl
std: 20
build_type: relwithdebinfo
cmake_extra: -DTBB_TEST_CXX20_MODULES=ON
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Test doc examples
run: |
mkdir build && cd build
cmake -G "${{ matrix.generator }}" -A x64 -DCMAKE_CXX_STANDARD=${{ matrix.std }} `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type}} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} `
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} ${{ matrix.cmake_extra }} -DTBB_TEST=OFF -DTBB_DOC_EXAMPLES=ON ..
if (!$?) {
throw "CMake configuration step of examples from documentation failed, exit code $LastExitCode"
}
cmake --build . --config ${{ matrix.build_type }} -v --parallel --target build-doc-examples
if (!$?) {
throw "CMake build step of examples from documentation failed, exit code $LastExitCode"
}
ctest -C ${{ matrix.build_type }} --timeout ${env:TEST_TIMEOUT} --output-on-failure -L doc-examples
if (!$?) {
throw "CTest of examples from documentation failed, exit code $LastExitCode"
}