Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support NAS site #706

Merged
merged 6 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions src/Applications/LDAS_App/ldas_setup
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ class LDASsetup:

# if built on sles15, BUILT_ON_SLES15 is "TRUE", else empty ""
BUILT_ON_SLES15 = "@BUILT_ON_SLES15@"

if BUILT_ON_SLES15 == "TRUE":
self.BUILT_ON_SLES15 = True
else:
self.BUILT_ON_SLES15 = False

self.GEOS_SITE = "@GEOS_SITE@"

# ------
# Required resource manager input fields
# ------
Expand Down Expand Up @@ -853,7 +854,6 @@ class LDASsetup:

config['slurm']['account'] = self.rqdRmInp['account']
config['slurm']['qos'] = 'debug'
config['slurm']['qos'] = 'cas'

config['input']['surface']['catch_tilefile'] = self.in_tilefile
config['input']['shared']['expid'] = self.rqdExeInp['RESTART_ID']
Expand Down Expand Up @@ -1250,8 +1250,11 @@ class LDASsetup:
fout =open(self.rundir+'/ldas_batchrun.j','w')
fout.write("#!/bin/bash -f\n")
jobid = None
SBATCHQSUB = 'sbatch'
expid = self.rqdExeInp['EXP_ID']
fout.write("\nsed -i 's/if($capdate<$enddate) sbatch /#if($capdate<$enddate) sbatch /g' lenkf.j\n\n")
if self.GEOS_SITE == 'NAS':
SBATCHQSUB = 'qsub'
fout.write("\nsed -i 's/if($capdate<$enddate) "//SBATCHQSUB//" /#if($capdate<$enddate) qsub /g' lenkf.j\n\n")
weiyuan-jiang marked this conversation as resolved.
Show resolved Hide resolved
nSegments = self.nSegments
for iseg in range(nSegments):
if iseg ==0 :
Expand Down Expand Up @@ -1304,6 +1307,7 @@ class LDASsetup:
shutil.copy(lenkf,'lenkf.j')

my_qos='allnccs'
if self.GEOS_SITE == 'NAS': my_qos = 'normal'
if 'qos' in self.optRmInp :
my_qos = self.optRmInp['qos']

Expand Down Expand Up @@ -1338,26 +1342,40 @@ class LDASsetup:
with open(lenkf,'rt') as fin:
with open('lenkf.j','wt') as fout :
for line in fin :
if self.GEOS_SITE == 'NAS':
if '#SBATCH' in line:
continue
if 'sbatch $HOMDIR/lenkf.j' in line:
continue

if self.GEOS_SITE == 'NCCS':
if '#PBS' in line:
continue
if 'qsub $HOMDIR/lenkf.j' in line:
continue

if 'MY_ACCOUNT' in line :
fout.write(line.replace('MY_ACCOUNT',self.rqdRmInp['account']))
elif 'MY_WALLTIME' in line :
fout.write(line.replace('MY_WALLTIME',self.rqdRmInp['walltime']))
elif 'MY_NODES' in line :
line_ = line.replace('MY_NODES',str(self.optRmInp['nodes']))
fout.write(line_.replace('MY_NTASKS_PER_NODE',str(self.rqdRmInp['ntasks-per-node'])))

if self.BUILT_ON_SLES15 :
fout.write("#SBATCH --constraint=mil\n")
else:
assert int(self.rqdRmInp['ntasks-per-node']) <= 46, 'ntasks-per-node should be <=46 for cas'
fout.write("#SBATCH --constraint=cas\n")
line_ = line_.replace('MY_NTASKS_PER_NODE',str(self.rqdRmInp['ntasks-per-node']))
line_ = line_.replace('MY_CONSTRAINT', 'cas_ait')
fout.write(line_)
if self.GEOS_SITE == "NCCS" :
if self.BUILT_ON_SLES15 :
fout.write("#SBATCH --constraint=mil\n")
else:
assert int(self.rqdRmInp['ntasks-per-node']) <= 46, 'ntasks-per-node should be <=46 for cas'
fout.write("#SBATCH --constraint=cas\n")

elif 'MY_OSERVER_NODES' in line :
fout.write(line.replace('MY_OSERVER_NODES',str(self.optRmInp['oserver_nodes'])))
elif 'MY_WRITERS_NPES' in line :
fout.write(line.replace('MY_WRITERS_NPES', str(self.optRmInp['writers-per-node'])))
elif 'MY_QOS' in line :
if 'allnccs' not in my_qos:
if 'allnccs' not in my_qos or 'normal' not in my_qos:
fout.write(line.replace('MY_QOS',my_qos))
elif 'MY_JOB' in line :
fout.write(line.replace('MY_JOB',my_job))
Expand Down
10 changes: 10 additions & 0 deletions src/Applications/LDAS_App/lenkf.j.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
#SBATCH --job-name=MY_JOB
#SBATCH --qos=MY_QOS

#PBS -l walltime=MY_WALLTIME
#PBS -l select=MY_NODES:ncpus=40:mpiprocs=40:model=MY_CONSTRAINT
#PBS -N MY_JOB
#PBS -q MY_QOS
#PBS -W group_list=MY_ACCOUNT
#PBS -o ../scratch/GEOSldas_log_txt
#PBS -e ../scratch/GEOSldas_err_txt
#PBS -j oe

#######################################################################
# System Settings and Architecture Specific Environment Variables
#######################################################################
Expand Down Expand Up @@ -831,5 +840,6 @@ else
cd $HOMDIR
#don't change below line(not even extra space)
if($capdate<$enddate) sbatch $HOMDIR/lenkf.j
if($capdate<$enddate) qsub $HOMDIR/lenkf.j
endif
endif