Changeset 7683 for branches/UKMO/dev_r7681_rebuild_nemo/NEMOGCM/TOOLS
- Timestamp:
- 2017-02-15T12:53:23+01:00 (7 years ago)
- Location:
- branches/UKMO/dev_r7681_rebuild_nemo/NEMOGCM/TOOLS/REBUILD_NEMO
- Files:
-
- 4 added
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r7681_rebuild_nemo/NEMOGCM/TOOLS/REBUILD_NEMO/rebuild_nemo
r3025 r7683 1 1 #!/bin/ksh 2 # 3 # Script to run the NEMO rebuild tool to rebuild NEMO 4 # diagnostic or restart files. 5 # 6 # The scripts creates the nam_rebuild namelist based upon 7 # the command line options you give it (see usage below) 8 # 9 # Ed Blockley, September 2011 10 # 11 # 2 3 # CALLS: rebuild_nemo.exe 12 4 13 5 #set -ax … … 18 10 echo " ************" 19 11 echo 20 echo " usage: ${0##*/} [- t -c] filebase ndomain [rebuild dimensions]"12 echo " usage: ${0##*/} [-l -t -c -m -n] filebase ndomain [rebuild dimensions]" 21 13 echo 22 echo " flags: -t num use num threads" 23 echo " -c num split 4D vars into time chuncks of size num" 14 echo " flags: -l submit to compute node" 15 echo " -t num use num threads" 16 echo " -c num split 4D vars into time chuncks of size num" 17 echo " -m force masking of global arrays (zero if no mdi)" 18 echo " -d deflate_level deflate level for output files (key_netcdf4 only)" 19 echo " -n namelist full path to namelist file to be created (otherwise default nam_rebuild+_process_id is used)" 24 20 echo 25 21 exit 1 26 22 } 27 23 28 while getopts c: t:opt24 while getopts c:n:t:d:lm opt 29 25 do 30 26 case ${opt} in 27 l) 28 BATCH="yes" 29 BATCH_CMD="qsub" 30 ARCH="XC40_METO" 31 echo "Submitting job to compute node" 32 ;; 31 33 t) 32 34 OMP_NUM_THREADS=${OPTARG} … … 35 37 NCHUNKSIZE=${OPTARG} 36 38 ;; 39 m) 40 NMASK="TRUE" 41 ;; 42 d) 43 DEFLATE=${OPTARG} 44 ;; 45 n) 46 nam_rebuild=${OPTARG} 47 ;; 37 48 esac 38 49 done 39 50 shift $(expr ${OPTIND} - 1) 40 51 41 if [[ $# <2 ]] ; then52 if [[ $# -lt 2 ]] ; then 42 53 usage 43 54 fi … … 49 60 DIM1=$3 50 61 DIM2=$4 51 export OMP_NUM_THREADS=${OMP_NUM_THREADS:-16} 62 export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} 63 nam_rebuild=${nam_rebuild:-nam_rebuild_$$} 52 64 53 65 if [[ -n ${DIM1} && -n ${DIM2} ]] ; then 54 66 dim_str=" dims '${DIM1}','${DIM2}'" 55 67 dims="dims='${DIM1}','${DIM2}'" 56 echo ${dim_str} >> nam_rebuild57 68 fi 58 69 59 70 echo "file ${file}, num_domains ${ndomain}, num_threads ${OMP_NUM_THREADS}${dim_str}" 60 71 61 cat > nam_rebuild << EOC72 cat > $nam_rebuild << EOC 62 73 &nam_rebuild 63 74 filebase='${file}' … … 65 76 EOC 66 77 if [[ -n ${dims} ]] ; then 67 echo ${dims} >> nam_rebuild78 echo ${dims} >> $nam_rebuild 68 79 fi 69 80 if [[ -n ${NCHUNKSIZE} ]] ; then 70 echo " nchunksize=${NCHUNKSIZE}" >> nam_rebuild81 echo " nchunksize=${NCHUNKSIZE}" >> $nam_rebuild 71 82 fi 72 echo "/" >> nam_rebuild 83 if [[ -n ${NMASK} ]] ; then 84 echo " l_maskout=.true." >> $nam_rebuild 85 fi 86 if [[ -n ${DEFLATE} ]] ; then 87 echo " deflate_level=${DEFLATE}" >> $nam_rebuild 88 fi 73 89 74 # run the rebuild code 75 ${script_dir}/rebuild_nemo.exe 90 echo "/" >> $nam_rebuild 91 92 if [[ ${BATCH} == "yes" ]] ; then 93 batch_file=rebuild_nemo_batch_${ARCH} 94 95 #Create a modified local copy of the batch submission file 96 #The process ID is appended to the end of the file name so it is unique 97 cat ${script_dir}/BATCH_TEMPLATES/${batch_file} | sed -e"s/NTHREADS/${OMP_NUM_THREADS}/" \ 98 -e"s:INDIR:${script_dir}:" \ 99 -e"s/NAMELIST/${nam_rebuild}/" > ${batch_file}_$$.sh 100 101 #Submit the job 102 $BATCH_CMD ${batch_file}_$$.sh 103 104 else 105 ${script_dir}/rebuild_nemo.exe $nam_rebuild 106 fi 107
Note: See TracChangeset
for help on using the changeset viewer.