Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2479 Discussions

how to install? how to use concurrent_bounded_queue under Windows / VS2012?

Oleg_V_
Beginner
692 Views

I'm completely newbie to TBB, i want to use "concurrent_bounded_queue" in my application (i do not plan to use any other parts of TBB if this matters)

I've downloaded and extracted TBB, now I have tbb43_20140724oss folder on my PC.

What next steps should I do to use "concurrent_bounded_queue"  from VS2012 (MS VC++ compiler)?

0 Kudos
1 Solution
jiri
New Contributor I
692 Views

In general, you have to do three things:

1. make sure the TBB headers are found by the compiler, i.e., making sure the include paths also contain tbb43_20140724oss/include. Note that it should really by that folder, not the tbb subfolder of the include, because you should put that tbb as part of the include, i.e., #include <tbb/concurrent_queue.h>

2. make sure the right lib files are found by the linker. The libs are found in tbb43_20140724oss/lib, but you also have to choose the right architecture and compiler

3. link you binary with the tbb libs.

However, it is possible, that in your case, you could get away with just 1. It is possible, that the concurrent_bounded_queue is (as a template) completely implemented in the headers, as well as all the other classes used by the queue.

View solution in original post

0 Kudos
4 Replies
jiri
New Contributor I
693 Views

In general, you have to do three things:

1. make sure the TBB headers are found by the compiler, i.e., making sure the include paths also contain tbb43_20140724oss/include. Note that it should really by that folder, not the tbb subfolder of the include, because you should put that tbb as part of the include, i.e., #include <tbb/concurrent_queue.h>

2. make sure the right lib files are found by the linker. The libs are found in tbb43_20140724oss/lib, but you also have to choose the right architecture and compiler

3. link you binary with the tbb libs.

However, it is possible, that in your case, you could get away with just 1. It is possible, that the concurrent_bounded_queue is (as a template) completely implemented in the headers, as well as all the other classes used by the queue.

0 Kudos
Oleg_V_
Beginner
692 Views

Thank you for detailed response.

I've just included <tbb/concurrent_queue.h> (not used it even!) and compiler already asks me for tbb.lib, so I have to use libs too.

I'm using VS2012 and don't know which lib folder to use vc11 or vc11_ui. I just tried "vc11" and it works

Also to execute my program I should add dll's from "bin" folder, of course.

After that everything works fine, so far I'm able to compile and execute my program.

Can I link tbb statically (how?) What is the difference between vc11 and vc11_ui?

  Thanks!

0 Kudos
Oleg_V_
Beginner
692 Views

Also it's interesting to know what is the difference between

void     push (const T &source) Enqueue an item at tail of queue. 
and
void     push (T &&source) Move an item at tail of queue. 

Probably it makes sense to document the difference between these two functions.

0 Kudos
RafSchietekat
Valued Contributor III
692 Views

The difference between & and && is a general C++11 issue and needs no further explanation here, although it is strange to see "enqueue" vs. "move" because both are enqueued.

0 Kudos
Reply