main
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * test3_0.c and test3_1.c are not equivalent because
|
|---|
| 3 | * they have different private list for the parallel construct.
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | #include <omp.h>
|
|---|
| 7 | #include <stdio.h>
|
|---|
| 8 | #include <stdlib.h>
|
|---|
| 9 |
|
|---|
| 10 | int main (int argc, char *argv[]) {
|
|---|
| 11 |
|
|---|
| 12 | int nthreads, tid;
|
|---|
| 13 |
|
|---|
| 14 | #pragma omp parallel private(nthreads)
|
|---|
| 15 | {
|
|---|
| 16 | tid = omp_get_thread_num();
|
|---|
| 17 | printf("Hello World from thread = %d\n", tid);
|
|---|
| 18 |
|
|---|
| 19 | if (tid == 0) {
|
|---|
| 20 | nthreads = omp_get_num_threads();
|
|---|
| 21 | printf("Number of threads = %d\n", nthreads);
|
|---|
| 22 | }
|
|---|
| 23 | }
|
|---|
| 24 | exit(0);
|
|---|
| 25 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.