Stub function

Stub function

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.


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

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.



Leave a Comment

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