The Path from Multicore to Manycore: Listing 2.

Parallel implementation of Fibonacci code.

int fib (int n) {
  if (n <= 2)
    return n;
  else {
    int x,y;
    x = cilk_spawn fib(n-1);
    y = fib(n-2);
    return x+y;
comments powered by Disqus


.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events