Skip to content

Commit

Permalink
Merge pull request #133 from dalesteam/make-fftw-default
Browse files Browse the repository at this point in the history
Enable FFTW by default

It is still possible to compile without the FFTW library, with `cmake -DUSE_FFTW=False`
If FFTW is compiled in, it is used by default, `solver_id = 100`. If it is not compiled in the default is `solver_id = 0`, i.e. the old FFT.
  • Loading branch information
fjansson authored Nov 4, 2024
2 parents 01ce16c + 9ebcb55 commit 92b146a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
fail-fast: false
matrix:
toolchain: ["gnu", "intel"]
fftw: ["", "-DUSE_FFTW=T"]
hypre: ["", "-DUSE_HYPRE=T"]

# Steps represent a sequence of tasks that will be executed as part of the job
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/precision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
strategy:
fail-fast: false
matrix:
fftw: ["", "-DUSE_FFTW=T"]
hypre: ["", "-DUSE_HYPRE=T"]
field_r: ["32","64"]
pois_r: ["32","64"]
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ endif(NETCDF_FORTRAN_LIB)
OPTION(USE_HYPRE "Also build iterative solver (optional, needs HYPRE)" OFF)

### FFTW based poisson solver (FFTW)
OPTION(USE_FFTW "Also build FFTW based poisson solver (optional, needs FFTW3)" OFF)
OPTION(USE_FFTW "Also build FFTW based poisson solver (optional, needs FFTW3)" ON)

### NVTX
OPTION(USE_NVTX "Enable GPU profiling" OFF)
Expand Down
6 changes: 5 additions & 1 deletion src/modglobal.f90
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ module modglobal
logical :: lconstexner = .false. !< switch to use the initial pressure profile in the exner function

! Poisson solver: modpois / modhypre
integer :: solver_id = 0 ! Identifier for nummerical solver: 0 1 2 3 4
#ifdef USE_FFTW
integer :: solver_id = 100 ! Identifier for nummerical solver: 0 1 2 3 4
#else
integer :: solver_id = 0
#endif
! FFT SMG PFMG BiCGSTAB GMRES
integer :: maxiter = 10000 ! Number of iterations . X X X X
real(real64):: tolerance = 1E-8! Convergence threshold . X X X X
Expand Down
4 changes: 1 addition & 3 deletions src/modpois.f90
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ subroutine initpois
implicit none

if (solver_id == 0) then
! FFT based solver
call fft2dinit(p, Fp, d, xyrt, ps,pe,qs,qe)
call fft2dinit(p, Fp, d, xyrt, ps, pe, qs, qe)
else if (solver_id == 100) then
! FFTW based solver
call fftwinit(p, Fp, d, xyrt, ps,pe,qs,qe)
Expand Down Expand Up @@ -101,7 +100,6 @@ subroutine exitpois
implicit none

if (solver_id == 0) then
! FFT based solver
call fft2dexit(p,Fp,d,xyrt)
else if (solver_id == 100) then
! FFTW based solver
Expand Down

0 comments on commit 92b146a

Please sign in to comment.