mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-04 05:41:33 +01:00
26 lines
439 B
C
26 lines
439 B
C
/*
|
|
* @@name: collapse.2c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
void test()
|
|
{
|
|
int j, k, jlast, klast;
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp for collapse(2) lastprivate(jlast, klast)
|
|
for (k=1; k<=2; k++)
|
|
for (j=1; j<=3; j++)
|
|
{
|
|
jlast=j;
|
|
klast=k;
|
|
}
|
|
#pragma omp single
|
|
printf("%d %d\n", klast, jlast);
|
|
}
|
|
}
|