fftw: add optional AVX/FMA optmization flags

This commit is contained in:
Markus Kowalewski 2021-09-03 13:56:56 +02:00 committed by Frederik Rietdijk
parent 2be939de5d
commit 3da1c95940

View file

@ -1,4 +1,15 @@
{ fetchurl, stdenv, lib, gfortran, llvmPackages ? null, precision ? "double", perl }: { fetchurl
, stdenv
, lib
, gfortran
, perl
, llvmPackages ? null
, precision ? "double"
, enableAvx ? stdenv.hostPlatform.avxSupport
, enableAvx2 ? stdenv.hostPlatform.avx2Support
, enableAvx512 ? stdenv.hostPlatform.avx512Support
, enableFma ? stdenv.hostPlatform.fmaSupport
}:
with lib; with lib;
@ -40,6 +51,10 @@ stdenv.mkDerivation {
# all x86_64 have sse2 # all x86_64 have sse2
# however, not all float sizes fit # however, not all float sizes fit
++ optional (stdenv.isx86_64 && (precision == "single" || precision == "double") ) "--enable-sse2" ++ optional (stdenv.isx86_64 && (precision == "single" || precision == "double") ) "--enable-sse2"
++ optional enableAvx "--enable-avx"
++ optional enableAvx2 "--enable-avx2"
++ optional enableAvx512 "--enable-avx512"
++ optional enableFma "--enable-fma"
++ [ "--enable-openmp" ] ++ [ "--enable-openmp" ]
# doc generation causes Fortran wrapper generation which hard-codes gcc # doc generation causes Fortran wrapper generation which hard-codes gcc
++ optional (!withDoc) "--disable-doc"; ++ optional (!withDoc) "--disable-doc";