From aronovitch at gmail.com  Fri Feb 10 11:29:39 2006
From: aronovitch at gmail.com (Amit Aronovitch)
Date: Fri, 10 Feb 2006 12:29:39 +0200
Subject: [Rd]  ATLAS threaded 64 bit Opteron build for R: need -fPIC
References: <x2u11dew8v.fsf@biostat.ku.dk>
Message-ID: <43EC6B13.1040203@gmail.com>

Hi,

 Sorry for sending such a late reply, and for being abit OT.

  I've been trying to compile 64 bit ATLAS for numpy
(http://numeric.scipy.org/ ),
and so far this thread is the most useful one I could google up - thanks!.
  I encountered similiar problems, and so far could not get a .a
linkable to numpy
(comparing to your post - it seems I might have forgotten to add the
-fPIC for the
F77FLAGS or MMFLAGS).

 Also, I'm having trouble with the ATLAS lapack. To get a usable lib,
one has to
merge it with a full lapack implementation (as described in the ATLAS
errata).
 However, I'm using RHEL4, and their installed liblapack.a seems to have
been compiled
without -fPIC, so the merged library is unlinkable to numpy's .so. Is
there a way to use Redhat's
installed liblapack.so?

 Few questions about your compiler flags:

1) Is there a reason to compile with -O rather than -O3?
 (did you try and encounter some problem, or found no major performance
difference)
2) I see you use -mfpmath=387 - does this work better than sse2 (which
seems to be
 the default)? How about the "sse,387" option - should I try that?
 
Martin Maechler wrote:

>>>>>/ "PD" == Peter Dalgaard <p.dalgaard at biostat.ku.dk <https://www.stat.math.ethz.ch/mailman/listinfo/r-devel>>
/>>>>>/  >>>>>> "PD" == Peter Dalgaard <p.dalgaard at biostat.ku.dk>
>>>>>>     on 26 Feb 2004 15:44:16 +0100 writes:
>
>    PD> Douglas Bates <bates at stat.wisc.edu> writes:
>    >> Have you tried configuring R with Goto's BLAS
>    >> http://www.cs.utexas.edu/users/kgoto/
>    >> 
>    >> I haven't worked with Opteron or Athlon64 computers but I understand
>    >> that Goto's BLAS are very effective on those machines.  Furthermore
>    >> Goto's BLAS are (only) available as .so libraries so you don't need to
>    >> mess with creating the .so version.
>
>    PD> I tried it, yes. Somewhat to my surprise, it seemed to be not quite as
>    PD> fast as the threaded ATLAS, but I wasn't very systematic about the
>    PD> benchmarking.
>
>    PD> (and the Goto items have license issues, which get in the way for
>    PD> binary distributions.)
>
>Thanks a lot, Peter, Brian, Doug, for your feedbacks!
>In the mean time, I have three running versions of R(-devel) on
>the 64-Opteron
>- "plain"
>- linked against threaded GOTO
>- linked against threaded (static) ATLAS  (using -fPIC for compilation;
>					   "large" Rlapack)
>and I find that GOTO is faster than ATLAS
>consistently (between ~ 5-20%) for several tests
>(square matrices; %*% and solve).
>ATLAS is still an order of magnitude faster than "plain" for
>3000x3000 matrices.
>
>Here are somewhat repeatable "ATLAS for R" build instructions:
>
> 1. get ATLAS source; unpack
> 2. make : use defaults and "express" installation
> 3. Before "make install ...", edit the  Make.<ARCHITECTURE> file:
>    add "-fPIC" to three places, namely  F77FLAGS, CCFLAG0, and MMFLAGS:
>    which in case of the "threaded Opteron" architecture, leads to
>    the three new lines
>       F77FLAGS = -fPIC -fomit-frame-pointer -O -m64
>
>	CCFLAG0 = -fPIC -fomit-frame-pointer -O -mfpmath=387 -m64
>
>	MMFLAGS = -fPIC -fomit-frame-pointer -O -mfpmath=387 -m64
>    in the file   Make.Linux_HAMMER64SSE2_2
>
> 4. make install arch=Linux_HAMMER64SSE2_2
>
> 5. Sym.link the ATLAS libraries into /usr/local/lib:
>
>    cd /usr/local/lib
>    ln -s <ATLAS_build_dir>/lib/Linux_HAMMER64SSE2_2/lib* .
>
> 6. (needed for runtime!):
>    Use environment variable LD_LIBRARY_PATH=/usr/local/lib
>
>
>Note that I haven't built *.so (shared) libraries yet.
 /



[Rd] ATLAS threaded 64 bit Opteron build for R: need -fPIC
Amit Aronovitch