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

TBB with C-Code

Last post 06-13-2008, 7:36 PM by mad\rreed. 10 replies.
Sort Posts: Previous Next
 06-09-2008, 5:48 AM 30256584  

TBB with C-Code

Hello,

can i use TBB for the parallelization of real unamanged C-Code. or it works only with C++-Code?

Thanks.

Greetings, Peter

 
 06-09-2008, 3:15 PM 30256621 in reply to 30256584  

Re: TBB with C-Code

Threading Building Blocks is a C++ library, and relies on many features of the language for its implementation.  You'll need a C++ program to take advantage of the features of TBB.  You might be able to embed chunks of C code into a C++ program using TBB just as you can otherwise, but TBB organization relies on the class and template parameterization features of C++ among many other features and needs a C++ compiler to interpret the TBB header files. 

 
 06-09-2008, 6:49 PM 30256632 in reply to 30256621  

Re: TBB with C-Code

Robert, you're scaring away the customers! Is there any reason why applying TBB to an existing C program might be more work than applying it to a program already using C++ features?
 
 06-10-2008, 6:14 AM 30256658 in reply to 30256632  

Re: TBB with C-Code

so the result is that TBB can be only use with C++-Code and not with C-Code. right?`

hmmmm, i use TBB and OpenMP. I just want to know some sure information for my thesis. Intel writes that TBB works with C++. They dont write C/C++. So i think that it can have some problem with the paralleization with C++-Code.

If TBB is implemented in C++ and uses C++ stuff than it cant work with C.

Thereofore i want to ask here in the forum if i am right.

 
 06-10-2008, 1:06 PM 30256688 in reply to 30256658  

Re: TBB with C-Code

TBB is very much C++: you will absolutely require a C++ compiler. C is a subset of C++ (except for some details): the C++ compiler will take your C program. You'll be replacing iteration statements with TBB classes (just as you would if you started with a C++ program): the parallelised version of your program will be a C++ program, and you'll need to know how to use C++.

"If TBB is implemented in C++ and uses C++ stuff than it cant work with C." It will work with your C program. It won't work with your C compiler.

It is a toolkit (or framework?), and it will require some work from you to apply it, but C++ is a better C, and TBB is a better OpenMP (or so I hear). If you're happy with OpenMP and it easily gives your program close to 100% efficiency, don't change; otherwise, try TBB.

Is using a C++ compiler a bigger obstacle for you than using a C compiler with OpenMP support (for me it would be the other way around)?

 
 06-10-2008, 11:08 PM 30256710 in reply to 30256688  

Re: TBB with C-Code

hi,

thanks for you reply.

okay, now i understand it.

greetings, peter

 
 06-11-2008, 12:51 AM 30256716 in reply to 30256710  

Re: TBB with C-Code

Then you have the advantage: may we know your situation (C++ compiler/knowledge), decision and motivation?

 
 06-11-2008, 2:11 AM 30256719 in reply to 30256716  

Re: TBB with C-Code

Hi,

i am computer since student and now i write my thesis. i have to create a migration concept for a software. the migration is from 32-bit singlecore to 64-bit and multicore architectures. i think that openmp and tbb are great tools for the parallelization of C/C++ (TBB only for C++ ;-) ) . so i can use TBB to parallelize C-Code but i have to use a C++-compiler. i have some requirements that in some cases is real ansi c-code required and so i cant use the tbb in this case. anyway, its possible to use tbb and openmp together for C++-Code.

i use the VS 2005 and VS 2008 compiler. as OS i use Windows XP and Vista in the 32-Bit and 64-Bit versions.

greetings, peter

 
 06-11-2008, 3:33 AM 30256722 in reply to 30256719  

Re: TBB with C-Code

So I assume it's not a real-world requirement, to allow OpenMP but not C++? It might be interesting to see a summary of your conclusions after you have compared both approaches (but only if TBB comes out on top, of course).

 
 06-11-2008, 3:54 AM 30256723 in reply to 30256722  

Re: TBB with C-Code

its some requirements for the software. like data parallelism, portability, scalability,...

both are very good. and fullfill the requirements. only TBB hast the negative point, that its cant be used with ansi c and a c compiler

openmp can be also used only for c-code because it uses compielr directives.

 

 
 06-13-2008, 7:36 PM 30256921 in reply to 30256723  

Re: TBB with C-Code

If we’re splitting hairs, OpenMP is not really ANSI C either. It’s an orthogonal extension graphed into the syntax, hidden in comment statements for those C compilers that can’t interpret it. But Peter, if you’re using VS 2005 and VS 2008 compilers, it’s really hard to get C without also getting C++. < Is this restriction to ANSI C a thesis requirement? It seems very limiting, given the scope of the thesis.

You suggest “some requirements that is some cases…” you must use ANSI C.  If those requirements are to interface to low level C functions, like an instrument driver or some provided C library, you can still use C++ and just restrict the code at the point of the interface to be pure C.  If that’s the nature of your requirements, you still may be able to use C++ and TBB.

 
View as RSS news feed in XML

Shortcuts


Tags For This Post

...

Community Tags

...