q description of clauses used in a parallel


Q. Description of clauses used in a parallel construct?

When a thread comes across a parallel construct a set of new threads is made to execute parallel region. Inside the parallel region every thread has a unique thread number. Thread number of master thread is zero. Thread number of thread may be attained by call of library function omp_get_thread_num.  At this instant we are giving description of clauses used in a parallel construct.

(a) Private Clause: 

This clause declares one or more list items to be private to thread. The syntax of private clause is

                    private(list).

(b) Firstprivate Clause:

The firstprivate clause declares one or more list items to be private to thread and initializes every of them with value that corresponding original item has when construct is encountered. The syntax of firstprivate clause is like this:

                firstprivate(list).

(c) Shared Clause:

The shared clause declares one or more list items to be shared amongst all threads in a team. The syntax of shared clause is :

                shared(list)

 (d) Copyin Clause: 

The copyin clause offers a mechanism to copy value of master thread's threadprivate variable to the threadprivate variable of every other member of team executing parallel region. The syntax of copyin clause is :

              copyin(list)

Request for Solution File

Ask an Expert for Answer!!
Electrical Engineering: q description of clauses used in a parallel
Reference No:- TGS0323992

Expected delivery within 24 Hours