Skip to content

Commit 5c9ec64

Browse files
committed
Update shell scripts for better spack integration
1 parent e967a6f commit 5c9ec64

File tree

2 files changed

+45
-27
lines changed

2 files changed

+45
-27
lines changed

scripts/fv3.j

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ set RUN_CMD = "$GEOSBIN/esma_mpirun -np "
132132

133133
setenv ARCH `uname`
134134
source $GEOSBIN/g5_modules
135-
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${BASEDIR}/${ARCH}/lib:${GEOSDIR}/lib
135+
setenv @LD_LIBRARY_PATH_CMD ${LD_LIBRARY_PATH}:${GEOSDIR}/lib
136+
# We only add BASEDIR to the @LD_LIBRARY_PATH_CMD if BASEDIR is defined (i.e., not running with Spack)
137+
if ( $?BASEDIR ) then
138+
setenv @LD_LIBRARY_PATH_CMD ${@LD_LIBRARY_PATH_CMD}:${BASEDIR}/${ARCH}/lib
139+
endif
136140
module list
137141

138142
#########################################

scripts/fv3_setup

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,16 @@ setenv NODE `uname -n`
3838

3939
if ($ARCH == Darwin) then
4040
set FINDPATH = realpath
41+
set PRELOAD_COMMAND = 'DYLD_INSERT_LIBRARIES'
42+
set LD_LIBRARY_PATH_CMD = 'DYLD_LIBRARY_PATH'
43+
# On macOS we seem to need to call mpirun directly and not use esma_mpirun
44+
# For some reason SIP does not let the libraries be preloaded
45+
set RUN_CMD = 'mpirun -np '
4146
else
4247
set FINDPATH = 'readlink -f'
48+
set PRELOAD_COMMAND = 'LD_PRELOAD'
49+
set LD_LIBRARY_PATH_CMD = 'LD_LIBRARY_PATH'
50+
set RUN_CMD = '$GEOSBIN/esma_mpirun -np '
4351
endif
4452
set FV3SETUP = `$FINDPATH $0`
4553
set BINDIR = `dirname $FV3SETUP`
@@ -64,9 +72,11 @@ endif
6472
# path to the sandbox. If we are not, then we set it to an empty
6573
# string.
6674
#
67-
# We also set the REAL_BIND_PATH environment variable. This is used
68-
# to set the bind paths for Singularity runs. REAL_BIND_PATH is the
69-
# physical path to the NOBACKUP directory
75+
# We also set the REAL_BIND_PATH and BASE_BIND_PATH environment
76+
# variables. These are used to set the bind paths for Singularity
77+
# runs. REAL_BIND_PATH is the physical path to the NOBACKUP directory
78+
# and BASE_BIND_PATH is the physical path to the /gpfsm directory
79+
# (needed for boundary conditions)
7080

7181
setenv KEYFILE ".singularity.d"
7282
setenv singstat 0
@@ -85,34 +95,25 @@ while ($singstat == 0)
8595
endif
8696
endif
8797
end
88-
8998
if ($singstat == 1) then
9099
setenv SINGULARITY_SANDBOX $SINGPATH
91100
setenv REAL_BIND_PATH `realpath $NOBACKUP`
92-
93-
set USING_SINGULARITY = TRUE
94-
set SINGULARITY_BUILD = ""
95-
set NATIVE_BUILD = "#DELETE"
101+
setenv BASE_BIND_PATH "/gpfsm"
96102
else
97103
setenv SINGULARITY_SANDBOX ""
98104
setenv REAL_BIND_PATH ""
99-
100-
set USING_SINGULARITY = FALSE
101-
set SINGULARITY_BUILD = "#DELETE"
102-
set NATIVE_BUILD = ""
105+
setenv BASE_BIND_PATH ""
103106
endif
104107

105108
cd $ORIGPATH
106109

107-
# Set TMPDIR to /tmp due to issues with heredocs in Singularity sandboxes
108-
# -----------------------------------------------------------------------
109-
110-
setenv TMPDIR /tmp
111-
112110
#######################################################################
113111
# Test for Command Line Flags
114112
#######################################################################
115113

114+
# Set default behavior of switches
115+
set LINKX = FALSE
116+
set EXE_VERB = "copied"
116117
set SINGULARITY_RUN_SITE = ""
117118
if ($singstat == 1) then
118119
set USING_SINGULARITY = TRUE
@@ -131,6 +132,7 @@ if ($singstat == 1) then
131132
else
132133
set USING_SINGULARITY = FALSE
133134
endif
135+
134136
while ( $#argv > 0 )
135137
set arg = $argv[1]
136138
shift argv
@@ -140,6 +142,17 @@ while ( $#argv > 0 )
140142
case --[Cc][Oo][Ll][Oo][Rr]:
141143
goto SETCOLOR
142144

145+
# Symlink StandAlone_FV3_Dycore.x
146+
case --link:
147+
set LINKX = TRUE
148+
set EXE_VERB = "linked"
149+
breaksw
150+
151+
# Avoid Symlink StandAlone_FV3_Dycore.x
152+
case --nolink:
153+
set LINKX = FALSE
154+
breaksw
155+
143156
# Here any string not above will trigger USAGE
144157
case -[Hh]:
145158
case --[Hh][Ee][Ll][Pp]:
@@ -342,6 +355,7 @@ else if ( $SITE == 'NAS' ) then
342355
echo " ${C2}sky (Skylake)${CN} (default)"
343356
echo " ${C2}cas (Cascade Lake)${CN}"
344357
echo " ${C2}rom (AMD Rome)${CN}"
358+
echo " ${C2}mil (AMD Milan)${CN}"
345359
echo " "
346360
echo " NOTE Due to how FV3 is compiled by default, Sandy Bridge"
347361
echo " and Ivy Bridge are not supported by current GEOS"
@@ -356,7 +370,8 @@ else if ( $SITE == 'NAS' ) then
356370
$MODEL != 'bro' & \
357371
$MODEL != 'sky' & \
358372
$MODEL != 'cas' & \
359-
$MODEL != 'rom' ) goto ASKPROC
373+
$MODEL != 'rom' & \
374+
$MODEL != 'mil' ) goto ASKPROC
360375

361376
# Some processors have weird names at NAS
362377
# ---------------------------------------
@@ -367,13 +382,11 @@ else if ( $SITE == 'NAS' ) then
367382
set MODEL = 'cas_ait'
368383
else if ($MODEL == rom) then
369384
set MODEL = 'rom_ait'
385+
else if ($MODEL == mil) then
386+
set MODEL = 'mil_ait'
370387
endif
371388

372-
if ( $MODEL == 'san') then
373-
set NCPUS_PER_NODE = 16
374-
else if ($MODEL == 'ivy') then
375-
set NCPUS_PER_NODE = 20
376-
else if ($MODEL == 'has') then
389+
if ($MODEL == 'has') then
377390
set NCPUS_PER_NODE = 24
378391
else if ($MODEL == 'bro') then
379392
set NCPUS_PER_NODE = 28
@@ -383,6 +396,8 @@ else if ( $SITE == 'NAS' ) then
383396
set NCPUS_PER_NODE = 40
384397
else if ($MODEL == 'rom_ait') then
385398
set NCPUS_PER_NODE = 128
399+
else if ($MODEL == 'mil_ait') then
400+
set NCPUS_PER_NODE = 128
386401
endif
387402

388403
else if( $SITE == 'AWS' | $SITE == 'Azure' ) then
@@ -780,7 +795,6 @@ EOF
780795
else if( $MPI_STACK == intelmpi ) then
781796

782797
cat > $EXPDIR/SETENV.commands << EOF
783-
#setenv MPS_STAT_LEVEL 4
784798
setenv I_MPI_ADJUST_ALLREDUCE 12
785799
setenv I_MPI_ADJUST_GATHERV 3
786800
@@ -798,8 +812,8 @@ setenv I_MPI_SHM_HEAP_VSIZE 512
798812
setenv PSM2_MEMORY large
799813
EOF
800814

801-
#Testing at NCCS showed these caused crash at higher res
802-
#Crashed at restart read
815+
# Testing at NCCS showed these caused a crash at higher resolutions at
816+
# restart read
803817
if ( $USING_SINGULARITY == FALSE ) then
804818

805819
cat >> $EXPDIR/SETENV.commands << EOF

0 commit comments

Comments
 (0)