- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reinitialization of the library can not be completed, cause __cilkrts_end_cilk return "Attempt to shut down Cilk while Cilk is still runningAborted"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not exactly sure what the issue is here. What exactly are you passing to __cilkrts_set_param()?
To call __cilkrts_end_cilk(), You must have exited the function that contains the cilk_spawn. Consider the basic "fib" application:
int fib(int n) { int x, y; if (n < 2) return n; x = cilk_spawn fib(n-1); y = fib(n-2); cilk_sync; return x+y; } int main(int argc, char **argv) { int n = 30; printf ("fib(%d) = %d\n", n fib(n)); }
You can call __cilkrts_end_cilk() in main() because you've exited all functions containing a cilk_spawn. If main() was modified to spawn fib(n), then __cilkrts_end_cilk() would return an error.
- Barry
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not exactly sure what the issue is here. What exactly are you passing to __cilkrts_set_param()?
To call __cilkrts_end_cilk(), You must have exited the function that contains the cilk_spawn. Consider the basic "fib" application:
int fib(int n) { int x, y; if (n < 2) return n; x = cilk_spawn fib(n-1); y = fib(n-2); cilk_sync; return x+y; } int main(int argc, char **argv) { int n = 30; printf ("fib(%d) = %d\n", n fib(n)); }
You can call __cilkrts_end_cilk() in main() because you've exited all functions containing a cilk_spawn. If main() was modified to spawn fib(n), then __cilkrts_end_cilk() would return an error.
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
void wrapper_workerbody()
{
for(int i = 0; i < workers; i++) {
cilk_spawn workerbody();
}
cilk_sync;
}
and call it from main.
but __cilkrts_end_cilk() in main still aborted program with "Attempt to shut down Cilk while Cilk is still runningAborted". (CILK_NWORKERS is unset)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following program works as expected:
#include#include #include int fib(int n) { int x,y; if (n < 2) return n; x = cilk_spawn fib(n-1); y = fib(n-2); cilk_sync; return x+y; } int main(int argc, char **argv) { int n = 30; int result; int err; err = __cilkrts_set_param("nworkers", "13"); printf("__cilkrts_set_param("nworkers", "13") returned %d\n", err); #ifdef SPAWN_IN_MAIN result = cilk_spawn fib(n); cilk_sync; #else result = fib(n); #endif printf("fib(%d)=%d\n", n, result); __cilkrts_end_cilk(); return 0; }
If I compile it with SPAWN_IN_MAIN defined, __cilkrts_end_cilk() prints the message "Attempt to shut down Cilk while Cilk is still running". If I compile it without defining SPAWN_IN_MAIN, it completes normally.
If you can give me a program that's misbehaving, I'll take a look at it.
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page