Software Archive
Read-only legacy content
17061 Discussions

last function executed before cilk runtime ends

Haris_R_1
Beginner
430 Views

Hello,

I’m experimenting with cilk runtime code and I was wondering what is the last function executed before cilk runtime ends.

When I run, for example ./fib 30 in linux, what is the last function that executes in cilk runtime assuming execution went without any problems.

By last function I mean any code before cilk runtime shuts down properly after ./fib 30 has completed, maybe some sort of cleanup code or some sort of memory free-up or anything in that sort.

Thanks for the help or any hints.

0 Kudos
1 Reply
Barry_T_Intel
Employee
430 Views

You're probably looking for __cilkrts_c_return_from_initial() in scheduler.c.

Note that the Cilk runtime does not do it's cleanup until __cilkrts_end_cilk() is called. If you're hunting for a leak, adding a call to __cilkrts_end_cilk() is the first thing to try.  Our assumption is that you're likely to re-enter a spawning function and we can reuse the data structures, worker threads, etc.  Since most applications don't call __cilkrts_end_cilk(), the resources are released by process rundown.

     - Barry

0 Kudos
Reply