GDCE: Parallelize your Games with Intel® TBB

Introduction to Intel® Threading Building Blocks

This video introduces you to Intel® Threading Building Blocks and provide some examples of how to use it.

An Introduction to the Intel® TBB Flow Graph

This video will introduce you to the flow graph feature in Intel® Threading Building Blocks (Intel® TBB) and provide examples of how it can be used. The flow graph feature provides a flexible and convenient API for parallel reactive and streaming applications.

Optimizing Game Architecture with Intel® TBB

Brad Werth, Intel Senior Software Engineer, spoke to game developers at GDC about how the cross-platform library, Intel® TBB, can enhance game performance.

Using Intel® Threading Building Blocks

Introduction to using the parallel_for template from Intel® TBB. Follow along with the sample code from the Add Parallelism Evaluation Guide.

GDCE: Parallelize your Games with Intel® TBB

During GDC, we had the opportunity to talk to Dr. Mario Deilmann from Intel about Intel® TBB and why game developers should consider using this template library. Moreover we learnt what the main benefits are of Intel® TBB and how it can help developers to parallelize their games.

Why Use Intel® TBB?

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.


What is it?

Widely used C++ template library for task parallelism

 


Primary features
  • Parallel algorithms and data structures
  • Scalable memory allocation and task scheduling

 


Reasons to use
  • Rich feature set for general purpose parallelism
  • C++; Windows*, Linux*, OS X* and other OSes

Learn More


Latest Posts

News
Forums
April 18, 2013: Join the TBB Flow Graph Webinar!

Whether you are new to TBB or a TBB expert, come hear Michael Voss, Architect of the Intel®  TBB flow graph, talk about the useful flow graph feature on May 7th @ 9:00 AM PST.  Register here.

 
Title: Creating parallel reactive and streaming applications with the Intel® Threading Building Blocks (Intel® TBB) flow graph
The  flow graph feature available in Intel® Threading Building Blocks (Intel® TBB) allows users to easily create both dependence graphs and reactive, messaging passing graphs that execute on top of Intel TBB tasks.  Users programmatically create nodes and edges that express the computations performed by their application and the dependencies between these computations.  The Intel TBB library is then able to exploit the parallelism that is implicit in the graph structure, and the resources available on the target machine, to speed up the application.  Flow graphs are applicable across a wide range of domains, including media, gaming, finance, portable/low-power computing and technical computing.   This 1-hour webinar will present a quick introduction to the Intel® Threading Building Blocks library, followed by a more complete description of the flow graph feature.  Attendees will be walked through the details of a “Hello World” flow graph, and then will be shown several more complex examples that demonstrate the power and flexibility of this parallel programming abstraction. 
 
Check out other webinars coming up this spring.
April 1, 2013: Intel® TBB for Android - New Community Preview Feature!

The latest Intel® TBB 4.1 update 3 contains binary files for Android* application development.  Access the files by downloading the Linux* OS package on the Download page.  Also check out the IDZ blog about how to start using Intel TBB library with Android applications.

Feedback? Please let us know.  

March 28, 2013: Intel® TBB 4.1 update 3 released

Files are available in the stable releases section. Download it!

Find out more about the changes on our forum.

I'm a newbie at Intel TBB. I'm using concurrent_vector and concurrent_hash_map. I haven't allocate anything using new, so may be there is no memory leak. But I'm getting bad allocation exception. I'm using 32 bit Linux Mint 14 on VMWare workstation which has 3GB of memory. How can I debug is my program leaking memory or it's just the program can't allocate enough memory?

Hi,

I've tried to compile and run this code with tbb 4.1:

http://software.intel.com/sites/products/documentation/doclib/tbb_sa/help/reference/flow_graph/message_flow_graph_example.htm

But found some errors, the changes I did to make it work was to replace:

broadcast_node<int> input;

for

broadcast_node<int> input(g);

and 

make_edge( squarer, std::get<0>( join.inputs() ) );
make_edge( cuber, std::get<1>( join.inputs() ) );

for:

make_edge( squarer, std::get<0>( join.input_ports() ) );
make_edge( cuber, std::get<1>( join.input_ports() ) );

With that I could compile with tbb 4.1 

Regards,

Internal Tags:  graph

I'm evaluating the commercial version of TBB with Intel Composer XE 2013 on Mac OS X 10.8.3.

My application is built with clang and needs to link with libc++.  When I also link in TBB (debug or release dylib) the application crashes whenever it tries to destruct a std::runtime_error exception that it previously constructed (doesn't need to throw it).

The crash occurs because the runtime_error destructor in libstdc++ is incorrectly being executed instead of the one in libc++ that my application linked with.

Please note that this is not an ABI incompatibility problem due to using libc++ and libstdc++ in the same process.  I'm not throwing the exception (or passing any other library type) across module boundaries.

The libtbb that is bundled with Composer XE 2013 appears to be built with gcc and depends on libstdc++.  The problem appears to be that the dynamic linker loads TBB and hence libstdc++ but then resolves the std::runtime_error destructor from libstdc++ instead of the one in libc++.  Since the runtime_error object was constructed using libc++ and then attempts to destruct using libstdc++, it's not surprising that a crash occurs since the implementations are different.

I can only reproduce the problem with std::runtime_error.  Destructing other exceptions (including ones derived from runtime_error) work fine.  In addition, I can only reproduce the problem when linking TBB.  I tried to create my own shared library that mimics what TBB is doing (and depends on libstdc++) but that worked fine.

Here is a sample program that reproduces the problem:

#include <stdexcept>
#include <iostream>
int main()
{
 {
 std::runtime_error rt("hi");
 std::cout << rt.what() << std::endl;
 }
 // Crash at end of scope when rt destructs
 return 0;
}

Build it like this:

$ clang -v
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix

TBB=/opt/intel/composer_xe_2013.1.119/tbb/lib/libtbb.dylib
clang++ -stdlib=libc++ myprog.cpp $TBB -o myprog
./myprog

This is the output:

hi
myprog(2226) malloc: *** error for object 0x7feb694039ec: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6 ./myprog

If you run under a debugger you'll see the following stack trace:

0 __kill 0x7fff8754bd46 
1 abort 0x7fff87472df0 
2 free 0x7fff874469b9 
3 std::runtime_error::~runtime_error 0x7fff8d425526 
4 main 0x1000011b7

The address of the runtime_error destructor matches that of libstdc++ instead of the one in libc++.

One obvious solution would be to use a version of TBB that depends on libc++ instead of libstdc++.  Is there a commercial version of TBB available built with libc++?

I'd appreciate any advice or workarounds.

Gamescom 2012 – PC Gaming comes out swinging! So… I just got back from GDC-Europe, and Gamescom. Both were fantastic events. My only regret is that I couldn’t stay a day or two longer. For GDC-Europe the highlight for me was Victor Kisliy’s (CEO Wargaming.net) Keynote on the Free to Play business model. Definitely more [...]
  In preparation for the Microsoft Windows 8* launch, Intel has updated the OpenCL* toolkits for application developers –Intel® SDK for OpenCL* Applications 2013 Beta. In addition to Windows 8*, the Intel SDK for OpenCL Applications Beta now supports OpenCL 1.2 API previews on CPU and other features such as a new kernel builder and [...]
Yeah… I know the title sounds sensationalistic. However; the news that broke last week about Windows Phone 8 (aka WP8) I believe is by FAR a bigger story than what it’s being given credit for. Why? In short it’s simply this. WP8 is running on a kernel layer shared with Win 8 and Win RT. [...]
Intel TBB provided us with optimized code that we did not have to develop or maintain for critical system services. I could assign my developers to code what we bring to the software table - crowd simulation software.
Michaël Rouillé
CTO, Golaem

Documentation

User Guide
Reference Manual
Stable Documentation
Latest Documentation
Doxygen
Release Notes
CHANGES file

Resources

TBB Forums
Code Samples
FAQs
Licensing

 

Structured Parallel Programming:
Patterns for Efficient Computation

Buy Now

Intel Threading Build Blocks:
Outfitting C++ for Multi-Core Processor Parallelism

Buy Now