-
Notifications
You must be signed in to change notification settings - Fork 149
/
BUILDING_ATLAS
280 lines (202 loc) · 6.75 KB
/
BUILDING_ATLAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
BUILDING_ATLAS
==============
In this file, I summarize the different configuration options for the
platforms. I keep this information mainly for my own reference, but
of course, you can try it out yourself ;)
I strongly suggest that you build ATLAS with the --with-netlib-lapack
option. This includes higher-level routines not covered in ATLAS from
the lapack libraries.
From my experience, I also found that the Core2 architectural defaults
work pretty well for both Intel and AMD chips. On 64bit, AMD64K10h is
a bit better, but not much. On the other hand, the AMD settings
perform too well on the Intel platform.
TABLE OF CONTENTS:
1. OBTAINING THE SOFTWARE
2. GENERAL REMARKS
3. LINUX
4. MAC OS X
5. WINDOWS
1. OBTAINING THE SOFTWARE
=========================
Getting lapack:
wget http://www.netlib.org/lapack/lapack-lite-3.1.1.tgz
Getting ATLAS:
wget http://sourceforge.net/projects/math-atlas/files/Stable/3.8.3/atlas3.8.3.tar.bz2/download
Getting jblas:
git clone git://github.com/mikiobraun/jblas.git
2. GENERAL REMARKS
==================
The general steps are as follows:
* Compile lapack. Lapack uses blas for its low-level
computations. ATLAS also implements a subset of Lapack, but not all
routines. But you can build ATLAS to include the Lapack routines it
does not implement, and this is what we're going to do.
* Compile ATLAS.
* Compile the native part of jblas with "make".
* Compile the java part of jblas with "ant" or maven.
The ATLAS build process is a bit, well, unusual, coming with compiled
(not scripted) configuration scripts. ATLAS has prebuilt
configurations which result in much faster compilation times. If it
doesn't find such a profile for your computer, it will perform a large
number of timing experiments to find the best combination (hence the
name "Automatically Tuned...").
Finally, some older processors don't support the SSE3 command
set. Some tweaking is necessary to compile ATLAS for SSE2, namely
configuring as for SSE3, and then going into the file "Make.inc", and
replacing SSE2 by SSE3 or removing -DATL_SSE3 from the compiler
directives.
For reference, here is a list of the main ATLAS options.
ATLAS OPTIONS
-------------
This chart may come in handy when you want ATLAS to build with some
predefined configurations.
ATLAS Architecture Options: (-A)
0 = 'UNKNOWN'
1 = 'POWER3'
2 = 'POWER4'
3 = 'POWER5'
4 = 'PPCG4'
5 = 'PPCG5'
6 = 'P5'
7 = 'P5MMX'
8 = 'PPRO'
9 = 'PII'
10 = 'PIII'
11 = 'PM'
12 = 'CoreSolo'
13 = 'CoreDuo'
14 = 'Core2Solo'
15 = 'Core2' <- used for 32 bit builds
16 = 'Corei7'
17 = 'P4'
18 = 'P4E'
19 = 'Efficeon'
20 = 'K7'
21 = 'HAMMER'
22 = 'AMD64K10h' <- used for 64 bit builds
23 = 'UNKNOWNx86'
24 = 'IA64Itan'
25 = 'IA64Itan2'
26 = 'USI'
27 = 'USII'
28 = 'USIII'
29 = 'USIV'
30 = 'UnknownUS'
31 = 'MIPSR1xK'
32 = 'MIPSICE9'
ATLAS Operating System Options: (-O)
0 = 'UNKNOWN'
1 = 'Linux'
2 = 'SunOS'
3 = 'SunOS4'
4 = 'OSF1'
5 = 'IRIX'
6 = 'AIX'
7 = 'Win9x'
8 = 'WinNT'
9 = 'HPUX'
10 = 'FreeBSD'
11 = 'OSX'
3. Linux
========
LAPACK
------
Copy make.inc.LINUX from INSTALL directory, update options in the file
like this:
FORTRAN = gfortran
OPTS = -O2 -fPIC
DRVOPTS = $(OPTS)
NOOPT = -fPIC
LOADER = gfortran
LOADOPTS = -fPIC
compile with "make -k blaslib lapacklib". "-k" (continue on error) is
needed because some files won't build otherwise.
ATLAS
-----
For 32 bit:
mkdir build
cd build
> ../configure -C if gfortran \
--with-netlib-lapack=$HOME/build/lapack-lite-3.1.1/liblapack_fortran.a \
-A 15 -Si cputhrchk 0 -b 32
make
make time
This sets the fortran compiler to gfortran, architecture Core2, 32
bit, and don't test for CPU throttling (not needed because we use
predefined configuration)
For 64 bit:
as above, but configure with
> ../configure \
--with-netlib-lapack=$HOME/build/lapack-lite-3.1.1/lapack_LINUX.a \
-A 21 -b 64 -Si cputhrchk 0 -Fa alg -fPIC
jblas
-----
> ./configure --static-libs --libpath=$HOME/build/ATLAS/build/lib/
4. Mac OS X
===========
If you install the gfortran with mac ports, you get gcc-mp-4.3 and
gfortran-mp-4.3. This means you have to redefine all the
compilers. Apart from that, it was pretty "smooth sailing ;)"
LAPACK
------
cp INSTALL/make.inc.LINUX make.inc
Update options to
FORTRAN = gfortran-mp-4.3
OPTS = -funroll-all-loops -O3 -fPIC
DRVOPTS = $(OPTS)
NOOPT = -fPIC
LOADER = gfortran-mp-4.3
LOADOPTS =
Run with "make -k"
ATLAS
-----
mkdir build_macosx
cd build_macosx
Execute the following script buil.sh:
CC=gcc-mp-4.3
F77=gfortran-mp-4.3
LAPACK=$HOME/Documents/lapack-lite-3.1.1
../configure -b 32 -C xc $CC -C gc $CC -C if $F77 -C ic $CC -C dm $CC -C sm $CC -C dk $CC -C sk $CC -Fa alg -fPIC --with-netlib-lapack=$LAPACK/liblapack_fortran.a
It's important to set the 32bit flag. Otherwise, it seems to construct
64 bit code.
5. Windows XP (32bit)
=====================
I'm describing here using cygwin. For some reason, the gcc4 version in
cygwin does not support compiling to mingw, but using the cygwin
version leads to some address spaces clashes with Java (at least, the
last time I checked), leading to a crash as soon as the cygwin
compiled code is loaded.
What all of this means is that you should use the old gcc3 "legacy"
compilers.
Also watch out for directory names with spaces in them, ATLAS does not
like them.
LAPACK
------
Compiling LAPACK just works as in Linux, but replace "gfortran" by "g77".
ATLAS
-----
Back in ATLAS 3.6, one needed to set architectures explicitly. With
3.8.3, there is no need to do so, but you have to set the fortran
compiler explicitly to "g77" (and the bit numbers to 32):
../configure --with-netlib-lapack=$HOME//build/lapack-lite-3.1.1/liblapack_fortran.a -A 15 -C if g77 -b 32
64-bit
------
Unfortunately, it is currently not possible to compile ATLAS for 64bit
under windows, mainly because cygwin is 32bit. There exists the
ming-w64 bit project (http://sourceforge.net/projects/mingw-w64/),
which provides 64bit compiler for the MINGW environment (a subset of
the UNIX- like environment cygwin provides, unfortunately insufficient
to build ATLAS).
What you can do, though,
Pure LAPACK-build on Windows 64 bit
-----------------------------------
Install the x86_64-w64-mingw32 compilers (just about everything except
for ada and objective C) ;)
In order to run fortran files, you might need to put
x86_64-w64-mingw32/sys-root/mingw/bin/
into your PATH.
Then, go into lapack-lite, and edit make.inc such that gfortran is
replaced by x86_64-w64-mingw32-gfortran everywhere. You should also
include the -funroll-all-loops -O3 options.
Compile using "make -k blaslib lapacklib" as usual, and rename the
results to libblas.a and liblapack.a. Then, do a normal lapack build.