|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
WARNINGS=-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return \
|
|
shun_iwasawa |
a35b8f |
-Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast \
|
|
shun_iwasawa |
a35b8f |
-Wwrite-strings
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
CFLAGS=-O3 -I.. -I../tools $(WARNINGS)
|
|
shun_iwasawa |
a35b8f |
CFLAGS+=-ffast-math -fomit-frame-pointer
|
|
shun_iwasawa |
a35b8f |
#CFLAGS+=-funroll-loops
|
|
shun_iwasawa |
a35b8f |
#CFLAGS+=-march=prescott
|
|
shun_iwasawa |
a35b8f |
#CFLAGS+= -mtune=native
|
|
shun_iwasawa |
a35b8f |
# TIP: try adding -openmp or -fopenmp to enable OPENMP directives and use of multiple cores
|
|
shun_iwasawa |
a35b8f |
#CFLAGS+=-fopenmp
|
|
shun_iwasawa |
a35b8f |
CFLAGS+= $(CFLAGADD)
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
ifeq "$(NFFT)" ""
|
|
shun_iwasawa |
a35b8f |
NFFT=1800
|
|
shun_iwasawa |
a35b8f |
endif
|
|
shun_iwasawa |
a35b8f |
ifeq "$(NUMFFTS)" ""
|
|
shun_iwasawa |
a35b8f |
NUMFFTS=10000
|
|
shun_iwasawa |
a35b8f |
endif
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
ifeq "$(DATATYPE)" ""
|
|
shun_iwasawa |
a35b8f |
DATATYPE=float
|
|
shun_iwasawa |
a35b8f |
endif
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
BENCHKISS=bm_kiss_$(DATATYPE)
|
|
shun_iwasawa |
a35b8f |
BENCHFFTW=bm_fftw_$(DATATYPE)
|
|
shun_iwasawa |
a35b8f |
SELFTEST=st_$(DATATYPE)
|
|
shun_iwasawa |
a35b8f |
TESTREAL=tr_$(DATATYPE)
|
|
shun_iwasawa |
a35b8f |
TESTKFC=tkfc_$(DATATYPE)
|
|
shun_iwasawa |
a35b8f |
FASTFILTREAL=ffr_$(DATATYPE)
|
|
shun_iwasawa |
a35b8f |
SELFTESTSRC=twotonetest.c
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
TYPEFLAGS=-Dkiss_fft_scalar=$(DATATYPE)
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
ifeq "$(DATATYPE)" "int16_t"
|
|
shun_iwasawa |
a35b8f |
TYPEFLAGS=-DFIXED_POINT=16
|
|
shun_iwasawa |
a35b8f |
endif
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
ifeq "$(DATATYPE)" "int32_t"
|
|
shun_iwasawa |
a35b8f |
TYPEFLAGS=-DFIXED_POINT=32
|
|
shun_iwasawa |
a35b8f |
endif
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
ifeq "$(DATATYPE)" "simd"
|
|
shun_iwasawa |
a35b8f |
TYPEFLAGS=-DUSE_SIMD=1 -msse
|
|
shun_iwasawa |
a35b8f |
endif
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
ifeq "$(DATATYPE)" "float"
|
|
shun_iwasawa |
a35b8f |
# fftw needs to be built with --enable-float to build this lib
|
|
shun_iwasawa |
a35b8f |
FFTWLIB=-lfftw3f
|
|
shun_iwasawa |
a35b8f |
else
|
|
shun_iwasawa |
a35b8f |
FFTWLIB=-lfftw3
|
|
shun_iwasawa |
a35b8f |
endif
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
FFTWLIBDIR=-L/usr/local/lib/
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
SRCFILES=../kiss_fft.c ../tools/kiss_fftnd.c ../tools/kiss_fftr.c pstats.c ../tools/kfc.c ../tools/kiss_fftndr.c
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
all: tools $(BENCHKISS) $(SELFTEST) $(BENCHFFTW) $(TESTREAL) $(TESTKFC)
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
tools:
|
|
shun_iwasawa |
a35b8f |
cd ../tools && make all
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
$(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
|
|
shun_iwasawa |
a35b8f |
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
$(TESTKFC): $(SRCFILES)
|
|
shun_iwasawa |
a35b8f |
$(CC) -o $@ $(CFLAGS) -DKFC_TEST $(TYPEFLAGS) $+ -lm
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
$(TESTREAL): test_real.c $(SRCFILES)
|
|
shun_iwasawa |
a35b8f |
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
$(BENCHKISS): benchkiss.c $(SRCFILES)
|
|
shun_iwasawa |
a35b8f |
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
$(BENCHFFTW): benchfftw.c pstats.c
|
|
shun_iwasawa |
a35b8f |
@echo "======attempting to build FFTW benchmark"
|
|
shun_iwasawa |
a35b8f |
@$(CC) -o $@ $(CFLAGS) -DDATATYPE$(DATATYPE) $+ $(FFTWLIB) $(FFTWLIBDIR) -lm || echo "FFTW not available for comparison"
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
test: all
|
|
shun_iwasawa |
a35b8f |
@./$(TESTKFC)
|
|
shun_iwasawa |
a35b8f |
@echo "======1d & 2-d complex fft self test (type= $(DATATYPE) )"
|
|
shun_iwasawa |
a35b8f |
@./$(SELFTEST)
|
|
shun_iwasawa |
a35b8f |
@echo "======real FFT (type= $(DATATYPE) )"
|
|
shun_iwasawa |
a35b8f |
@./$(TESTREAL)
|
|
shun_iwasawa |
a35b8f |
@echo "======timing test (type=$(DATATYPE))"
|
|
shun_iwasawa |
a35b8f |
@./$(BENCHKISS) -x $(NUMFFTS) -n $(NFFT)
|
|
shun_iwasawa |
a35b8f |
@[ -x ./$(BENCHFFTW) ] && ./$(BENCHFFTW) -x $(NUMFFTS) -n $(NFFT) ||true
|
|
shun_iwasawa |
a35b8f |
@echo "======higher dimensions type=$(DATATYPE))"
|
|
shun_iwasawa |
a35b8f |
@./testkiss.py
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
selftest.c:
|
|
shun_iwasawa |
a35b8f |
./mk_test.py 10 12 14 > selftest.c
|
|
shun_iwasawa |
a35b8f |
selftest_short.c:
|
|
shun_iwasawa |
a35b8f |
./mk_test.py -s 10 12 14 > selftest_short.c
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
CXXFLAGS=-O3 -ffast-math -fomit-frame-pointer -I.. -I../tools -W -Wall
|
|
shun_iwasawa |
a35b8f |
testcpp: testcpp.cc ../kissfft.hh
|
|
shun_iwasawa |
a35b8f |
$(CXX) -o $@ $(CXXFLAGS) testcpp.cc -lm
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
|
|
shun_iwasawa |
a35b8f |
clean:
|
|
shun_iwasawa |
a35b8f |
rm -f *~ bm_* st_* tr_* kf_* tkfc_* ff_* ffr_* *.pyc *.pyo *.dat testcpp
|