Several decoder optimizations, including implementation of FFTW wisdom.

Notes:
1. Equivalents of wisdom1.bat will be needed for *nix and OS X.  (The
   version now added to the source .../lib directory is an example only.)
2. Installers should offer to run the wisdom1[.bat] script at installation
   time.
3. wisdom1[.bat] and fftwf-wisdom[.exe] must be installed in .../bin directory 



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4607 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2014-11-19 17:23:57 +00:00
parent deb94dde78
commit f07a960e2d
5 changed files with 46 additions and 10 deletions

View File

@ -7,7 +7,8 @@ subroutine filbig(dd,npts,f0,newdat,c4a,n4,sq0)
parameter (NFFT1=672000,NFFT2=77175)
parameter (NZ2=1000)
real*4 dd(npts) !Input data
complex ca(NFFT1) !FFT of input
real*4 rca(NFFT1)
complex ca(NFFT1/2+1) !FFT of input
complex c4a(NFFT2) !Output data
real*4 s(NZ2)
real*8 df
@ -17,8 +18,8 @@ subroutine filbig(dd,npts,f0,newdat,c4a,n4,sq0)
integer*8 plan1,plan2,plan3
logical first
include 'fftw3.f90'
equivalence (rfilt,cfilt)
data first/.true./,npatience/0/
equivalence (rfilt,cfilt),(rca,ca)
data first/.true./,npatience/1/
data halfpulse/114.97547150,36.57879257,-20.93789101, &
5.89886379,1.59355187,-2.49138308,0.60910773,-0.04248129/
common/refspec/dfref,ref(NSZ)
@ -34,7 +35,7 @@ subroutine filbig(dd,npts,f0,newdat,c4a,n4,sq0)
if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE
! Plan the FFTs just once
call timer('FFTplans ',0)
call sfftw_plan_dft_1d(plan1,nfft1,ca,ca,FFTW_BACKWARD,nflags)
call sfftw_plan_dft_r2c_1d(plan1,nfft1,rca,rca,nflags)
call sfftw_plan_dft_1d(plan2,nfft2,c4a,c4a,FFTW_FORWARD,nflags)
call sfftw_plan_dft_1d(plan3,nfft2,cfilt,cfilt,FFTW_BACKWARD,nflags)
call timer('FFTplans ',1)
@ -67,8 +68,8 @@ subroutine filbig(dd,npts,f0,newdat,c4a,n4,sq0)
if(newdat.ne.0) then
nz=min(npts,nfft1)
ca(1:nz)=dd(1:nz)
ca(nz+1:)=0. !### Should change this to r2c FFT ###
rca(1:nz)=dd(1:nz)
rca(nz+1:)=0.
call timer('FFTbig ',0)
call sfftw_execute(plan1)
call timer('FFTbig ',1)
@ -78,7 +79,7 @@ subroutine filbig(dd,npts,f0,newdat,c4a,n4,sq0)
if(j.lt.1) j=1
if(j.gt.NSZ) j=NSZ
fac=sqrt(min(30.0,1.0/ref(j)))
ca(i)=fac * ca(i)
ca(i)=conjg(fac * ca(i))
enddo
endif

View File

@ -22,8 +22,8 @@ subroutine four2a(a,nfft,ndim,isign,iform)
complex aa(NSMALL)
integer nn(NPMAX),ns(NPMAX),nf(NPMAX)
integer*8 plan(NPMAX),nl(NPMAX),nloc
! character cfftw*20
data nplan/0/,npatience/1/
! data nplan/0/,npatience/0/
include 'fftw3.f90'
save plan,nplan,nn,ns,nf,nl
@ -42,6 +42,16 @@ subroutine four2a(a,nfft,ndim,isign,iform)
nf(i)=iform
nl(i)=nloc
! cfftw(1:2)='ci'
! if(nf(i).ne.1) cfftw(1:2)='ri'
! cfftw(3:3)='f'
! if(ns(i).eq.1) cfftw(3:3)='b'
! write(cfftw(4:),*) nn(i)
! cfftw=cfftw(1:3)//cfftw(5:)
! write(12,3999) i,nn(i),ns(i),nf(i),cfftw
!3999 format(4i10,2x,a20)
! flush(12)
! Planning: FFTW_ESTIMATE, FFTW_ESTIMATE_PATIENT, FFTW_MEASURE,
! FFTW_PATIENT, FFTW_EXHAUSTIVE
nflags=FFTW_ESTIMATE

View File

@ -103,7 +103,19 @@ program jt9
npts=(60*ntrperiod-6)*12000
if(iarg .eq. offset + 1) then
open(12,file=trim(data_dir)//'/timer.out',status='unknown')
call timer('jt9 ',0)
! Import FFTW wisdom, if available:
open(28,file=trim(data_dir)//'/fftwf_wisdom.dat',status='old',err=30)
read(28,1000,err=30,end=30) firstline
1000 format(a30)
rewind 28
call import_wisdom_from_file(isuccess,28)
close(28)
if(isuccess.ne.0) write(12,1010) firstline
1010 format('Imported FFTW wisdom: ',a30)
call flush(12)
30 call timer('jt9 ',0)
endif
id2=0 !??? Why is this necessary ???

View File

@ -25,7 +25,18 @@ subroutine jt9a()
call getcwd(cwd)
open(12,file=trim(data_dir)//'/timer.out',status='unknown')
limtrace=0
! Import FFTW wisdom, if available:
open(28,file=trim(exe_dir)//'/fftwf_wisdom.dat',status='old',err=30)
read(28,1000,err=30,end=30) firstline
1000 format(a30)
rewind 28
call import_wisdom_from_file(isuccess,28)
close(28)
if(isuccess.ne.0) write(12,1010) firstline
1010 format('Imported FFTW wisdom: ',a30)
call flush(12)
30 limtrace=0
! limtrace=-1 !Disable all calls to timer()
lu=12

2
lib/wisdom1.bat Normal file
View File

@ -0,0 +1,2 @@
C:\JTSDK-QT\fftw3f\fftwf-wisdom -o fftwf_wisdom.dat -t 1 -m rif672000 cif77175 cib77175 rif16384 rif884736 cib2048 rif8192 rif512 rib512 cib512