Get TBB going by a single click!

By Elena Gavrina (Intel) (1 posts) on July 7, 2008 at 4:28 am

Have you ever confronted compiler or linker errors while building a Intel(R) Threading Building Blocks (TBB) based application with Microsoft* Visual Studio*? What was the problem there? Perhaps the path to the TBB headers was absent? Or TBB libraries were not added to the project settings? Or maybe different TBB versions were mixed? Have you ever thought it would be great to have a tool that could configure Visual Studio projects to use TBB by the single press of a button, so you would avoid all that annoying errors?

The great news for you: such a tool already exists and available at the ‘Downloads | Extras' page under ‘msvs_plugin' link. This tool, the TBB integration plug-in, provides a simple mechanism to set up the use of TBB in Microsoft* Visual C++* projects. The plug-in adds the TBB paths into Visual C++ project settings and properly specifies the TBB libraries to link with. It works with all Visual Studio versions that TBB supports, namely Visual Studio 2003, 2005 and 2008, but keep in mind that the tool doesn't work with Visual Studio Express Editions because those don't support add-in projects.

At first you should install the plug-in. Although it requires going through a set of installation steps the process is very simple. For Visual Studio 2005 copying the plug-in files into ‘My Documents\Visual Studio 2005\Addins' folder is enough; similarly for Visual Studio 2008. Looks simple, doesn't it? For Visual Studio 2003 several additional installation steps are required but it is also easy. Detailed installation instructions can be found in Readme.txt that is part of the plug-in package.

Well, now, after the plug-in has been successfully installed you can integrate TBB into your Visual C++ projects by one click, or switch between TBB versions easily. For that right-click on the project item in the Solution Explorer and open the "Use Intel(R) TBB" sub-menu in the project context menu as shown at Figure 1.

Figure 1. A sample of “Use Intel(R) TBB” sub-menu

In this sub-menu you will see a list of the TBB versions that can be used in your projects. This list is created on basis of the plug-in configuration file called paths.xml which is also a part of the plug-in package. On Figure 2 below you can see an example of the configuration file. By the way, exactly this sample is provided with the plug-in and it corresponds to the sub-menu displayed on Figure 1 above.

 

Figure 2. A sample of paths.xml file

As far as you can see from Figure 2 two TBB versions are specified in the XML file by default: TBB 2.0 and TBB 2.1. Correspondingly, the integration sub-menu has two items. We fully rely on the information provided by the user because it would be difficult to track all open-source TBB packages on a machine and determine where they are installed. If necessary, you can specify more TBB versions by adding new <TBB> tags to the configuration file. A <TBB> tag has several sub-tags. Generally, you need to specify all these sub-tags; otherwise the corresponding paths will not be added to your projects. You might however omit ‘mode="64"' tags if you only work with 32-bit applications, and vice versa. One more thing that I would like to note: if you use variables like $(TBB21_INSTALL_DIR) above, then don't forget to add them to your Windows* environment.  

However let's return to our example. As you maybe already noticed, the text ‘TBB 2.0' displayed in the TBB integration sub-menu matches the ‘version_name' attribute from the XML file. The name can be any string that you like. But why is TBB 2.0 disabled? The reason is quite simple: the folder specified under <TBB_INCLUDE_DIR> tag doesn't exist, which must be means that TBB 2.0 is not installed; so, it doesn't make sense to integrate this TBB version.

Along with the fact that the plug-in is easy-to-install and easy-to-use it can be also easily switched off: you just need to deselect it in the ‘Tool | Add-in Manager' menu (Figure 3).

 

Figure 3. Add-in Manager menu

So, here I introduced you the tool that simplifies setting a Visual C++ project to use Intel(R) Threading Building Blocks. Hope that it will be useful for you in your work with TBB and that you will like it. Your feedbacks will be very much appreciated and will allow us to improve the plug-in. Please, don't hesitate to provide us your opinion about it.

Categories: Threading Building Blocks

Comments (3)

July 17, 2008 10:07 AM PDT


Josef Huber
Hello!

There is a problem with the msvs_plugin in combination with a localized German Visual Studio:
The plugin is loaded correctly, I can manually add the menu-items to the main-menu (e.g. to the "Project" - Menu) and they work as expected, but the menu-items do NOT appear in the context menu of the project/solution as seen in Figure 1 of this page (http://software.intel.com/en-us/blogs/2008/07/07/get-tbb-going-by-a-single-click).

This is the case with both Visual Studio 2005 (German) and Visual Studio 2008 (German).

Sincerely
Josef
July 18, 2008 8:16 AM PDT

Elena Gavrina (Intel)
Total Points:
225
Status Points:
0
Green Belt
Josef,

Thank you for report about the issue. We will work on solving of this problem.
December 29, 2008 9:22 AM PST


Frank Neubecker
Hi,

There is also a problem the msvs_plugin in combination with Visual Studio 2008 SP1. The plugin appears in the Add-In manager but does not appear as a menu item in the Solution Explorer context menu. The only way to get it to work is to manually add the include and library path. Even so, the tbb.dll needs to exist in the same path as the application.

Regards,
Frank Neubecker

Trackbacks (0)


Leave a comment  

To obtain technical support, please go to Software Support.
Name (required)*

Email (required; will not be displayed on this page)*

Your URL (optional)


Comment*