Welcome to Intel® Software Network Quick Login | Join | Help |
Search in Intel® Software Network Forums
in Go

the building and running process on multi-core

Last post 07-03-2008, 2:24 PM by bin_1024. 4 replies.
Sort Posts: Previous Next
 07-02-2008, 9:57 AM 30258132  

the building and running process on multi-core

Can anyone explain the relationships among TBB, compilers, OSs and processors? I mean what exactly each part does to make the programming benefit from multi cores. The question may seem simple, but I think it is this simple question that makes it hard to get TBB more generic and compatible.

 

 
 07-02-2008, 1:32 PM 30258150 in reply to 30258132  

Re: the building and running process on multi-core

TBB is only one of several viable (according to your application and programming language) multi-core programming methods.  It combines the ideas of STL and OpenMP to provide an interface to a threading library to be linked to compiled code.  Like those, it aims to relieve the programmer of the details of making the application work with each compiler and OS combination.

Language standards dictate the extent to which the programming language supports multi-programming (very little, for C++ itself). The division of responsibility between a library such as TBB, the underlying threading library, and the OS, is negotiable to some extent, but cannot normally be the concern of the software developer.

 
 07-02-2008, 4:51 PM 30258162 in reply to 30258150  

Re: the building and running process on multi-core

Thanks for the explanation. Although multi-core libraries try to releive programmer from the concern of compatibility, they are facing the compatible issues themselves. I think this is the reason why TBB lists all the supported processors, OSs, compilers, etc. As a programmer, normally you don't need to worry about such issues as long as you are able to build the programming and testing platform and keep your development going. But as an end user, you may encounter different issues when installing the program for multi-core. Sometimes, end users are not even able to get their OS running on multi-core hardware. Although the OS itself does have multi-core feature. As a result, programmers or at least designers need to get some idea hidden behind the library. For example, if a new multi-core chip is supported by an OS which is in the compatible list of TBB, does this mean this chip can totally be supported by TBB? Another question is why TBB cannot support some OS which does support multi-core. What's the difficulty there? So it'd be greatly appreciated if anyone can give out an relationship map of all steps from the source codes, TBB to the final executable file as detailed as possible and clear enough to explain why TBB cannot yet support some other OS which has multi-core feature. This may be very helpful when programmers have to face the questions from end users about compatible issues.

 

 
 07-02-2008, 10:44 PM 30258172 in reply to 30258162  

Re: the building and running process on multi-core

To be able to use TBB on a new processor, the important low-level stuff is in include/tbb_machine.h and include/machine/*, where some assembler code needs to be added to support atomics and a small lock. It currently makes some important assumptions that make it somewhat difficult to port TBB to PA-RISC, for example, because that O.S.processor only seems to have a 32-bit semaphore that has to be aligned on a 16-byte boundary, but hopefully other processors are more in line with TBB's assumptions. Note that the file names are misleading: they can be renamed to gcc_<machine> and windows_<machine>.h (unless that last one should be something like msvc_<machine>.h instead?). See "Additions to atomic<T>" for that.

TBB also uses low-level threading support from the O.S. in the form of POSIX threads or Microsoft Windows threads, and for Linux it also does something with futex, but it should be relatively easy to port to a similar API if POSIX threads are not available (I did this for Solaris threads once, but that has little practical relevance because Solaris has had POSIX threads as well since quite some time).

Otherwise, you'll need GNU make and/or whatever build infrastructure your O.S. uses, and an adaptation of the build files to the platform you are using. For example, I changed the "machine" stuff above to support 32-bit PowerPC (since recently also with 64-bit atomics) and SPARC, but I have not yet built all of TBBthe examples for my Mac mini (which might seem silly at first sight, but obviously TBB should be backward compatible for maximum usability) or for the SPARC server I used.

(Paradoxically, compiling TBB currently does not make use of multiple cores, because GNU make doesn't.)

"For example, if a new multi-core chip is supported by an OS which is in the compatible list of TBB, does this mean this chip can totally be supported by TBB?" You'll need to write some assembler code first.

"Another question is why TBB cannot support some OS which does support multi-core. What's the difficulty there?" Does it have POSIX threads? Does it have GNU make? If so, you can just add some files in build/, modified from a similar O.S., otherwise it will be a bit more work.

See "build directions" and "build" links in index.html in the source distribution for some details.

Do you have any concrete purpose beyond this abstract concern?

 
 07-03-2008, 2:24 PM 30258247 in reply to 30258172  

Re: the building and running process on multi-core

Thanks for such detailed explanations. Actually I have no concrete purpose. I was just wondering how much TBB gets involved with processors and how to avoid compatible issues for the systems in the past or in the future. As computer systems are getting more and more complex and diversified, compatibility is more sensitive and important. Thanks again for your information.

 

 
View as RSS news feed in XML

Shortcuts


Tags For This Post

...

Community Tags

...