forked from GEOS-ESM/WxMap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodules
More file actions
executable file
·497 lines (389 loc) · 14.4 KB
/
Copy pathmodules
File metadata and controls
executable file
·497 lines (389 loc) · 14.4 KB
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
488
489
490
491
492
493
494
495
496
497
#!/bin/csh -f
########################################################################
#
# Name: g5_modules
#
# Purposes -
# * provide single location for BASEDIR and module values
# * initialize the following:
# - set BASEDIR
# - update LD_LIBRARY_PATH with BASEDIR lib
# - load library modules
# * echo expected BASEDIR and library module values when queried
#
# Notes:
# 1. The script will not function correctly if the scriptname
# definition within the script is incorrect.
# 2. Type "g5_modules help" for usage information.
#
# Perl Notes:
# ==========
# 1. You cannot "source" this file from a perl script.
# 2. Instead use the following in your perl script:
# #--------------------------------
# use Env;
# do "g5_modules_perl_wrapper";
# #--------------------------------
# 3. Use the g5_modules_perl_wrapper file located in the build's bin
# directory, where a copy of g5_modules also resides. This is important
# since g5_modules_perl_wrapper uses g5_modules and expects it to be in
# the same directory.
#
# Bash Notes:
# ==========
# If you are in a bash shell, then source the g5_modules.sh script.
# > source g5_modules.sh
#
# REVISION HISTORY
# 31Aug2007 Stassi Initial version of code
# 15Oct2007 Stassi Expand list of machines and include defaults
# 15Dec2007 Stassi Added LD_LIBRARY_PATH functionality
# 21Jul2008 Takacs New modules and BASEDIR on discover after OS upgrade
# 13Apr2009 Stassi Updated for pleiades
# 22Apr2010 Kokron Updated for Fortuna-2.1 on pleiades
# 21Jul2011 Kokron Overlay older MKL module as on discover to gain reproducible results from dgeev in GSI
# 24Aug2012 Stassi Added sh option to write bash source-able file
# 03Nov2016 Thompson Remove JIBB
########################################################################
# NOTE: Spell out scriptname--DO NOT SET EQUAL TO $0!
#----------------------------------------------------
set scriptname = g5_modules
if ( $scriptname == "$0:t" ) then
set sourced = 0
else
set sourced = 1
endif
# check for improper usage
#-------------------------
if (! $sourced && ! $#argv) goto usage # not sourced and no args
if ( $sourced && $#argv) goto usage # sourced with args
# get architecture, machine, and node information
#------------------------------------------------
set arch = `uname -s`
set mach = `uname -m`
set node = `uname -n`
# Find site
# ---------
if (($node =~ discover*) || ($node =~ borg*) || \
($node =~ dali*) || ($node =~ warp*)) then
set site = "NCCS"
else if (($node =~ pfe*) || ($node =~ p4fe*) || \
($node =~ r[0-9]*i[0-9]*n[0-9]*) || \
($node =~ bridge*) || ($node =~ maia*)) then
set site = "NAS"
else if ($node =~ janus*) then
set site = "GMAO.janus"
else if ( $node =~ bender* ) then
set site = "ACDL.bender"
else if ( $node =~ *niteroi* ) then
set site = "GMAO.niteroi"
else if ( -d /ford1/share/gmao_SIteam/ && -d /ford1/local/ && $arch == Linux ) then
set site = "GMAO.desktop"
else
set site = $node
endif
alias echo2 "echo \!* > /dev/stderr"
# get values
#-----------
if ($mach == x86_64) goto X86_64
# ERROR -- unknown architecture/machine
#--------------------------------------
echo2 "${scriptname}: >>>WARNING<<< unrecognizable arch/machine = $arch/$mach"
echo 0 # indicating error condition
exit 8
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# X86_64 values (Linux)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
X86_64:
#==================#
# X86_64 default #
#==================#
set modinit = DUMMY
set loadmodules = 0
set usemodules = 0
#========#
# NCCS #
#========#
if ( $site == NCCS ) then
# Are we on SLES12...
if ( -e /etc/os-release ) then
set mod1 = GEOSenv
set mod2 = comp/gcc/6.5.0
set mod3 = comp/intel/19.1.0.166
set mod4 = mpi/impi/19.1.0.166
set mod5 = python/GEOSpyD/Ana2019.10_py2.7
set basedir = /discover/swdev/gmao_SIteam/Baselibs/ESMA-Baselibs-6.0.11-SLES12/x86_64-unknown-linux-gnu/ifort_19.1.0.166-intelmpi_19.1.0.166
set mods = ( $mod1 $mod2 $mod3 $mod4 $mod5 )
set usemod1 = /discover/swdev/gmao_SIteam/modulefiles-SLES12
# or SLES 11?
else
set mod1 = GEOSenv
set mod2 = other/comp/gcc-6.3
set mod3 = comp/intel-18.0.5.274
set mod4 = mpi/impi-18.0.5.274
set mod5 = lib/mkl-18.0.5.274
set mod6 = other/python/GEOSpyD/Ana2019.10_py2.7
set basedir = /discover/swdev/gmao_SIteam/Baselibs/ESMA-Baselibs-6.0.11-SLES11/x86_64-unknown-linux-gnu/ifort_18.0.5.274-intelmpi_18.0.5.274
set mods = ( $mod1 $mod2 $mod3 $mod4 $mod5 $mod6 )
set usemod1 = /discover/swdev/gmao_SIteam/modulefiles-SLES11
endif
set modinit = /usr/share/modules/init/csh
set loadmodules = 0
set usemods = ( $usemod1 )
set usemodules = 1
#=======#
# NAS #
#=======#
else if ( $site == NAS ) then
set basedir = /nobackup/gmao_SIteam/Baselibs/ESMA-Baselibs-6.0.11/x86_64-unknown-linux-gnu/ifort_2018.5.274-mpt_2.17r13-gcc_6.3.0
set mod1 = GEOSenv
set mod2 = comp-gcc/6.3.0
set mod3 = 2018.5.274.modulefile
set mod4 = mpi-hpe/mpt.2.17r13
set mod5 = math-mkl/2018.5.274
set mod6 = python/GEOSpyD/Ana2019.10_py2.7
set mods = ( $mod1 $mod2 $mod3 $mod4 $mod5 $mod6 )
set modinit = /usr/share/modules/init/tcsh
set loadmodules = 0
set usemod1 = /u/scicon/tools/modulefiles
set usemod2 = /nobackup/gmao_SIteam/modulefiles
set usemod3 = /nasa/intel/Compiler/2018.5.274
set usemods = ( $usemod1 $usemod2 $usemod3 )
set usemodules = 1
#=========#
# JANUS #
#=========#
else if ( $site == GMAO.janus ) then
set basedir=/ford1/share/gmao_SIteam/Baselibs/ESMA-Baselibs-6.0.11/x86_64-unknown-linux-gnu/pgfortran_17.10-openmpi_3.0.0-gcc_6.3.0
set mod1 = comp/gcc/6.3.0
set mod2 = comp/pgi/17.10-gcc_6.3.0
set mod3 = mpi/openmpi/3.0.0/pgi-17.10_gcc-6.3.0
set mod4 = lib/mkl/17.0.4.196
set mod5 = other/python/canopy
set mod6 = other/git/latest
set mod7 = other/cmake/latest
setenv ESMA_FC pgfortran
setenv GPU_CC_REV cc20
setenv PGI_LOCALRC /ford1/share/gmao_SIteam/PGILocalRC/linux86-64/17.10/bin/localrc.60300
set mods = ( $mod1 $mod2 $mod3 $mod4 $mod5 $mod6 $mod7 )
set modinit = /usr/share/Modules/init/tcsh
set loadmodules = 0
set usemodules = 1
#===========#
# Bender #
#===========#
else if ( $site == ACDL.bender ) then
set basedir=/ford1/share/gmao_SIteam/Baselibs/GMAO-Baselibs-5_0_0/x86_64-unknown-linux-gnu/ifort_13.1.1.163-openmpi_1.8.1
set BASEBIN=$basedir/$arch/bin
set PYBIN = /share/dasilva/epd/epd-7.3-2-rh5-x86_64/bin
set IFCBIN = /opt/intel/composer_xe_2013.5.192/bin
set MPIBIN = /ford1/share/gmao_SIteam/MPI/openmpi-1.8.1-ifort-13.1.1.163/bin
source $IFCBIN/ifortvars.csh intel64
setenv MKLPATH $MKLROOT/lib
set path = ( $BASEBIN $MPIBIN $PYBIN $path )
set loadmodules = 0
set usemodules = 0
#===========#
# Niteroi #
#===========#
else if ( $site == GMAO.niteroi ) then
set basedir = /Users/mathomp4/Baselibs/GMAO-Baselibs-5_0_0/x86_64-apple-darwin14.0.0/ifort_15.0.1.108-openmpi_1.8.3
set BASEBIN = $basedir/$arch/bin
set PYBIN = /Library/Frameworks/EPD64.framework/Versions/7.3/bin
set IFCPATH = /opt/intel/composer_xe_2015.1.108
set MPIBIN = /Users/mathomp4/MPI/openmpi/1.8.3/ifort-15.0.1.108
source $IFCPATH/bin/compilervars.csh intel64
setenv MKLPATH $MKLROOT/lib
set path = ( $BASEBIN $MPIBIN $PYBIN $path )
set loadmodules = 0
set usemodules = 0
#=================#
# GMAO DESKTOP #
#=================#
else if ( $site == GMAO.desktop ) then
set basedir=/ford1/share/gmao_SIteam/Baselibs/ESMA-Baselibs-6.0.11/x86_64-unknown-linux-gnu/ifort_18.0.5.274-openmpi_4.0.0-gcc_6.3.0
set mod1 = GEOSenv
set mod2 = comp/gcc/6.3.0
set mod3 = comp/intel/18.0.5.274
set mod4 = mpi/openmpi/4.0.0/intel-18.0.5.274_gcc-6.3.0
set mod5 = lib/mkl/18.0.5.274
set mod6 = other/python/GEOSpyD/Ana2019.10_py2.7
set mods = ( $mod1 $mod2 $mod3 $mod4 $mod5 $mod6 )
set modinit = /usr/share/Modules/init/tcsh
set loadmodules = 0
set usemod1 = /ford1/share/gmao_SIteam/modulefiles
set usemods = ( $usemod1 )
set usemodules = 1
endif
goto ACTION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# perform requested action
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
ACTION:
#===================#
# ECHO VALUE(s) #
#===================#
set wrapper = 0
if ( $#argv > 0 ) then
if ( $1 == basedir ) then
echo $basedir
else if ( $1 == modules ) then
echo $mods
else if ( $1 == modinit ) then
echo $modinit
else if ( $1 == loadmodules ) then
echo $loadmodules
else if ( $1 == usemodules ) then
echo $usemods
else if ( $1 == ESMA_FC ) then
echo $ESMA_FC
else if ( $1 == site ) then
echo $site
else if ( $1 == sh ) then
set wrapper = 1
goto SETVALUES
else if ( $1 == help ) then
goto usage
else
echo2 "${scriptname}: >>>ERROR<<< unrecognizable option -- $1"
echo2 Type "$scriptname help" for usage information.
echo 0 # indicating error condition
exit 9
endif
exit
endif
SETVALUES:
#================#
# SET VALUES #
#================#
#-------------------------------------------------------------------------
# set environment variables, BASEDIR and LD_LIBRARY_PATH; and load modules
#-------------------------------------------------------------------------
# setenv BASEDIR
#---------------
if ($?basedir) then
if (! $wrapper) echo -n "${scriptname}: Setting BASEDIR"
setenv BASEDIR $basedir
else if ($?BASEDIR) then
if (! $wrapper) echo -n "${scriptname}: BASEDIR found in environment"
else
echo
echo "BASEDIR not found in environment or set by ${scriptname}"
exit 3
endif
# add BASEDIR lib to LD_LIBRARY_PATH, if not already there
#---------------------------------------------------------
if ($?LD_LIBRARY_PATH) then
echo $LD_LIBRARY_PATH | grep $BASEDIR/$arch/lib > /dev/null
if ($status) then # == 1, if not found
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$BASEDIR/$arch/lib
endif
else
setenv LD_LIBRARY_PATH $BASEDIR/$arch/lib
endif
# add individual $ld_libraries to LD_LIBRARY_PATH, if not already there
#----------------------------------------------------------------------
if ($?ld_libraries) then
foreach lib ( $ld_libraries )
if ($LD_LIBRARY_PATH !~ *$lib*) then
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$lib
endif
end
endif
if ($?LD_LIBRARY64_PATH) then
echo $LD_LIBRARY64_PATH | grep $BASEDIR/$arch/lib > /dev/null
if ($status) then # == 1, if not found
setenv LD_LIBRARY64_PATH ${LD_LIBRARY64_PATH}:$BASEDIR/$arch/lib
endif
endif
# load library modules
#---------------------
if (-e $modinit) then
if (! $wrapper) echo -n " and modules"
source $modinit
module purge
if ($loadmodules) module load modules
if ($usemodules) then
foreach usemod ( $usemods )
module use -a $usemod
end
endif
foreach mod ( $mods )
module load $mod
end
endif
if (! $wrapper) echo " for $node"
# write sh commands to a .g5_modules.sh file
#-------------------------------------------
if ($wrapper) then
set outfil = ".g5_modules.sh"
if ($?BASEDIR) then
echo "export BASEDIR=$BASEDIR" >! $outfil
endif
if ($?LD_LIBRARY_PATH) then
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $outfil
endif
if ($?LD_LIBRARY64_PATH) then
echo "export LD_LIBRARY64_PATH=$LD_LIBRARY64_PATH" >> $outfil
endif
set modulecmd = `which modulecmd`
if ($status) set modulecmd = "/usr/bin/modulecmd"
set modinit_sh = `echo $modinit | sed "s|/csh|/sh|"`
if (-e $modulecmd) then
if (-e $modinit_sh) then
echo 'source '$modinit_sh >> $outfil
endif
echo 'eval `'$modulecmd sh purge'`' >> $outfil
if ($loadmodules) then
echo 'eval `'$modulecmd sh load modules'`' >> $outfil
endif
foreach mod ($mods)
echo 'eval `'$modulecmd sh load $mod'`' >> $outfil
end
endif
endif
setenv GAVERSION 2.1.0.oga.1
setenv PYTHONPATH /home/adasilva/workspace/QFED/Linux/lib/Python:$INSTALL_PATH/lib
setenv MYPYTHON /discover/nobackup/projects/gmao/share/dasilva/Python/epd-7.3-2-rh5-x86_64/bin
set GITBIN = /usr/local/other/git/1.7.3.4_GNU/bin
set path = ( . $path $INSTALL_PATH/utils \
$SHARE/dasilva/opengrads/Contents $GITBIN $MYPYTHON \
~adasilva/bin $SHARE/dasilva/bin /usr/local/bin )
exit
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# usage information #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
usage:
more <<EOF
NAME
$scriptname - Script to handle BASEDIR and library module definitions
DESCRIPTION
This script provides a single location for storing the BASEDIR and
library module name information. Previous to this script, this
information was coded in multiple files.
This script will set the BASEDIR environment variable to its proper value,
add the BASEDIR lib directory to LD_LIBRARY_PATH (if necessary), and will
load library modules when sourced.
If the script is called with "basedir", "modules", "modinit", or
"loadmodules", then it will echo the values to standard output without
modifying the environment.
The "modinit" and "loadmodules" options are primarily for use with
the g5_modules_perl_wrapper script.
SYNOPSIS
source $scriptname
or
$scriptname <option>
OPTIONS
help echo usage
basedir echo expected value for BASEDIR environment variable
modules echo expected list of modules
modinit echo location of csh module initialization script
loadmodules echo logical indicating whether "module load modules"
is needed prior to loading other modules
usemodules echo logical indicating whether "module use directory(s)"
is needed prior to loading other modules
ESMA_FC echo value of ESMA_FC if set
site echo site as detected by $scriptname
sh write sh version of g5_modules to file named, ".g5_modules.sh"
EOF
exit 1