mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
28 lines
437 B
C
28 lines
437 B
C
/*
|
|
* @@name: doacross.1c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
float foo(int i);
|
|
float bar(float a, float b);
|
|
float baz(float b);
|
|
|
|
void work( int N, float *A, float *B, float *C )
|
|
{
|
|
int i;
|
|
|
|
#pragma omp for ordered(1)
|
|
for (i=1; i<N; i++)
|
|
{
|
|
A[i] = foo(i);
|
|
|
|
#pragma omp ordered depend(sink: i-1)
|
|
B[i] = bar(A[i], B[i-1]);
|
|
#pragma omp ordered depend(source)
|
|
|
|
C[i] = baz(B[i]);
|
|
}
|
|
}
|