Changeset 1374 for trunk/LMDZ.GENERIC/deftank
- Timestamp:
- Feb 11, 2015, 3:08:27 PM (10 years ago)
- Location:
- trunk/LMDZ.GENERIC/deftank/def_generic_giants
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/deftank/def_generic_giants/long_run.sh
r1372 r1374 3 3 # In your directory, you need : 4 4 # - this script 5 # - launch_128_96_64_ref : a reference script, containing the settings of a job (which .def to use, which executable, Load Leveler settings...)6 # - the PROTO_Saturn_Article directory (add the executable inside) 5 # - the reference script for Load Leveler, containing the settings of a job (which .def to use, which executable, Load Leveler settings...). 6 7 7 8 8 #!/bin/bash 9 9 10 #MODIFY THIS : 11 n=11 #total number of jobs 12 name='norings' 13 cd /san/home/sylvestr/simus/bacasable/long_run/norings #your start directory 10 ##### MODIFY THIS : 11 n=3 #total number of jobs 12 ref='launch_128_96_64_ref' #name of the reference script 14 13 15 # THE REFERENCE SCRIPT IS READ : launch_128_96_64_ref 14 15 #Following commands are specific to Load Leveler : change them if you use another batch scheduling system 16 ini_dir='$LOADL_STEP_INITDIR' # Absolute path to the submission directory, as named in the reference script 17 run_dir='$LOADL_STEP_INITDIR/${tmpdir}' #Generic absolute path to the run directory, as named in the reference script (eg. job_name.job_id etc...) 18 19 sub_cmd=llsubmit #command to submit a job 20 21 ############################################################################################################################## 22 23 # THE REFERENCE SCRIPT IS READ : 16 24 17 25 #we check that the lines about the copy of the startfi.nc follows the one with 18 26 #start.nc 19 27 20 ligne= $(grep -n 'start.nc' launch_128_96_64_ref | cut -d: -f1)21 lignefi= $(grep -n 'startfi.nc' launch_128_96_64_ref | cut -d: -f1)28 ligne="$(grep -n 'cp .*start.nc' ${ref} | cut -d: -f1)" 29 lignefi="$(grep -n 'cp .*startfi.nc' ${ref} | cut -d: -f1)" 22 30 23 if [ ${lignefi} -ne $(expr ${ligne} \+ 1)]31 if [ ${lignefi} -ne "$(expr ${ligne} \+ 1)" ] 24 32 then 25 33 echo 'Error :' 26 echo 'In launch_128_96_64_ref,the line about startfi.nc must follow the line about start.nc'34 echo 'In '${ref}' ,the line about startfi.nc must follow the line about start.nc' 27 35 exit 28 36 fi 29 37 30 38 #CREATION OF THE 1ST SCRIPT 31 cp launch_128_96_64_ref launch1_128_96_6439 cp ${ref} launch1 32 40 33 41 #CREATION OF THE LAST SCRIPT … … 35 43 #same as the reference script except that its start*.nc files are the restart*.nc files produced by the second to last simulation 36 44 37 head -n $(expr ${ligne} \- 1 ) launch1 _128_96_64 > launch${n}_128_96_6438 echo 'cp -rf zeLAST/restart.nc $LOADL_STEP_INITDIR/${tmpdir}/start.nc' >> launch${n}_128_96_6439 echo 'cp -rf zeLAST/restartfi.nc $LOADL_STEP_INITDIR/${tmpdir}/startfi.nc' >> launch${n}_128_96_6440 tail -n +$(expr ${lignefi} \+ 1 ) launch1 _128_96_64 >> launch${n}_128_96_6445 head -n $(expr ${ligne} \- 1 ) launch1 > launch${n} 46 echo 'cp -rf ' ${ini_dir}'/zeLAST/restart.nc ' ${run_dir}'/start.nc' >> launch${n} 47 echo 'cp -rf ' ${ini_dir}'/zeLAST/restartfi.nc ' ${run_dir}'/startfi.nc' >> launch${n} 48 tail -n +$(expr ${lignefi} \+ 1 ) launch1 >> launch${n} 41 49 42 50 43 51 #1ST SCRIPT IS COMPLETED AND THE OTHERS (from 2 to n-1 ARE CREATED) 44 52 45 # Scripts 2 to n-1 are created from the last script ( to start from the restart*.nc).46 # Commands are added to Scripts 1 to n-1 to launch the next script.53 # Scripts 2 to n-1 are created from the last script (as jobs 2 to n-1 must start from restart*.nc produced by the previous job). 54 # Commands are added to Scripts 1 to n-1 to launch the next job. 47 55 48 touch outputs_${name}.txt #file to save the names of the jobs composing this run 56 for ((i=1 ; i<=${n}; i+=1)) 57 do 58 if [ ${i} -ne 1 ] && [ ${i} -ne ${n} ] 59 then 60 cp launch${n} launch${i} 61 fi 49 62 50 for ((i=1 ; i<$n; i+=1)) 51 do 52 if [ ${i} -ne 1 ]53 then54 cp launch${n}_128_96_64 launch${i}_128_96_6455 fi63 #Link toward the repertory of the last simulation 64 echo 'cd ' ${ini_dir} >> launch${i} 65 echo 'rm -f zeLAST' >> launch${i} 66 echo 'lastdir=`ls -ltrd */ | awk' "'{print" '$NF}'"'" '| tail -n 1 `' >> launch${i} 67 echo 'ln -sf ${lastdir} zeLAST' >> launch${i} 68 echo >> launch${i} 56 69 57 #Save the name of the jobs 58 echo 'echo $LOADL_STEP_INITDIR/${tmpdir} >> $LOADL_STEP_INITDIR/outputs_'${name}'.txt' >> launch${i}_128_96_64 59 echo ' ' >> launch${i}_128_96_64 60 61 #Launch the next job 62 echo '#Lancement du job script suivant' >> launch${i}_128_96_64 63 echo 'cd $LOADL_STEP_INITDIR' >> launch${i}_128_96_64 64 echo 'llsubmit launch'$(expr $i \+ 1)'_128_96_64' >> launch${i}_128_96_64 65 70 if [ ${i} -ne ${n} ] 71 then 72 #Launch the next job 73 echo '#Lancement du job script suivant' >> launch${i} 74 echo 'cd' ${ini_dir} >> launch${i} 75 echo ${sub_cmd}' launch'$(expr $i \+ 1) >> launch${i} 76 fi 66 77 done 67 78 68 echo 'echo $LOADL_STEP_INITDIR/${tmpdir} >> $LOADL_STEP_INITDIR/outputs_'${name}'.txt' >> launch${n}_128_96_64 79 80 #LAST RUN : CREATION OF outputs.txt 81 # concatnc.e < outputs.txt will concatenate all the diagfi.nc 69 82 83 echo 'cd '${ini_dir} >> launch${n} 84 echo 'find . -maxdepth 2 -name "diagfi.nc" >> outputs.txt' >> launch${n} 85 86 echo 'echo >> '${ini_dir}'/outputs.txt' >> launch${n} 87 echo 'echo 0 >> '${ini_dir}'/outputs.txt' >> launch${n} 88 echo 'echo ls >> '${ini_dir}'/outputs.txt' >> launch${n} 89 echo 'echo all >> '${ini_dir}'/outputs.txt' >> launch${n} 90 echo 'echo >> '${ini_dir}'/outputs.txt' >> launch${n} 91 70 92 #LAUNCH THE 1ST JOB 71 llsubmit launch1_128_96_64 93 ${sub_cmd} launch1 72 94
Note: See TracChangeset
for help on using the changeset viewer.