Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

fftw 3.3: enable AVX instruction set for SIMD speedup #19002

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions Library/Formula/fftw.rb
Expand Up @@ -6,6 +6,7 @@ class Fftw < Formula
sha1 '11487180928d05746d431ebe7a176b52fe205cf9'

option "with-fortran", "Enable Fortran bindings"
option "without-avx", "Disable AVX instruction set for SIMD speedup"

def install
args = ["--enable-shared",
Expand All @@ -14,25 +15,25 @@ def install
"--enable-threads",
"--disable-dependency-tracking"]

simd_args = ["--enable-sse2"]
simd_args << "--enable-avx" unless build.include? "without-avx"
if build.include? "with-fortran"
ENV.fortran
else
args << "--disable-fortran" unless which 'gfortran'
end

# single precision
# enable-sse only works with single
system "./configure", "--enable-single",
"--enable-sse",
*args
# enable-sse2 works for both single and double precisions
system "./configure", "--enable-single", *(args + simd_args)
system "make install"

# clean up so we can compile the double precision variant
system "make clean"

# double precision
# enable-sse2 only works with double precision (default)
system "./configure", "--enable-sse2", *args
# enable-sse2 works for both single and double precisions
system "./configure", *(args + simd_args)
system "make install"

# clean up so we can compile the long-double precision variant
Expand Down
4 changes: 4 additions & 0 deletions Library/Formula/gfortran.rb
Expand Up @@ -20,6 +20,8 @@ class Gfortran < Formula
depends_on 'gmp'
depends_on 'libmpc'
depends_on 'mpfr'
depends_on 'isl'
depends_on 'cloog'

# http://gcc.gnu.org/install/test.html
depends_on 'dejagnu' if build.include? 'check'
Expand Down Expand Up @@ -54,6 +56,8 @@ def install
"--with-gmp=#{Formula.factory('gmp').opt_prefix}",
"--with-mpfr=#{Formula.factory('mpfr').opt_prefix}",
"--with-mpc=#{Formula.factory('libmpc').opt_prefix}",
"--with-isl=#{Formula.factory('isl').opt_prefix}",
"--with-cloog=#{Formula.factory('cloog').opt_prefix}",
# ...we build the stage 1 gcc with clang (which is know to fail checks)
"--enable-checking=release",
"--disable-stage1-checking",
Expand Down