[100521] trunk/dports/math/atlas

vince at macports.org vince at macports.org
Fri Dec 14 10:39:18 PST 2012


Revision: 100521
          https://trac.macports.org/changeset/100521
Author:   vince at macports.org
Date:     2012-12-14 10:39:18 -0800 (Fri, 14 Dec 2012)
Log Message:
-----------
Add a lot of patches to fix ppc builds. Add also OpenMP support
for gcc versions > 4.5. Fix some indentation issues (I know I
should not).

Modified Paths:
--------------
    trunk/dports/math/atlas/Portfile

Added Paths:
-----------
    trunk/dports/math/atlas/files/patch-ATL_DecAtomicCount_ppc_S.diff
    trunk/dports/math/atlas/files/patch-ATL_cmm4x4x128_av_c.diff
    trunk/dports/math/atlas/files/patch-Make_ttune.diff
    trunk/dports/math/atlas/files/patch-emit_mm_c.diff

Modified: trunk/dports/math/atlas/Portfile
===================================================================
--- trunk/dports/math/atlas/Portfile	2012-12-14 18:22:49 UTC (rev 100520)
+++ trunk/dports/math/atlas/Portfile	2012-12-14 18:39:18 UTC (rev 100521)
@@ -7,7 +7,7 @@
 license                         BSD
 name                            atlas
 version                         3.10.0
-revision						1
+revision                        1
 
 # additional versions
 set lapackversion               3.4.2
@@ -31,7 +31,11 @@
 distfiles                       ${atlasdist}:atlas \
                                 ${lapackdist}:lapack
 
-patchfiles                      patch-atlcomp_txt.diff
+patchfiles                      patch-atlcomp_txt.diff \
+                                patch-emit_mm_c.diff \
+                                patch-Make_ttune.diff \
+                                patch-ATL_DecAtomicCount_ppc_S.diff \
+                                patch-ATL_cmm4x4x128_av_c.diff
 
 
 checksums           atlas3.10.0.tar.bz2 \
@@ -91,9 +95,9 @@
 
     if {[variant_isset clang] || [variant_isset dragonegg]} {
     
-		pre-fetch {
-			return -code error "Use of Clang is disabled with this version of Xcode."
-		}
+        pre-fetch {
+            return -code error "Use of Clang is disabled with this version of Xcode."
+        }
     }
     
     if {[variant_isset gcc45]} {
@@ -115,7 +119,7 @@
 
         # Defaults to gcc45
         set                     gccversion 4.5
-        default_variants		+gcc45
+        default_variants        +gcc45
     }
     
 } else {
@@ -207,11 +211,9 @@
     configure.args-append       --nof77
 }
 
-# At this point, no threading for ppc/ppc64
-
 if {${build_arch} == "ppc" || ${build_arch} == "ppc64"} {
 
-    configure.args-append       -t 0
+    configure.args-append       -t 2
 }
 
 # MacPorts defaults to ppc on G4 and G5, so we must override 64-bit
@@ -222,7 +224,7 @@
     configure.args-delete       --cc=${configure.cc} \
                                 -Fa alg -fPIC
 
-    configure.args-append       --cc='${configure.cc} -m32' \
+    configure.args-append       --cc='${configure.cc} -m32 force_cpusubtype_ALL' \
                                 -A 4 \
                                 -Fa alg '-fPIC -m32 -force_cpusubtype_ALL'
     
@@ -250,9 +252,9 @@
     if {![info exists use_clang]} {
     
         # Force Core i1 arch
-		pre-fetch {
-			ui_warn "GCC compilers on OS X do not support AVX instructions."
-		}
+        pre-fetch {
+            ui_warn "GCC compilers on OS X do not support AVX instructions."
+        }
         configure.args-append   -A 25
     } else {
     
@@ -270,7 +272,7 @@
     lappend merger_configure_args(ppc)      --cc='${configure.cc} -m32'\
                                             -b 32 \
                                             -A 4 \
-                                            -t 0 \
+                                            -t 2 \
                                             -s gas_ppc \
                                             -Fa alg '-fPIC -m32 \
                                             -force_cpusubtype_ALL'
@@ -278,7 +280,7 @@
     lappend merger_configure_args(ppc64)    --cc='${configure.cc} -m64'\
                                             -b 64 \
                                             -A 5 \
-                                            -t 0 \
+                                            -t 2 \
                                             -s gas_ppc \
                                             -Fa alg '-fPIC -m64 \
                                             -force_cpusubtype_ALL'
@@ -295,7 +297,13 @@
                                             -Fa alg '-fPIC -m64'
 }
 
+# If we use gcc >= 46, add OpenMP support
 
+if {[info exists gccversion] && ${gccnumber} > 45} {
+    configure.args-append                   -Si omp 1 
+}
+
+
 extract {
     # extract Atlas and move to a consistent working directory name
     system -W ${workpath} "bunzip2 -dc ${distpath}/${atlasdist} | \
@@ -322,36 +330,36 @@
         reinplace "s|-MPGCC-|${cc}|" ${worksrcpath}/CONFIG/src/probe_comp.c
         reinplace "s|-MPFORTRAN-|${ff}|" ${worksrcpath}/CONFIG/src/probe_comp.c
         reinplace "s|-MPPATH-|${prefix}/bin|" ${worksrcpath}/CONFIG/src/probe_comp.c
-		if {${build_arch} == "ppc"} {
+        if {${build_arch} == "ppc"} {
 
-			reinplace "s|XXX|'${cc}' '-O3 -maltivec \
-			        -mabi=altivec -mcpu=7400 -mtune=7400 \
-			        -fno-schedule-insns \
-				-fschedule-insns2'|" \
-				${worksrcpath}/CONFIG/src/atlcomp.txt
-		} elseif {${build_arch} == "ppc64"} {
+            reinplace "s|XXX|'${cc}' '-O3 -maltivec \
+                    -mabi=altivec -mcpu=7400 -mtune=7400 \
+                    -fno-schedule-insns \
+                -fschedule-insns2'|" \
+                ${worksrcpath}/CONFIG/src/atlcomp.txt
+        } elseif {${build_arch} == "ppc64"} {
 
-			reinplace "s|XXX|'${cc}' '-O3 -maltivec \
-			        -mabi=altivec -mcpu=970 -mtune=970 \
-			        -mvrsave -mpowerpc64 \
-			        -fno-schedule-insns \
-				-fno-schedule-insns2'|" \
-				${worksrcpath}/CONFIG/src/atlcomp.txt
-		} else {
-		
-			reinplace "s|XXX|'${cc}' '-fomit-frame-pointer \
+            reinplace "s|XXX|'${cc}' '-O3 -maltivec \
+                    -mabi=altivec -mcpu=970 -mtune=970 \
+                    -mvrsave -mpowerpc64 \
+                    -fno-schedule-insns \
+                -fno-schedule-insns2'|" \
+                ${worksrcpath}/CONFIG/src/atlcomp.txt
+        } else {
+        
+            reinplace "s|XXX|'${cc}' '-fomit-frame-pointer \
                 -mfpmath=sse -msse3 -O2 -fno-schedule-insns2'|" \
-				${worksrcpath}/CONFIG/src/atlcomp.txt
-		}
+                ${worksrcpath}/CONFIG/src/atlcomp.txt
+        }
     } else {
         reinplace "s|XXX|'${cc}' '-Oz -fomit-frame-pointer'|" \
              ${worksrcpath}/CONFIG/src/atlcomp.txt
     }
 
-	# Forces goodgcc
+    # Forces goodgcc
 
-	reinplace -E "s|GOODGCC =.*|GOODGCC = ${configure.cc}\");|" \
-		${worksrcpath}/CONFIG/src/SpewMakeInc.c
+    reinplace -E "s|GOODGCC =.*|GOODGCC = ${configure.cc}\");|" \
+        ${worksrcpath}/CONFIG/src/SpewMakeInc.c
     
     # If we use clang, we must grasp a gfortran compiler to build
     # Fortran sources (do not impact overall Atlas performance)
@@ -386,29 +394,29 @@
     if {[info exists gccnumber] && ![variant_isset nofortran]} {
 
         configure.args-append       -C if ${configure.f77}
-		set libgfbasepath			${prefix}/lib/gcc${gccnumber}
-		if {[variant_isset universal]} {
+        set libgfbasepath            ${prefix}/lib/gcc${gccnumber}
+        if {[variant_isset universal]} {
 
-			foreach arch ${universal_archs_to_use} {
+            foreach arch ${universal_archs_to_use} {
 
-				set libgfarchpath	${libgfbasepath}/${arch}            
-				if {[file exists ${libgfarchpath}/libgfortran.dylib]} {
+                set libgfarchpath    ${libgfbasepath}/${arch}            
+                if {[file exists ${libgfarchpath}/libgfortran.dylib]} {
 
-					lappend merger_configure_args($arch) \
-					     -Ss f77lib ${libgfarchpath}/libgfortran.dylib
-				} else {
+                    lappend merger_configure_args($arch) \
+                         -Ss f77lib ${libgfarchpath}/libgfortran.dylib
+                } else {
                 
-					lappend merger_configure_args($arch) \
-						-Ss f77lib ${libgfbasepath}/libgfortran.dylib
-				}
-			}
-		} else {
-		
-			configure.args-append	-Ss f77lib ${libgfbasepath}/libgfortran.dylib
-		}
-	}
+                    lappend merger_configure_args($arch) \
+                        -Ss f77lib ${libgfbasepath}/libgfortran.dylib
+                }
+            }
+        } else {
+        
+            configure.args-append    -Ss f77lib ${libgfbasepath}/libgfortran.dylib
+        }
+    }
 
-	# Create build trees
+    # Create build trees
     if {[variant_isset universal]} {
         foreach arch ${universal_archs_to_use} {
             copy ${workpath}/${name}-${version} \
@@ -432,8 +440,8 @@
 
     if {[variant_isset universal]} {
         foreach arch ${universal_archs_to_use} {
-			file mkdir ${workpath}/${name}-${version}-${arch}/build
-		}
+            file mkdir ${workpath}/${name}-${version}-${arch}/build
+        }
     } else {
         file mkdir ${workpath}/${name}-${version}/build
     }
@@ -452,7 +460,6 @@
         set         archs ${build_arch}
     }
 
-    
     foreach arch ${archs} {
         if {![variant_isset universal]} {
         
@@ -464,8 +471,12 @@
 
         # Recursively remove directories
         ui_debug    "patch to recursively remove directories on clean"
-        reinplace    "s|rm -f|rm -rf|g" ${atlas_path}/build/Makefile
+        reinplace   "s|rm -f|rm -rf|g" ${atlas_path}/build/Makefile
         
+        # Ensure libgomp is linked
+        if {[info exists gccversion] && ${gccnumber} > 45} {
+            reinplace -E "s|(LIBS =.*)|\\1 ${prefix}/lib/gcc${gccnumber}/libgomp.dylib|" \
+                ${atlas_path}/build/Make.inc
     }
 }
 
@@ -475,26 +486,26 @@
 build.dir               ${workpath}/${name}-${version}/build
 
 post-build {
-	if {! [variant_isset universal]} {
-		reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \
-			${build.dir}/lib/Makefile
-		reinplace "s|dynamic|dynamiclib|g" \
-			${build.dir}/lib/Makefile
-		system "cd ${build.dir}/lib && ${build.cmd} shared_all"
-	} else {
+    if {! [variant_isset universal]} {
+        reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \
+            ${build.dir}/lib/Makefile
+        reinplace "s|dynamic|dynamiclib|g" \
+            ${build.dir}/lib/Makefile
+        system "cd ${build.dir}/lib && ${build.cmd} shared_all"
+    } else {
         foreach arch ${universal_archs_to_use} {
-			reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \
-				${workpath}/${name}-${version}-${arch}/build/lib/Makefile
-			reinplace "s|dynamic|dynamiclib|g" \
-				${workpath}/${name}-${version}-${arch}/build/lib/Makefile
-			system "cd ${workpath}/${name}-${version}-${arch}/build/lib && \
-					${build.cmd} shared_all"
-		}
-	}
+            reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \
+                ${workpath}/${name}-${version}-${arch}/build/lib/Makefile
+            reinplace "s|dynamic|dynamiclib|g" \
+                ${workpath}/${name}-${version}-${arch}/build/lib/Makefile
+            system "cd ${workpath}/${name}-${version}-${arch}/build/lib && \
+                    ${build.cmd} shared_all"
+        }
+    }
 }
 
-destroot.dir            ${build.dir}
-destroot.destdir        DESTDIR=${destroot}${prefix}
+destroot.dir          ${build.dir}
+destroot.destdir      DESTDIR=${destroot}${prefix}
 
 livecheck.name        math-atlas
 livecheck.distname    Stable

Added: trunk/dports/math/atlas/files/patch-ATL_DecAtomicCount_ppc_S.diff
===================================================================
--- trunk/dports/math/atlas/files/patch-ATL_DecAtomicCount_ppc_S.diff	                        (rev 0)
+++ trunk/dports/math/atlas/files/patch-ATL_DecAtomicCount_ppc_S.diff	2012-12-14 18:39:18 UTC (rev 100521)
@@ -0,0 +1,17 @@
+--- src/threads/ATL_DecAtomicCount_ppc.S.orig	2012-12-14 12:03:13.000000000 +0100
++++ src/threads/ATL_DecAtomicCount_ppc.S	2012-12-14 12:03:38.000000000 +0100
+@@ -24,7 +24,6 @@
+ ATL_DecAtomicCount:
+    #endif
+ #endif
+-#error "Code is not reliable on PPC, don't know why"
+ /* r3                           r3  */
+ /* int ATL_DecAtomicCount(void *vp) */
+ RETRY:
+@@ -32,5 +31,5 @@
+    addi  r5, r5, -1   /* decrement value */
+    stwcx. r5, 0, r3   /* attempt to store decremented value back to mem */
+    bne-  RETRY        /* If store failed, retry */
+-   mr r3, r5
++   mr. r3, r5
+    blr

Added: trunk/dports/math/atlas/files/patch-ATL_cmm4x4x128_av_c.diff
===================================================================
--- trunk/dports/math/atlas/files/patch-ATL_cmm4x4x128_av_c.diff	                        (rev 0)
+++ trunk/dports/math/atlas/files/patch-ATL_cmm4x4x128_av_c.diff	2012-12-14 18:39:18 UTC (rev 100521)
@@ -0,0 +1,11 @@
+--- tune/blas/gemm/CASES/ATL_cmm4x4x128_av.c.orig	2012-12-14 12:32:46.000000000 +0100
++++ tune/blas/gemm/CASES/ATL_cmm4x4x128_av.c	2012-12-14 12:32:55.000000000 +0100
+@@ -1321,7 +1321,7 @@
+    #endif
+ 	vmaddfp	vC01, vA0, vB1, vC01
+    #ifdef BETAX
+-	dcbtst	0, pBETA, 0
++	dcbtst	0, pBETA
+    #endif
+ 	vmaddfp	vC11, vA1, vB1, vC11
+ 	vmaddfp	vC21, vA2, vB1, vC21

Added: trunk/dports/math/atlas/files/patch-Make_ttune.diff
===================================================================
--- trunk/dports/math/atlas/files/patch-Make_ttune.diff	                        (rev 0)
+++ trunk/dports/math/atlas/files/patch-Make_ttune.diff	2012-12-14 18:39:18 UTC (rev 100521)
@@ -0,0 +1,17 @@
+--- makes/Make.ttune.orig	2012-12-13 20:56:33.000000000 +0100
++++ makes/Make.ttune	2012-12-13 20:58:59.000000000 +0100
+@@ -197,6 +197,14 @@
+               ATL_DecAtomicCount_arch.S ; \
+            rm $(BLDdir)/src/threads/atomic.inc ; \
+            echo "aobj = ATL_SetAtomicCount_arch.o ATL_ResetAtomicCount_mips.o ATL_DecAtomicCount_mips.o ATL_FreeAtomicCount_arch.o" > $(BLDdir)/src/threads/atomic.inc ; \
++	elif $(MAKE) xprobe_atomic_ppc ; then \
++           cp $(myTHRdir)/ATL_*AtomicCount_arch.c . ; \
++           cp $(myTHRdir)/ATL_ResetAtomicCount_ppc.S \
++              ATL_ResetAtomicCount_arch.S ; \
++           cp $(myTHRdir)/ATL_DecAtomicCount_ppc.S \
++              ATL_DecAtomicCount_arch.S ; \
++           rm $(BLDdir)/src/threads/atomic.inc ; \
++           echo "aobj = ATL_SetAtomicCount_arch.o ATL_ResetAtomicCount_ppc.o ATL_DecAtomicCount_ppc.o ATL_FreeAtomicCount_arch.o" > $(BLDdir)/src/threads/atomic.inc ; \
+         else \
+            $(MAKE) iForceUseMutex ; \
+         fi

Added: trunk/dports/math/atlas/files/patch-emit_mm_c.diff
===================================================================
--- trunk/dports/math/atlas/files/patch-emit_mm_c.diff	                        (rev 0)
+++ trunk/dports/math/atlas/files/patch-emit_mm_c.diff	2012-12-14 18:39:18 UTC (rev 100521)
@@ -0,0 +1,15 @@
+--- tune/blas/gemm/emit_mm.c.orig	2012-12-10 13:59:14.000000000 +0100
++++ tune/blas/gemm/emit_mm.c	2012-12-10 13:59:59.000000000 +0100
+@@ -2688,10 +2688,7 @@
+       {
+          if (wp->CC[0])  /* need non-default compilation rule */
+          {
+-            char *comp = (wp->CC[0] == 'g' && wp->CC[1] == 'c'
+-                          && wp->CC[2] == 'c' &&
+-                          (wp->CC[3] == '\0' || wp->CC[3] == ' '))
+-                         ? "$(GOODGCC)" : wp->CC;
++            char *comp = "$(GOODGCC)";
+             for (j=0; j < nbetas; j++)
+             {
+                for(k=0; k < wp->ncomps; k++)
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20121214/4c23bbdc/attachment-0001.html>


More information about the macports-changes mailing list