annotate ext/kissfft/test/Makefile @ 184:76ec2365b250

Bring in kissfft into this repo (formerly a subrepo, but the remote is not responding)
author Chris Cannam
date Tue, 21 Jul 2015 07:34:15 +0100
parents
children
rev   line source
Chris@184 1
Chris@184 2 WARNINGS=-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return \
Chris@184 3 -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast \
Chris@184 4 -Wwrite-strings
Chris@184 5
Chris@184 6 CFLAGS=-O3 -I.. -I../tools $(WARNINGS)
Chris@184 7 CFLAGS+=-ffast-math -fomit-frame-pointer
Chris@184 8 #CFLAGS+=-funroll-loops
Chris@184 9 #CFLAGS+=-march=prescott
Chris@184 10 #CFLAGS+= -mtune=native
Chris@184 11 # TIP: try adding -openmp or -fopenmp to enable OPENMP directives and use of multiple cores
Chris@184 12 #CFLAGS+=-fopenmp
Chris@184 13 CFLAGS+= $(CFLAGADD)
Chris@184 14
Chris@184 15
Chris@184 16 ifeq "$(NFFT)" ""
Chris@184 17 NFFT=1800
Chris@184 18 endif
Chris@184 19 ifeq "$(NUMFFTS)" ""
Chris@184 20 NUMFFTS=10000
Chris@184 21 endif
Chris@184 22
Chris@184 23 ifeq "$(DATATYPE)" ""
Chris@184 24 DATATYPE=float
Chris@184 25 endif
Chris@184 26
Chris@184 27 BENCHKISS=bm_kiss_$(DATATYPE)
Chris@184 28 BENCHFFTW=bm_fftw_$(DATATYPE)
Chris@184 29 SELFTEST=st_$(DATATYPE)
Chris@184 30 TESTREAL=tr_$(DATATYPE)
Chris@184 31 TESTKFC=tkfc_$(DATATYPE)
Chris@184 32 FASTFILTREAL=ffr_$(DATATYPE)
Chris@184 33 SELFTESTSRC=twotonetest.c
Chris@184 34
Chris@184 35
Chris@184 36 TYPEFLAGS=-Dkiss_fft_scalar=$(DATATYPE)
Chris@184 37
Chris@184 38 ifeq "$(DATATYPE)" "int16_t"
Chris@184 39 TYPEFLAGS=-DFIXED_POINT=16
Chris@184 40 endif
Chris@184 41
Chris@184 42 ifeq "$(DATATYPE)" "int32_t"
Chris@184 43 TYPEFLAGS=-DFIXED_POINT=32
Chris@184 44 endif
Chris@184 45
Chris@184 46 ifeq "$(DATATYPE)" "simd"
Chris@184 47 TYPEFLAGS=-DUSE_SIMD=1 -msse
Chris@184 48 endif
Chris@184 49
Chris@184 50
Chris@184 51 ifeq "$(DATATYPE)" "float"
Chris@184 52 # fftw needs to be built with --enable-float to build this lib
Chris@184 53 FFTWLIB=-lfftw3f
Chris@184 54 else
Chris@184 55 FFTWLIB=-lfftw3
Chris@184 56 endif
Chris@184 57
Chris@184 58 FFTWLIBDIR=-L/usr/local/lib/
Chris@184 59
Chris@184 60 SRCFILES=../kiss_fft.c ../tools/kiss_fftnd.c ../tools/kiss_fftr.c pstats.c ../tools/kfc.c ../tools/kiss_fftndr.c
Chris@184 61
Chris@184 62 all: tools $(BENCHKISS) $(SELFTEST) $(BENCHFFTW) $(TESTREAL) $(TESTKFC)
Chris@184 63
Chris@184 64 tools:
Chris@184 65 cd ../tools && make all
Chris@184 66
Chris@184 67
Chris@184 68 $(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
Chris@184 69 $(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
Chris@184 70
Chris@184 71 $(TESTKFC): $(SRCFILES)
Chris@184 72 $(CC) -o $@ $(CFLAGS) -DKFC_TEST $(TYPEFLAGS) $+ -lm
Chris@184 73
Chris@184 74 $(TESTREAL): test_real.c $(SRCFILES)
Chris@184 75 $(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
Chris@184 76
Chris@184 77 $(BENCHKISS): benchkiss.c $(SRCFILES)
Chris@184 78 $(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
Chris@184 79
Chris@184 80 $(BENCHFFTW): benchfftw.c pstats.c
Chris@184 81 @echo "======attempting to build FFTW benchmark"
Chris@184 82 @$(CC) -o $@ $(CFLAGS) -DDATATYPE$(DATATYPE) $+ $(FFTWLIB) $(FFTWLIBDIR) -lm || echo "FFTW not available for comparison"
Chris@184 83
Chris@184 84 test: all
Chris@184 85 @./$(TESTKFC)
Chris@184 86 @echo "======1d & 2-d complex fft self test (type= $(DATATYPE) )"
Chris@184 87 @./$(SELFTEST)
Chris@184 88 @echo "======real FFT (type= $(DATATYPE) )"
Chris@184 89 @./$(TESTREAL)
Chris@184 90 @echo "======timing test (type=$(DATATYPE))"
Chris@184 91 @./$(BENCHKISS) -x $(NUMFFTS) -n $(NFFT)
Chris@184 92 @[ -x ./$(BENCHFFTW) ] && ./$(BENCHFFTW) -x $(NUMFFTS) -n $(NFFT) ||true
Chris@184 93 @echo "======higher dimensions type=$(DATATYPE))"
Chris@184 94 @./testkiss.py
Chris@184 95
Chris@184 96 selftest.c:
Chris@184 97 ./mk_test.py 10 12 14 > selftest.c
Chris@184 98 selftest_short.c:
Chris@184 99 ./mk_test.py -s 10 12 14 > selftest_short.c
Chris@184 100
Chris@184 101
Chris@184 102 CXXFLAGS=-O3 -ffast-math -fomit-frame-pointer -I.. -I../tools -W -Wall
Chris@184 103 testcpp: testcpp.cc ../kissfft.hh
Chris@184 104 $(CXX) -o $@ $(CXXFLAGS) testcpp.cc -lm
Chris@184 105
Chris@184 106
Chris@184 107 clean:
Chris@184 108 rm -f *~ bm_* st_* tr_* kf_* tkfc_* ff_* ffr_* *.pyc *.pyo *.dat testcpp