mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
26 lines
400 B
C
26 lines
400 B
C
/*
|
|
* @@name: nested_loop.1c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
void work(int i, int j) {}
|
|
|
|
void good_nesting(int n)
|
|
{
|
|
int i, j;
|
|
#pragma omp parallel default(shared)
|
|
{
|
|
#pragma omp for
|
|
for (i=0; i<n; i++) {
|
|
#pragma omp parallel shared(i, n)
|
|
{
|
|
#pragma omp for
|
|
for (j=0; j < n; j++)
|
|
work(i, j);
|
|
}
|
|
}
|
|
}
|
|
}
|