mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
21 lines
315 B
C
21 lines
315 B
C
/*
|
|
* @@name: lastprivate.1c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
void lastpriv (int n, float *a, float *b)
|
|
{
|
|
int i;
|
|
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp for lastprivate(i)
|
|
for (i=0; i<n-1; i++)
|
|
a[i] = b[i] + b[i+1];
|
|
}
|
|
|
|
a[i]=b[i]; /* i == n-1 here */
|
|
}
|