mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-08 07:32:12 +01:00
24 lines
391 B
C
24 lines
391 B
C
/*
|
|
* @@name: lastprivate.2c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
* @@version: omp_5.0
|
|
*/
|
|
#include <math.h>
|
|
|
|
float condlastprivate(float *a, int n)
|
|
{
|
|
float x = 0.0f;
|
|
|
|
#pragma omp parallel for simd lastprivate(conditional: x)
|
|
for (int k = 0; k < n; k++) {
|
|
if (a[k] < 108.5 || a[k] > 208.5) {
|
|
x = sinf(a[k]);
|
|
}
|
|
}
|
|
|
|
return x;
|
|
}
|