forked from StormSurgeLive/asgs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplatforms.sh
executable file
·741 lines (718 loc) · 23.2 KB
/
platforms.sh
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
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
#!/bin/bash
#----------------------------------------------------------------
#
# $THIS: This file contains functions required for initializing
# variables that are architecture (platform) dependent.
# It is sourced by asgs_main.sh and any other shell script that
# is platform dependent.
#
#----------------------------------------------------------------
# Copyright(C) 2012--2019 Jason Fleming
#
# This file is part of the ADCIRC Surge Guidance System (ASGS).
#
# The ASGS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ASGS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the ASGS. If not, see <http://www.gnu.org/licenses/>.
#----------------------------------------------------------------
#
# initialization subroutines for the various machines/architectures
#
# Suggested aliases to support the Operator's tasks. Add these
# to .bashrc, .bash_profile or similar
#
# alias lsta='ls -lth *.state | head'
#
#
# D O N O T M A N U A L L Y A D D P L A T F O R M S H E R E A N Y M O R E
# See ./platforms/README
#
source ${SCRIPTDIR:-.}/monitoring/logging.sh
init_queenbee()
{ #<- can replace the following with a custom script
local THIS="platforms.sh>env_dispatch()>init_queenbee()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=queenbee.loni.org
QUEUESYS=PBS
PPN=20
QCHECKCMD=qstat
QSUMMARYCMD=showq
QUOTACHECKCMD=showquota
ALLOCCHECKCMD=showquota
QUEUENAME=workq
SERQUEUE=single
SUBMITSTRING=qsub
QSCRIPTTEMPLATE=$SCRIPTDIR/qscript.template
QSCRIPTGEN=qscript.pl # asgs looks in $SCRIPTDIR for this
OPENDAPPOST=opendap_post.sh #<~ $SCRIPTDIR/output/ assumed
if [[ ${RMQMessaging_Enable} == "on" ]]; then
RMQMessaging_LocationName="LONI"
RMQMessaging_ClusterName="Queenbee"
RMQMessaging_NcoHome="$HOME/local"
fi
JOBLAUNCHER='mpirun -np %totalcpu% -machinefile $PBS_NODEFILE'
ACCOUNT=null
TDS=( lsu_tds )
SSHKEY=~/.ssh/id_rsa.pub
REMOVALCMD="rmpurge"
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=$SCRATCH
ARCHIVEDIR=$SCRATCH
# @jasonfleming: for ~/.bashrc: Prevent git push from opening up a graphical
# dialog box to ask for a password; it will interactively ask for
# a password instead
unset SSH_ASKPASS
MAKEJOBS=8
}
#
init_supermic()
{ #<- can replace the following with a custom script
local THIS="platforms.sh>env_dispatch()>init_supermic()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=supermic.hpc.lsu.edu
QUEUESYS=PBS
PPN=20
QCHECKCMD=qstat
QSUMMARYCMD=showq
QUOTACHECKCMD=showquota
ALLOCCHECKCMD=showquota
QUEUENAME=workq
SERQUEUE=single
SUBMITSTRING=qsub
QSCRIPTTEMPLATE=$SCRIPTDIR/qscript.template
QSCRIPTGEN=qscript.pl
OPENDAPPOST=opendap_post.sh #<~ $SCRIPTDIR/output/ assumed
if [[ ${RMQMessaging_Enable} == "on" ]]; then
RMQMessaging_LocationName="LSU"
RMQMessaging_ClusterName="SuperMIC"
RMQMessaging_NcoHome="$HOME/local"
fi
JOBLAUNCHER='mpirun -np %totalcpu% -machinefile $PBS_NODEFILE'
ACCOUNT=null
PERL5LIB=${PERL5LIB}:${SCRIPTDIR}/PERL
local THIS="platforms.sh>env_dispatch()>init_supermic()"
SSHKEY=~/.ssh/id_rsa.pub
REMOVALCMD="rmpurge"
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=$SCRATCH
ARCHIVEDIR=$SCRATCH
TDS=( lsu_tds )
MAKEJOBS=8
}
# Note 0: This entry is meant to model a minimal entry
# Note 1: We're moving to placing conditional environements based on user or operator
# into $HOME/.asgsh_profile; e.g., setting MATLABEXE ('mex' or 'script' should go there)
# Note 3: Anything that is initialized without a value or as "null" should not be in here, but
# the variables should be documented somewhere
# Note 4: init-asgsh.sh should be run to ensure $WORK and $SCRATCH is set properly so that it
# propagates in the ASGS Shell environment
init_queenbeeC()
{ local THIS="platforms.sh>env_dispatch()>init_queenbeeC()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=qbc.loni.org
QUEUESYS=SLURM
QCHECKCMD=sacct
QUEUENAME=workq
SERQUEUE=single
PPN=48
JOBLAUNCHER='srun '
SUBMITSTRING=sbatch
QSCRIPTTEMPLATE=$SCRIPTDIR/qscript.template
QSCRIPTGEN=qscript.pl
OPENDAPPOST=opendap_post.sh #<~ $SCRIPTDIR/output/ assumed
if [[ ${RMQMessaging_Enable} == "on" ]]; then
RMQMessaging_LocationName="LONI"
RMQMessaging_ClusterName="QueenbeeC"
RMQMessaging_NcoHome=$WORK/local
fi
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=$SCRATCH
ARCHIVEDIR=$SCRATCH
TDS=( lsu_tds )
MAKEJOBS=8
}
init_hatteras()
{ #<- can replace the following with a custom script
local THIS="platforms.sh>env_dispatch()>init_hatteras()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=hatteras.renci.org
QUEUESYS=SLURM
QUEUENAME=batch # <---<< PARTITION synonym on slurm
SERQUEUE=batch
PPN=null
CONSTRAINT=null # ivybridge or sandybridge
RESERVATION=null # ncfs or null, causes job to run on dedicated cores
PARTITION=null
QCHECKCMD=sacct
JOBLAUNCHER='srun '
ACCOUNT=null
SUBMITSTRING=sbatch
SCRATCH=/projects/ncfs/data
SSHKEY=~/.ssh/id_rsa.pub
QSCRIPTTEMPLATE=$SCRIPTDIR/qscript.template
QSCRIPTGEN=qscript.pl
OPENDAPPOST=opendap_post.sh #<~ $SCRIPTDIR/output/ assumed
WALLTIMEFORMAT="minutes"
QSUMMARYCMD=null
QUOTACHECKCMD="df -h /projects/ncfs"
ALLOCCHECKCMD=null
TDS=( renci_tds )
#
MATLABEXE=script # "script" means just execute matlab (don't use mex files)
#
RMQMessaging_Enable="on" # "on"|"off"
RMQMessaging_Transmit="on" # enables message transmission ("on" | "off")
RMQMessaging_NcoHome="/home/ncfs"
RMQMessaging_LocationName="RENCI"
RMQMessaging_ClusterName="Hatteras"
#
# specify location of platform- and Operator-specific scripts to
# set up environment for different types of jobs
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=$SCRATCH
ARCHIVEDIR=$SCRATCH
MAKEJOBS=8
}
#
init_frontera()
{ #<- can replace the following with a custom script
local THIS="platforms.sh>env_dispatch()>init_frontera()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=frontera.tacc.utexas.edu
QUEUESYS=SLURM
QUEUENAME=normal
SERQUEUE=small
PPN=56 # if this changes, also need to change the "small" queue defn in asgs_main.sh
CONSTRAINT=null
RESERVATION=null
QOS=null
QCHECKCMD=sacct
JOBLAUNCHER='ibrun '
ACCOUNT=null
SUBMITSTRING=sbatch
SSHKEY=~/.ssh/id_rsa_frontera
QSCRIPTTEMPLATE=$SCRIPTDIR/qscript.template
QSCRIPTGEN=qscript.pl
OPENDAPPOST=opendap_post.sh #<~ $SCRIPTDIR/output/ assumed
GROUP="G-803086"
QSUMMARYCMD=null
QUOTACHECKCMD=null
ALLOCCHECKCMD=null
#
if [[ ${RMQMessaging_Enable} == "on" ]]; then
RMQMessaging_LocationName="TACC"
RMQMessaging_ClusterName="Frontera"
RMQMessaging_NcoHome=$WORK/local
fi
MATLABEXE=script # "script" means just execute matlab (don't use mex files)
# specify location of platform- and Operator-specific scripts to
# set up environment for different types of jobs
local THIS="platforms.sh>env_dispatch()>init_frontera()"
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=/corral-tacc/utexas/hurricane/ASGS
ARCHIVEDIR=2020 # is this used?
TDS=( tacc_tds )
MAKEJOBS=8
}
#
init_stampede2()
{ #<- can replace the following with a custom script
local THIS="platforms.sh>env_dispatch()>init_stampede2()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=stampede2.tacc.utexas.edu
QUEUESYS=SLURM
QUEUENAME=skx-normal # same as SLURM partition
SERQUEUE=skx-normal
PPN=48
CONSTRAINT=null
RESERVATION=null
QOS=null
QCHECKCMD=sacct
JOBLAUNCHER='ibrun '
ACCOUNT=null
SUBMITSTRING=sbatch
SSHKEY=~/.ssh/id_rsa_stampede2
QSCRIPTTEMPLATE=$SCRIPTDIR/qscript.template
QSCRIPTGEN=qscript.pl
OPENDAPPOST=opendap_post.sh #<~ $SCRIPTDIR/output/ assumed
GROUP="G-803086"
QSUMMARYCMD=null
QUOTACHECKCMD=null
ALLOCCHECKCMD=null
if [[ ${RMQMessaging_Enable} == "on" ]]; then
RMQMessaging_LocationName="TACC"
RMQMessaging_ClusterName="Stampede2"
RMQMessaging_NcoHome=$WORK/local
fi
local THIS="platforms.sh>env_dispatch()>init_stampede2()"
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=/corral-tacc/utexas/hurricane/ASGS
ARCHIVEDIR=2020
TDS=( tacc_tds )
MAKEJOBS=8
}
#
init_lonestar5()
{ #<- can replace the following with a custom script
local THIS="platforms.sh>env_dispatch()>init_lonestar5()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=lonestar5.tacc.utexas.edu
QUEUESYS=SLURM
QUEUENAME=normal # same as SLURM partition
SERQUEUE=normal
CONSTRAINT=null
RESERVATION=null
QCHECKCMD=squeue
JOBLAUNCHER='ibrun '
ACCOUNT=null
PPN=24
SUBMITSTRING=sbatch
SSHKEY=id_rsa_lonestar5
QSCRIPTTEMPLATE=$SCRIPTDIR/qscript.template
QSCRIPTGEN=qscript.pl
OPENDAPPOST=opendap_post.sh #<~ $SCRIPTDIR/output/ assumed
UMASK=006
GROUP="G-803086"
QSUMMARYCMD=null
QUOTACHECKCMD=null
ALLOCCHECKCMD=null
# matlab
MATLABEXE=script # "script" means just execute matlab (don't use mex files)
#
if [[ ${RMQMessaging_Enable} == "on" ]]; then
RMQMessaging_LocationName="TACC"
RMQMessaging_ClusterName="Lonestar5"
RMQMessaging_NcoHome=$WORK/local
fi
local THIS="platforms.sh>env_dispatch()>init_lonestar5()"
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=/corral-tacc/utexas/hurricane/ASGS
ARCHIVEDIR=2020
TDS=(tacc_tds)
MAKEJOBS=8
}
# docker bootstrap
init_docker()
{
local THIS="platforms.sh>env_dispatch()>init_docker()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=docker.local
QUEUESYS=mpiexec
QCHECKCMD="ps -aux | grep mpiexec "
SUBMITSTRING="mpiexec "
SCRATCH=${SCRATCH:-/scratch/$USER}
SSHKEY=id_rsa_docker
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=$SCRATCH
ARCHIVEDIR=$SCRATCH
TDS=()
MAKEJOBS=2
}
# placeholder for vagrant bootstrap
init_vagrant() {
MAKEJOBS=2
}
init_desktop()
{
local THIS="platforms.sh>env_dispatch()>init_desktop()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=jason-desktop.seahorsecoastal.com
QUEUESYS=mpiexec
QUEUENAME=mpiexec
SERQUEUE=cmd
QCHECKCMD="ps -aux | grep mpiexec "
SUBMITSTRING="mpiexec "
SCRATCH=/srv/asgs
SSHKEY=id_rsa_jason-desktop
ADCOPTIONS='compiler=gfortran MACHINENAME=jason-desktop'
SWANMACROSINC=macros.inc.gfortran
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=$SCRATCH
ARCHIVEDIR=$SCRATCH
TDS=()
MAKEJOBS=1
}
init_desktop_serial() # changed from init_desktop-serial due to bash complaints
{
local THIS="platforms.sh>env_dispatch()>init_desktop-serial()"
scenarioMessage "$THIS: Setting platforms-specific parameters."
HPCENV=jason-desktop-serial
QUEUESYS=serial
QCHECKCMD="ps -aux | grep adcirc "
SUBMITSTRING="./"
SCRATCH=/srv/asgs
SSHKEY=id_rsa_jason-desktop-serial
ADCOPTIONS='compiler=gfortran MACHINENAME=jason-desktop-serial'
SWANMACROSINC=macros.inc.gfortran
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=$SCRATCH
ARCHIVEDIR=$SCRATCH
TDS=(renci_tds)
MAKEJOBS=1
}
init_Poseidon()
{
HPCENV=poseidon.vsnet.gmu.edu
QUEUESYS=mpiexec
QCHECKCMD="ps -aux | grep mpiexec "
SUBMITSTRING="mpiexec -n"
SCRATCH=/home/fhrl/Documents/asgs_processing
SSHKEY=id_rsa_jason-desktop
ADCOPTIONS='compiler=gfortran MACHINENAME=jason-desktop'
SWANMACROSINC=macros.inc.gfortran
ARCHIVE=enstorm_pedir_removal.sh
ARCHIVEBASE=$SCRATCH
ARCHIVEDIR=$SCRATCH
MAKEJOBS=1
}
init_test()
{ #<- can replace the following with a custom script
QUEUESYS=Test
NCPU=-1
MAKEJOBS=1
}
#
# Writes properties related to the combination of the HPC platform, the Operator,
# and the THREDDS data server the results are to be posted to.
writeTDSProperties()
{
local THIS="platforms.sh>writeTDSProperties()"
SERVER=$1
RUNPROPERTIES=run.properties
if [[ $# -eq 2 ]]; then
RUNPROPERTIES=$2
fi
scenarioMessage "$THIS: Setting platforms-specific parameters for ${SERVER}."
operator=$USER
CATALOGPREFIX="" # after thredds/catalog
DOWNLOADPREFIX="" # after thredds/fileServer
case $SERVER in
"renci_tds")
THREDDSHOST=tds.renci.org # WWW hostname for emailed links
OPENDAPHOST=renci_tds # alias in $HOME/.ssh/config
OPENDAPPORT=":80"
OPENDAPPROTOCOL="http"
OPENDAPBASEDIR=/projects/ncfs/opendap/data
echo "post.opendap.${SERVER}.linkablehosts : ( null )" >> $RUNPROPERTIES
echo "post.opendap.${SERVER}.copyablehosts : ( hatteras )" >> $RUNPROPERTIES
;;
# THREDDS Data Server (TDS, i.e., OPeNDAP server) at LSU
"lsu_tds")
THREDDSHOST=fortytwo.cct.lsu.edu
OPENDAPHOST=lsu_tds
OPENDAPPORT=":443"
OPENDAPPROTOCOL="https"
OPENDAPBASEDIR=/data/opendap
echo "post.opendap.${SERVER}.linkablehosts : ( null )" >> $RUNPROPERTIES
echo "post.opendap.${SERVER}.copyablehosts : ( null )" >> $RUNPROPERTIES
;;
# THREDDS Data Server (TDS, i.e., OPeNDAP server) at LSU Center for Coastal Resiliency
"lsu_ccr_tds")
THREDDSHOST=chenier.cct.lsu.edu # WWW hostname for emailed links
OPENDAPHOST=lsu_ccr_tds # alias in $HOME/.ssh/config
OPENDAPPORT=":8080"
OPENDAPPROTOCOL="http"
CATALOGPREFIX=/asgs/ASGS-2019
DOWNLOADPREFIX=/asgs/ASGS-2019
OPENDAPBASEDIR=/data/thredds/ASGS/ASGS-2019
echo "post.opendap.${SERVER}.linkablehosts : ( null )" >> $RUNPROPERTIES
echo "post.opendap.${SERVER}.copyablehosts : ( null )" >> $RUNPROPERTIES
;;
#
# THREDDS Data Server (TDS, i.e., OPeNDAP server) at Texas
# Advanced Computing Center (TACC)
"tacc_tds")
THREDDSHOST=adcircvis.tacc.utexas.edu # WWW hostname for emailed links
OPENDAPHOST=tacc_tds # alias in $HOME/.ssh/config
OPENDAPPORT=":8080"
OPENDAPPROTOCOL="http"
DOWNLOADPREFIX=/asgs
CATALOGPREFIX=/asgs
OPENDAPBASEDIR=/corral-tacc/utexas/hurricane/ASGS
echo "post.opendap.${SERVER}.linkablehosts : ( null )" >> $RUNPROPERTIES
echo "post.opendap.${SERVER}.copyablehosts : ( lonestar5 stampede2 frontera )" >> $RUNPROPERTIES
;;
"tacc_tds2")
THREDDSHOST=chg-1.oden.tacc.utexas.edu # WWW hostname for emailed links
OPENDAPHOST=tacc_tds2 # alias in $HOME/.ssh/config
OPENDAPPORT=":80" # ':80' can be an empty string, but for clarity it's here
OPENDAPPROTOCOL="http"
DOWNLOADPREFIX=/asgs
CATALOGPREFIX=/asgs
OPENDAPBASEDIR=/corral-tacc/utexas/hurricane/ASGS
echo "post.opendap.${SERVER}.linkablehosts : ( null )" >> $RUNPROPERTIES
echo "post.opendap.${SERVER}.copyablehosts : ( lonestar5 stampede2 frontera )" >> $RUNPROPERTIES
;;
*)
echo "$THIS: ERROR: THREDDS Data Server $SERVER was not recognized."
esac
# now write properties
echo "post.opendap.${SERVER}.opendaphost : $OPENDAPHOST" >> $RUNPROPERTIES
echo "post.opendap.${SERVER}.threddshost : $THREDDSHOST" >> $RUNPROPERTIES
echo "post.opendap.${SERVER}.downloadprefix : $OPENDAPPROTOCOL://$THREDDSHOST$OPENDAPPORT/thredds/fileServer$DOWNLOADPREFIX" >> $RUNPROPERTIES
echo "post.opendap.${SERVER}.catalogprefix : $OPENDAPPROTOCOL://$THREDDSHOST$OPENDAPPORT/thredds/catalog$CATALOGPREFIX" >> $RUNPROPERTIES
echo "post.opendap.${SERVER}.opendapbasedir : $OPENDAPBASEDIR" >> $RUNPROPERTIES
# if the Operator has an asgs-global.conf file, assume that a perl mail client capability is
# set up and ready to use
echo "notification.opendap.email.opendapmailserver : aws" >> $RUNPROPERTIES
}
#
# set the values of HPCENV and HPCENVSHORT
set_hpc() {
local THIS="platforms.sh>set_hpc()"
echo "$THIS: Setting the values of HPCENV and HPCENVSHORT."
fqdn=$(hostname --long)
echo "$THIS: The fully qualified domain name is ${fqdn}."
HPCENV=null
HPCENVSHORT=null
if [[ ${fqdn:(-25)} = "stampede2.tacc.utexas.edu" ]]; then
HPCENV=${fqdn:(-25)}
HPCENVSHORT=stampede2
return
fi
if [[ ${fqdn:(-19)} = "ls5.tacc.utexas.edu" ]]; then
HPCENV=lonestar5.tacc.utexas.edu
HPCENVSHORT=lonestar5
return
fi
if [[ ${fqdn:(-24)} = "frontera.tacc.utexas.edu" ]]; then
HPCENV=frontera.tacc.utexas.edu
HPCENVSHORT=frontera
return
fi
if [ 1 -eq $(hostname --fqdn | grep -c qb1) ]; then
HPCENV=queenbee.loni.org
HPCENVSHORT=queenbee
fi
if [ 1 -eq $(hostname --fqdn | grep -c qb2) ]; then
HPCENV=queenbee.loni.org
HPCENVSHORT=queenbee
fi
if [ 1 -eq $(hostname --fqdn | grep -c qbc) ]; then
HPCENV=qbc.loni.org
HPCENVSHORT=queenbeeC
fi
if [[ ${fqdn:0:4} == "smic" ]]; then
HPCENV=supermic.hpc.lsu.edu
HPCENVSHORT=supermic
fi
if [[ ${fqdn:0:2} == "ht" ]]; then
HPCENV=hatteras.renci.org
HPCENVSHORT=hatteras
fi
if [[ ${fqdn:0:5} == "jason" ]]; then
HPCENV=desktop.seahorsecoastal.com
HPCENVSHORT=desktop
fi
if [ 1 -eq $(hostname --fqdn | grep -c soldier) ]; then
HPCENV=soldier.seahorsecoastal.com
HPCENVSHORT=desktop
fi
if [[ "${ASGS_MACHINE_NAME}" = "docker" ]]; then
HPCENV=docker.local
HPCENVSHORT=docker
fi
# this whole function will be replaced with guess, but for now ...
if [[ $HPCENVSHORT = "null" ]]; then
plat=$($SCRIPTDIR/bin/guess platform)
HPCENVSHORT=$plat
HPCENV=$plat
fi
echo "$THIS: The value of HPCENV is ${HPCENV}."
echo "$THIS: The value of HPCENVSHORT is ${HPCENVSHORT}."
}
# general init function for platforms defined using the
# the init script as the first argument
init_platform()
{
local INIT=${1:-"$PLATFORM_INIT"}
if [ -z "${INIT}" ]; then
echo "(warn !!!) platform init script must be specified as the first argument! No platform init.sh known."
return
fi
if [ ! -e "${INIT}" ]; then
echo "(warn !!!) Can't find init script, '$INIT'! No platform selected."
return
fi
printf "... attempting to load '$INIT' ... "
source $INIT
if [ $? -eq 0 ]; then
printf "OK\n"
else
echo
echo "(warn !!!) Failed to load '$INIT'! No platform selected."
fi
return
}
#
# used to dispatch environmentally sensitive actions
env_dispatch() {
HPCENVSHORT=$1
local THIS="platforms.sh>env_dispatch()"
scenarioMessage "$THIS: Initializing settings for ${HPCENVSHORT}."
echo "(info) $THIS: Initializing settings for ${HPCENVSHORT}."
case $HPCENVSHORT in
"hatteras") allMessage "$THIS: Hatteras (RENCI) configuration found."
init_hatteras
;;
"queenbee") allMessage "$THIS: Queenbee (LONI) configuration found."
init_queenbee
;;
"supermic") allMessage "$THIS: SuperMIC (LSU HPC) configuration found."
init_supermic
;;
"queenbeeC") allMessage "$THIS: QueenbeeC (LONI) configuration found."
init_queenbeeC
;;
"lonestar5") allMessage "$THIS: Lonestar (TACC) configuration found."
init_lonestar5
;;
"stampede2") allMessage "$THIS: Stampede2 (TACC) configuration found."
init_stampede2
;;
"frontera") allMessage "$THIS: Frontera (TACC) configuration found."
init_frontera
;;
"desktop") allMessage "$THIS: desktop configuration found."
init_desktop
;;
"desktop-serial") consoleMessage "$THIS: desktop-serial configuration found."
init_desktop-serial
;;
"docker") allMessage "$THIS: docker configuration found."
init_docker
;;
"poseidon") allMessage "$THIS: Poseidon configuration found."
init_Poseidon
;;
"vagrant") allMessage "$THIS: vagrant configuration found."
init_vagrant
;;
"docker") allMessage "$THIS: docker configuration found."
init_docker
;;
"test") allMessage "$THIS: test environment (default) configuration found."
init_test
;;
*) # fallback for new method of initializing a platform
init_platform
;;
esac
# support arbitrarily $USER customizations after platforms.sh has been utilized
# this file will also be replacing config/operator_defaults.sh in the near future
if [ -e $HOME/.asgsh_profile ]; then
source $HOME/.asgsh_profile
fi
}
# This bash function uses:
# * local variables
# * doesn't affect environmenta "by reference" (implicitly)
# * echo's "return" so it can be captured by called using $() syntax
# e.g.,
# QUEUENAME=$(HPCQueueHints "$QUEUENAME" "$HPCENV" "$QOS" "$CPUREQUEST")
HPC_Queue_Hint()
{
# default, returned if conditions not met
local DEFAULT_QUEUENAME=$1
local HPCENV=$2
local QOS=$3
local CPUREQUEST=$4
case "$HPCENV" in
"frontera.tacc.utexas.edu")
# on frontera, if a job uses only 1 or 2 nodes, it must be submitted to the
# "small" queue ... this includes wind-only parallel jobs ... the PPN
# for frontera is 56, so this hack would have to be updated if that changes
if [[ $CPUREQUEST -eq 1 ]]; then
echo "small"
elif [[ $CPUREQUEST -le 112 ]]; then
echo "small"
else
echo $DEFAULT_QUEUENAME
fi
;;
"qbc.loni.org")
if [[ $CPUREQUEST -eq 1 ]]; then
echo "single"
elif [[ $CPUREQUEST -le 48 ]]; then
echo "single"
else
echo $DEFAULT_QUEUENAME
fi
;;
*)
echo $DEFAULT_QUEUENAME
;;
esac
}
# encapsulated potentially hairy logic for adjusting PPN for
# certain platforms and based on more than one variable
HPC_PPN_Hint()
{
local QUEUEKIND=$1
local QUEUENAME=$2
local HPCENV=$3
local QOS=$4
local DEFAULT_PPN=$5 # default, returned if conditions not met
case "$HPCENV" in
"supermic.hpc.lsu.edu")
if [[ "$QUEUENAME" == "priority" && "$QUEUEKIND" == "serial" ]]; then
echo 20
else
echo $DEFAULT_PPN
fi
;;
"queenbee.loni.org")
if [[ "$QUEUENAME" == "priority" && "$QUEUEKIND" == "serial" ]]; then
echo 20
else
echo $DEFAULT_PPN
fi
;;
*)
echo $DEFAULT_PPN
;;
esac
}
# This bash function uses:
# * local variables
# * doesn't affect environments "by reference" (implicitly)
# * echo's "return" so it can be captured by called using $() syntax
# e.g.,
# RESERVATION=$(HPC_Reservation_Hint "$RESERVATION" "$HPCENV" "$QOS" "$CPUREQUEST")
HPC_Reservation_Hint()
{
# default, returned if conditions not met
local DEFAULT_RESERVATION=$1
local HPCENV=$2
local QOS=$3
local CPUREQUEST=$4
case "$HPCENV" in
"frontera.tacc.utexas.edu")
# on frontera, if a job uses only 1 or 2 nodes, it must be submitted to the
# "small" queue ... this includes wind-only parallel jobs ... the PPN
# for frontera is 56, so this hack would have to be updated if that changes
# ... a reservation on Frontera that was created for parallel jobs will
# not work on the "small" queue i.e., jobs (whether serial or parallel)
# that use only 1 or 2 compute nodes
if [[ $CPUREQUEST -eq 1 ]]; then
echo "null"
elif [[ $CPUREQUEST -le 112 ]]; then
echo "null"
else
echo $DEFAULT_RESERVATION # this is the reservation created by TACC for the Operator to use for parallel jobs
fi
;;
*)
echo $DEFAULT_RESERVATION
;;
esac
}