I'm concerned about thread creation overhead in some code that I'm writing.
I have a bit of code like this:
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(ROW,COL)
!$OMP DO SCHEDULE STATIC(1)
DO ROW = 1,N
DO COL = 1,M
!set global foo(row,col)
!$OMP END DO NOWAIT
!$OMP END PARALLEL
this code is in a Fortran subroutine that is called many times. What I think is happening is (1): that
N threads are created the first time that this PARALLEL section is encountered and that the threads
stick around so that thread creation overhead is minimal.
However, I am worried that I'm wrong and that what is happening is (2): N threads might be created each time the parallel section is encountered which is overhead that I would have to work to eliminate.
Can someone verify whether (1) or (2) is what happens?
Thanks for your time.