long fib_cilk_ccilk_perturbed(int n) { if (n<2) return n; long x; long y; if (n <= FIB_BOTTOM_OUT) return fib_seq(n); x = cilk_spawn fib_cilk_ccilk_perturbed(n-1); // We add a spawn here in order to match time_fib in qthreads y = fib_cilk_ccilk_perturbed(n-2); cilk_sync; return x+y; }
long fib_seq(int n) { if (n<2) return 1; return fib_seq(n-1) + fib_seq(n-2); }
void fib0_seq (int n) { seq_res = fib_seq(n); bots_message("Fibonacci result for %d is %lld\n",n,seq_res); }