summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorthor <thor@pkgsrc.org>2021-04-30 11:13:36 +0000
committerthor <thor@pkgsrc.org>2021-04-30 11:13:36 +0000
commitc2164f4d9ae04138bbaef49759d9705daeddb765 (patch)
tree83f5aed018e857071213a5111a8d246b6101d5df /math
parent17ea0c3eaa798fbaf2c71e0deb9c4d7deb64a2b4 (diff)
downloadpkgsrc-c2164f4d9ae04138bbaef49759d9705daeddb765.tar.gz
math/fftw: enable SIMD optimizations for x86-64
… and also fix perl usage for test target only. FFTW checks at runtime which optimization really works.
Diffstat (limited to 'math')
-rw-r--r--math/fftw/Makefile27
1 files changed, 23 insertions, 4 deletions
diff --git a/math/fftw/Makefile b/math/fftw/Makefile
index 4587faf0613..fba9c7c7a10 100644
--- a/math/fftw/Makefile
+++ b/math/fftw/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.63 2021/04/30 09:01:48 thor Exp $
+# $NetBSD: Makefile,v 1.64 2021/04/30 11:13:36 thor Exp $
-PKGREVISION= 4
+PKGREVISION= 5
COMMENT= Collection of fast C routines to compute DFTs
@@ -36,7 +36,7 @@ FFTW_PRECISION= double float
# Test will only use the default build.
.if defined(PKGSRC_RUN_TEST) && !empty(PKGSRC_RUN_TEST:M[Yy][Ee][Ss])
-USE_TOOLS+= perl
+USE_TOOLS+= perl:test
.endif
PLIST_VARS+= pthreads
@@ -53,10 +53,29 @@ CONFIGURE_DIRS+= build/${p}
MAKE_DIRS+= build/${p}
.endfor
+# FFTW offers SIMD runtime detection, but wants explicit build options.
+# These should be generic for all platforms. Compiler needs intrinsics
+# for this, but those have been present for quite some time.
+FFTW_FLOAT_OPTS= --enable-generic-simd128 --enable-generic-simd256
+FFTW_DOUBLE_OPTS= --enable-generic-simd128 --enable-generic-simd256
+
+.if ${MACHINE_ARCH} == "x86_64"
+FFTW_FLOAT_OPTS+= --enable-sse --enable-sse2 --enable-avx --enable-avx2
+FFTW_FLOAT_OPTS+= --enable-avx512 --enable-avx-128-fma
+FFTW_DOUBLE_OPTS+= --enable-sse2 --enable-avx --enable-avx2
+FFTW_DOUBLE_OPTS+= --enable-avx512 --enable-avx-128-fma
+.endif
+
pre-configure:
.for d in ${CONFIGURE_DIRS}
mkdir -p ${WRKSRC:Q}/${d}
-.if ${d} == "build/quad-precision"
+.if ${d} == "build/float"
+ printf '#!/bin/sh\nexec ../../configure "$$@" --enable-${d:S,build/,,} ${FFTW_FLOAT_OPTS}' \
+ > ${WRKSRC:Q}/${d}/configure
+.elif ${d} == "build/double"
+ printf '#!/bin/sh\nexec ../../configure "$$@" --enable-${d:S,build/,,} ${FFTW_DOUBLE_OPTS}' \
+ > ${WRKSRC:Q}/${d}/configure
+.elif ${d} == "build/quad-precision"
printf '#!/bin/sh\nexec ../../configure "$$@" --enable-${d:S,build/,,} --disable-mpi\n' \
> ${WRKSRC:Q}/${d}/configure
.else