fftw: clean up funrolling, make avx into a package option

This commit is contained in:
nia 2021-05-15 11:05:29 +00:00
parent be29d2f130
commit c4ac7912cd
3 changed files with 28 additions and 38 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.70 2021/05/15 10:19:33 nia Exp $
# $NetBSD: Makefile,v 1.71 2021/05/15 11:05:29 nia Exp $
DISTNAME= fftw-3.3.9
PKGREVISION= 5
@ -49,30 +49,16 @@ CONFIGURE_DIRS+= build/${p}
MAKE_DIRS+= build/${p}
.endfor
# SIMD stuff needs some baseline.
GCC_REQD+= 4.9
# 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
FFTW_DOUBLE_OPTS+= --enable-sse2 --enable-avx
FFTW_FLOAT_OPTS+= --enable-avx2 --enable-avx512 --enable-avx-128-fma
FFTW_DOUBLE_OPTS+= --enable-avx2 --enable-avx512 --enable-avx-128-fma
# Generic compiler vector abstractions.
.if !empty(PKGSRC_COMPILER:M*gcc*) || !empty(PKGSRC_COMPILER:M*clang*)
FFTW_FLOAT_OPTS+= --enable-generic-simd128 --enable-generic-simd256
FFTW_DOUBLE_OPTS+= --enable-generic-simd128 --enable-generic-simd256
.endif
# TODO: Add the above for other architectures.
# Avoid -march=core-avx2 messing up with user CFLAGS.
# This rules out gcc 4.8 for AVX2 builds.
SUBST_CLASSES+= hardcore
SUBST_STAGE.hardcore= pre-configure
SUBST_FILES.hardcore= configure configure.ac
SUBST_SED.hardcore= -e "s,march=core-avx2,march=donotbother,g"
.if ${MACHINE_ARCH} == "x86_64"
FFTW_FLOAT_OPTS+= --enable-sse --enable-sse2
FFTW_DOUBLE_OPTS+= --enable-sse2
.endif
pre-configure:
.for d in ${CONFIGURE_DIRS}

View file

@ -1,4 +1,4 @@
# $NetBSD: buildlink3.mk,v 1.10 2021/05/15 10:19:33 nia Exp $
# $NetBSD: buildlink3.mk,v 1.11 2021/05/15 11:05:29 nia Exp $
BUILDLINK_TREE+= fftw
@ -9,8 +9,6 @@ BUILDLINK_API_DEPENDS.fftw+= fftw>=3.0
BUILDLINK_ABI_DEPENDS.fftw+= fftw>=3.1nb1
BUILDLINK_PKGSRCDIR.fftw?= ../../math/fftw
GCC_REQD+= 4.9
pkgbase := fftw
.include "../../mk/pkg-build-options.mk"
.if ${PKG_BUILD_OPTIONS.fftw:Mmpi}

View file

@ -1,20 +1,26 @@
# $NetBSD: options.mk,v 1.5 2021/05/07 12:31:22 thor Exp $
# $NetBSD: options.mk,v 1.6 2021/05/15 11:05:29 nia Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.fftw
# fftw (double) and fftwf (single) are always built, you can add
# fftwl (long) and fftwq (quad).
PKG_SUPPORTED_OPTIONS= fftw-fortran openmp mpi fftw-long fftw-quad
# Enable fortran support by default on platforms supported by lang/g95.
.if (${MACHINE_ARCH} == i386 || ${MACHINE_ARCH} == x86_64 || \
${MACHINE_ARCH} == ia64 || !empty(MACHINE_ARCH:Mpowerpc*) || \
${MACHINE_ARCH} == hppa || !empty(MACHINE_ARCH:Msparc*) || \
${MACHINE_ARCH} == alpha || !empty(MACHINE_ARCH:Mmips*))
# ...but disable it until lang/g95 issue is resolved.
#PKG_SUGGESTED_OPTIONS= fftw-fortran
.include "../../mk/bsd.prefs.mk"
.if ${MACHINE_ARCH} == "x86_64"
PKG_SUPPORTED_OPTIONS+= avx
.endif
.include "../../mk/bsd.options.mk"
.if !empty(PKG_OPTIONS:Mavx)
GCC_REQD+= 4.9
. for opt in avx avx2 avx512 avx-128-fma
FFTW_FLOAT_OPTS+= --enable-${opt}
FFTW_DOUBLE_OPTS+= --enable-${opt}
. endfor
.endif
.if !empty(PKG_OPTIONS:Mfftw-fortran)
USE_LANGUAGES+= fortran77
.else
@ -27,20 +33,20 @@ PLIST.omp= yes
CONFIGURE_ARGS+= --enable-openmp
.endif
PLIST_VARS+= mpi
PLIST_VARS+= mpi
.if !empty(PKG_OPTIONS:Mmpi)
PLIST.mpi= yes
PLIST.mpi= yes
CONFIGURE_ARGS+= --enable-mpi
.include "../../mk/mpi.buildlink3.mk"
.endif
PLIST_VARS+= long quad
PLIST_VARS+= long
.if !empty(PKG_OPTIONS:Mfftw-long)
FFTW_PRECISION+= long-double
PLIST.long= yes
.endif
PLIST_VARS+= quad
.if !empty(PKG_OPTIONS:Mfftw-quad)
FFTW_PRECISION+= quad-precision
PLIST.quad= yes