18 lines
315 B
C++
18 lines
315 B
C++
|
#include <cstdio>
|
||
|
#include <omp.h>
|
||
|
|
||
|
void myfunc(int i) {
|
||
|
#pragma omp parallel for
|
||
|
for (int j = 0; j < 4; j++) {
|
||
|
int tid = omp_get_thread_num();
|
||
|
printf("tid=%d executing (i,j)=(%d,%d)\n", tid, i, j);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int main () {
|
||
|
#pragma omp parallel for num_threads(4)
|
||
|
for (int i = 0; i < 4; i++) {
|
||
|
myfunc(i);
|
||
|
}
|
||
|
}
|