TBB and cilk

TBB and cilk

I have the following loop that is executed within a lambda function called by TBB and I would like to use a cilk_for instead of the usual for:

//distsq and tmpC3 are arrays of floats
for (int k = 0; k < len1D; k += 1)


int t = k*3;

distsq[k] = tmpC3[t] + tmpC3[t+1] + tmpC3[t+2];


When I do change the for to a cilk_for the program crashes and Parallel Inspector says I have a data race. I assume the race involves distsq[k]; is that right? Do I need to protect distsq? Is it OK to use cilk_for inside a TBB lambda function?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

It looks like this should work.

Are you using Composer 12.0, or the Cilk++ kit? And which OS are you using?

The version of Intel Cilk Plus in Composer 12.0 should work with TBB. We may need a sample program to track this down.

- Barry

Leave a Comment

Please sign in to add a comment. Not a member? Join today