From c2164f4d9ae04138bbaef49759d9705daeddb765 Mon Sep 17 00:00:00 2001 From: thor Date: Fri, 30 Apr 2021 11:13:36 +0000 Subject: math/fftw: enable SIMD optimizations for x86-64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … and also fix perl usage for test target only. FFTW checks at runtime which optimization really works. --- math/fftw/Makefile | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'math') 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 -- cgit v1.2.3