OpenMP® Forum

Discussion on the OpenMP specification run by the OpenMP ARB. OpenMP and the OpenMP logo are registered trademarks of the OpenMP Architecture Review Board in the United States and other countries. All rights reserved.

where MYSUBROUTINE and MYFUNCTION are serial procedures. My questions are

1. Does the fortran compiler create a copy of MYSUBROUTINE and MYFUNCTION foreach processor being used? 2. Do I need to explicitly indicate in MYSUBROUTINE and MYFUNCTION definitions which variables need to be thread private?I have read the LLNL OpenMP tutorial but the answer to these questions is not yet clear to me.

1. Does the fortran compiler create a copy of MYSUBROUTINE and MYFUNCTION foreach processor being used?

What do you mean by "a copy"? Parallel regions are about creating and running threads. Your code imply having several threads, each one of them calling, in sequence, MYSUBROUTINE() and MYFUNCTION(X)...

2. Do I need to explicitly indicate in MYSUBROUTINE and MYFUNCTION definitions which variables need to be thread private?

Well... "automatic" variables (i.e. those allocated in the subroutine stack) are "automatically" private to each thread. You will have to declare as threadprivate those SAVE and COMMON variables which need to be so.