Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
wants to merge 2 commits into from

3 participants

@sxprophet

No description provided.

@mistydemeo
Owner

Not all of the compilers in Xcode support AVX; only clang does. (GCC didn't support it until 4.6, which is newer than what Xcode provides.) This should probably only be enabeld if ENV.compiler == :clang.

Not all of the Intel processors in hardware we support have AVX either; just Sandy Bridge and Ivy Bridge. This should only be enabled on hardware that can use it.

@samueljohn

Can we have the gfortran and fftw in separate pull requests? The title does not mention gfortran at all.

I am in favor of adding cloog and isl to gfortran but I need to test this and this is easier in separate requests.
I am willing to test the gfortran stuff - ping me in a new PR.

I have a core 2 duo and sandy bridge mac, so I can test that stuff (but I am not testing this right now).

Also true what @mistydemeo said. Please add the avx stuff if compiler is :clang and the hardware is right. (https://github.com/mxcl/homebrew/blob/master/Library/Homebrew/os/mac/hardware.rb#L27)

And please check if superenv does not remove the avx flags during compiler call.

@mistydemeo
Owner

I added a new helper to determine if the CPU is AVX-capable: Hardware::CPU.avx?

You'll still need to ensure that it's only enabled if the compiler is clang.

@sxprophet

@samueljohn and @mistydemeo
Thanks for your comments. I'm closing this PR in favor of new, separated PRs for fftw and gfortran.

@sxprophet sxprophet closed this
@mistydemeo
Owner

You can keep them separate by pushing to separate branches on your Github fork of homebrew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 6, 2013
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 6 deletions.
  1. +7 −6 Library/Formula/fftw.rb
  2. +4 −0 Library/Formula/gfortran.rb
View
13 Library/Formula/fftw.rb
@@ -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",
@@ -14,6 +15,8 @@ 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
@@ -21,18 +24,16 @@ def install
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
View
4 Library/Formula/gfortran.rb
@@ -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'
@@ -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",
Something went wrong with that request. Please try again.