source:
CIVL/mods/dev.civl.com/doc/omp/nestedomp.c@
1aaefd4
| Last change on this file since 1aaefd4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 356 bytes | |
| Line | |
|---|---|
| 1 | #include <omp.h> |
| 2 | #include <stdio.h> |
| 3 | |
| 4 | int main () { |
| 5 | int x; |
| 6 | #pragma omp parallel num_threads(8) |
| 7 | { |
| 8 | int num = omp_get_thread_num(); |
| 9 | if (num > 2) { |
| 10 | #pragma omp for |
| 11 | for (int i=0; i<5; i++) { |
| 12 | printf("In loop thread %d printing %d\n", num, i); |
| 13 | } |
| 14 | } else { |
| 15 | printf("Outside of loop printing %d\n", num); |
| 16 | } |
| 17 | } |
| 18 | } |
Note:
See TracBrowser
for help on using the repository browser.
