Tbb - oneAPI Threading Building Blocks (oneTBB)

Overview

oneAPI Threading Building Blocks

Apache License Version 2.0 oneTBB CI

oneTBB is a flexible C++ library that simplifies the work of adding parallelism to complex applications, even if you are not a threading expert.

The library lets you easily write parallel programs that take full advantage of the multi-core performance. Such programs are portable, composable and have a future-proof scalability. oneTBB provides you with functions, interfaces, and classes to parallelize and scale the code. All you have to do is to use the templates.

The library differs from typical threading packages in the following ways:

  • oneTBB enables you to specify logical parallelism instead of threads.
  • oneTBB targets threading for performance.
  • oneTBB is compatible with other threading packages.
  • oneTBB emphasizes scalable, data parallel programming.
  • oneTBB relies on generic programming.

Refer to oneTBB examples and samples to see how you can use the library.

oneTBB is a part of oneAPI. The current branch implements version 1.1 of oneAPI Specification.

Release Information

Here are Release Notes and System Requirements.

Documentation

Installation

See Installation from Sources to learn how to install oneTBB.

Support

Please report issues and suggestions via GitHub issues. See our documentation to learn how to work with them.

How to Contribute

We welcome community contributions, so check our Contributing Guidelines to learn more.

License

oneAPI Threading Building Blocks is licensed under Apache License, Version 2.0. By its terms, contributions submitted to the project are also done under that license.

Engineering team contacts


* All names and brands may be claimed as the property of others.

Comments
  • Add export attributes + bug fixes

    Add export attributes + bug fixes

    I've cherry-picked my bugfixes from my previous PR and redid the mingw support, this time using export attributes. This will also help remove the def files in the future. There's one symbol missing, and it's ?construct@r1@detail@tbb@@YAXAEAVqueuing_rw_mutex@d1@23@@Z. Where is it located in the header files? Also, tbbmalloc hasn't been decorated with export attributes, I'll work on it soon.

    opened by longnguyen2004 63
  • Some tests failed on MSVC 2019 (x64 build)

    Some tests failed on MSVC 2019 (x64 build)

    Release build:

    F:\tmp\tbb\oneTBB-2021.3.0\build\2019.64>cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Releas
    e -DCMAKE_CXX_STANDARD=17 -G "NMake Makefiles" ..\..
    -- The CXX compiler identification is MSVC 19.20.27519.0
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/
    Tools/MSVC/14.20.27508/bin/HostX64/x64/cl.exe
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/
    Tools/MSVC/14.20.27508/bin/HostX64/x64/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Looking for C++ include pthread.h
    -- Looking for C++ include pthread.h - not found
    -- Found Threads: TRUE
    -- HWLOC target HWLOC::hwloc_1_11 doesn't exist. The tbbbind target cannot be created
    -- HWLOC target HWLOC::hwloc_2 doesn't exist. The tbbbind_2_0 target cannot be created
    -- HWLOC target HWLOC::hwloc_2_4 doesn't exist. The tbbbind_2_4 target cannot be created
    -- The C compiler identification is MSVC 19.20.27519.0
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/To
    ols/MSVC/14.20.27508/bin/HostX64/x64/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/To
    ols/MSVC/14.20.27508/bin/HostX64/x64/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Configuring done
    -- Generating done
    -- Build files have been written to: F:/tmp/tbb/oneTBB-2021.3.0/build/2019.64
    

    Tests:

    The following tests FAILED:
             11 - test_partitioner (Failed)
             12 - test_parallel_for (Failed)
             14 - test_parallel_reduce (Failed)
             21 - test_concurrent_vector (Failed)
             63 - test_task (Failed)
             80 - conformance_parallel_for (Failed)
             82 - conformance_parallel_reduce (Failed)
    

    RelWithDebInfo build:

    F:\tmp\tbb\oneTBB-2021.3.0\build\2019.64rd>cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=RelW
    ithDebInfo -DCMAKE_CXX_STANDARD=17 -G "NMake Makefiles" ..\..
    -- The CXX compiler identification is MSVC 19.20.27519.0
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/
    Tools/MSVC/14.20.27508/bin/HostX64/x64/cl.exe
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/
    Tools/MSVC/14.20.27508/bin/HostX64/x64/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Looking for C++ include pthread.h
    -- Looking for C++ include pthread.h - not found
    -- Found Threads: TRUE
    -- HWLOC target HWLOC::hwloc_1_11 doesn't exist. The tbbbind target cannot be created
    -- HWLOC target HWLOC::hwloc_2 doesn't exist. The tbbbind_2_0 target cannot be created
    -- HWLOC target HWLOC::hwloc_2_4 doesn't exist. The tbbbind_2_4 target cannot be created
    -- The C compiler identification is MSVC 19.20.27519.0
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/To
    ols/MSVC/14.20.27508/bin/HostX64/x64/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/To
    ols/MSVC/14.20.27508/bin/HostX64/x64/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Configuring done
    -- Generating done
    -- Build files have been written to: F:/tmp/tbb/oneTBB-2021.3.0/build/2019.64rd
    
    F:\tmp\tbb\oneTBB-2021.3.0\build\2019.64rd>
    

    Tests:

    The following tests FAILED:
             11 - test_partitioner (Failed)
             12 - test_parallel_for (Failed)
             14 - test_parallel_reduce (Failed)
             21 - test_concurrent_vector (Failed)
             36 - test_eh_flow_graph (Failed)
             63 - test_task (Failed)
             80 - conformance_parallel_for (Failed)
             82 - conformance_parallel_reduce (Failed)
    

    LOG:

    test 11
            Start  11: test_partitioner
    
    11: Test command: "test_partitioner" "--forc
    e-colors=1"
    11: Test timeout computed to be: 10000000
    11: Access violation
     11/132 Test  #11: test_partitioner .........................***Failed    0.04 sec
    test 12
            Start  12: test_parallel_for
    
    12: Test command: "test_parallel_for" "--for
    ce-colors=1"
    12: Test timeout computed to be: 10000000
    12: Access violation
     12/132 Test  #12: test_parallel_for ........................***Failed    3.68 sec
    
    test 14
            Start  14: test_parallel_reduce
    
    14: Test command: "test_parallel_reduce" "--
    force-colors=1"
    14: Test timeout computed to be: 10000000
    14: Access violation
     14/132 Test  #14: test_parallel_reduce .....................***Failed    0.20 sec
    
    
    test 21
            Start  21: test_concurrent_vector
    
    21: Test command: "test_concurrent_vector" "
    --force-colors=1"
    21: Test timeout computed to be: 10000000
    21: Access violation
     21/132 Test  #21: test_concurrent_vector ...................***Failed    0.88 sec
    
    
    test 36
            Start  36: test_eh_flow_graph
    
    36: Test command: "test_eh_flow_graph" "--fo
    rce-colors=1"
    36: Test timeout computed to be: 10000000
    36: [doctest] doctest version is "2.3.5"
    36: [doctest] run with "--help" for options
    36: ===============================================================================
    36: F:\tmp\tbb\oneTBB-2021.3.0\test\tbb\test_eh_flow_graph.cpp(2029):
    36: TEST CASE:  Testing several threads
    36:
    36: F:\tmp\tbb\oneTBB-2021.3.0\test\common/exception_handling.h(241): WARNING: WARN( n < c_Timeout )
     is NOT correct!
    36:   values: WARN( 1000000 <  1000000 )
    36:   logged: input_node(1): Missed wakeup or machine is overloaded?
    36:
    .......
    36: F:\tmp\tbb\oneTBB-2021.3.0\test\common/exception_handling.h(241): WARNING: WARN( n < c_Timeout )
     is NOT correct!
    36:   values: WARN( 1000000 <  1000000 )
    36:   logged: input_node(1): Missed wakeup or machine is overloaded?
    36:
    36: F:\tmp\tbb\oneTBB-2021.3.0\test\common/exception_handling.h(241): WARNING: WARN( n < c_Timeout )
     is
     36/132 Test  #36: test_eh_flow_graph .......................***Failed   96.01 sec
    
    
    test 63
            Start  63: test_task
    
    63: Test command: "test_task" "--force-color
    s=1"
    63: Test timeout computed to be: 10000000
    63: [doctest] doctest version is "2.3.5"
    63: [doctest] run with "--help" for options
    63: Access violation
     63/132 Test  #63: test_task ................................***Failed    0.24 sec
    
    
    test 80
            Start  80: conformance_parallel_for
    
    80: Test command: "conformance_parallel_for"
     "--force-colors=1"
    80: Test timeout computed to be: 10000000
    80: Access violation
     80/132 Test  #80: conformance_parallel_for .................***Failed    0.06 sec
    
    
    test 82
            Start  82: conformance_parallel_reduce
    
    82: Test command: "conformance_parallel_redu
    ce" "--force-colors=1"
    82: Test timeout computed to be: 10000000
    82: Access violation
     82/132 Test  #82: conformance_parallel_reduce ..............***Failed    0.07 sec
    
    bug 
    opened by phprus 49
  • Retry if pthread_create fails with EAGAIN

    Retry if pthread_create fails with EAGAIN

    Description

    On many Unix-like systems, pthread_create can fail spuriously even if the running machine has enough resources to spawn a new thread. Therefore, if EAGAIN is returned from pthread_create, we actually have to try again.

    I observed this issue when running the mold linker (https://github.com/rui314/mold) under a heavy load. mold uses OneTBB for parallelization.

    As another data point, Go has the same logic to retry on EAGAIN: https://go-review.googlesource.com/c/go/+/33894/

    nanosleep is defined in POSIX 2001, so I believe that all Unix-like systems support it.

    • [x] - git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details)

    Type of change

    • [x] bug fix - change that fixes an issue
    • [ ] new feature - change that adds functionality
    • [ ] tests - change in tests
    • [ ] infrastructure - change in infrastructure and CI
    • [ ] documentation - documentation update

    Tests

    • [ ] added - required for new features and some bug fixes
    • [x] not needed

    Documentation

    • [ ] updated in # - add PR number
    • [ ] needs to be updated
    • [x] not needed

    Breaks backward compatibility

    • [ ] Yes
    • [x] No
    • [ ] Unknown

    Notify the following users

    Other information

    opened by rui314 33
  • 2021.2.0: build fails

    2021.2.0: build fails

    make  -f src/tbb/CMakeFiles/tbb.dir/build.make src/tbb/CMakeFiles/tbb.dir/depend
    make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/x86_64-redhat-linux-gnu'
    cd /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0 /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/src/tbb /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/x86_64-redhat-linux-gnu/src/tbb /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/x86_64-redhat-linux-gnu/src/tbb/CMakeFiles/tbb.dir/DependInfo.cmake --color=
    make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/x86_64-redhat-linux-gnu'
    make  -f src/tbb/CMakeFiles/tbb.dir/build.make src/tbb/CMakeFiles/tbb.dir/build
    make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/x86_64-redhat-linux-gnu'
    [  0%] Building CXX object src/tbb/CMakeFiles/tbb.dir/arena.cpp.o
    cd /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/x86_64-redhat-linux-gnu/src/tbb && /usr/bin/g++ -D__TBB_BUILD -D__TBB_USE_ITT_NOTIFY -I/home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/src/tbb/../../include -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -DNDEBUG -fPIC -MMD -flifetime-dse=1 -Wall -Wextra -Werror -Wfatal-errors -mrtm -pthread -std=c++11 -o CMakeFiles/tbb.dir/arena.cpp.o -c /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/src/tbb/arena.cpp
    In file included from /usr/lib/gcc/x86_64-redhat-linux/11/include/x86gprintrin.h:81,
                     from /usr/lib/gcc/x86_64-redhat-linux/11/include/immintrin.h:27,
                     from /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/src/tbb/../../include/oneapi/tbb/detail/_machine.h:33,
                     from /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/src/tbb/../../include/oneapi/tbb/detail/_utils.h:26,
                     from /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/src/tbb/task_dispatcher.h:20,
                     from /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/src/tbb/arena.cpp:17:
    /home/tkloczko/rpmbuild/BUILD/oneTBB-2021.2.0/src/tbb/scheduler_common.h: In function ‘tbb::detail::r1::prolonged_pause()’:
    /usr/lib/gcc/x86_64-redhat-linux/11/include/waitpkgintrin.h:53:1: error: inlining failed in call to ‘always_inline’ ‘_tpause(unsigned int, unsigned long long)’: target specific option mismatch
       53 | _tpause (unsigned int __A, unsigned long long __B)
          | ^~~~~~~
    compilation terminated due to -Wfatal-errors.
    make[2]: *** [src/tbb/CMakeFiles/tbb.dir/build.make:98: src/tbb/CMakeFiles/tbb.dir/arena.cpp.o] Error 1
    
    bug 
    opened by kloczek 31
  • Add option to build TBB statically

    Add option to build TBB statically

    Hi all,

    I appreciate the new CMake integration, it makes building TBB via add_subdirectory much more streamlined. I would like to build TBB into my app as a static library, in order to avoid having to move dll around on Windows. However, the new CMake hardcode the tbb lib to be a SHARED library: https://github.com/oneapi-src/oneTBB/blob/51c0b2f742920535178560f31c6e91065bf87b41/src/tbb/CMakeLists.txt#L15

    It would be better to not put any keyword here, and let the user decide whether they want to build TBB as a shared/static library (CMake will graciously switch based on the value of the flag BUILD_SHARED_LIBS).

    I know that it is not recommended to build TBB as a static library, due to possible duplicated scheduler. However, if I am building all my dependencies from source into the same app, then I should be able to build TBB as a static library. The hassle of moving dll around on Windows is simply not worth it.

    enhancement 
    opened by jdumas 28
  • The test_limiter_node test is hanging indefinitely on CMAKE_BUILD_TYPE=Release (gcc-9, gcc-8)

    The test_limiter_node test is hanging indefinitely on CMAKE_BUILD_TYPE=Release (gcc-9, gcc-8)

    Commit: https://github.com/oneapi-src/oneTBB/commit/2dba2072869a189b9fdab3ffa431d3ea49059a19

    With CMAKE_BUILD_TYPE=relwithdebinfo the test_limiter_node test work fine:

    42: Test command: /home/phprus/tmp/4/6/tbb/oneTBB-2dba2072869a189b9fdab3ffa431d3ea49059a19/build/gcc8/gnu_8.2_cxx11_64_relwithdebinfo/test_limiter_node "--force-colors=1"
    42: Test timeout computed to be: 9.99988e+06
    42: [doctest] doctest version is "2.3.5"
    42: [doctest] run with "--help" for options
    42: ===============================================================================
    42: [doctest] test cases:      6 |      6 passed |      0 failed |      0 skipped
    42: [doctest] assertions: 217212 | 217212 passed |      0 failed |
    42: [doctest] Status: SUCCESS!
     42/129 Test  #42: test_limiter_node ........................   Passed    0.33 sec
    

    With CMAKE_BUILD_TYPE=Release and gcc-9, gcc-8 the test_limiter_node test is hanging indefinitely:

    42: Test command: /home/phprus/tmp/4/6/tbb/oneTBB-2dba2072869a189b9fdab3ffa431d3ea49059a19/build/gcc9/gnu_9.3_cxx11_64_release/test_limiter_node "--force-colors=1"
    42: Test timeout computed to be: 9.99988e+06
    42: [doctest] doctest version is "2.3.5"
    42: [doctest] run with "--help" for options
    42: ===============================================================================
    42: /home/phprus/tmp/4/6/tbb/oneTBB-2dba2072869a189b9fdab3ffa431d3ea49059a19/test/tbb/test_limiter_node.cpp:515:
    42: TEST CASE:  Message is released if successor does not accept
    42:
    42: /home/phprus/tmp/4/6/tbb/oneTBB-2dba2072869a189b9fdab3ffa431d3ea49059a19/test/tbb/test_limiter_node.cpp:515: FATAL ERROR: test case CRASHED: SIGTERM - Termination request signal
    42:
    42: ===============================================================================
    42: [doctest] test cases:      4 |      3 passed |      1 failed |      2 skipped
    42: [doctest] assertions: 217181 | 217181 passed |      0 failed |
    42: [doctest] Status: FAILURE!
     42/129 Test  #42: test_limiter_node ........................***Exception: Child terminated  8.75 sec
    
    bug 
    opened by phprus 26
  • Clang thread sanitizer (TSan) reports many errors, most tests fail

    Clang thread sanitizer (TSan) reports many errors, most tests fail

    I built TBB from git master using Clang's -fsanitize=thread option:

    https://clang.llvm.org/docs/ThreadSanitizer.html

    The result is that almost all the unit tests fail.

    Are these false positives or true positives?

    If false positives, is there an 'official' suppression list?

    opened by seanm 25
  • task.h is deprecated, alternative?

    task.h is deprecated, alternative?

    With a recent version of TBB I am getting the warning

    /usr/include/tbb/task.h:21:139: note: #pragma message: TBB Warning: tbb/task.h is deprecated.
    For details, please see Deprecated Features appendix in the TBB reference manual.
    

    but I am unable to find information about the deprecation or an alternative to using the class task. What is the proposed path forward?

    opened by tjhei 22
  • Controlling where TBB threads are running

    Controlling where TBB threads are running

    I have been looking for a way to assign TBB threads to specific hardware cores, but after some research I saw that TBB does not give any control to where the TBB threads are running. My current project has the requirement of assigning the TBB threads to specific CPU cores and as I found at software intel forums and online, many more people have the same requirement. There is a way to do it with thread local storage: https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/294546 But this requires each task to check its thread local storage and determine whether the current thread is pinned to a hardware core, making it costly. It also requires some sort of synchronization among threads so that to assign the right core IDs. My solution is doing the thread pinning at thread creation within src/rml/serve/thread_monitor.h. I am using compare-and-swap instruction to access a shared CPU number array and make each thread get one of these numbers. May I open a pull request to present my solution? Please let me know what you think. Thanks, Dimos

    opened by dimstamat 20
  • Tasks are enqueued but not executed in TBB

    Tasks are enqueued but not executed in TBB

    Hi We are running into TBB scheduler issue where we see tasks are getting enqueued but not executed. we see same issue with both TBB version: TBB 2018 Update 5 and TBB 4.3 initial version. In our application, aster thread instantiates Scheduler with thread count as 8. priority is same for all tasks. and tbb::task::enqueue() method is used for enqueuing task. we use one tbb worker thread for i/o and it runs forever. in current state, number of active threads in arena is 1 and which is used for i/o . as per the TBB state , new work is available and my_max_workers_requested is 8 but server my slack value is set to -1, all worker threads ( except one used for i/o) are in commit wait state waiting for wake up signal. it never recovered from this state. can you please share some details on what could be wrong.

    Arena object elements: my_task_stream = {tbb::internal::no_copy = {tbb::internal::no_assign = {}, }, population = {0, 26300, 0}, lanes = {0x3169e68,

            0x3177b38, 0x317a948}, N = 16}, my_max_num_workers = 8, my_num_workers_requested = 8,
    
        my_pool_state = {<tbb::internal::atomic_impl_with_arithmetic<unsigned long, unsigned long, char>> = {<tbb::internal::atomic_impl<unsigned long>> = {my_storage = {
    
                my_value = 18446744073709551615}}, <No data fields>}, <No data fields>},
    

    Thanks in advance, Sangarshan

    opened by Sangarshan 20
  • Provide a way to handle thread creation errors

    Provide a way to handle thread creation errors

    We are using TBB in an application that may potentially work in high load conditions, and may occasionally hit the system limits on the number of threads and processes. In our code base we handle this condition gracefully, but TBB internally does not handle this and simply terminates the process in case of thread creation failure. We need a way to handle TBB thread creation failures.

    For this, we need to specify explicitly the point when the internal threads are created. There used to be task_scheduler_init class that could be used for this purpose, but it is currently deprecated. We would be fine if this class was un-deprecated and modified to indicate thread creation errors e.g. with an exception. A different class with the same effect would be fine as well.

    Also, side note, exit(1) is not the proper way to abort the application as it terminates without a signal. The preferred way to abort is abort(), as it generates a signal, which can be caught and processed e.g. by collecting a backtrace, which we do in our application.

    enhancement 
    opened by Lastique 19
  • the tbb has core

    the tbb has core

    tbb version: https://github.com/intel/tbb/releases/tag/2019_U9 tbb code: __TBB_ASSERT( my_state==st_quit || !my_next, "Thread monitor missed a spurious wakeup?" ); core dump: #0 0x00007fa32a065387 in raise () from /lib64/libc.so.6 #1 0x00007fa32a066a78 in abort () from /lib64/libc.so.6 #2 0x0000000000e74bf6 in tbb::assertion_failure (filename=0x1065850 "../../src/tbb/private_server.cpp", line=274, expression=0x10658a9 "my_state==st_quit || !my_next", comment=0x1065880 "Thread monitor missed a spurious wakeup?") at ../../src/tbb/tbb_assert_impl.h:72 #3 0x0000000000e7336e in tbb::internal::rml::private_worker::run (this=0x7fa3141e3400) at ../../src/tbb/private_server.cpp:274 #4 0x0000000000e73128 in tbb::internal::rml::private_worker::thread_routine (arg=0x7fa3141e3400) at ../../src/tbb/private_server.cpp:219 #5 0x00007fa32ae28ea5 in start_thread () from /lib64/libpthread.so.0 #6 0x00007fa32a12d96d in clone () from /lib64/libc.so.6

    opened by bihailong 0
  • Shwetajh/doctest1

    Shwetajh/doctest1

    Description

    Doctest update to version 2.4.9

    Fixes # - issue number(s) if exists

    • [ ] - git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details)

    Type of change

    Choose one or multiple, leave empty if none of the other choices apply

    Add a respective label(s) to PR if you have permissions

    • [ ] bug fix - change that fixes an issue
    • [ ] new feature - change that adds functionality
    • [ ] tests - change in tests
    • [ ] infrastructure - change in infrastructure and CI
    • [ ] documentation - documentation update

    Tests

    • [ ] added - required for new features and some bug fixes
    • [x] not needed

    Documentation

    • [ ] updated in # - add PR number
    • [ ] needs to be updated
    • [x] not needed

    Breaks backward compatibility

    • [ ] Yes
    • [x] No
    • [ ] Unknown

    Notify the following users

    List users with @ to send notifications

    Other information

    opened by JhaShweta1 2
  • Implement notifications about idle threads

    Implement notifications about idle threads

    Description

    Extend the task_scheduler_observer interface with two new methods:

    • on_scheduler_idle(), invoked when a thread does not have any tasks to run and fails to steal any other tasks, before it goes to sleep;
    • on_scheduler_active(), invoked when an idle thread finds a new task to run, after it wakes from sleeping.

    Extend the observer_list to notify all observer proxies about the idle and active thread states.

    Extend the task_dispatcher to notify about idle and active threads before and after they go to sleep.

    Fixes #992

    • [x] - git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details)

    Type of change

    • [ ] bug fix - change that fixes an issue
    • [x] new feature - change that adds functionality
    • [ ] tests - change in tests
    • [ ] infrastructure - change in infrastructure and CI
    • [ ] documentation - documentation update

    Tests

    • [ ] added - required for new features and some bug fixes
    • [ ] not needed

    Documentation

    • [ ] updated in # - add PR number
    • [x] needs to be updated
    • [ ] not needed

    Breaks backward compatibility

    • [ ] Yes
    • [ ] No
    • [x] Unknown

    Does not break API compatibility, may break ABI compatibility for classes that inherit from task_scheduler_observer.

    Notify the following users

    @pavelkumbrasev

    Other information

    opened by fwyzard 0
  • callback on idle threads

    callback on idle threads

    Hi, I am looking for a way to keep track of when and how long any TBB thread stays idle within (the framework used by) my application.

    After reading a bit of the oneTBB code, my understanding is that I can consider a thread to be idle when it is in the stealing loop at https://github.com/oneapi-src/oneTBB/blob/v2021.8.0-rc1/src/tbb/task_dispatcher.h#L193-L232: https://github.com/oneapi-src/oneTBB/blob/bd619c54a6ed475ee404af2dd033f6f353ecf47f/src/tbb/task_dispatcher.h#L193-L232

    Is this reasonable? That is,

    • is it OK to consider a thread as idle, that is, not executing any task, while it is in that loop ?
    • are there other places where an idle thread could spend its time ?

    As for a way to notify my application when a thread is idle, I have been thinking to extend the task_scheduler_observer adding two methods on_thread_idle() and on_thread_active().

    Does this seem like a good approach ?

    Thanks for any comments and suggestions - next I'll see if I can implement something along these lines.

    .Andrea

    enhancement 
    opened by fwyzard 10
  • High CPU observed with TBB when the loop size is increased.

    High CPU observed with TBB when the loop size is increased.

    Hi Team, Below is my code where I have used task_arena implementation as suggested in https://github.com/oneapi-src/oneTBB/issues/105 since i was facing similar high CPU issues as discussed in the link. In the below code, tbb::info::default_concurrency() and tbb::this_task_arena::max_concurrency() evaluates to 8 in my system.

        **tbb::global_control global_limit(tbb::global_control::max_allowed_parallelism, tbb::info::default_concurrency());
        int max_threads = tbb::this_task_arena::max_concurrency() 
                                     + tbb::info::default_concurrency() /* the number of IO threads to reserve slots inside the arena */;
        tbb::task_arena arena(max_threads, tbb::info::default_concurrency());
        arena.execute([&] {
            tbb::this_task_arena::isolate([&] {
                tbb::parallel_for(tbb::blocked_range2d<int>(kSize, (height - kSize), kSize, (width - kSize)),
                    [&](tbb::blocked_range2d<int> r)
                    {
                               //parallel operation
                    });
                });
            });**
    

    I could see with above code, application's CPU varies from 40%-60% when the parallel operation is performed. I don't find exact usage from the samples of this repo or documentation of TBB.

    QUESTIONS:

    1. Am I doing something incorrect here or can the above code be improved ?
    2. As we have reserved the tbb::info::default_concurrency() in task_arena, why do we still see the increase in CPU when the loop size increases?
    opened by Dush27 13
  • Fix compilation error on MacOS

    Fix compilation error on MacOS

    contrib/libs/tbb/include/tbb/../oneapi/tbb/detail/_config.h:385:55: error: invalid token at start of a preprocessor expression
              (_WIN32 || _WIN64 || __APPLE__ || (__unix__ && !__ANDROID__))
                                                          ^
    1 error generated.
    

    at the time the following error is reported by clang-14. This PR adds a workaround for the case.

    Description

    Add a comprehensive description of proposed changes

    Fixes # - issue number(s) if exists

    • [ ] - git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details)

    Type of change

    Choose one or multiple, leave empty if none of the other choices apply

    Add a respective label(s) to PR if you have permissions

    • [ ] bug fix - change that fixes an issue
    • [ ] new feature - change that adds functionality
    • [ ] tests - change in tests
    • [ ] infrastructure - change in infrastructure and CI
    • [ ] documentation - documentation update

    Tests

    • [ ] added - required for new features and some bug fixes
    • [ ] not needed

    Documentation

    • [ ] updated in # - add PR number
    • [ ] needs to be updated
    • [ ] not needed

    Breaks backward compatibility

    • [ ] Yes
    • [ ] No
    • [ ] Unknown

    Notify the following users

    List users with @ to send notifications

    Other information

    opened by georgthegreat 0
Releases(v2021.7.0)
Owner
oneAPI-SRC
oneAPI open source projects
oneAPI-SRC
oneAPI DPC++ Library (oneDPL) https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-library.html

oneAPI DPC++ Library (oneDPL) The oneAPI DPC++ Library (oneDPL) aims to work with the oneAPI DPC++ Compiler to provide high-productivity APIs to devel

oneAPI-SRC 646 Dec 29, 2022
A library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies.

Fiber Tasking Lib This is a library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies. Dependenc

RichieSams 796 Dec 30, 2022
experimental cooperative threading library for gba in pure C

gba-co-thread Experimental cooperative threading library for Gameboy Advance in pure C. See co_thread.h and co_thread.c for the tiny threading library

Evan Bowman 15 Oct 25, 2022
KRATOS Multiphysics ("Kratos") is a framework for building parallel, multi-disciplinary simulation software

KRATOS Multiphysics ("Kratos") is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.

KratosMultiphysics 774 Dec 29, 2022
oneAPI Threading Building Blocks (oneTBB)

oneAPI Threading Building Blocks oneAPI Threading Building Blocks (oneTBB) lets you easily write parallel C++ programs that take full advantage of mul

oneAPI-SRC 4.2k Jan 3, 2023
CMake find module for Intel Threading Building Blocks

FindTBB Module FindTBB is a CMake find package module for Intel® Threading Building Blocks (TBB). Usage The signature of the TBB find module in CMake

Justus Calvin 84 Dec 3, 2022
oneAPI DPC++ Library (oneDPL) https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-library.html

oneAPI DPC++ Library (oneDPL) The oneAPI DPC++ Library (oneDPL) aims to work with the oneAPI DPC++ Compiler to provide high-productivity APIs to devel

oneAPI-SRC 646 Dec 29, 2022
Provide building blocks (software, hardware and algorithms) for implementing SLAM using small sensors

RemoteSLAM The purpose of this repo is to provide the building blocks (software drivers, hardware and algorithms) for implementing SLAM systems using

Autonomous Drones Lab, Tel Aviv University 38 Jan 20, 2022
Building blocks for modern GNOME applications

Adwaita Building blocks for modern GNOME applications. License Libadwaita is licensed under the LGPL-2.1+. Building We use the Meson (and thereby Ninj

Muqtadir 3 Jan 19, 2022
Speed-up Version of ORB_SLAM3 by TBB library

ORB-SLAM3 Custom version, January 31st, 2022 Parallelize ORB feature extraction by TBB library, along with new update in V1.0, the speed is over real-

Long Vuong 12 Dec 7, 2022
oneAPI Deep Neural Network Library (oneDNN)

oneAPI Deep Neural Network Library (oneDNN) This software was previously known as Intel(R) Math Kernel Library for Deep Neural Networks (Intel(R) MKL-

oneAPI-SRC 3k Jan 6, 2023
oneAPI Data Analytics Library (oneDAL)

Intel® oneAPI Data Analytics Library Installation | Documentation | Support | Examples | Samples | How to Contribute Intel® oneAPI Data Analytics Libr

oneAPI-SRC 534 Dec 30, 2022
oneAPI Data Analytics Library (oneDAL)

Intel® oneAPI Data Analytics Library Installation | Documentation | Support | Examples | Samples | How to Contribute Intel® oneAPI Data Analytics Libr

oneAPI-SRC 534 Dec 30, 2022
A library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies.

Fiber Tasking Lib This is a library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies. Dependenc

RichieSams 796 Dec 30, 2022
experimental cooperative threading library for gba in pure C

gba-co-thread Experimental cooperative threading library for Gameboy Advance in pure C. See co_thread.h and co_thread.c for the tiny threading library

Evan Bowman 15 Oct 25, 2022
The basics of threading a process. How to make threads. Discovering the mutex.

Dining-Philosopher-Problem! The basics of threading a process. How to make threads. Discovering the mutex. In C.. Решение задачи об обедающих философа

Yuriy Koroliov 1 Jan 10, 2022
An experimental sprite rendering setup utilizing SSBO's, Threading, EnTT reactive systems, and array-textures based sprite caching.

entt-reactive An experimental sprite rendering setup utilizing pooled SSBO's, a multithreaded setup based on Even Todd's The Poor Man's Threading Arch

Jackie Fuchs 7 Apr 29, 2022
Growtopia Server Using Code Blocks IDE

Growtopia Server First Growtopia Private Server made with ENet by GrowtopiaNoobs. This project has been compiled with Codeblocks This project has been

GuckTube YT 9 Dec 25, 2022