-
Notifications
You must be signed in to change notification settings - Fork 568
/
Copy pathcmplr.env
429 lines (333 loc) · 13 KB
/
cmplr.env
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
#!/bin/bash -e
# --------------------------------------------------------------------------- #
# cmplr.env : Defines the compiler executable and its options for WW3 #
# from the compiler keyword given in argument #
# #
# - supported compiler are SGI-MPT, INTEL, GNU, PORTLAND, CRAY #
# #
# #
# use : cmplr.env cmplr #
# #
# cmplr : keyword based on a value and optional suffix, prefix and extras #
# #
# value : mpt / intel / gnu / pgi / cray #
# suffix : _debug #
# prefix : datarmor_ #
# extras : so_ #
# #
# - examples : intel / pgi_debug / datarmor_mpt_debug / so_intel #
# #
# remarks : #
# #
# - template files comp.tmpl and link.tmpl will be used to create the #
# comp and link file based on the following environment variables : #
# $optc, $optl, $comp_seq, $comp_mpi, $optomp, $err_pattern, $warn_pattern #
# #
# #
# M. Accensi #
# August 2018 #
# --------------------------------------------------------------------------- #
## Set some defaults (can be overriden by individual compiler sections)
# grep pattern for errors/warnings in compiler output:
err_pattern='[[:space:]]error[[:space:]]'
warn_pattern='warn'
# Binary I/O defaults to native endian:
endian='native'
# disable listing done by the compiler
list='no'
###############################
# MPT #
###############################
if [ "$cmplr" == "mpt" ] || [ "$cmplr" == "mpt_debug" ] || [ "$cmplr" == "mpt_prof" ] || \
[ "$cmplr" == "datarmor_mpt" ] || [ "$cmplr" == "datarmor_mpt_debug" ] || [ "$cmplr" == "datarmor_mpt_prof" ] ; then
# COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# common compiler
comp_seq='ifort'
comp_mpi='ifort -lmpi'
# Cray compiler
if [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] ; then
comp_seq='ftn'
comp_mpi='ftn'
fi
# OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# common options
optc='-c -module $path_m -no-fma -ip -g -i4 -real-size 32 -fp-model precise -assume byterecl -fno-alias -fno-fnalias'
optl='-o $prog -g'
endian='big_endian'
# list options
if [ "$list" == 'yes' ] ; then optc="$optc -list"; fi
# omp options
optomp="-openmp"
# optimized options
if [ -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O3"
optl="$optl -O3"
fi
# profiling option
if [ ! -z "$(echo $cmplr | grep prof)" ] ; then
optc="$optc -p"
optl="$optl -p"
fi
# debugging options
if [ ! -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O0 -debug all -warn all -check all -check noarg_temp_created -fp-stack-check -heap-arrays -traceback -fpe0"
optl="$optl -O0 -traceback"
fi
# system-dependant options
if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
optc="$optc -xcore-avx2"
optl="$optl -xcore-avx2"
else
optc="$optc -xhost"
optl="$optl -xhost"
fi
#Flags for CPP:
cppad3procflag='-E'
cppad3flag2=' '
cppad3flag3='-o'
cppad3flag4='#'
fi
###############################
# INTEL #
###############################
if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || [ "$cmplr" == "intel_prof" ] || \
[ "$cmplr" == "so_intel" ] || [ "$cmplr" == "so_intel_debug" ] || [ "$cmplr" == "so_intel_prof" ] || \
[ "$cmplr" == "datarmor_intel" ] || [ "$cmplr" == "datarmor_intel_debug" ] || [ "$cmplr" == "datarmor_intel_prof" ] || \
[ "$cmplr" == "wcoss_cray" ] || [ "$cmplr" == "wcoss_dell_p3" ] || [ "$cmplr" == "cheyenne.intel" ] || \
[ "$cmplr" == "gaea.intel" ] || [ "$cmplr" == "jet.intel" ] || \
[ "$cmplr" == "wcoss2" ] || [ "$cmplr" == "s4.intel" ] || \
[ "$cmplr" == "expanse.intel" ] || \
[ "$cmplr" == "hera.intel" ] || [ "$cmplr" == "orion.intel" ] || [ "$cmplr" == "stampede.intel" ] || \
[ "$cmplr" == "ukmo_cray_intel" ] || [ "$cmplr" == "ukmo_cray_intel_debug" ]; then
# COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# compiler
comp_seq='ifort'
comp_mpi='mpiifort'
# cray compiler
if [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] || [ "$cmplr" == "gaea.intel" ] || [ "$cmplr" == "wcoss2" ] || [[ $cmplr == ukmo_cray* ]]; then
comp_seq='ftn'
comp_mpi='ftn'
fi
if [ ! -z "$(echo $cmplr | grep cheyenne)" ] ; then
comp_seq='ifort'
comp_mpi='mpif90'
fi
# OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# common options
optc='-c -module $path_m -no-fma -ip -g -traceback -i4 -real-size 32 -fp-model precise -assume byterecl -fno-alias -fno-fnalias -sox'
optl='-o $prog -g'
endian='big_endian'
# list options
if [ "$list" == 'yes' ] ; then optc="$optc -list"; fi
# omp options
if [ ! -z "$(echo $cmplr | grep datarmor)" ] || [ "$cmplr" == "hera.intel" ] || [ "$cmplr" == "orion.intel" ] || \
[ "$cmplr" == "wcoss_cray" ] || [ "$cmplr" == "wcoss_dell_p3" ] || [ "$cmplr" == "cheyenne.intel" ] || \
[ "$cmplr" == "gaea.intel" ] || [ "$cmplr" == "jet.intel" ] || [ "$cmplr" == "wcoss2" ] || \
[ "$cmplr" == "stampede.intel" ] || [ "$cmplr" == "s4.intel" ] || [ "$cmplr" == "expanse.intel" ] ; then
optomp="-qopenmp"
else
optomp="-openmp"
fi
# optimized options
if [ -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O3"
optl="$optl -O3"
fi
# profiling option
if [ ! -z "$(echo $cmplr | grep prof)" ] ; then
optc="$optc -p"
optl="$optl -p"
fi
# debugging options
if [ ! -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O0 -debug all -warn all -check all -check noarg_temp_created -fp-stack-check -heap-arrays -traceback -fpe0"
optl="$optl -O0 -traceback"
fi
# system-dependant options
if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
optc="$optc -xcore-avx2"
optl="$optl -xcore-avx2"
elif [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] ; then
optc="$optc -xCORE-AVX2"
optl="$optl -xCORE-AVX2"
elif [ ! -z "$(echo $cmplr | grep wcoss2)" ] ; then
optc="$optc"
optl="$optl"
elif [ ! -z "$(echo $cmplr | grep wcoss_dell_p3)" ] ; then
optc="$optc -xHOST"
optl="$optl -xHOST"
elif [ ! -z "$(echo $cmplr | grep jet.intel)" ] ; then
optc="$optc -axSSE4.2,AVX,CORE-AVX2,CORE-AVX512 -align array64byte -ip"
optl="$optl -axSSE4.2,AVX,CORE-AVX2,CORE-AVX512 -align array64byte -ip"
elif [[ $cmplr == ukmo_cray* ]]; then
: # processor type set by ftn wrapper script.
elif [ ! -z "$(echo $cmplr | grep s4)" ] ; then
#Necessary to run on the Ivy partition
optc="$optc -march=ivybridge"
optl="$optl -march=ivybridge"
else
optc="$optc -xhost"
optl="$optl -xhost"
fi
if [ ! -z "$(echo $cmplr | grep so)" ] ; then
optc="$optc -fPIC"
optl='-o $prog -g'
fi
#Flags for CPP:
cppad3procflag='-E'
cppad3flag2=' '
cppad3flag3='>'
cppad3flag4='#'
fi
###############################
# GNU #
###############################
if [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || [ "$cmplr" == "gnu_prof" ] || \
[ "$cmplr" == "so_gnu" ] || [ "$cmplr" == "so_gnu_debug" ] || [ "$cmplr" == "so_gnu_prof" ] || \
[ "$cmplr" == "hera.gnu" ] || [ "$cmplr" == "cheyenne.gnu" ] || \
[ "$cmplr" == "datarmor_gnu" ] || [ "$cmplr" == "datarmor_gnu_debug" ] || [ "$cmplr" == "datarmor_gnu_prof" ] || \
[ "$cmplr" == "ukmo_cray_gnu" ] || [ "$cmplr" == "ukmo_cray_gnu_debug" ] || [ "$cmplr" == "ukmo_cray_gnu_prof" ] ; then
# COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Only match `error` and `warn` at beginning of line:
err_pattern='^error'
warn_pattern='^warn'
# common compiler
comp_seq='gfortran'
comp_mpi='mpif90'
# Cray compiler
if [ ! -z "$(echo $cmplr | grep cray)" ] ; then
comp_seq='ftn'
comp_mpi='ftn'
fi
# OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# common options
optc='-c -J$path_m -g -fno-second-underscore -ffree-line-length-none'
optl='-o $prog -g'
endian='big_endian'
# omp options
optomp='-fopenmp'
# optimized options
if [ -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O3"
optl="$optl -O3"
fi
# profiling option
if [ ! -z "$(echo $cmplr | grep prof)" ] ; then
optc="$optc -p"
optl="$optl -p"
fi
# debugging options
if [ ! -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O0 -Wall -fcheck=all -ffpe-trap=invalid,zero,overflow -frecursive -fbacktrace"
optl="$optl -O0 -fbacktrace"
fi
# system-dependant options
if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
optc="$optc -march=core-avx2"
optl="$optl -march=core-avx2"
elif [ ! -z "$(echo $cmplr | grep ukmo_cray)" ]; then
# don't specify -march for Cray; processor specific tuning handled by ftn wrapper script
optc="$optc -frecord-marker=4"
else
optc="$optc -march=native"
optl="$optl -march=native"
fi
if [ ! -z "$(echo $cmplr | grep so)" ] ; then
optc="$optc -fPIC"
fi
#Flags for CPP:
cppad3procflag='-E'
cppad3flag2=' '
cppad3flag3='-o'
cppad3flag4='#'
fi
###############################
# PGI #
###############################
if [ "$cmplr" == "pgi" ] || [ "$cmplr" == "pgi_debug" ] || [ "$cmplr" == "pgi_prof" ] || \
[ "$cmplr" == "datarmor_pgi" ] || [ "$cmplr" == "datarmor_pgi_debug" ] || [ "$cmplr" == "datarmor_pgi_debug" ] ; then
# COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# common compiler
comp_seq='pgf90'
comp_mpi='mpif90'
# OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# common options
optc='-c -module $path_m -g -i4 -r4 -Kieee -byteswapio'
optl='-o $prog -g'
# list options
if [ "$list" == 'yes' ] ; then optc="$optc -Mlist"; fi
# omp options
optomp="-mp"
# optimized options
if [ -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O3"
optl="$optl -O3"
fi
# profiling option
if [ ! -z "$(echo $cmplr | grep prof)" ] ; then
optc="$optc -p"
optl="$optl -p"
fi
# debugging options
if [ ! -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O0 -Mbounds -Mchkfpstk -Mchkstk -Mdalign -Mdclchk -Mdepchk -Miomutex -Ktrap=fp -Mrecursive -traceback"
optl="$optl -O0 -traceback"
fi
# system-dependant options
if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
optc="$(echo $optc | sed 's/O3/O2/') -Mlist"
optl="$optl"
else
optc="$optc"
optl="$optl"
fi
#Flags for CPP:
cppad3procflag='-E'
cppad3flag2=' '
cppad3flag3='>'
cppad3flag4='#'
fi
###############################
# Crayftn (CCE)
###############################
if [ "$cmplr" == "ukmo_cray" ] || [ "$cmplr" == "ukmo_cray_debug" ] || \
[ "$cmplr" == "ukmo_cray_regtest" ]; then
# COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# common compiler
comp_seq='ftn'
comp_mpi='ftn'
# cray compiler output needs more specific err/warn search patterns:
err_pattern='crayftn: error'
warn_pattern='crayftn: warn'
# OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# common options
optc='-c -J$path_m -sdefault32 -eg'
optl='-o $prog'
# list options
if [ "$list" == 'yes' ] ; then optc="$optc -hlist=a"; fi
# omp options
optomp="-h omp"
# optimized options
if [ -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O3"
optl="$optl -O3"
fi
# debugging options
if [ ! -z "$(echo $cmplr | grep debug)" ] ; then
optc="$optc -O0 -g -Rbcps"
optl="$optl -O0 -g"
fi
# regtest options:
if [ ! -z "$(echo $cmplr | grep regtest)" ] ; then
# -O1 best balance between compile time and runtime for regtests
optc="$optc -O1"
optl="$optl -O1"
fi
# system-dependant options
# N/A
#Flags for CPP:
cppad3procflag='-eP'
cppad3flag2=' '
cppad3flag3='#'
cppad3flag4=' '
fi