Skip to content

Commit

Permalink
Merge branch 'p3dfft-mt' of https://bitbucket.org/dmitrypek/p3dfft in…
Browse files Browse the repository at this point in the history
…to p3dfft-mt
  • Loading branch information
jytang committed Dec 16, 2015
2 parents 07cf339 + 8abd9ce commit b738ea1
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 7 deletions.
78 changes: 71 additions & 7 deletions build/fft_exec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ subroutine exec_b_c1(X,stride_x1,stride_x2,Y,stride_y1, &

!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_b_c1(tid)
sty = starty_b_c1(tid)
plan = plan1_bc(tid)
Expand Down Expand Up @@ -157,7 +161,11 @@ subroutine exec_b_c2_same(X,stride_x1,stride_x2,Y,stride_y1, &
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_b_c2_same(tid)
sty = starty_b_c2_same(tid)
plan = plan2_bc_same(tid)
Expand Down Expand Up @@ -199,7 +207,11 @@ subroutine exec_b_c2_dif(X,stride_x1,stride_x2,Y,stride_y1, &
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_b_c2_dif(tid)
sty = starty_b_c2_dif(tid)
plan = plan2_bc_dif(tid)
Expand Down Expand Up @@ -243,7 +255,11 @@ subroutine exec_b_c2r(X,dimx,Y,dimy,N,m)
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_bcr(tid)
sty = starty_bcr(tid)
plan = plan1_bcr(tid)
Expand Down Expand Up @@ -285,12 +301,16 @@ subroutine exec_f_c1(X,stride_x1,stride_x2,Y,stride_y1,stride_y2,N,m)


#ifdef FFTW
!!$OMP PARALLEL private(tid,stx,sty,plan)
!$OMP PARALLEL private(tid,stx,sty,plan)

! tid = omp_get_thread_num()
#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif


do tid=0,num_thr-1
! do tid=0,num_thr-1

stx = startx_f_c1(tid)
sty = starty_f_c1(tid)
Expand All @@ -304,8 +324,8 @@ subroutine exec_f_c1(X,stride_x1,stride_x2,Y,stride_y1,stride_y2,N,m)
call sfftw_execute_dft(plan,X(stx),Y(sty))
#endif

enddo
!!$OMP END PARALLEL
! enddo
!$OMP END PARALLEL

#elif defined ESSL

Expand Down Expand Up @@ -337,7 +357,11 @@ subroutine exec_f_c2_same(X,stride_x1,stride_x2,Y,stride_y1,stride_y2,N,m)
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_f_c2_same(tid)
sty = starty_f_c2_same(tid)
plan = plan2_fc_same(tid)
Expand Down Expand Up @@ -379,7 +403,11 @@ subroutine exec_f_c2_dif(X,stride_x1,stride_x2,Y,stride_y1,stride_y2,N,m)
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

tid = omp_get_thread_num()
#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_f_c2_dif(tid)
sty = starty_f_c2_dif(tid)
plan = plan2_fc_dif(tid)
Expand Down Expand Up @@ -424,7 +452,11 @@ subroutine exec_f_r2c(X,dimx,Y,dimy,N,m)

!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_frc(tid)
sty = starty_frc(tid)
plan = plan1_frc(tid)
Expand Down Expand Up @@ -471,7 +503,11 @@ subroutine exec_ctrans_r2_same (X, stride_x1, stride_x2, Y, stride_y1, stride_y2
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_ctrans_same(tid)
sty = starty_ctrans_same(tid)
plan = plan_ctrans_same(tid)
Expand Down Expand Up @@ -516,7 +552,11 @@ subroutine exec_ctrans_r2_dif (X, stride_x1, stride_x2, Y, stride_y1, stride_y2,
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_ctrans_dif(tid)
sty = starty_ctrans_dif(tid)
plan = plan_ctrans_dif(tid)
Expand Down Expand Up @@ -562,7 +602,11 @@ subroutine exec_ctrans_r2_complex_same (X, stride_x1, stride_x2, Y, stride_y1, s
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_ctrans_same(tid)
sty = starty_ctrans_same(tid)
plan = plan_ctrans_same(tid)
Expand Down Expand Up @@ -616,7 +660,11 @@ subroutine exec_ctrans_r2_complex_dif (X, stride_x1, stride_x2, Y, stride_y1, st
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_ctrans_dif(tid)
sty = starty_ctrans_dif(tid)
plan = plan_ctrans_dif(tid)
Expand Down Expand Up @@ -675,7 +723,11 @@ subroutine exec_strans_r2_same (X, stride_x1, stride_x2, Y, stride_y1, stride_y2
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_strans_same(tid)
sty = starty_strans_same(tid)
plan = plan_strans_same(tid)
Expand Down Expand Up @@ -720,7 +772,11 @@ subroutine exec_strans_r2_dif (X, stride_x1, stride_x2, Y, stride_y1, stride_y2,
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_strans_dif(tid)
sty = starty_strans_dif(tid)
plan = plan_strans_dif(tid)
Expand Down Expand Up @@ -766,7 +822,11 @@ subroutine exec_strans_r2_complex_same (X, stride_x1, stride_x2, Y, stride_y1, s
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

tid = omp_get_thread_num()
#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_strans_same(tid)
sty = starty_strans_same(tid)
plan = plan_strans_same(tid)
Expand Down Expand Up @@ -820,7 +880,11 @@ subroutine exec_strans_r2_complex_dif (X, stride_x1, stride_x2, Y, stride_y1, st
#ifdef FFTW
!$OMP PARALLEL private(tid,stx,sty,plan)

#ifdef OPENMP
tid = omp_get_thread_num()
#else
tid = 0
#endif
stx = startx_strans_dif(tid)
sty = starty_strans_dif(tid)
plan = plan_strans_dif(tid)
Expand Down
6 changes: 6 additions & 0 deletions build/init_plan.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,18 @@ subroutine init_plan
complex(mytype), allocatable :: A(:),C(:)
integer omp_get_num_threads,omp_get_thread_num,l,m,tid,ierr

#ifdef OPENMP

!$OMP PARALLEL
!$OMP MASTER
num_thr = omp_get_num_threads()
!$OMP END MASTER
!$OMP END PARALLEL

#else
num_thr = 1
#endif

if(taskid .eq. 0) then
print *,'Running on ',num_thr,'threads'
endif
Expand Down

0 comments on commit b738ea1

Please sign in to comment.