OpenMP-Examples/sources/Example_collapse.2.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);
}
}