3 # Submission script for GridEngine (GE). Each job will
4 # be executed via the jobScript.sh
5 # This jobScript supports up to 7 parameters. Edit
6 # the user specific part of the script according to
9 # Input to the script is a filelist with 1 file per line.
10 # For each file a job is started. With the parameter
11 # nFilesPerJob a comma separated filelist will be
12 # generated and handed to the job script. This feature
13 # is usefull when running many small jobs. Each
14 # job has its own logfile. All needed directories for the
15 # logfiles will be created if non existing.
17 # IMPORTANT: the hera/prometheus cluster jobs will only
18 # see the /hera file system. All needed scripts, programs
19 # and parameters have to be located on /hera or the job
20 # will crash. This script syncs your working dir to the submission
21 # dir on /hera . Make sure your scripts use the submission dir!
22 # Software should be taken from /cvmfs/hades.gsi.de/install/
24 # job log files will be named like inputfiles. If nFilesPerJob > 1
25 # the log files will contain the partnumber.
27 ######################################################################
31 currentDir=$(pwd | xargs -i basename {})
32 currentDir=../$currentDir
42 submmissionbase=/lustre/nyx/hades/user/${user}/sub
43 submissiondir=${submmissionbase}/urqmd
44 nFilesPerJob=1 # number of files to be analyzed by 1 job (default==1)
45 jobscript=${submissiondir}/jobScript_SL.sh # exec script (full path, call without dot, set it executable!)
46 #outputdir=/hera/hades/dstsim/apr12/urqmd/${urqmdout}/new/${part} # outputdir for files AND logFiles
47 outputdir=/lustre/nyx/hades/dstsim/apr12/urqmd/${urqmdout}/new/${part} # outputdir for files AND logFiles
48 pathoutputlog=${outputdir}/out # protocol from batch farm for each file
49 filename=testrun # filename of log file if nFilesPerJob > 1 (partnumber will be appended)
51 par1=/cvmfs/hades.gsi.de/install/urqmd-3.3p2/urqmd # urqmd exe
52 #par1=/cvmfs/hades.gsi.de/install/urqmd-3.4/urqmd # urqmd exe
53 par2=/cvmfs/hades.gsi.de/install/convert-urqmd_1.3.7/convert-urqmd_1.3.7 # converter
54 par3="" # optional par3 : input file list
55 par4=${outputdir} # optional par4 : outputfile (part number will be appended (_num.root))
56 par5=$events # optional par5 : number of events
57 par6="" # optional random seed
58 par7=${submissiondir}/input/Au_Au_${energy}MeV_${urqmdout}.input # optional input file
59 resources="--mem=2000 --time=0-2:00:00" # runtime < 10h, mem < 2GB
60 jobarrayFile="urqmd_jobarray_${urqmdout}_${part}.dat"
62 filelist=${currentDir}/all_files_${part}.list # file list in local dir! not in submissiondir!!!
64 filepattern=Au_Au_${energy}MeV_${events}evts_
66 createList=no # (yes/no) use this to create files list with generic names (for simulation, testing)
67 # use "no" if you have a filelist available
70 ######################################################################
73 #---------------------------------------------------------------------
74 # create a file list for submission (simulation, testing etc.)
75 # for real data you will have a filelist with real filenames
76 if [ "$createList" == "yes" ]
80 echo "===> REMOVING EXISTING FILELIST : $filelist"
84 echo "===> CREATE FILELIST : $filelist"
85 ((start=${part}*10000-10000))
86 ((stop= $start+10000))
89 for ((ct=$start+1;ct<=$stop;ct++))
91 echo ${filepattern}${ct} >> $filelist
94 #---------------------------------------------------------------------
98 nFiles=$( cat $filelist | wc -l)
100 #---------------------------------------------------------------------
102 if [ ! -d $submmissionbase ]
104 echo "===> CREATE SUBMISSIONBASEDIR : $submmissionbase"
105 mkdir -p $submmissionbase
107 echo "===> USE SUBMISSIONBASEDIR : $submmissionbase"
110 if [ ! -d $pathoutputlog ]
112 echo "===> CREATE LOGDIR : $pathoutputlog"
113 mkdir -p $pathoutputlog
115 echo "===> USE LOGDIR : $pathoutputlog"
117 #---------------------------------------------------------------------
120 ctF=0 # counter for file number
121 ctJ=0 # counter for job number
122 partNumber=0 # counter for part number
124 if [ -f $jobarrayFile ]
128 echo "===> CREATING JOB ARRAY FILE"
130 #---------------------------------------------------------------------
131 # read the files list into an job array
134 for file in $(cat $filelist)
139 #---------------------------------------------------------------------
142 #---------------------------------------------------------------------
143 # loop over the job array and submit parts with
146 while ((ctF<$nFiles))
148 #---------------------------------------------------------------------
149 # build comma separated file list
151 if [ $nFilesPerJob -gt 1 ]
153 infileList=${jobarray[${ctF}]}
155 for (( ctList=1;ctList<$nFilesPerJob; ctList++ ))
157 if [ $ctF -lt ${nFiles} ]
159 infileList="${infileList},${jobarray[${ctF}]}"
164 infileList=${jobarray[${ctF}]}
167 #---------------------------------------------------------------------
171 logfile="${pathoutputlog}/${filename}_${partNumber}.log"
173 if [ $nFilesPerJob -eq 1 ]
175 file=$(basename ${infileList})
176 logfile="${pathoutputlog}/${file}.log"
184 # echo "-----------------------------------------------------------------------------"
185 # echo "add part ${partNumber} last file ${ctF} of $nFiles ====> add new job ${infileList}"
187 ######################################################################
188 # SEND NEW JOB (USER SPECIFIC)
192 seed=$(echo $par3 | sed "s/$filepattern//")
194 #((seed=ctF * 1000 + 1))
197 #urqmd #convert filename outputdir nevents seed input
198 echo "${par1} ${par2} ${par3} ${par4} ${par5} ${par6} ${par7}" >> $jobarrayFile
202 ######################################################################
205 #---------------------------------------------------------------------
207 #---------------------------------------------------------------------
208 # sync the local modified stuff
209 # to the submission dir
210 echo "===> SYNC CURENTDIR TO SUBMISSIONDIR : rsync -vHaz $currentDir ${submmissionbase}"
211 rsync -vHaz $currentDir ${submmissionbase}/
215 if [ ! $syncStat -eq 0 ]
217 echo "===> ERROR : SYNCHRONIZATION ENCOUNTERED PROBLEMS"
220 echo "-------------------------------------------------"
222 nFiles=$( cat $jobarrayFile | wc -l)
226 while ((${ctsend} * ${block} < ${nFiles}))
228 ((start=${ctsend}*${block}))
229 ((rest=${nFiles}-${start}))
230 if [ $rest -le $block ]
236 ((arrayoffset=${ctsend} * ${block}))
237 command="--array=1-${stop} ${resources} -D ${submissiondir} --output=${pathoutputlog}/slurm-%A_%a.out ${jobscript} ${submissiondir}/${jobarrayFile} ${pathoutputlog} ${arrayoffset}"
244 echo "${nFiles} jobs for day ${day} submitted"