Use the SHARED clause on the PARALLEL, PARALLEL DO, and PARALLEL SECTIONS directives to make variables shared among all the threads in a team.
In the following example, the variables X and NPOINTS are shared among all the threads in the team:
Example |
---|
!$OMP PARALLEL DEFAULT(PRIVATE),SHARED(X,NPOINTS) IAM = OMP_GET_THREAD_NUM() NP = OMP_GET_NUM_THREADS() IPOINTS = NPOINTS/NP CALL SUBDOMAIN(X,IAM,IPOINTS) !$OMP END PARALLEL |