mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
28 lines
481 B
C
28 lines
481 B
C
/*
|
|
* @@name: tasking.6c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
#define LARGE_NUMBER 10000000
|
|
double item[LARGE_NUMBER];
|
|
extern void process(double);
|
|
int main() {
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp single
|
|
{
|
|
int i;
|
|
#pragma omp task untied
|
|
// i is firstprivate, item is shared
|
|
{
|
|
for (i=0; i<LARGE_NUMBER; i++)
|
|
#pragma omp task
|
|
process(item[i]);
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|