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

Fix branch runs with run_acme #1594

Merged
merged 3 commits into from
Jun 26, 2017
Merged
Changes from 2 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
25 changes: 17 additions & 8 deletions run_acme.template.csh
Original file line number Diff line number Diff line change
Expand Up @@ -1001,20 +1001,23 @@ endif

mkdir -p batch_output ### Make directory that stdout and stderr will go into.

set batch_options = ''

set machine = `lowercase $machine` # Change to lowercase, just to make the following easier to read.

if ( $machine == hopper ) then
# TODO: Pass the correct options to the queue through batch_options
set batch_options = ""
sed -i /"#PBS \( \)*-N"/c"#PBS -N ${job_name}" ${case_run_exe}
sed -i /"#PBS \( \)*-j oe"/a'#PBS -o batch_output/${PBS_JOBNAME}.o${PBS_JOBID}' ${case_run_exe}

sed -i /"#PBS \( \)*-N"/c"#PBS -N ST+${job_name}" $shortterm_archive_script
sed -i /"#PBS \( \)*-j oe"/a'#PBS -o batch_output/${PBS_JOBNAME}.o${PBS_JOBID}' $shortterm_archive_script
sed -i /"#PBS \( \)*-N"/c"#PBS -N LT+${job_name}" $longterm_archive_script
sed -i /"#PBS \( \)*-j oe"/a'#PBS -o batch_output/${PBS_JOBNAME}.o${PBS_JOBID}' $longterm_archive_script

else if ( $machine == cori || $machine == edison ) then
sed -i /"#SBATCH \( \)*--job-name"/c"#SBATCH --job-name=${job_name}" ${case_run_exe}
sed -i /"#SBATCH \( \)*--job-name"/a"#SBATCH --account=${project}" ${case_run_exe}
sed -i /"#SBATCH \( \)*--output"/c"#SBATCH --output=batch_output/"${case_name}'.o%j' ${case_run_exe}
set batch_options = "--job-name=${job_name} --output=batch_output/${case_name}.o%j"

sed -i /"#SBATCH \( \)*--job-name"/c"#SBATCH --job-name=ST+${job_name}" $shortterm_archive_script
sed -i /"#SBATCH \( \)*--job-name"/a"#SBATCH --account=${project}" $shortterm_archive_script
Expand All @@ -1024,6 +1027,7 @@ else if ( $machine == cori || $machine == edison ) then
sed -i /"#SBATCH \( \)*--output"/c'#SBATCH --output=batch_output/LT+'${case_name}'.o%j' $longterm_archive_script

else if ( $machine == titan || $machine == eos ) then
set batch_options = ""
sed -i /"#PBS \( \)*-N"/c"#PBS -N ${job_name}" ${case_run_exe}
sed -i /"#PBS \( \)*-A"/c"#PBS -A ${project}" ${case_run_exe}
sed -i /"#PBS \( \)*-j oe"/a'#PBS -o batch_output/${PBS_JOBNAME}.o${PBS_JOBID}' ${case_run_exe}
Expand All @@ -1038,6 +1042,8 @@ else
acme_print ' Assuming default ACME values.'
endif

acme_print "Batch options: ${batch_options}"

#============================================
# QUEUE OPTIONS
#============================================
Expand Down Expand Up @@ -1153,6 +1159,7 @@ else if ( $model_start_type == 'branch' ) then
acme_print '$restart_filedate = '$restart_filedate

### the next line gets the YYYY-MM of the month before the restart time. Needed for staging history files.
### NOTE: This is broken for cases that have run for less than a month
set restart_prevdate = `date -d "${restart_filedate} - 1 month" +%Y-%m`

acme_print '$restart_prevdate = '$restart_prevdate
Expand All @@ -1165,9 +1172,9 @@ else if ( $model_start_type == 'branch' ) then
cp ${restart_files_dir}/${restart_case_name}.cpl.r.${restart_filedate}-00000.nc $case_run_dir
cp ${restart_files_dir}/${restart_case_name}.mosart.r.${restart_filedate}-00000.nc $case_run_dir
cp ${restart_files_dir}/${restart_case_name}.mosart.rh0.${restart_filedate}-00000.nc $case_run_dir
cp ${restart_files_dir}/rst.mpas-cice.${restart_filedate}_00.00.00.nc $case_run_dir
cp ${restart_files_dir}/rst.mpas-o.${restart_filedate}_00.00.00.nc $case_run_dir
cp ${restart_files_dir}/${restart_case_name}.cam.h0.${restart_prevdate}.nc $case_run_dir
cp ${restart_files_dir}/mpascice.rst.${restart_filedate}_00000.nc $case_run_dir
cp ${restart_files_dir}/mpaso.rst.${restart_filedate}_00000.nc $case_run_dir
cp ${restart_files_dir}/${restart_case_name}.cam.h0.${restart_prevdate}-*-00000.nc $case_run_dir
cp ${restart_files_dir}/${restart_case_name}.mosart.h0.${restart_prevdate}.nc $case_run_dir
cp ${restart_files_dir}/${restart_case_name}.clm2.h0.${restart_prevdate}.nc $case_run_dir
cp ${restart_files_dir}/rpointer* $case_run_dir
Expand All @@ -1176,7 +1183,9 @@ else if ( $model_start_type == 'branch' ) then
$xmlchange_exe --id RUN_REFCASE --val $restart_case_name
$xmlchange_exe --id RUN_REFDATE --val $restart_filedate # Model date of restart file
$xmlchange_exe --id CONTINUE_RUN --val "FALSE"
$xmlchange_exe --id BRNCH_RETAIN_CASENAME --val "FALSE" ## Only TRUE if you want to continue the run with the same name (risky)!!
# Currently broken in CIME
# Only uncomment this if you want to continue the run with the same name (risky)!!
# $xmlchange_exe --id BRNCH_RETAIN_CASENAME --val "TRUE"

else

Expand Down Expand Up @@ -1211,7 +1220,7 @@ acme_newline
if ( `lowercase $submit_run` == 'true' ) then
if ( $num_submits == 1 ) then
acme_print ' SUBMITTING A SINGLE JOB.'
${case_submit_exe}
${case_submit_exe} --batch-args " ${batch_options} "
else if ( $num_submits <= 0 ) then
acme_print '$num_submits <= 0 so NOT submitting a job.'
acme_print '$num_submits = '$num_submits
Expand Down