Skip to content
Snippets Groups Projects
Commit 6faecf97 authored by Nemergut, Daniel (Maths & Physics)'s avatar Nemergut, Daniel (Maths & Physics) :face_palm_tone1:
Browse files

Wrapped FFTW3 multithreading in conditional compilation to be included only...

Wrapped FFTW3 multithreading in conditional compilation to be included only when compiled with -fopenmp
parent 393bb83d
No related branches found
No related tags found
1 merge request!2FFTW3 multithreading
......@@ -2,7 +2,9 @@ MODULE Fourier
USE params, ONLY: db,wflag
USE Grids, ONLY: nx,ny,nz
USE ISO_C_BINDING
#ifdef _OPENMP
USE OMP_LIB, ONLY: omp_get_max_threads
#endif
IMPLICIT NONE
INTEGER(C_LONG),SAVE :: pforward,pbackward,xforward,xbackward, &
yforward,ybackward,zforward,zbackward
......@@ -11,7 +13,9 @@ CONTAINS
INCLUDE 'fftw3.f'
COMPLEX(db),ALLOCATABLE :: p(:,:,:,:,:)
INTEGER,SAVE :: FFTW_planflag
#ifdef _OPENMP
INTEGER :: FFTW_thread_stat
#endif
! set option for FFTW setup here
! FFTW_planflag=FFTW_ESTIMATE
! FFTW_planflag=FFTW_MEASURE
......@@ -19,8 +23,10 @@ CONTAINS
! FFTW_planflag=FFTW_EXHAUSTIVE
! FFTW_planflag=FFTW_MEASURE+FFTW_UNALIGNED
ALLOCATE(p(nx,ny,nz,2,2))
#ifdef _OPENMP
CALL dfftw_init_threads(FFTW_thread_stat)
CALL dfftw_plan_with_nthreads(omp_get_max_threads())
#endif
CALL dfftw_plan_dft_3d(pforward,nx,ny,nz,p(:,:,:,1,1),p(:,:,:,1,1), &
FFTW_FORWARD, FFTW_planflag)
CALL dfftw_plan_dft_3d(pbackward,nx,ny,nz,p(:,:,:,1,1),p(:,:,:,1,1), &
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment