mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-07-18 21:14:24 -04:00
modified time benchmark to repeat same buffer over and over to avoid IO bottlenecks and get more consistent numbers.
This commit is contained in:
@ -28,25 +28,26 @@ endif
|
||||
$(UTIL): $(UTILSRC)
|
||||
gcc -o $@ $(CFLAGS) $(TYPEFLAGS) $(UTILSRC)
|
||||
|
||||
RANDDAT=rand_$(DATATYPE)_$(NUMFFTS)_$(NFFT).dat
|
||||
RANDDAT=rand_$(DATATYPE)_$(NFFT).dat
|
||||
$(RANDDAT):
|
||||
./rand_fft_data.py -n $(NUMFFTS) -N $(NFFT) -t $(DATATYPE) > $(RANDDAT)
|
||||
./rand_fft_data.py -n 1 -N $(NFFT) -t $(DATATYPE) > $(RANDDAT)
|
||||
|
||||
time: all $(RANDDAT)
|
||||
@echo
|
||||
@echo -n "#### timing $(NUMFFTS) x $(NFFT) point FFTs. "; factor $(NFFT)
|
||||
@if [ -x ~/fftw/st ] && [ $(DATATYPE) == "double" ]; then \
|
||||
echo "#### FFTW FFT $(DATATYPE)"; \
|
||||
time ~/fftw/st -n $(NFFT) < $(RANDDAT) > /dev/null;\
|
||||
time ~/fftw/st -x $(NUMFFTS) -n $(NFFT) < $(RANDDAT) > /dev/null;\
|
||||
fi
|
||||
@echo "#### KISS FFT $(DATATYPE)"
|
||||
@time ./$(UTIL) -n $(NFFT) < $(RANDDAT) > /dev/null
|
||||
@time ./$(UTIL) -x $(NUMFFTS) -n $(NFFT) < $(RANDDAT) > /dev/null
|
||||
@rm $(RANDDAT)
|
||||
|
||||
POW2=256 512 1024 2048
|
||||
POW3=243 729 2187
|
||||
POW5=25 125 625
|
||||
mtime: all
|
||||
@for n in $(POW2) ;do \
|
||||
@for n in $(POW5) ;do \
|
||||
export NFFT=$$n;make time; \
|
||||
done
|
||||
|
||||
|
@ -26,16 +26,20 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
|
||||
|
||||
|
||||
void fft_file(FILE * fin,FILE * fout,int nfft,int isinverse,int useascii)
|
||||
void fft_file(FILE * fin,FILE * fout,int nfft,int isinverse,int useascii,int times)
|
||||
{
|
||||
int i;
|
||||
void *st;
|
||||
kiss_fft_cpx * buf;
|
||||
kiss_fft_cpx * bufout;
|
||||
|
||||
buf = (kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx) * nfft );
|
||||
bufout = (kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx) * nfft );
|
||||
st = kiss_fft_alloc( nfft ,isinverse );
|
||||
|
||||
while ( fread( buf , sizeof(kiss_fft_cpx) * nfft ,1, fin ) > 0 ) {
|
||||
kiss_fft( st , buf );
|
||||
for (i=0;i<times;++i)
|
||||
kiss_fft_io( st , buf ,bufout);
|
||||
if (useascii) {
|
||||
int i;
|
||||
for (i=0;i<nfft;++i)
|
||||
@ -46,6 +50,7 @@ void fft_file(FILE * fin,FILE * fout,int nfft,int isinverse,int useascii)
|
||||
}
|
||||
free(st);
|
||||
free(buf);
|
||||
free(bufout);
|
||||
}
|
||||
|
||||
int main(int argc,char ** argv)
|
||||
@ -55,14 +60,16 @@ int main(int argc,char ** argv)
|
||||
FILE *fin=stdin;
|
||||
FILE *fout=stdout;
|
||||
int useascii=0;
|
||||
|
||||
int times=1;
|
||||
|
||||
while (1) {
|
||||
int c=getopt(argc,argv,"n:ia");
|
||||
int c=getopt(argc,argv,"n:iax:");
|
||||
if (c==-1) break;
|
||||
switch (c) {
|
||||
case 'a':useascii=1;break;
|
||||
case 'n':nfft = atoi(optarg);break;
|
||||
case 'i':isinverse=1;break;
|
||||
case 'x':times=atoi(optarg);break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +85,7 @@ int main(int argc,char ** argv)
|
||||
++optind;
|
||||
}
|
||||
|
||||
fft_file(fin,fout,nfft,isinverse,useascii);
|
||||
fft_file(fin,fout,nfft,isinverse,useascii,times);
|
||||
|
||||
if (fout!=stdout) fclose(fout);
|
||||
if (fin!=stdin) fclose(fin);
|
||||
|
Reference in New Issue
Block a user