q use of parallel construct with private clausein


Q. Use of parallel construct with private clause?

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

#include < stdio.h >

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 subsequent illustration every thread in parallel region determines what part of global array x to work on based on thread number.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: q use of parallel construct with private clausein
Reference No:- TGS0324027

Expected delivery within 24 Hours