pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/math/fftw math/fftw: enable SIMD optimizations for x86-64



details:   https://anonhg.NetBSD.org/pkgsrc/rev/304ae77d9e08
branches:  trunk
changeset: 451708:304ae77d9e08
user:      thor <thor%pkgsrc.org@localhost>
date:      Fri Apr 30 11:13:36 2021 +0000

description:
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:

 math/fftw/Makefile |  27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 888641c4b44a -r 304ae77d9e08 math/fftw/Makefile
--- a/math/fftw/Makefile        Fri Apr 30 10:39:02 2021 +0000
+++ b/math/fftw/Makefile        Fri Apr 30 11:13:36 2021 +0000
@@ -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 @@
 
 # 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 @@
 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


Home | Main Index | Thread Index | Old Index