forked from pmodels/mpe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL.cross
487 lines (389 loc) · 20.3 KB
/
INSTALL.cross
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
MPE (Multi-Processing Environment)
----------------------------------
Version 2.5.0. Oct, 2009
Mathematics and Computer Science Division
Argonne National Laboratory
II. CONFIGURATION
-----------------
Please read the CONFIGURATION section II. a) and II. b) in INSTALL to get
yourself familar with the Configuration Model of MPE.
III. INSTALLATION INSTRUCTIONS
------------------------------
This file describes the Cross-Compilation build instructions for MPE.
If you don't need cross-compilation support or you don't know what
cross-compilation is, you probably don't need to read this. INSTALL
is all you need to know.
**** The following is NO longer true in this MPE release ****
This release of MPE has better support of cross-compilation and does
not require a 2-step process, i.e. no cross-spec file is needed.
Cross compilation is similar to native compilation except the addition
of --host and --build as required by autoconf(i.e. configure).
In short, cross-compile requires specification of CC/F77/MPI_CC/MPI_F77,
--host and --build as part of configure command.
More documentation will be added later.
**************************************************************
For those who need cross-compilation support, 7 to 10 variables are
needed. These variables are determined through some runtime tests on
cross-compiled host (i.e. the host where the libraries/executable are
being built for). The exact number of variables depends on if the
MPE's internal Fortran to C MPI profiling wrapper library needs to be
built. 7 of the 10 environmental variables are related to the C compiler
of the cross-compiled platform.
CROSS_SIZEOF_CHAR : sizeof(char), e.g. 1
CROSS_SIZEOF_SHORT : sizeof(short), e.g. 2
CROSS_SIZEOF_INT : sizeof(int), e.g. 4
CROSS_SIZEOF_LONG : sizeof(long), e.g. 8
CROSS_SIZEOF_LONG_LONG : sizeof(long long), e.g. 8
CROSS_SIZEOF_VOID_P : sizeof(void *), e.g. 8
CROSS_BIGENDIAN : true if it is a big endian machine, false otherwise.
If your MPI implementation does NOT provide any Fortran to C MPI profiling
wrapper library, then you need to specify 3 more environmental variables.
The following environmental variables specify properties of MPI
implementation if F2CMPI_LIBS is defined, i.e MPE's internal Fortran
to C MPI profiling library is used. These variables are related to
how Fortran primitive type looks like in C.
CROSS_MPI_STATUS_SIZE : value of MPI_STATUS_SIZE defined in mpif.h, i.e.
sizeof(MPI_STATUS_SIZE)/sizeof(MPI_Fint), e.g. 4
CROSS_FORTRAN2C_TRUE : value of fortran's .TRUE. in C program, e.g. 1
CROSS_FORTRAN2C_FALSE : value of fortran's .FALSE. in C program, e.g. 0
III. a) Cross-Compile Specification
-----------------------------------
In order to simplify and avoid any ambiguity in the determination of these
values, a small subpackage called "cross_spec" within MPE can be used.
This goal of this subpackage is to generate a cross-compile specification
file which will contain all the relevant CROSS_xxx variables listed above.
The subapackage has its own independent configure and accepts a similar set
of configure variables and options as MPE's configure. If you are not
familar with MPE's configure variables and options, please see INSTALL file's
section II. a) and II. b). Or you can do "mpe2/cross_spec/configure --help"
for a list of the cross_spec's options and environment variables.
The default cross-compile specification file generated by cross_spec
is called cross_spec.txt which can be overriden by option --with-spec.
Let say we are cross-compiling MPE for x86_64 (64bit linux) backend nodes
on a 32bit linux frontend box which has the following cross-compilers:
the serial C cross-compiler : /usr/local/bin/lans64_cc,
the serial Fortran cross-compiler : /usr/local/bin/lans64_fc,
the MPI C cross-compiler : /usr/local/bin/lans64_mpicc,
the MPI Fortran cross-compiler : /usr/local/bin/lans64_mpif90
Usually the frontend will have a command to run executable in the backend,
let say this is called "/usr/local/bin/lans64_run -np 1", where "-np 1"
means the executable will be run on 1 node.
Now pick a build directory <build_spec_dir> to build cross_spec, be sure
not set <build_spec_dir> as <mpe2_src_dir>. Doing so will cause conflict
between cross_spec's Makefile and mpe2's main Makefile.
One can configure cross_spec as follows:
mkdir <build_spec_dir>
cd <build_spec_dir>
<mpe2_src_dir>/cross_spec/configure --host=x86_64-linux \
AR=ar RANLIB=ranlib \
CC=/usr/local/bin/lans64_cc \
F77=/usr/local/bin/lans64_fc \
MPI_CC=/usr/local/bin/lans64_mpicc \
MPI_F77=/usr/local/bin/lans64_mpif90 \
MPERUN="/usr/local/bin/lans64_run -np 1"
make
make run
Where --host=x86_64_linux informs configure we are building for 64bit linux.
Notice there isn't a --prefix option in the configure command, as it isn't
necessary to install this subpackage anywhere. Here AR and RANLIB are used
in the configure command to highlight these variables can be added for
platform which has specific AR and RANLIB for the backend nodes. The MPERUN
allows users to run the tests on the backend through Makefile, i.e. through
the "make run" commad. Without MPERUN or there isn't a command to launch
executable to run on the backend, the "make run" will execute the tests
locally on the frontend. In that case, one has to launch the tests separately
by hand.
There are 2 executables and 1 script created by cross_spec. They are
cross_cc, cross_f2c and cross_env.
cross_cc: an executable that specifies various C compiler features
in the backend. (Has to run on the backend)
cross_f2c: an executable that specifies various Fortran to C features
in the backend. (Has to run on the backend)
cross_env: a script that specifies the configure options used in
cross_spec and these options will be used in cross-compiling
MPE again. (run on the frontend)
If running of the cross_cc, cross_f2c and cross_env returns successfully,
a cross_spec.txt file will be generated, an example of file is like
# C compiler runtime characteristics...
CROSS_SIZEOF_CHAR=1
CROSS_SIZEOF_SHORT=2
CROSS_SIZEOF_INT=4
CROSS_SIZEOF_LONG=8
CROSS_SIZEOF_LONG_LONG=8
CROSS_SIZEOF_VOID_P=8
CROSS_BIGENDIAN=false
# Fortran to C runtime characteristics...
CROSS_MPI_STATUS_SIZE=5
CROSS_FORTRAN2C_TRUE=1
CROSS_FORTRAN2C_FALSE=0
# C and Fortran development tool variables...
MPI_CC=/usr/local/bin/lans64_mpicc
CC=/usr/local/bin/lans64_cc
MPI_F77=/usr/local/bin/lans64_mpif90
F77=/usr/local/bin/lans64_fc
AR=ar
RANLIB=ranlib
Any other configure variables, e.g. CFLAGS, for MPE configure
can be appended in the cross_spec.txt, as they will be proprogangated
down to other subpackages within MPE configure.
III. b) Cross-Compilation With "cross_spec.txt"
-----------------------------------------------
With cross_spec.txt generated by cross_spec subpackage, cross_compile
MPE becomes easy. One can do it as follows:
mkdir <build_mpe2_for_backend>
cd <build_mpe2_for_backend>
<mpe2_src_dir>/configure --prefix=<mpe2_install_dir> \
--host=x86_64_linux \
--with-cross-spec=<build_spec_dir>/cross_spec.txt \
MPERUN="/usr/local/bin/lans64_run -np 4"
make
make install
make installcheck-all
Here AR and RANLIB are added for illustration purposes.
Where --host is used to inform configure what type of host to be built for
the backend. Again, MPERUN is optional here. With MPERUN, the
"make installcheck-all" command will launch runtime tests to the backend
to check if every selected components are built correctly. Notice that
the MPERUN command here is different from the one used in cross_spec, since
we want to run multiple processes job in the "installcheck-all".
instructions for BlueGeneLight (BG/L)
-------------------------------------
**** Cross-Spec build ****
mkdir <build_spec_dir>
cd <build_spec_dir>
<mpe2_src_dir>/cross_spec/configure CC=blrts_xlc F77=blrts_xlf \
MPI_CC=mpixlc MPI_F77=mpixlf77 \
--host=powerpc-unknown-linux-gnu \
--build=powerpc-pc-linux-gnu
make
cqsub -n 1 -t 5 cross_cc
cqsub -n 1 -t 5 cross_f2c
cross_env
Here --host is set to powerpc-unknown-linux-gnu even BG/L is not linux
Since we don't know what is the correct host-type for BG/L, --host
is arbitary set to powerpc-unknown-linux-gnu and should be different
from --build value so the configure knows we are doing cross-compilation.
Also make sure that "cqsub ... cross_cc" is finished __before__
"cqsub ... cross_f2c", otherwise the cross_spec.txt may have overlapped
output from both cross_cc and cross_f2c at the same time.
**** MPE2 build ****
mkdir <build_mpe2_for_backend>
cd <build_mpe2_for_backend>
<mpe2_src_dir>/configure --prefix=<mpe2_install_dir> \
--host=powerpc-unknown-linux-gnu \
--build=powerpc-pc-linux-gnu \
--with-cross-spec=<build_spec_dir>/cross_spec.txt \
--with-java=/usr/lib/IBMJava2/jre \
--disable-misc --disable-graphics \
--disable-sample --disable-rlog
make
make install
make installcheck
instructions for BlueGene P (BG/P)
-------------------------------------
**** Cross-Spec build ****
mkdir <build_spec_dir>
cd <build_spec_dir>
<mpe2_src_dir>/cross_spec/configure CC=bgxlc_r F77=bgxlf_r \
MPI_CC=mpixlc_r MPI_F77=mpixlf77_r \
--host=powerpc-unknown-linux-gnu \
--build=powerpc-pc-linux-gnu
** the "_r" is used to enable thread support in the compiler **
** mpixlc_r/mpixlf_r are in /bgsys/drivers/ppcfloor/comm/bin **
make
cqsub -n 1 -t 5 cross_cc
cqsub -n 1 -t 5 cross_f2c
cross_env
Here --host is set to powerpc-unknown-linux-gnu even BG/P is not linux
Since we don't know what is the correct host-type for BG/P, --host
is arbitary set to powerpc-unknown-linux-gnu and should be different
from --build value so the configure knows we are doing cross-compilation.
Also make sure that "cqsub ... cross_cc" is finished __before__
"cqsub ... cross_f2c", otherwise the cross_spec.txt may have overlapped
output from both cross_cc and cross_f2c at the same time.
**** MPE2 build ****
mkdir <build_mpe2_for_backend>
cd <build_mpe2_for_backend>
<mpe2_src_dir>/configure --prefix=<mpe2_install_dir> \
--host=powerpc-unknown-linux-gnu \
--build=powerpc-pc-linux-gnu \
--with-cross-spec=<build_spec_dir>/cross_spec.txt\
--disable-safePMPI \
--disable-misc --disable-graphics \
--disable-sample --disable-rlog
make
make install
make installcheck
instructions for SiCortex (SC5812)
-------------------------------------
On the i686 linux cross-compiling frontend (bblogin)
**** Cross-Spec build ****
mkdir <build_spec_dir>
cd <build_spec_dir>
<mpe2_src_dir>/cross_spec/configure \
CC="scpathcc -n32" \
F77="scpathf95 -fno-second-underscore -n32" \
MPI_CC="scmpicc --pathscale -n32" \
MPI_F77="scmpif90 -fno-second-underscore -n32" \
LIBS=-lpthread \
--host=mips64el-gentoo-linux-gnu \
--build=x86_64_linux
make
The above build is for n32 binary. For 64-bit binary, replace -n32 by -64.
Now log onto sicortex's login node (fd-login)
to launch programs with srun to get the cross_spec.txt
srun -n 1 cross_cc
srun -n 1 cross_f2c
srun -n 1 cross_env
**** MPE2 build ****
mkdir <build_mpe2_for_backend>
cd <build_mpe2_for_backend>
<mpe2_src_dir>/configure --prefix=<mpe2_install_dir> \
--host=mips64el-gentoo-linux-gnu \
--build=x86-linux-gnu_linux \
--with-cross-spec=<build_spec_dir>/cross_spec.txt\
--disable-safePMPI
make
make install
make installcheck
instructions for Cray X1E (Phoenix)
----------------------------------
On the i686 linux cross-compiling frontend (robin)
**** Cross-Spec build ****
mkdir <build_spec_dir>
cd <build_spec_dir>
<mpe2_src_dir>/cross_spec/configure CC=cc F77="ftn -s real64 -dp" \
MPI_CC=cc MPI_F77="ftn -s real64 -dp" \
--host=craynv-cray-unicosmp3.0.X \
--build=i686-pc-linux-gnu
make
# Now create a cross_tests.cmd as follows:
cat > cross_tests.cmd <<EOF
#!/bin/sh
#PBS -l walltime=5:00,mppe=1
#PBS -j oe
#PBS -m abe
#PBS -A xxxxx
# job starts in home directory, cd to the submission directory
cd ${PBS_O_WORKDIR}
echo "running cross_cc"
aprun -n 1 ./cross_cc
echo "running cross_f2c"
aprun -n 1 ./cross_f2c
EOF
qsub cross_tests.cmd
# After the job is done, then run cross_env on the front-end
./cross_env
Now make sure that java (SUN or IBM's jdk) is in your path.
**** MPE2 build ****
mkdir <build_mpe2_for_backend>
cd <build_mpe2_for_backend>
<mpe2_src_dir>/configure --prefix=<mpe2_install_dir> \
--host=craynv-cray-unicosmp3.0.X \
--build=i686-pc-linux-gnu \
--with-cross-spec=<build_spec_dir>/cross_spec.txt \
--disable-misc --disable-graphics \
--disable-threadlogging
--disable-threadlogging disables the pthread logging support since Cray
backend does not seem to support pthread calls.
make
make install
make installcheck
instructions for Cray XT4 (jaguar)
----------------------------------
Compiling for the catamount(no thread support) on the frontend
**** Cross-Spec build ****
mkdir <build_spec_dir>
cd <build_spec_dir>
<mpe2_src_dir>/cross_spec/configure CC="cc --target=catamount" \
F77="ftn --target=catamount" \
MPI_CC="cc --target=catamount" \
MPI_F77="ftn --target=catamount" \
--host=x86_64-catamount-linux \
--build=x86_64-linux
make
# allocate an interactive PBS job slot to run cross_cc and cross_f2c
qsub -A XXXXX -V -I -lwalltime=00:15:00,size=2
# cd to where cross_cc and cross_f2c re
cd <mpe2_src_dir>/cross_spec
# run cross_cc and cross_f2c
yod -sz 1 cross_cc
yod -sz 1 cross_f2c
# Now make sure that java (SUN or IBM's jdk) is in your path if it is available
**** MPE2 build ****
mkdir <build_mpe2_for_backend>
cd <build_mpe2_for_backend>
<mpe2_src_dir>/configure --prefix=<mpe2_install_dir> \
--host=x86_64-catamount-linux \
--build=x86_64-linux \
--with-cross-spec=<build_spec_dir>/cross_spec.txt \
CC="cc --target=catamount" \
F77="ftn --target=catamount" \
MPI_CC="cc --target=catamount" \
MPI_F77="ftn --target=catamount"
make
make install
III. c) Cross-Compilation Without "cross_spec.txt"
--------------------------------------------------
The section contains some examples of cross-compiling MPE on older platforms:
For cross-compilation with an existing version of MPICH(or LAM). e.g. ASCI-Red.
*** If the Fortran to C MPI profiling wrapper library exists (it is called
libfmpich.a in MPICH and liblamf77mpi.a in LAM), do
setenv CC cicc
setenv F77 cif77
setenv CROSS_SIZEOF_CHAR 1
setenv CROSS_SIZEOF_SHORT 2
setenv CROSS_SIZEOF_INT 4
setenv CROSS_SIZEOF_LONG_LONG 8
setenv CROSS_BIGENDIAN false
${MPE_SRC_DIR}/configure --with-mpicc=${MPICH_INSTALL_DIR}/bin/mpicc \
--with-mpif77=${MPICH_INSTALL_DIR}/bin/mpif77 \
--with-f2cmpilibs=-lfmpich \
--disable-graphics
make
make install PREFIX=${MPE_INSTALL_DIR}
Here assume mpicc/mpif77 scripts exist. If not, mpicc should include lines:
#! /bin/sh
cicc -I${MPICH_INSTALL_DIR}/include -L${MPICH_INSTALL_DIR}/lib $@ <-lmpi>
mpif77 can be composed by including the following line
#! /bin/sh
cicc -I${MPICH_INSTALL_DIR}/include -L${MPICH_INSTALL_DIR}/lib $@ <-lmpi>
<-lmpi> refers to various MPI libraries included in your MPI implementation.
*** If the Fortran to C MPI profiling wrapper library does NOT exist,
then the MPE's own Fortran to C MPI profiling wrapper library needs
to be built. 3 additional environment variables are needed. They
are CROSS_MPI_STATUS_SIZE, CROSS_FORTRAN2C_TRUE & CROSS_FORTRAN2C_FALSE
setenv CC cicc
setenv F77 cif77
setenv CROSS_SIZEOF_CHAR 1
setenv CROSS_SIZEOF_SHORT 2
setenv CROSS_SIZEOF_INT 4
setenv CROSS_SIZEOF_LONG_LONG 8
setenv CROSS_BIGENDIAN false
setenv CROSS_MPI_STATUS_SIZE 4
setenv CROSS_FORTRAN2C_TRUE 1
setenv CROSS_FORTRAN2C_FALSE 0
${MPE_SRC_DIR}/configure --with-mpicc=${MPICH_INSTALL_DIR}/bin/mpicc \
--with-mpif77=${MPICH_INSTALL_DIR}/bin/mpif77 \
--disable-graphics
make
make install PREFIX=${MPE_INSTALL_DIR}
For Cray X1E MPI implementation: cross-compilation at a linux front-end(robin)
(e.g. phoenix at Oak Ridge)
${MPE_SRC_DIR}/configure \
MPI_F77="ftn -s real64 -dp" \
F77="ftn -s real64 -dp" \
MPI_CC=cc \
CC=$HOME/phoenix/bin/gcc-robin \
--host=craynv-cray-unicosmp3.0.X \
--build=i686-pc-linux-gnu \
CROSS_SIZEOF_CHAR=1 \
CROSS_SIZEOF_SHORT=2 \
CROSS_SIZEOF_INT=4 \
CROSS_SIZEOF_LONG_LONG=8 \
CROSS_BIGENDIAN=true \
CROSS_MPI_STATUS_SIZE=6 \
CROSS_FORTRAN2C_TRUE=1 \
CROSS_FORTRAN2C_FALSE=0 \
--disable-misc --disable-graphics --disable-collchk \
--disable-sample --disable-rlog