Intel® Threading Building Blocks

why do I have to define an array of mutexes?

Hello,

In the sample programs for TBB there is an example for the use of concurrent_priority_queue, a program to find the shortest part in a tree,  the program used is shortpath.cpp In the programthere is an array defined as spin_mutex *locks, later in the function void InitializeGraph() the array is created as locks = new spin_mutex[N] where N is the number of vertices I want on the tree. If I want 20000 vertices I have to define 20000 mutexes

Need a guide line for using TBB in C++11 compiler

I have read TBB reference but I still have no clue how to use TBB in C++11 compiler properly.

In my C++11 compatible compiler,

1. Should I use std::thread or include tbb own std thread class?

2. Can I mix compiler built-in threading library with tbb? Eg, Can std::mutex work in tbb::parallel_for?

I found a forum thread in 2012 but I can't figure it out the conclusion. Can anyone provide a guide line? For sure, I can write a test case to give it a try. But I'd like to hear it from tbb developers.

TIA

32 bit installation of tbb in a 64 bit linux machine

 

I am trying to install tbb from source as 32 bit in a 64 bit linux machine. Can anyone guide how to make tbb as 32 bit forcefully in a 64 bit machine.

I already tried this.

 CONFIG: cfg=debug arch=ia32 compiler=gcc target=linux runtime=cc4.1.2_libc2.5_kernel2.6.18

but still the -m64 flag is appearing in the compilation, I need to change it to -m32.

 

Very disappointing behavior (I would say bug). See example

bool func()
{
	bool dummy = false;

	tbb::combinable<int> res( 0 );

	tbb::enumerable_thread_specific<int> tls( 0 );

	tbb::parallel_for(0, 1000, [&](int i) {
		int & local_i = tls.local();

		local_i = 1;

		tbb::parallel_for(0, 1000, [&](int k) {
			dummy = true;
		} );

		res.local() += local_i;

		local_i = 0;
	} );

	const int iRes = res.combine( std::plus<int>() );

	printf("iRes == %d\n", iRes);

	return (iRes == 1000);
}

Concurrent_unordered containers my_number_of_buckets is uninitialized in move constructor and move assignment operator

Move operations in concurrent_unordered containers lead to an invalid container. Not sure if GitHub issues get any visibility yet. So I am just adding my GitHub issue to the forum. https://github.com/01org/tbb/issues/7

Subscribe to Intel® Threading Building Blocks