| Line 1... |
Line 1... |
| 1 |
|
1 |
|
| 2 |
Notes on enabling Atlas libs for Octave and R
|
2 |
Notes on using Atlas libs with GNU Octave and GNU R
|
| 3 |
|
3 |
|
| 4 |
I. Overview
|
4 |
I. Overview
|
| 5 |
|
5 |
|
| 6 |
As of the Debian releases 2.1.34-6 (for GNU Octave) and 1.3.0-3 (for GNU R),
|
6 |
As of the Debian releases 2.1.34-6 (for GNU Octave) and 1.3.0-3 (for GNU R),
|
| 7 |
both Octave and R can be used with Atlas, the Automatically Tuned Linear
|
7 |
both Octave and R can be used with Atlas, the Automatically Tuned Linear
|
| Line 23... |
Line 23... |
| 23 |
and shown in /proc/cpuinfo.
|
23 |
and shown in /proc/cpuinfo.
|
| 24 |
|
24 |
|
| 25 |
The Atlas libraries can be loaded dynamically instead of the (non-optimised)
|
25 |
The Atlas libraries can be loaded dynamically instead of the (non-optimised)
|
| 26 |
blas libraries against which both Octave and R are compiled.
|
26 |
blas libraries against which both Octave and R are compiled.
|
| 27 |
|
27 |
|
| - |
|
28 |
Section III below briefly describes how Atlas libraries can be compiled for
|
| - |
|
29 |
your specific machine to further optimise performance.
|
| 28 |
|
30 |
|
| 29 |
II. Using the Atlas libraries
|
31 |
II. Using the Atlas libraries
|
| 30 |
|
32 |
|
| - |
|
33 |
II.A New default behaviour with automatic loading of the Atlas libraries
|
| - |
|
34 |
|
| 31 |
In order to have the libraries loaded at run-time, the location needs to be
|
35 |
In order to have the libraries loaded at run-time, the location needs to be
|
| 32 |
communicated to the dynamic linker/loader. [ There appears to be a bug in
|
36 |
communicated to the dynamic linker/loader. As of the Debian release
|
| 33 |
ld.so as the location is already in ld.so.conf, but found "too late". ]
|
37 |
libc6_2.2.4-5 of the glibc library, a patch to ldconfig automates the use of
|
| - |
|
38 |
the Atlas library. If an Atlas package is installed, and correctly registered
|
| - |
|
39 |
in /etc/ld.so.conf as done by its postinst script, ldconfig will
|
| - |
|
40 |
automatically load the Atlas' version of the Blas instead of the (slower)
|
| - |
|
41 |
default Blas.
|
| - |
|
42 |
|
| - |
|
43 |
The following text is hence only relevant for systems which have not yet
|
| - |
|
44 |
upgraded to libc6_2.2.4-5 or later.
|
| - |
|
45 |
|
| - |
|
46 |
II.B Old behaviour requiring LD_LIBRARY_PATH for Octave
|
| 34 |
|
47 |
|
| 35 |
For Octave, use the variable LD_LIBRARY_PATH. On a computer with the
|
48 |
For Octave, use the variable LD_LIBRARY_PATH. On a computer with the
|
| 36 |
atlas2-base package:
|
49 |
atlas2-base package:
|
| 37 |
|
50 |
|
| 38 |
$ LD_LIBRARY_PATH=/usr/lib/atlas octave2.1 -q
|
51 |
$ LD_LIBRARY_PATH=/usr/lib/atlas octave2.1 -q
|
| Line 43... |
Line 56... |
| 43 |
octave2.1:1> X=randn(1000,1000);t=cputime();Y=X'*X;cputime-t
|
56 |
octave2.1:1> X=randn(1000,1000);t=cputime();Y=X'*X;cputime-t
|
| 44 |
ans = 61.520
|
57 |
ans = 61.520
|
| 45 |
|
58 |
|
| 46 |
For R version 1.3.0-4, the R_LD_LIBRARY_PATH variable has to be used, and its
|
59 |
For R version 1.3.0-4, the R_LD_LIBRARY_PATH variable has to be used, and its
|
| 47 |
value needs to be copied out of /usr/bin/R (or edited therein). For R version
|
60 |
value needs to be copied out of /usr/bin/R (or edited therein). For R version
|
| 48 |
R 1.3.1 this done automatically in the R startup shell script. For an Athlon
|
61 |
1.3.1 or later this is done automatically in the R startup shell script. For
|
| 49 |
machine, and with the explicit definition which is no longer needed as of R
|
62 |
an Athlon machine, and with the explicit definition which is no longer needed
|
| 50 |
1.3.1, the example becomes
|
63 |
as of R 1.3.1, the example becomes
|
| 51 |
|
64 |
|
| 52 |
$ R_LD_LIBRARY_PATH=/usr/lib/R/bin:/usr/local/lib:/usr/X11R6/lib:/usr/lib/3dnow/atlas:/usr/lib:/usr/X11R6/lib:/usr/lib/gcc-lib/i386-linux/2.95.4:. R --vanilla -q
|
65 |
$ R_LD_LIBRARY_PATH=/usr/lib/R/bin:/usr/local/lib:/usr/X11R6/lib:/usr/lib/3dnow/atlas:/usr/lib:/usr/X11R6/lib:/usr/lib/gcc-lib/i386-linux/2.95.4:. R --vanilla -q
|
| 53 |
> mm <- matrix(rnorm(10^6), ncol = 10^3)
|
66 |
> mm <- matrix(rnorm(10^6), ncol = 10^3)
|
| 54 |
> system.time(crossprod(mm))
|
67 |
> system.time(crossprod(mm))
|
| 55 |
[1] 2.38 0.04 2.84 0.00 0.00
|
68 |
[1] 2.38 0.04 2.84 0.00 0.00
|
| Line 70... |
Line 83... |
| 70 |
employ "/usr/lib/xmm/atlas" and Pentium IV users should employ
|
83 |
employ "/usr/lib/xmm/atlas" and Pentium IV users should employ
|
| 71 |
"/usr/lib/26/atlas".
|
84 |
"/usr/lib/26/atlas".
|
| 72 |
|
85 |
|
| 73 |
Lastly, it should be pointed out that it is probably worthwhile to locally
|
86 |
Lastly, it should be pointed out that it is probably worthwhile to locally
|
| 74 |
compile, and thereby optimise, the Atlas libraries if at least a moderately
|
87 |
compile, and thereby optimise, the Atlas libraries if at least a moderately
|
| 75 |
intensive load is expected.
|
88 |
intensive load is expected. This is described in the next section.
|
| - |
|
89 |
|
| - |
|
90 |
III. Locally compiling the Atlas libraries
|
| 76 |
|
91 |
|
| - |
|
92 |
The Debian Atlas packages have been setup to allow for local recompilation of
|
| - |
|
93 |
the Atlas libraries. This way the behaviour will be tuned exactly to the
|
| - |
|
94 |
specific CPU rather than the broader class of CPUs. It has been reported that
|
| - |
|
95 |
this can increase performance by a further 12% on the examples above.
|
| - |
|
96 |
Detailed instructions are in /usr/share/doc/atlas2-base/README.debian.gz but
|
| - |
|
97 |
the process is essentially the following [ courtesy of Doug Bates ]
|
| 77 |
|
98 |
|
| - |
|
99 |
apt-get source atlas2-base
|
| - |
|
100 |
cd atlas2-$VERSION
|
| - |
|
101 |
fakeroot debian/rules/custom
|
| - |
|
102 |
# wait for a *very* long time
|
| - |
|
103 |
dpkg -i ../atlas2-base*.deb
|
| - |
|
104 |
|
| - |
|
105 |
|
| 78 |
III. See also
|
106 |
IV. See also
|
| 79 |
|
107 |
|
| 80 |
The Atlas packages have a very detailed README.Debian file which should be
|
108 |
The Atlas packages have a very detailed README.Debian file which should be
|
| 81 |
consulted; it also details local recompilation. Sources and documentation for
|
109 |
consulted; it also details local recompilation. Sources and documentation for
|
| 82 |
Atlas are at http://www.netlib.org/atlas.
|
110 |
Atlas are at http://www.netlib.org/atlas.
|
| 83 |
|
111 |
|
| 84 |
|
112 |
|
| 85 |
IV. Acknowledgements
|
113 |
V. Acknowledgements
|
| 86 |
|
114 |
|
| 87 |
Camm Maguire developed the scheme of overloading Atlas over the default blas
|
115 |
Camm Maguire developed the scheme of overloading Atlas over the default blas
|
| 88 |
libraries and deserves all the credit. Many thanks to John Eaton for helping
|
116 |
libraries and deserves all the credit. Many thanks to John Eaton for helping
|
| 89 |
debug some errors in the initial setup, and to Doug Bates for work on the R
|
117 |
debug some errors in the initial setup, and to Doug Bates for work on the R
|
| - |
|
118 |
package. Special thanks to Ben Collins for providing a patched ldconfig as
|
| 90 |
package.
|
119 |
part of the libc6 package.
|
| 91 |
|
120 |
|
| 92 |
|
121 |
|
| - |
|
122 |
Initial version
|
| 93 |
-- Dirk Eddelbuettel <edd@debian.org> Tue, 21 Aug 2001 21:37:15 -0500
|
123 |
-- Dirk Eddelbuettel <edd@debian.org> Tue, 21 Aug 2001 21:37:15 -0500
|
| - |
|
124 |
|
| - |
|
125 |
First updated
|
| - |
|
126 |
-- Dirk Eddelbuettel <edd@debian.org> Sun, 11 Nov 2001 11:03:19 -0600
|