Killing spawned functions

Killing spawned functions

hillelav's picture

Is it possible for a parent function to kill or cancel all its spawned functions?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
William Leiserson (Intel)'s picture

This is speculative computing. Cilk++ doesn't have builtin support for speculation because it is non-deterministic. I.e., it makes it difficult to reason about the correctness of code. Thus, Cilkscreen would not necessarily report races when they exist, and Cilkview's output would be irrelevant.

You can, however, implement speculation, yourself, if you don't mind the above limitations. E.g.,

void bar (volatile int *abort_parallelism) {
while (!*abort_parallelism) {
if (do_work() == meets_some_aborting_condition) *abort_parallelism = 1;

void foo () {
volatile int abort_parallelism = 0;
cilk_spawn bar(&abort_parallelism);

Login to leave a comment.