[Omp] The parallel
Shengyan Hong
shhong at cse.psu.edu
Mon Mar 19 06:27:03 PDT 2007
Every OMP member,
subroutine evolve(u0, u1, t, indexmap, d1, d2, d3)
c---------------------------------------------------------------------
c---------------------------------------------------------------------
c---------------------------------------------------------------------
c evolve u0 -> u1 (t time steps) in fourier space
c---------------------------------------------------------------------
implicit none
include 'global.h'
integer d1, d2, d3
double complex u0(d1+1,d2,d3)
double complex u1(d1+1,d2,d3)
integer indexmap(d1+1,d2,d3)
integer t
integer i, j, k
integer TID,OMP_GET_THREAD_NUM
!$omp parallel default(shared) private(i,j,k)
C TID = OMP_GET_THREAD_NUM()
C PRINT *, 'thread = ', TID
C print *, "March 12"
CALL MAGIC_BRK_SIM_START()
!$omp do
do k = 1, d3
do j = 1, d2
do i = 1, d1
u1(i,j,k) = u0(i,j,k)*ex(t*indexmap(i,j,k))
end do
end do
end do
!$omp end do nowait
CALL MAGIC_BRK_SIM_MIDDLE()
!$omp BARRIER
CALL MAGIC_BRK_SIM_STOP()
!$omp end parallel
return
end
For the above code, it generates 8 threads each time when it is
called by the parent subroutine. And the OS allocates the 8 threads to 8
processors. When the subroutine evolve is over, the 8 threads is over too.
Next time, the subroutine evolve is called again. And the code will
generate 8 new threads. I want that the 8 threads can be assigned to the 8 processors in the same mapping
relationship as it happens last time?
First, is the new 8 threads the similar to the 8 ones the subroutine evolve generates last time? Second,
can I use some methods to make the new threads binding to the
processors in the same mapping form the OS does last time?
Thank you.
Shengyan Hong
More information about the Omp
mailing list