I'm using Linux, Eclipse and Intel compiler V14.
I'm trying to compile the basic fibonacci example:
#include <iostream>
#include <cilk/cilk.h>
using namespace std;
int fib(int n) {
if (n < 2) return 1;
else {
int rst = 0;
rst += cilk_spawn fib(n-1);
rst += cilk_spawn fib(n-2);
cilk_sync;
return rst;
}
}
int main() {
int res = fib(9);
return 0;
}
And getting compile error:
error expected an expression
I tried to use:
cilk_spawn
Cilk_spawn
_cilk_spawn
_Cilk_spawn
but same error..
Not sure if you can use cilk_spawn with the += operator. Does the following code work?