A workaround for math/R (was Re: math/R eats up all.)

Maho NAKATA chat95 at mac.com
Fri Feb 9 22:18:03 UTC 2007


Dear all,
First, Eric, I'd like to ask your opinion about the patch I proposed.
If you approve I'll commit to math/R for atlas users. 

Several tries I found that for my Pentium M, status of buildablity of R
is following:

ATLAS + internal LAPACK    o
ATLAS + external LAPACK    x
ATLAS + ATLAS's  LAPACK    x
---
BLAS  + external LAPACK    o
BLAS  + internal LAPACK    o
---
GOTOBLAS + internal LAPACK o
GOTOBLAS + external LAPACK o

o means build successfully
x means build hangs up at:
cc -std=gnu99 -shared -L/usr/local/lib -o grDevices.so chull.o devNull.o devPicTeX.o devPS.o devQuartz.o init.o   -L../../../../lib -lR
mkdir ../../../../library/grDevices/libs  
.

internal LAPACK means using LAPACK comes with R.
external LAPACK means using math/lapack
ATLAS's LAPACK means using libalapack from math/atlas.

I briefly read the source code what routines are used in internal LAPACK of R,
it contains, Cholesky factorization etc, which are accelerated by ATLAS.
Anyway, vanilla Lapack+atlas blas combination
is 10%~20% faster than atlas's LAPACK. This is unfortunate perfomance loss.

Here I propose a patch; just workarounding hang up during the build.
there may be performance loss by not using ATLAS's LAPACK.

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/math/R/Makefile,v
retrieving revision 1.57
diff -u -r1.57 Makefile
--- Makefile    25 Jan 2007 17:56:40 -0000      1.57
+++ Makefile    9 Feb 2007 22:08:12 -0000
@@ -72,9 +72,15 @@
 
 .if defined(WITH_ATLAS)
 LIB_DEPENDS+=  atlas.2:${PORTSDIR}/math/atlas
-CONFIGURE_ARGS+=--with-lapack="-lalapack -lcblas" --with-blas="-lf77blas"
+CONFIGURE_ARGS+=--with-blas="-lf77blas -latlas"
+# A workaround to prevent hangs up during the build.
+.if ${ARCH} != "i386"
+CONFIGURE_ARGS+=--with-lapack="-lalapack -lcblas"
 PLIST_SUB+=    BLAS="@comment "
 .else
+PLIST_SUB+=    BLAS=""
+.endif
+.else
 LIB_DEPENDS+=  blas.2:${PORTSDIR}/math/blas
 CONFIGURE_ARGS+=--with-blas="-lblas"
 PLIST_SUB+=    BLAS=""        

Thanks for your patience, and sorry for inconvenience.
Sincerely yours,
-- NAKATA, Maho (maho at FreeBSD.org)



More information about the freebsd-ports mailing list