mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
20 lines
326 B
C
20 lines
326 B
C
/*
|
|
* @@name: SIMD.3c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
double work( double *a, double *b, int n )
|
|
{
|
|
int i;
|
|
double tmp, sum;
|
|
sum = 0.0;
|
|
#pragma omp simd private(tmp) reduction(+:sum)
|
|
for (i = 0; i < n; i++) {
|
|
tmp = a[i] + b[i];
|
|
sum += tmp;
|
|
}
|
|
return sum;
|
|
}
|