Folks, as part of the perf variant proposal, I have written a perf-1.0 portgroup file that might do the job. Opinion?
Thanks, Vincent — # $Id: perf-1.0.tcl vi...@macports.org $ # # Copyright (c) 2013 The MacPorts Project # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of The MacPorts Project nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # This portgroup provides a perf variant than can be used to # optimize code at the expense of portability. It uses # macports-clang-3.3 as C and C++ compiler at the -O4 level (enables loop # vectorizer and LTO) and dragonegg-3.3-gfortran-4.8 to compile # Fortran code, thereby allowing AVX instructions even in Fortran code # # Usage: # PortGroup perf 1.0 proc get_perf_flags {} { # Find out on which system we are running set archflags "" set os.major [lindex [split [sysctl kern.osrelease] " "] 0] if {(${os.major} > 11 && \ (![catch {sysctl hw.optional.fma} result1] && $result1 == 1)) || (![catch {sysctl hw.cpufamily} result2] && $result2 == 280134364)} { append archflags "-mfma " } if {(${os.major} > 11 && \ (![catch {sysctl hw.optional.avx2_0} result1] && $result1 == 1)) || (![catch {sysctl hw.cpufamily} result2] && $result2 == 280134364)} { append archflags "-mavx2 " } elseif {(${os.major} > 10 && \ (![catch {sysctl hw.optional.avx1_0} result1] && $result1 == 1)) || (![catch {sysctl hw.cpufamily} result2] && $result2 == 1418770316)} { append archflags "-mavx " } elseif {${os.major} > 9 && \ ![catch {sysctl hw.optional.sse4_2} result1] && $result1 == 1} { set archflags "-msse4.2 " } elseif {${os.major} > 9 && \ ![catch {sysctl hw.optional.sse4_1} result1] && $result1 == 1} { set archflags "-msse4.1 " } elseif {${os.major} > 8 && \ ![catch {sysctl hw.optional.supplementalsse3} result1] && $result1 == 1} { set archflags "-mssse3 " } elseif { ![catch {sysctl hw.optional.altivec} result1] && $result1 == 1} { # PowerPC set archflags "-maltivec -mabi=altivec " } append archflags "-O4 -march=native" return $archflags } variant perf description {Optimize for current arch} { depends_build-append port:clang-3.3 depends_build-append port:dragonegg-3.3-gcc-4.8 set optflags [get_perf_flags] set fortflags "${optflags}\ -specs=${prefix}/libexec/dragonegg/llvm33gcc48-integrated-as.specs" configure.compiler macports-clang-3.3 configure.f77 ${prefix}/bin/dragonegg-3.3-gfortran-mp-4.8 configure.f90 ${prefix}/bin/dragonegg-3.3-gfortran-mp-4.8 configure.optflags ${optflags} configure.fflags ${fortflags} configure.f90flags ${fortflags} } _______________________________________________ macports-dev mailing list macports-dev@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-dev