By default, the threads share variables and have a single address space. Beside the PRIVATE clause it is possible to use private data that is provided by the stack of each thread. Local variables within subprograms might be put on the stack and therefore will be private for each thread.
NNODE = omp_get_max_threads () !$omp parallel call SUB (NNODE) !$omp end parallel subroutine SUB (NNODE) integer NNODE ! is shared by all threads integer INODE ! will be private for each thread INODE = omp_get_thread_num() write (6,'I am ',I3,' of ',I3,' threads') INODE end subroutine SUB
Note: In most cases, the Fortran compiler will not put local variables on the stack but in a data region that is shared by all threads. A special compiler flag might be necessary to force the compiler to put local variables on the stack (e.g. -auto or -stackvar).
Note: The ADAPTOR translation works in exactly this way that it generates subprograms for the code within a parallel region. Private variables become local variables, shared variables are passed as dummy arguments to allow shared access.
OpenMP knows about further directives that can be used to define private data.