-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 2.1 official release, more documentation to follow.
- Loading branch information
Showing
82 changed files
with
69,968 additions
and
2,204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
# | ||
|
||
### Job Name (will be used as prefix later on!) | ||
#PBS -N icar_batch_run | ||
### Project code | ||
#PBS -A P48500028 | ||
#PBS -l walltime=00:15:00 | ||
#PBS -q regular | ||
### Merge output and error files | ||
#PBS -o job_output/log.out | ||
### job error file (PBS will not allow use of ${PBS_JOBID} here? ) | ||
#PBS -e job_output/log.err | ||
### Select X nodes with 36 CPUs each for a total of 72 MPI processes | ||
#PBS -l select=1:ncpus=36:mpiprocs=36:ompthreads=1 | ||
|
||
### PBS options for automation: https://gif.biotech.iastate.edu/submitting-dependency-jobs-using-pbs-torque | ||
|
||
# otherwise xarray is not available: | ||
module load conda/latest | ||
source /glade/u/apps/opt/conda/bin/activate | ||
|
||
# echo ${PBS_JOBID::7} | ||
|
||
# Set OpenMP variables | ||
export OMP_NUM_THREADS=1 | ||
# export MP_TASK_AFFINITY=core:$OMP_NUM_THREADS | ||
|
||
# the easy way | ||
# icar icar_options.nml | ||
|
||
# the complex way (allows a continuous sequence of jobs) | ||
PREFIX=$PBS_JOBNAME | ||
|
||
# it is useful to keep all other filenames relative to $PREFIX | ||
# note that this is not required anywhere though | ||
OUTDIR=$PREFIX | ||
OPTFILE=${PREFIX}_options.nml | ||
BATCHFILE=${PREFIX}_batch_submit.sh | ||
TEMPLATE=${PREFIX}_template.nml | ||
|
||
# specify the location of the icar executable to use: | ||
EXE=${HOME}/bin/icar | ||
|
||
# various useful helper scripts (SETUP_RUN is critical) | ||
SETUP_RUN=${HOME}/icar/helpers/setup_next_run.py | ||
MAKE_TEMPLATE=${HOME}/icar/helpers/make_template.py | ||
MKOUTDIR=mkdir #<user_defined_path>/mkscratch.py # mkscratch creates the directory on scratch and links to it | ||
|
||
|
||
# -------------------------------------------------- | ||
# SHOULD NOT NEED TO MODIFY ANYTHING BELOW THIS LINE | ||
# -------------------------------------------------- | ||
|
||
# if the template file doesn't exist yet, make it | ||
if [[ ! -e $TEMPLATE ]]; then | ||
$MAKE_TEMPLATE $OPTFILE $TEMPLATE > job_output/py_mktemp.out | ||
fi | ||
|
||
# if the output directory doesn't exist, create it | ||
if [[ ! -e $OUTDIR ]]; then | ||
$MKOUTDIR $OUTDIR | ||
fi | ||
|
||
# if we didn't finish yet we have to continue -BK: but we print this in line 87, so 2 jobs max? | ||
if [[ ! -e ${PREFIX}_finished ]]; then | ||
# first submit the next job dependant on this one | ||
qsub -W depend=afterany:${PBS_JOBID} ${BATCHFILE} | ||
|
||
# if we have run before, setup the appropriate restart options | ||
if [[ -e ${PREFIX}_running ]]; then | ||
# echo "setting up next run (setup_next_run.py)" | ||
$SETUP_RUN $OPTFILE $TEMPLATE > job_output/py_setup.out | ||
fi | ||
|
||
# declare that we have run before so the next job will know | ||
touch ${PREFIX}_running | ||
|
||
# run the actual executable (e.g. icar options.nml) | ||
cafrun -n 36 $EXE $OPTFILE >> job_output/icar${PBS_JOBID::7}.out | ||
# typically the job will get killed while icar is running | ||
# but for some reason bkilling the job still lets it touch _finished... | ||
# maybe this will give it a chance to really kill it first? | ||
sleep 20 | ||
|
||
# if icar completes, we are done, tell the next job that we finished | ||
touch ${PREFIX}_finished | ||
else | ||
# if the last job ran to completion, delete the inter-job communication files and exit | ||
rm ${PREFIX}_running | ||
rm ${PREFIX}_finished | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/bash | ||
### Job Name (will be used as prefix later on!) | ||
#SBATCH --job-name="ICAR_tst" | ||
#SBATCH --nodes=1 | ||
#SBATCH --ntasks-per-node=32 | ||
#SBATCH --time=00:05:00 | ||
#SBATCH --constraint=haswell | ||
#SBATCH --qos=debug | ||
### Project code | ||
#SBATCH --account=m4062 | ||
### error and output files in separate folder, name with jobid (%x) an job name (%j) | ||
### N.B: create the job_output folder before submitting this job! | ||
#SBATCH --output=job_output/log-%x.%j.out | ||
#SBATCH --error=job_output/log-%x.%j.err | ||
|
||
# Make sure a python environment with xarray is available: | ||
module load python | ||
conda activate myenv | ||
|
||
# Set OpenMP variables | ||
export OMP_NUM_THREADS=1 | ||
# export MP_TASK_AFFINITY=core:$OMP_NUM_THREADS | ||
|
||
# the easy way | ||
# icar icar_options.nml | ||
|
||
# the complex way (allows a continuous sequence of jobs) | ||
PREFIX=tst ##$SBATCH_JOB_NAME | ||
|
||
# it is useful to keep all other filenames relative to $PREFIX | ||
# note that this is not required anywhere though | ||
OUTDIR=$PREFIX | ||
OPTFILE=options.nml #${PREFIX}_options.nml | ||
BATCHFILE=batch_submit_SLURM.sh #${PREFIX}_batch_submit.sh | ||
TEMPLATE=${PREFIX}_template.nml | ||
|
||
# the ICAR executable to use | ||
EXE=$HOME/bin/icar_dbs | ||
|
||
# load any environmental settings to run icar properly (system dependent): | ||
. /global/cfs/cdirs/m4062/env_scripts/UO-GNU-env.sh | ||
|
||
|
||
# various useful helper scripts (SETUP_RUN is critical) | ||
SETUP_RUN=${HOME}/icar/helpers/setup_next_run.py | ||
MAKE_TEMPLATE=${HOME}/icar/helpers/make_template.py | ||
MKOUTDIR=mkdir #<user_defined_path>/mkscratch.py # mkscratch creates the directory on scratch and links to it | ||
|
||
|
||
|
||
# -------------------------------------------------- | ||
# SHOULD NOT NEED TO MODIFY ANYTHING BELOW THIS LINE | ||
# -------------------------------------------------- | ||
|
||
# if the template file doesn't exist yet, make it | ||
if [[ ! -e $TEMPLATE ]]; then | ||
$MAKE_TEMPLATE $OPTFILE $TEMPLATE > job_output/py_mktemp.out | ||
fi | ||
|
||
# # if the output directory doesn't exist, create it | ||
# if [[ ! -e $OUTDIR ]]; then | ||
# $MKOUTDIR $OUTDIR | ||
# fi | ||
|
||
# if we didn't finish yet we have to continue -BK: but we print this in line 87, so 2 jobs max? | ||
if [[ ! -e ${PREFIX}_finished ]]; then | ||
# first submit the next job dependant on this one | ||
# sub -w "ended(${PBS_JOBID})" < $BATCHFILE | ||
# qsub -W depend=afterany:${PBS_JOBID} ${BATCHFILE} ## PBS version | ||
sbatch --dependency=afternotok:$SLURM_JOB_ID ${BATCHFILE} | ||
|
||
# if we have run before, setup the appropriate restart options | ||
if [[ -e ${PREFIX}_running ]]; then | ||
# echo "setting up next run (setup_next_run.py)" | ||
$SETUP_RUN $OPTFILE $TEMPLATE > job_output/py_setup.out | ||
fi | ||
|
||
# declare that we have run before so the next job will know | ||
touch ${PREFIX}_running | ||
|
||
# run the actual executable (e.g. icar options.nml) | ||
# cafrun -n 36 $EXE $OPTFILE > job_output/icar_$SLURM_JOB_ID.out | ||
cafrun -n 36 $EXE $OPTFILE >> job_output/icar.out ### if you prefer one log file for the icar output | ||
|
||
# typically the job will get killed while icar is running | ||
# but for some reason bkilling the job still lets it touch _finished... | ||
# maybe this will give it a chance to really kill it first? | ||
sleep 10 | ||
|
||
# if icar completes, we are done, tell the next job that we finished | ||
# BK dont understand this: wont it prevent the next (or after-next job from starting (ln 63)) | ||
touch ${PREFIX}_finished | ||
else | ||
# if the last job ran to completion, delete the inter-job communication files and exit | ||
rm ${PREFIX}_running | ||
rm ${PREFIX}_finished | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.