Learn to use Sun Studio compilers and tools to build Intel's TBB, an open-source runtime library that facilitates parallelism in C++ programs. Contents
Intel's Threading Building Block (TBB) is a leading-edge, open-source runtime library with a rich set of templates that significantly lowers the effort required to express parallelism in C++ programs. A version of TBB that can run on the Solaris platform (x86) has been recently released. This version of TBB can be built using Sun Studio Express compilers and tools, the latest set of compilers and tools from Sun Microsystems that are geared towards simplifying multi-core development and that provide industry-leading application performance. This article describes the steps involved in obtaining the right sets of tools to build TBB using Sun Studio software. It also illustrates how to build and run an example program that uses TBB. The Intel TBB distribution includes excellent documentation about how to develop an application using TBB. This article focuses on issues specific to using TBB with Sun Studio software on the Solaris OS and can be considered supplemental to such documentation. It is assumed that you already have an x86 machine running the Solaris 10 OS. To build TBB on the Solaris OS and to build applications using TBB, you must use the Sun Studio Express February 2008 build. To download Sun Studio Express software:
TBB can also be built using the Sun Studio 12 compilers. However, the Sun Studio 12 compilers require a patch that is not yet available for download. This information will be made available as soon as the patch is ready. You can download TBB. Remember to choose the stable version of TBB. Download both the source version and the Sun binaries available at the TBB download site. Use It is also strongly recommended to download the Getting Started Guide and TBB Tutorial from the documentation page. Make sure that Sun Studio Express compilers and Assuming Sun Studio Express Compilers are installed in
This builds the TBB library and places it in the build directory, for example, This directory contains the files The TBB build also generates two files, If you downloaded the Sun binaries for TBB, the shared objects for the library are available in the
directory The TBB distribution consists of several examples that illustrate the use of the templates provided by the TBB library. To build all the examples:
This results in all the examples being built and run. This assumes that you have already built the TBB sources and the library is available, for example in If you would like to use the pre-built TBB libraries to build the examples, remember to edit the To build a specific example, let's take the example of the Sub string finder in the Make sure that the
This builds and runs the It is also necessary to use the link-time flag If the program includes any of the
These settings either need to be defined in the makefile in addition to the user's environment (for example, through the
The availability of Threading Building Blocks built with Sun Studio compilers on the Solaris OS opens up very exciting opportunities for application developers to develop parallel applications. The Solaris OS has long been an excellent platform for parallel application development and deployment with proven records of performance, scalability, and a system stack fine-tuned to harness the computing power offered by multi-core and multi-processor systems. Sun Studio compilers and tools have been an industry leader not only in setting performance records, but also in offering a rich feature set such as auto-parallelization, Open MP support, a thread analysis tool, and a performance analyzer and debugger to develop, debug, and tune applications for multi-threading and multi-core. TBB has significantly enhanced the state of the art in multi-threading application development by providing a framework where programmers can elegantly express parallelism. The confluence of these technologies leads to very interesting possibilities as programmers can attempt to exploit the parallelism offered by the latest multi-core systems, by developing applications using the TBB parallel programming model with Sun Studio compilers on the Solaris OS. Deepankar Bairagi is a Staff Engineer with the Sun Studio Compiler team at Sun Microsystems, where he works on code generation and compiler optimizations for the compiler back end for x86/x64 platforms. Prior to his current position Deepankar worked at Sun Microsystems Laboratories. Deepankar holds a PhD in Computer Engineering from North Carolina State University. | |||||||||||||||||||||
|
| ||||||||||||