Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Does TBB require C++0x enabled compiler?

Brijender_B_Intel
184 Views

Does TBB requires C++0x support in compiler? if so, is there a way to still use TBB templates without C++0x?

0 Kudos
1 Solution
robert-reed
Valued Contributor II
184 Views
To elaborate on Raf's correct, albeit terse reply, TBB has features to take advantage of lambda support in the compiler but does not require it. Perhaps the biggest visible change to accommodate lambda constructs is in parallel_reduce(), which has a new interface that contains all the components to present a self-contained means for describing a reduction using a pair of lambda constructs. The original interface is still available but requires a separate body class to permit the definition of two user functions for doing the reduction and doing the join, plus a means to initialize private copies of the reduction variable(s) and recover the final result. Compare the current version of the original interface:

    template 
    void parallel_reduce( const Range& range, Body& body ) {
     internal::start_reduce::run( range, body, __TBB_DEFAULT_PARTITIONER() );
    }

To the new interface to maximize the advantage of lambda constructs:

    template
    Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction ) {
     internal::lambda_reduce_body body(identity, real_body, reduction);
        internal::start_reduce,const __TBB_DEFAULT_PARTITIONER>
     ::run(range, body, __TBB_DEFAULT_PARTITIONER() );
     return body.result();
    }

So if you're currently using TBB but have not made the transition to a compiler that provides lambda support, you should be just fine. Andwhen you're ready to advance your compiler and try lambdas,TBB will be ready for you .

View solution in original post

3 Replies
RafSchietekat
Black Belt
184 Views

"Does TBB requires C++0x support in compiler?"
No.

robert-reed
Valued Contributor II
185 Views
To elaborate on Raf's correct, albeit terse reply, TBB has features to take advantage of lambda support in the compiler but does not require it. Perhaps the biggest visible change to accommodate lambda constructs is in parallel_reduce(), which has a new interface that contains all the components to present a self-contained means for describing a reduction using a pair of lambda constructs. The original interface is still available but requires a separate body class to permit the definition of two user functions for doing the reduction and doing the join, plus a means to initialize private copies of the reduction variable(s) and recover the final result. Compare the current version of the original interface:

    template 
    void parallel_reduce( const Range& range, Body& body ) {
     internal::start_reduce::run( range, body, __TBB_DEFAULT_PARTITIONER() );
    }

To the new interface to maximize the advantage of lambda constructs:

    template
    Value parallel_reduce( const Range& range, const Value& identity, const RealBody& real_body, const Reduction& reduction ) {
     internal::lambda_reduce_body body(identity, real_body, reduction);
        internal::start_reduce,const __TBB_DEFAULT_PARTITIONER>
     ::run(range, body, __TBB_DEFAULT_PARTITIONER() );
     return body.result();
    }

So if you're currently using TBB but have not made the transition to a compiler that provides lambda support, you should be just fine. Andwhen you're ready to advance your compiler and try lambdas,TBB will be ready for you .

ninhngt
Beginner
184 Views
A place to look for information like this is the TBB manual.

Reply