Using ATLAS with R is an old topic quite covered in the "R Administration" manual (and by R's "configure" script collection). I still do not easily manage to build R properly on our new AMD Opteron (2-processor). I did work with the current Atlas 3.6.0, configured manually (but "express" version) to build a threaded ATLAS version, and successfully ran Atlas' own "make ptsanity_test arch=Linux_HAMMER64SSE2_2" sanity check as well. As it is known, this builds only static (*.a) versions of the ATLAS libraries. However, after an R site search for (something like) "ATLAS shared", I found Peter Dalgaard's message http://finzi.psych.upenn.edu/R/Rhelp02/archive/7158.html where PD confirmed it would work fine to link against the static ATLAS libraries. I didn't need (his suggestion of) using an explicit "-L..atlas_place...", since these libraries are symbolically linked into /usr/local/lib/ which is searched by default. Now, R's configure (R-devel of 2004-02-24) finds the ATLAS setup well behaved, reporting>> R is now configured for x86_64-unknown-linux-gnu >> >> Source directory: ../R-devel >> Installation directory: /usr/local >> >> C compiler: gcc -g -O2 -Wall -Wno-comment >> C++ compiler: g++ -g -O2 >> Fortran compiler: g77 -g -O2 -Wall -fno-f90 >> >> Interfaces supported: X11 >> External libraries: readline, BLAS(ATLAS)^^^^^^^^^^^ and compilation (of course) goes fine till the crucial linking stage : gcc -shared -o libRlapack.so dlapack0.lo dlapack1.lo dlapack2.lo dlapack3.lo cmplx.lo -lf77blas -latlas -L/usr/lib64 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../../../lib64 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 -lfrtbegin -lg2c -lm -lgcc_s /usr/bin/ld: /usr/local/lib/libf77blas.a(xerbla.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libf77blas.a: could not read symbols: Bad value collect2: ld returned 1 exit status and I'm stuck to some extent. Note that the "recompile with -fPIC" must related to the contents of ATLAS' libf77blas.a itself (or to "xerbla.o" more concretely), since all of R's dlapack[0-3].lo are of course compile with -fPIC. I tend to conclude that I do need shared versions of ATLAS' libraries? If yes, I think I've seen instructions on how to build these. Where? If these are really needed, I think I should add them to the corresponding "R administration manual" section, right? Thanks in advance for your share of experience here. Martin
Martin Maechler <maechler@stat.math.ethz.ch> writes:> and compilation (of course) goes fine till the crucial linking > stage : > > gcc -shared -o libRlapack.so dlapack0.lo dlapack1.lo dlapack2.lo dlapack3.lo cmplx.lo -lf77blas -latlas -L/usr/lib64 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../../../lib64 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 -lfrtbegin -lg2c -lm -lgcc_s > /usr/bin/ld: /usr/local/lib/libf77blas.a(xerbla.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC > /usr/local/lib/libf77blas.a: could not read symbols: Bad value > collect2: ld returned 1 exit status > > and I'm stuck to some extent. > Note that the "recompile with -fPIC" must related to the > contents of ATLAS' libf77blas.a itself (or to "xerbla.o" more > concretely), since all of R's dlapack[0-3].lo are of course > compile with -fPIC. > > I tend to conclude that I do need shared versions of ATLAS' > libraries? If yes, I think I've seen instructions on how to > build these. Where? > If these are really needed, I think I should add them to the > corresponding "R administration manual" section, right?I don't think we actually got them written down (thank you for volunteering...) but it isn't terribly hard. There are just two basic tricks: - add -fPIC all over the place during configure. - after building you'll get a bunch of .a files. These can be converted to .so using ld -shared -o libfoo.so --whole-archive libfoo.a One thing I haven't gotten around to yet is the ATLAS/LAPACK integration mentioned on http://math-atlas.sourceforge.net/errata.html#completelp -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
You do need to add -fPIC to the compile flags. The same thing happens on Solaris 64-bit (under some compilers, anyway). You don't need a shared library, but you do need relocatable code in the static libraries. You can also try building without xerbla. I think this is a route that many of us are about to take. However, I would avoid ATLAS and use K. Goto's Opteron BLAS, which is easier to get to work (no xerbla) and has instructions in R-devel's R-admin.texi file. Peter D has a dual Opteron and asked about it a while back, probably on R-core. (I have played a bit, but our Opteron cluster is a week or so away now.) Brian On Thu, 26 Feb 2004, Martin Maechler wrote:> Using ATLAS with R is an old topic quite covered in the "R > Administration" manual (and by R's "configure" script > collection). > > I still do not easily manage to build R properly on our new AMD > Opteron (2-processor). > I did work with the current Atlas 3.6.0, configured manually > (but "express" version) to build a threaded ATLAS version, and > successfully ran Atlas' own "make ptsanity_test arch=Linux_HAMMER64SSE2_2" > sanity check as well. > > As it is known, this builds only static (*.a) versions of the > ATLAS libraries. However, after an R site search for (something > like) "ATLAS shared", I found Peter Dalgaard's message > http://finzi.psych.upenn.edu/R/Rhelp02/archive/7158.html > where PD confirmed it would work fine to link against the static > ATLAS libraries. > I didn't need (his suggestion of) using an explicit "-L..atlas_place...", > since these libraries are symbolically linked into > /usr/local/lib/ which is searched by default. > > Now, R's configure (R-devel of 2004-02-24) > finds the ATLAS setup well behaved, reporting > > >> R is now configured for x86_64-unknown-linux-gnu > >> > >> Source directory: ../R-devel > >> Installation directory: /usr/local > >> > >> C compiler: gcc -g -O2 -Wall -Wno-comment > >> C++ compiler: g++ -g -O2 > >> Fortran compiler: g77 -g -O2 -Wall -fno-f90 > >> > >> Interfaces supported: X11 > >> External libraries: readline, BLAS(ATLAS) > ^^^^^^^^^^^ > > and compilation (of course) goes fine till the crucial linking > stage : > > gcc -shared -o libRlapack.so dlapack0.lo dlapack1.lo dlapack2.lo dlapack3.lo cmplx.lo -lf77blas -latlas -L/usr/lib64 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../../../lib64 -L/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 -lfrtbegin -lg2c -lm -lgcc_s > /usr/bin/ld: /usr/local/lib/libf77blas.a(xerbla.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC > /usr/local/lib/libf77blas.a: could not read symbols: Bad value > collect2: ld returned 1 exit status > > and I'm stuck to some extent. > Note that the "recompile with -fPIC" must related to the > contents of ATLAS' libf77blas.a itself (or to "xerbla.o" more > concretely), since all of R's dlapack[0-3].lo are of course > compile with -fPIC. > > I tend to conclude that I do need shared versions of ATLAS' > libraries? If yes, I think I've seen instructions on how to > build these. Where? > If these are really needed, I think I should add them to the > corresponding "R administration manual" section, right? > > Thanks in advance for your share of experience here. > Martin > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel > >-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595