- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At the beginning of "main" in your program (before using any Cilk keywords), try executing the folllowing call, and see if it addresses your problem.
__cilkrts_set_param("stack size", "2000000");
That should set the default size of all of the stacks that Cilk creates to approximately 2 MB.
Note that the Cilk runtime creates more than P stacks on amachine with P worker threadsbecause of the way the scheduler works, so use with caution.
Cheers,
Jim
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Cilk Plus doesn't work that way.
"cilk_spawn" is a terrible keyword. Except we never found a better one. The cilk_spawn keyword tells the runtime that the continuation (the code after the spawned function) may be stolen by another worker and run in parallel with the spawned function. It gives permission for parallelism. It does not command it. The Cilk runtime does not create a thread in response to the cilk_spawn keyword.
When the runtime steals a continuation, it needs a stack to run it on. So it creates a stack, transfersonto the new stack,and starts executing the continuation. When the two strands sync, you continue executing on the leftmost stack; the one that you entered the function on.
You can set the size of the stacks that the Cilk runtime will create, both when threads are created and when the runtime creates these extra stacks. But a stack may move between threads. You don't have control on a per-thread basis.
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At the beginning of "main" in your program (before using any Cilk keywords), try executing the folllowing call, and see if it addresses your problem.
__cilkrts_set_param("stack size", "2000000");
That should set the default size of all of the stacks that Cilk creates to approximately 2 MB.
Note that the Cilk runtime creates more than P stacks on amachine with P worker threadsbecause of the way the scheduler works, so use with caution.
Cheers,
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On Windows, the default is taken from the value set by the /STACK linker option for the executable (the .exe file). If not specified, the Windows linker defaults to 1MB.
As Jim noted, you can override these defaultsusing __cilkrts_set_param().
- Barry

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