in this example we will see the use of parallel


In this example we will see the use of parallel construct with private and firstprivate clauses. At the end of the program i and j remain undefined as these are private to thread in parallel construct.

#include

int main()

{

int i, j;

i = 1;

j = 2;

#pragma omp parallel private(i) firstprivate(j)

{

i = 3;

j = j + 2;

}

printf("%d %d\n", i, j); /* i and j are undefined */

return 0;

}

In the following example, each thread in the parallel region decides what part of the global array x to work on, based on the thread number.

Request for Solution File

Ask an Expert for Answer!!
Computer Networking: in this example we will see the use of parallel
Reference No:- TGS0208318

Expected delivery within 24 Hours