1313# Barnett tidying Feb, May 2020. Libin Lu edits, 2020.
1414# Garrett Wright, Joakim Anden, Barnett: dual-prec lib build, Jun-Jul'20.
1515# Windows compatibility, jonas-kr, Sep '20.
16+ # XSIMD dependency, Marco Barbone, June 2024.
1617
1718# Compiler (CXX), and linking from C, fortran. We use GCC by default...
1819CXX = g++
@@ -26,7 +27,7 @@ PYTHON = python3
2627# Notes: 1) -Ofast breaks isfinite() & isnan(), so use -O3 which now is as fast
2728# 2) -fcx-limited-range for fortran-speed complex arith in C++
2829# 3) we use simply-expanded (:=) makefile variables, otherwise confusing
29- CFLAGS := -O3 -funroll-loops -march=native -fcx-limited-range $(CFLAGS )
30+ CFLAGS := -O3 -funroll-loops -march=native -fcx-limited-range -ffp-contract=fast $(CFLAGS )
3031FFLAGS := $(CFLAGS ) $(FFLAGS )
3132CXXFLAGS := $(CFLAGS ) $(CXXFLAGS )
3233# FFTW base name, and math linking...
@@ -50,10 +51,10 @@ OFLAGS =
5051# For experts only, location of MWrap executable (see docs/install.rst):
5152MWRAP = mwrap
5253
53- # depenency root
54+ # dependency root (relative to top directory)
5455DEPS_ROOT := deps
5556
56- # xsimd repo url
57+ # xsimd dependency repo URL
5758XSIMD_URL := https://github.com/xtensor-stack/xsimd.git
5859XSIMD_VERSION := 13.0.0
5960XSIMD_DIR := $(DEPS_ROOT ) /xsimd
@@ -68,7 +69,7 @@ FINUFFT = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
6869# Now come flags that should be added, whatever user overrode in make.inc.
6970# -fPIC (position-indep code) needed to build dyn lib (.so)
7071# Also, we force return (via :=) to the land of simply-expanded variables...
71- INCL = -Iinclude
72+ INCL = -Iinclude -I $( XSIMD_DIR ) /include
7273CXXFLAGS := $(CXXFLAGS ) $(INCL ) -fPIC -std=c++17
7374CFLAGS := $(CFLAGS ) $(INCL ) -fPIC
7475# here /usr/include needed for fftw3.f "fortran header"... (JiriK: no longer)
@@ -121,11 +122,11 @@ OBJS_PI = $(SOBJS_PI) contrib/legendre_rule_fast.o
121122# all lib dual-precision objs
122123OBJSD = $(OBJS ) $(OBJSF ) $(OBJS_PI )
123124
124- .PHONY : usage lib examples test perftest spreadtest spreadtestall fortran matlab octave all mex python clean objclean pyclean mexclean wheel docker-wheel gurutime docs
125+ .PHONY : usage lib examples test perftest spreadtest spreadtestall fortran matlab octave all mex python clean objclean pyclean mexclean wheel docker-wheel gurutime docs setup setupclean
125126
126127default : usage
127128
128- all : test perftest lib examples fortran matlab octave python setup
129+ all : test perftest lib examples fortran matlab octave python
129130
130131usage :
131132 @echo " Makefile for FINUFFT library. Please specify your task:"
@@ -142,7 +143,8 @@ usage:
142143 @echo " make spreadtestall - small set spreader-only tests for CI use"
143144 @echo " make objclean - remove all object files, preserving libs & MEX"
144145 @echo " make clean - also remove all lib, MEX, py, and demo executables"
145- @echo " make setup - download dependencies"
146+ @echo " make setup - check (and possibly download) dependencies"
147+ @echo " make setupclean - delete downloaded dependencies"
146148 @echo " For faster (multicore) making, append, for example, -j8"
147149 @echo " "
148150 @echo " Make options:"
@@ -155,9 +157,9 @@ usage:
155157HEADERS = $(wildcard include/* .h include/finufft/* .h)
156158
157159# implicit rules for objects (note -o ensures writes to correct dir)
158- % .o : % .cpp $(HEADERS ) setup
160+ % .o : % .cpp $(HEADERS )
159161 $(CXX ) -c $(CXXFLAGS ) $< -o $@
160- % _32.o : % .cpp $(HEADERS ) setup
162+ % _32.o : % .cpp $(HEADERS )
161163 $(CXX ) -DSINGLE -c $(CXXFLAGS ) $< -o $@
162164% .o : % .c $(HEADERS )
163165 $(CC ) -c $(CFLAGS ) $< -o $@
@@ -168,8 +170,9 @@ HEADERS = $(wildcard include/*.h include/finufft/*.h)
168170% _32.o : % .f
169171 $(FC ) -DSINGLE -c $(FFLAGS ) $< -o $@
170172
171- # included auto-generated code dependency...
172- src/spreadinterp.o : src/ker_horner_allw_loop_constexpr.h src/ker_lowupsampfac_horner_allw_loop_constexpr.c
173+ # included auto-generated code and xsimd header-lib dependency...
174+ src/spreadinterp.o : src/ker_horner_allw_loop_constexpr.h src/ker_lowupsampfac_horner_allw_loop_constexpr.c $(XSIMD_DIR ) /include/xsimd/xsimd.hpp
175+ src/spreadinterp_32.o : src/ker_horner_allw_loop_constexpr.h src/ker_lowupsampfac_horner_allw_loop_constexpr.c $(XSIMD_DIR ) /include/xsimd/xsimd.hpp
173176
174177
175178# lib -----------------------------------------------------------------------
@@ -416,11 +419,12 @@ wheel: $(STATICLIB) $(DYNLIB)
416419docker-wheel :
417420 docker run --rm -e package_name=finufft -v ` pwd` :/io libinlu/manylinux2010_x86_64_fftw /io/python/ci/build-wheels.sh
418421
419- # =============================== SETUP ====================================
422+
423+ # ================== SETUP OF EXTERNAL DEPENDENCIES ===============
420424
421425define clone_repo
422- @echo "Cloning repository $(1 ) at tag $(2 ) into directory $(3 ) "
423426 @if [ ! -d "$(3 ) " ]; then \
427+ echo "Cloning repository $(1 ) at tag $(2 ) into directory $(3 ) "; \
424428 git clone --depth=1 --branch $(2 ) $(1 ) $(3 ) ; \
425429 else \
426430 cd $(3 ) && \
@@ -435,17 +439,16 @@ define clone_repo
435439 fi
436440endef
437441
438- setup :
439- @echo " Downloading dependencies..."
440- @echo " Downloading xsimd..."
442+ $(XSIMD_DIR ) /include/xsimd/xsimd.hpp :
441443 mkdir -p $(DEPS_ROOT )
444+ @echo " Checking xsimd external dependency..."
442445 $(call clone_repo,$(XSIMD_URL ) ,$(XSIMD_VERSION ) ,$(XSIMD_DIR ) )
443- @echo " xsimd downloaded in deps/xsimd"
444- CXXFLAGS += -I$(XSIMD_DIR ) /include
446+ @echo " xsimd installed in deps/xsimd"
445447
446448setupclean :
447449 rm -rf $(DEPS_ROOT )
448450
451+
449452# =============================== DOCUMENTATION =============================
450453
451454docs : docs/* .docsrc docs/matlabhelp.doc docs/makecdocs.sh
@@ -458,7 +461,7 @@ docs/matlabhelp.doc: docs/genmatlabhelp.sh matlab/*.sh matlab/*.docsrc matlab/*.
458461
459462# =============================== CLEAN UP ==================================
460463
461- clean : objclean pyclean setupclean
464+ clean : objclean pyclean
462465ifneq ($(MINGW ) ,ON)
463466 # non-Windows-WSL clean up...
464467 rm -f $(STATICLIB) $(DYNLIB)
0 commit comments