Software Archive
Read-only legacy content

Stub function

newport_j
Beginner
397 Views

What is a stub function? I am referrring to its use in the old Cilk 5.4.6 manual when you call a cilk function from a c function. I think it is on page 12.

Any help appreciated thanks in advance.


Newport_j
0 Kudos
1 Reply
Jim_S_Intel
Employee
397 Views
The "stub function" described in the Cilk 5.4.6manual (MIT Cilk) is a special functionthat MIT Cilk generates for a function g marked with the "cilk" keyword, which allows g to be called from a C function f.
In MIT Cilk, to calla "cilk function" from C, you needed to create a new "CilkContext", which roughly speaking, can be thought of as creating a new copy of the MIT Cilk runtime. Thus, calling Cilk from C in MIT Cilk is not going to be particularly efficient. You are usually better off converting f into a Cilk function, and then "calling" g by immediately spawning g() and then syncing.

There is no analogous notion in Intel Cilk Plus with MIT Cilk's "stub" function. Calling between C and Cilk is much easier in Intel Cilk Plus, as was discussed in earlier conversations.

I believe there are other kinds of "stubs" in Cilk Plus, but they are a completely unrelated thing, and you should avoid confusing them with MIT Cilk.

Cheers,

Jim
0 Kudos
Reply