1 | #!/bin/ksh |
---|
2 | # $Id$ |
---|
3 | ###################################################### |
---|
4 | # Original : C. Talandier for NEMO team |
---|
5 | # Contact : nemo_st@locean-ipsl.upmc.fr |
---|
6 | # |
---|
7 | # INPUT ARGS: 4 + 1 optional |
---|
8 | # - CONF : configuration name (ORCA2_LIM, GYRE ..) |
---|
9 | # - MTIME : timing/no timing (timing or notiming) |
---|
10 | # - JOBTOL: jobs to launch: all, long, 1_short or gtime |
---|
11 | # - OWNEXP: name of the experience performed |
---|
12 | # - REFTAG: (optional): reference tag name to which current |
---|
13 | # version will be compare to |
---|
14 | # |
---|
15 | # WORK: This script aims to (for each standard configuration) : |
---|
16 | # |
---|
17 | # I. Take into account target's specificities |
---|
18 | # Variables below must be filled for a new target |
---|
19 | # - W_XX = name of target |
---|
20 | # - LAUN = name of jobs launcher command |
---|
21 | # - LLJOBS = name of jobs listing command |
---|
22 | # - LSUB = name of running command |
---|
23 | # - LPERF = name of timing command for the whole run |
---|
24 | # - LJTIM = required time for a one year run (/proc) |
---|
25 | # - LJTIMJ = required time for a one year run (job) |
---|
26 | # - CMDGET = name of specific command to retrieve files |
---|
27 | # - SYMBOL = identifier associated to a platform which |
---|
28 | # is used to name all outputs files |
---|
29 | # Ex: For Brodie, this symbol could be "B_" so |
---|
30 | # file names looks like B_solver.stat ... |
---|
31 | # |
---|
32 | # II. Build jobs |
---|
33 | # - based on specific header depending on target, it must |
---|
34 | # be provided for a new target following samples |
---|
35 | # jhd_[target_name]_mon for mono-processors runs |
---|
36 | # jhd_[target_name]_mpi for multi-processors MPI runs |
---|
37 | # jhd_[target_name]_omp for multi-processors OPen-MP runs |
---|
38 | # |
---|
39 | # III. Launch jobs |
---|
40 | # to test both reproductibility and restartability |
---|
41 | # for each configuration NAME_CONF |
---|
42 | # & for each run type [mon, mpi, omp] |
---|
43 | # 3 runs will be launched: |
---|
44 | # - LONG |
---|
45 | # - 1_SHORT |
---|
46 | # - 2_SHORT |
---|
47 | # |
---|
48 | # IV. Launch cron job |
---|
49 | # Since no jobs (for a given configuration) are in |
---|
50 | # the batch queue, this cron will launch the assessment.ksh |
---|
51 | # script |
---|
52 | # |
---|
53 | ########################################################## |
---|
54 | #set -xv |
---|
55 | ########################################################## |
---|
56 | ##### Begin Users modifications |
---|
57 | ########################################################## |
---|
58 | # IODIR : directory where to get ORCA2_LIM_nemo_v3.1.tar |
---|
59 | # PRC : total number of processors which will be used |
---|
60 | ########################################################## |
---|
61 | IODIR=/Volumes/FENUA/ORCA2_LIM_nemo_v2_IO |
---|
62 | PRC=8 |
---|
63 | TARGET=osxxlf |
---|
64 | ########################################################## |
---|
65 | ##### End Users modifications |
---|
66 | ########################################################## |
---|
67 | |
---|
68 | CONF=$1 |
---|
69 | MTIME=$2 |
---|
70 | JOBTOL=$3 |
---|
71 | OWNEXP=$4 |
---|
72 | REFTAG=$5 |
---|
73 | RUN=$(basename `pwd`) |
---|
74 | |
---|
75 | # Specific case of Zahir: |
---|
76 | if [ ${RUN} = 'mon' -a ${TARGET} = 'aix6' ] ; then TARGET=ax6_mono ; fi |
---|
77 | |
---|
78 | # --------------------------------------------------------------- |
---|
79 | # I. Take into account target's specificities |
---|
80 | # Select appropriate target lines in Job_${CONF}.ksh |
---|
81 | # --------------------------------------------------------------- |
---|
82 | if [ ${TARGET} = 'sx8brodie' ]; then |
---|
83 | W_XX='#-T- sx8brodie' |
---|
84 | LAUN='qsub ' |
---|
85 | LLJOBS=qstat |
---|
86 | LSUB="mpirun -np ${PRC}" |
---|
87 | LPERF= |
---|
88 | LJTIM='01:20:00' |
---|
89 | LJTIMJ='01:40:00' |
---|
90 | CMDGET=mfget |
---|
91 | SYMBOL=B_ |
---|
92 | elif [ ${TARGET} = 'aix6' ]; then |
---|
93 | W_XX='#-T- aix6' |
---|
94 | LAUN='llsubmit ' |
---|
95 | LLJOBS=Qstat |
---|
96 | LSUB= |
---|
97 | LPERF="poe hpmcount -o perfs_mpi.txt" |
---|
98 | LJTIM='01:10:00' |
---|
99 | LJTIMJ= |
---|
100 | CMDGET=mfget |
---|
101 | SYMBOL=V_ |
---|
102 | elif [ ${TARGET} = 'ax6_mono' ]; then |
---|
103 | W_XX='#-T- ax6_mono' |
---|
104 | LAUN='llsubmit ' |
---|
105 | LLJOBS=Qstat |
---|
106 | LSUB= |
---|
107 | LPERF="hpmcount -o perfs_mon.txt" |
---|
108 | LJTIM='05:10:00' |
---|
109 | LJTIMJ= |
---|
110 | CMDGET=mfget |
---|
111 | SYMBOL=V_ |
---|
112 | elif [ ${TARGET} = 'osxxlf' ]; then |
---|
113 | W_XX='#-T- osxxlf' |
---|
114 | LAUN='./' |
---|
115 | LLJOBS= |
---|
116 | LSUB="mpirun -np ${PRC}" |
---|
117 | LPERF= |
---|
118 | LJTIM= |
---|
119 | LJTIMJ= |
---|
120 | CMDGET=cp |
---|
121 | SYMBOL=D_ |
---|
122 | else |
---|
123 | echo ' #######################################' |
---|
124 | echo ' You must give a target name :' |
---|
125 | echo ' sx8brodie, aix6, ax6_mono or add one' |
---|
126 | echo ' Have a look in lance_batch.ksh script' |
---|
127 | echo ' #######################################' |
---|
128 | stop |
---|
129 | fi |
---|
130 | |
---|
131 | sed -e "s%^$W_XX *%%" job_${CONF}.ksh | grep -v '^#-T- ' > job_${CONF}.$$ |
---|
132 | |
---|
133 | # -------------------------------------------------------------- |
---|
134 | # II. Build jobs |
---|
135 | # Adapt header (batch jobs) and concatanate it with core job |
---|
136 | # -------------------------------------------------------------- |
---|
137 | case ${TARGET} in |
---|
138 | 'osxxlf' ) |
---|
139 | cp jhd_${TARGET}_${RUN} jhd_${TARGET}_${RUN}_tmp ;; |
---|
140 | 'ax6_mono' ) |
---|
141 | CAR_JNAM=$( grep '\# @ job_name' jhd_${TARGET}_${RUN} ) |
---|
142 | sed -e "s%$CAR_JNAM%\# @ job_name = ${RUN}${CONF}%" \ |
---|
143 | jhd_${TARGET}_${RUN} > jhd_${TARGET}_${RUN}_tmp ;; |
---|
144 | 'aix6' ) |
---|
145 | CAR_JNAM=$( grep '\# @ job_name' jhd_${TARGET}_${RUN} ) |
---|
146 | CAR_JMPI=$( grep '\# @ total_tasks' jhd_${TARGET}_${RUN} ) |
---|
147 | sed -e "s%$CAR_JNAM%\# @ job_name = ${RUN}${CONF}%" \ |
---|
148 | -e "s%$CAR_JMPI%\# @ total_tasks = ${PRC}%" \ |
---|
149 | jhd_${TARGET}_${RUN} > jhd_${TARGET}_${RUN}_tmp ;; |
---|
150 | 'sx8brodie' ) |
---|
151 | CAR_JNAM=$( grep '\#PBS -N ' jhd_${TARGET}_${RUN} ) |
---|
152 | CAR_JNAMO=$( grep '\#PBS -o ' jhd_${TARGET}_${RUN} ) |
---|
153 | CAR_JNAME=$( grep '\#PBS -e ' jhd_${TARGET}_${RUN} ) |
---|
154 | if [ ${RUN} = 'mpi' -o ${RUN} = 'omp' ] ; then |
---|
155 | CAR_JMPI=$( grep '\#PBS -l cpunum_job' jhd_${TARGET}_${RUN} ) |
---|
156 | sed -e "s%$CAR_JNAM%\#PBS -N ${RUN}${CONF}%" \ |
---|
157 | -e "s%$CAR_JNAMO%\#PBS -o ${RUN}${CONF}_std%" \ |
---|
158 | -e "s%$CAR_JNAME%\#PBS -e ${RUN}${CONF}_err%" \ |
---|
159 | -e "s%$CAR_JMPI%\#PBS -l cpunum_job=${PRC}%" \ |
---|
160 | jhd_${TARGET}_${RUN} > jhd_${TARGET}_${RUN}_tmp |
---|
161 | else |
---|
162 | sed -e "s%$CAR_JNAM%\#PBS -N ${RUN}${CONF}%" \ |
---|
163 | -e "s%$CAR_JNAMO%\#PBS -o ${RUN}${CONF}_std%" \ |
---|
164 | -e "s%$CAR_JNAME%\#PBS -e ${RUN}${CONF}_err%" \ |
---|
165 | jhd_${TARGET}_${RUN} > jhd_${TARGET}_${RUN}_tmp |
---|
166 | fi ;; |
---|
167 | esac |
---|
168 | |
---|
169 | cat jhd_${TARGET}_${RUN}_tmp job_${CONF}.$$ > job_tmp_${RUN}.ksh |
---|
170 | rm -f job_${CONF}.$$ jhd_${TARGET}_${RUN}_tmp |
---|
171 | |
---|
172 | # ----------------------------------------------------------------------------- |
---|
173 | # III. Launch jobs |
---|
174 | # The 3 following jobs are created for the run [type]=mon,mpi,omp : |
---|
175 | # - "job_[type]_long.ksh" ---> long run |
---|
176 | # - "job_[type]_1_short.ksh" ---> stream 1 run |
---|
177 | # - "job_[type]_2_short.ksh" ---> stream 2 run |
---|
178 | # - "job_[type]_gtime.ksh" ---> one year run |
---|
179 | # The first 2 as the last one are immediatly launched whereas "job_[type]_2_short.ksh" |
---|
180 | # is launched only when the "job_[type]_1_short.ksh" short run is finished |
---|
181 | # ----------------------------------------------------------------------------- |
---|
182 | jobnam[0]=long ; jobnam[1]=1_short ; jobnam[2]=2_short ; jobnam[3]=gtime |
---|
183 | dirjob[0]=LONG ; dirjob[1]=1_SHORT ; dirjob[2]=2_SHORT ; dirjob[3]=GTIME |
---|
184 | |
---|
185 | case ${JOBTOL} in |
---|
186 | 'all' ) |
---|
187 | if [ ${MTIME} = 'timing' ] ; then |
---|
188 | ind=0 |
---|
189 | iloop=4 |
---|
190 | else |
---|
191 | ind=0 |
---|
192 | iloop=3 |
---|
193 | fi |
---|
194 | ;; |
---|
195 | 'long' ) |
---|
196 | ind=0 |
---|
197 | iloop=1 ;; |
---|
198 | 'short' ) |
---|
199 | ind=1 |
---|
200 | iloop=3 ;; |
---|
201 | 'gtime' ) |
---|
202 | ind=3 |
---|
203 | iloop=4 ;; |
---|
204 | esac |
---|
205 | |
---|
206 | while [ $ind -lt ${iloop} ] |
---|
207 | do |
---|
208 | CAR_TYPE_tmp=$( grep 'type=' job_tmp_${RUN}.ksh ) |
---|
209 | CAR_TYPE=`echo $CAR_TYPE_tmp | cut -f 1 -d " " ` |
---|
210 | CAR_RUN_tmp=$( grep 'RUN=xxx' job_tmp_${RUN}.ksh ) |
---|
211 | CAR_RUN=`echo $CAR_RUN_tmp | cut -f 1 -d " " ` |
---|
212 | CAR_MPP_tmp=$( grep 'NB_PROCS=xxx' job_tmp_${RUN}.ksh ) |
---|
213 | CAR_MPP=`echo $CAR_MPP_tmp | cut -f 1 -d " " ` |
---|
214 | CAR_SUB_tmp=$( grep 'LAUNCH=xxx' job_tmp_${RUN}.ksh ) |
---|
215 | CAR_SUB=`echo $CAR_SUB_tmp | cut -f 1 -d " " ` |
---|
216 | CAR_EXE_tmp=$( grep 'LEXE=xxx' job_tmp_${RUN}.ksh ) |
---|
217 | CAR_EXE=`echo $CAR_EXE_tmp | cut -f 1 -d " " ` |
---|
218 | CAR_PER_tmp=$( grep 'CPERF=xxx' job_tmp_${RUN}.ksh ) |
---|
219 | CAR_PER=`echo $CAR_PER_tmp | cut -f 1 -d " " ` |
---|
220 | CAR_MAN_tmp=$( grep 'MAINDIR=xxx' job_tmp_${RUN}.ksh ) |
---|
221 | CAR_MAN=`echo $CAR_MAN_tmp | cut -f 1 -d " " ` |
---|
222 | CAR_INP_tmp=$( grep 'D_INPUT=xxx' job_tmp_${RUN}.ksh ) |
---|
223 | CAR_INP=`echo $CAR_INP_tmp | cut -f 1 -d " " ` |
---|
224 | CAR_GET_tmp=$( grep 'D_GET=xxx' job_tmp_${RUN}.ksh ) |
---|
225 | CAR_GET=`echo $CAR_GET_tmp | cut -f 1 -d " " ` |
---|
226 | CAR_RTG_tmp=$( grep 'REF_TAG=xxx' job_tmp_${RUN}.ksh ) |
---|
227 | CAR_RTG=`echo $CAR_RTG_tmp | cut -f 1 -d " " ` |
---|
228 | CAR_MYO_tmp=$( grep 'MYO_EXP=xxx' job_tmp_${RUN}.ksh ) |
---|
229 | CAR_MYO=`echo $CAR_MYO_tmp | cut -f 1 -d " " ` |
---|
230 | CAR_TSY_tmp=$( grep 'TSYMB=xxx' job_tmp_${RUN}.ksh ) |
---|
231 | CAR_TSY=`echo $CAR_TSY_tmp | cut -f 1 -d " " ` |
---|
232 | |
---|
233 | sed -e "s%$CAR_TYPE%type=${jobnam[$ind]}%" \ |
---|
234 | -e "s%$CAR_RUN%RUN=$RUN%" \ |
---|
235 | -e "s%$CAR_MPP%NB_PROCS=$PRC%" \ |
---|
236 | -e "s%$CAR_SUB%LAUNCH='$LAUN'%" \ |
---|
237 | -e "s%$CAR_EXE%LEXE='$LSUB'%" \ |
---|
238 | -e "s%$CAR_PER%CPERF='$LPERF'%" \ |
---|
239 | -e "s%$CAR_INP%D_INPUT=$IODIR%" \ |
---|
240 | -e "s%$CAR_GET%D_GET=$CMDGET%" \ |
---|
241 | -e "s%$CAR_RTG%REF_TAG=$REFTAG%" \ |
---|
242 | -e "s%$CAR_MYO%MYO_EXP=$OWNEXP%" \ |
---|
243 | -e "s%$CAR_TSY%TSYMB=$SYMBOL%" \ |
---|
244 | job_tmp_${RUN}.ksh > job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh |
---|
245 | |
---|
246 | if [ ${jobnam[$ind]} = 'gtime' ] ; then |
---|
247 | |
---|
248 | case ${TARGET} in |
---|
249 | 'ax6_mono' | 'aix6' ) |
---|
250 | CAR_JTIM=$( grep '\# @ wall_clock_limit' job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh ) |
---|
251 | sed -e "s%$CAR_JTIM%\# @ wall_clock_limit = ${LJTIM}%" \ |
---|
252 | job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh > job_${RUN}_${jobnam[$ind]}.ksh_tmp ;; |
---|
253 | 'sx8brodie' ) |
---|
254 | CAR_JTIMP=$( grep '\#PBS -l cputim_prc' job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh ) |
---|
255 | CAR_JTIMJ=$( grep '\#PBS -l cputim_job' job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh ) |
---|
256 | sed -e "s%$CAR_JTIMP%\#PBS -l cputim_prc=${LJTIM}%" \ |
---|
257 | -e "s%$CAR_JTIMJ%\#PBS -l cputim_job=${LJTIMJ}%" \ |
---|
258 | job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh > job_${RUN}_${jobnam[$ind]}.ksh_tmp ;; |
---|
259 | esac |
---|
260 | mv job_${RUN}_${jobnam[$ind]}.ksh_tmp job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh |
---|
261 | |
---|
262 | fi |
---|
263 | |
---|
264 | chmod 750 job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh |
---|
265 | |
---|
266 | if [ ! -d ${dirjob[$ind]}/$OWNEXP ] ; then |
---|
267 | mkdir ${dirjob[$ind]}/$OWNEXP |
---|
268 | fi |
---|
269 | mv job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh ${dirjob[$ind]}/${OWNEXP}/. |
---|
270 | |
---|
271 | if [ ${jobnam[$ind]} != '2_short' ] ; then |
---|
272 | cd ${dirjob[$ind]}/${OWNEXP} |
---|
273 | ${LAUN}job_${RUN}_${jobnam[$ind]}_${OWNEXP}.ksh & |
---|
274 | cd ../.. |
---|
275 | fi |
---|
276 | |
---|
277 | let ind=$ind+1 |
---|
278 | done |
---|
279 | rm -f job_tmp_${RUN}.ksh |
---|
280 | |
---|
281 | # List all jobs submitted |
---|
282 | ${LLJOBS} |
---|
283 | |
---|
284 | # ----------------------------------------------------------------------------- |
---|
285 | # IV. Launch cron to be able to launch the assessment step |
---|
286 | # ----------------------------------------------------------------------------- |
---|
287 | if [ ${RUN} == 'mon' ] ; then |
---|
288 | cd .. |
---|
289 | |
---|
290 | CAR_LJOB_tmp=$( grep 'LJOBS=' cron_jobs.ksh ) |
---|
291 | CAR_LJOB=`echo $CAR_LJOB_tmp | cut -f 1 -d " " ` |
---|
292 | |
---|
293 | sed -e "s%$CAR_LJOB%LJOBS=${LLJOBS}%" cron_jobs.ksh > cron_jobs.$$ |
---|
294 | mv cron_jobs.$$ cron_jobs.ksh && rm -rf cron_jobs.$$ |
---|
295 | chmod 744 cron_jobs.ksh |
---|
296 | |
---|
297 | if [ ${TARGET} != 'osxxlf' ]; then |
---|
298 | ./cron_jobs.ksh ${CONF} & |
---|
299 | fi |
---|
300 | fi |
---|