Open main menu

CDOT Wiki β

Changes

J&J

4,685 bytes added, 06:00, 11 December 2016
Introduction to Intel Threading Building Blocks
== '''Introduction to Intel Threading Building Blocks''' ==
 
Intel Threading Building Blocks offers a rich and complete approach to expressing parallelism in a C++ program. It is a library that helps you leverage multi-core processor
performance without having to be a threading expert. Threading Building Blocks is not just a threads-replacement library; it represents a higher-level, taskbased
parallelism that abstracts platform details and threading mechanisms for performance and scalability.
'''Why Use It:'''Intel® Threading Building Blocks (Intel® TBB) lets you easily write parallel C++ programs that take full advantage of multicore performance, that are portable and composable, and that have future-proof scalability.
Intel TBB uses generic programming. The essence of generic programming is writing the best possible algorithms with the fewest constraints. The C++ Standard Template Library (STL) is a good example of generic programming in which the interfaces are specified by requirements on types.
'''Threading Building Blocks enables you to specify tasks instead of threads'''
 
Most threading packages require you to create, join, and manage threads. Programming directly in terms of threads can be tedious and can lead to inefficient programs because threads are low-level, heavy constructs that are close to the hardware. Direct programming with threads forces you to do the work to efficiently map logical tasks onto threads. In contrast, the Threading Building Blocks runtime library automatically schedules tasks onto threads in a way that makes efficient use of processor resources. The runtime is very effective at loadbalancing the many tasks you will be specifying. By avoiding programming in a raw native thread model, you can expect better portability, easier programming, more understandable source code, and better performance and scalability in general. Indeed, the alternative of using raw threads directly would amount to programming in the assembly language of parallel programming. It may give you maximum flexibility, but with many costs.
 
'''Threading Building Blocks targets threading for performance'''
 
Most general-purpose threading packages support many different kinds of threading, such as threading for asynchronous events in graphical user interfaces. As a result, general-purpose packages tend to be low-level tools that provide a foundation, not a solution. Instead, Threading Building Blocks focuses on the particular goal of parallelizing computationally intensive work, delivering higher-level, simpler solutions.
 
'''Threading Building Blocks is compatible with other threading packages'''
 
Threading Building Blocks can coexist seamlessly with other threading packages. This is very important because it does not force you to pick among Threading
Building Blocks, OpenMP, or raw threads for your entire program. You are free to add Threading Building Blocks to programs that have threading in them
already. You can also add an OpenMP directive, for instance, somewhere else in your program that uses Threading Building Blocks. For a particular part of your program, you will use one method, but in a large program, it is reasonable to anticipate the convenience of mixing various techniques. It is fortunate that Threading Building Blocks supports this.
Using or creating libraries is a key reason for this flexibility, particularly because libraries are often supplied by others. For instance, Intel’s Math Kernel Library (MKL) and Integrated Performance Primitives (IPP) library are implemented internally using OpenMP. You can freely link a program using Threading Building Blocks with the Intel MKL or Intel IPP library.
 
'''Threading Building Blocks emphasizes scalable, data-parallel programming'''
 
Breaking a program into separate functional blocks and assigning a separate
thread to each block is a solution that usually does not scale well because, typically,
the number of functional blocks is fixed. In contrast, Threading Building
Blocks emphasizes data-parallel programming, enabling multiple threads to
work most efficiently together. Data-parallel programming scales well to larger
numbers of processors by dividing a data set into smaller pieces. With dataparallel
programming, program performance increases (scales) as you add processors.
Threading Building Blocks also avoids classic bottlenecks, such as a global
task queue that each processor must wait for and lock in order to get a new
task.
 
 
'''Threading Building Blocks relies on generic programming'''
 
Traditional libraries specify interfaces in terms of specific types or base classes.
Instead, Threading Building Blocks uses generic programming, which is defined
in Chapter 12. The essence of generic programming is to write the best possible
algorithms with the fewest constraints. The C++ Standard Template Library
(STL) is a good example of generic programming in which the interfaces are
specified by requirements on types. For example, C++ STL has a template function
that sorts a sequence abstractly, defined in terms of iterators on the
sequence. Generic programming enables Threading Building Blocks to be flexible yet efficient.
The generic interfaces enable you to customize components to your
specific needs.
 
 
 
 
 
 
 
Intel® Threading Building Blocks (Intel® TBB) makes parallel performance and scalability easily accessible to software developers who are writing loop and task based applications. Developers can build robust applications that abstract platform details and threading mechanisms while achieving performance that scales with increasing core count.
== Rich Feature Set for Parallelism ==
10
edits