Hello,
I need to know how the private and shared variables are used for cilk_for loop in cilk plus.
For example, this serial code
int z=0;
int a= 0;
int n=0;
....
for (i=0; ia = a + x[i];
y[z] = x[i];
z++;
}
With openMP, the parallel code :
#pragma omp parallel for private(i) \\
shared(x, y, n) \\
reduction(+: a, z)
for (i=0; ia = a + x[i];
y[z] = x[i];
z++;
}
Now, the parallel code with cilk plus is it correct ? :
cilk::reducer_opadd z;
cilk::reducer_opadd a;
# pragma SIMD private (i) \\ shared (x, y, n)
cilk_for (int i=0; ia = a + x[i];
y[z] = x[i];
z++;
}
The parallel code with cilk plus is it correct ?
Thank you for your help,




