Software Archive
Read-only legacy content
17061 Discussions

Cilk plus implicit threshold

Guilherme_R_
Beginner
401 Views

Hi,

I'm new to cilk, and i wanted to ask if it has an implicit threshold for the task creation, in recursive computations like fib?

If so, is it based on the number of tasks created, or in the depth of the computation?

 

Thanks!

0 Kudos
1 Reply
Jim_S_Intel
Employee
401 Views

The short answer is "no", there are no implicit threshholds for recursive computations like fib.   Any coarsening you might want in the base case to stop the recursion early needs to be specified manually. 

Every cilk_spawn in fib should be doing roughly the same work at every level of the recursion, to push something onto the current worker's deque and allow for stealing of the continuation of the spawn.For an arbitrary computation, coarsening based on number of tasks created or task depth may not always do the right thing, since doing so often makes some implicit assumption about balance in the recursion.    There is, however, an implicit calculation of grainsize of a cilk_for loop by default.

Cheers,

Jim

0 Kudos
Reply