- Timestamp:
- Aug 29, 2008, 10:41:35 AM (17 years ago)
- Children:
- 181f9e
- Parents:
- 830971
- File:
-
- 1 edited
-
util/src/dynamicANOVA.sh.in (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
util/src/dynamicANOVA.sh.in
r830971 rb562aa 10 10 JOINER="@bindir@/joiner" 11 11 CRUNCHER="/mount/bespin/heber/build/mpqc-2.3.0/bin/mpqc" 12 CONVERTER="/mount/bespin/heber/tmp/mpqc/espack2mpqc. sh"12 CONVERTER="/mount/bespin/heber/tmp/mpqc/espack2mpqc.py" 13 13 PREPARER="/mount/bespin/heber/tmp/mpqc/convertresults.sh" 14 14 … … 32 32 } 33 33 34 function RunSim { 35 # 1 is the config file 36 # 2 is the number of nodes 37 # 3 further command line option 38 # 4 and argument 39 # set the maximum number of nodes 40 MaxNodes=`cat $2 | awk 'END{print NR}'` 41 gamma=`grep ProcPEGamma $1 | awk -F"\t" {'print $2'}` 42 psi=`grep ProcPEPsi $1 | awk -F"\t" {'print $2'}` 43 let nodes=$gamma*$psi 44 if [ $nodes -gt $MaxNodes ]; then 45 echo "Process $1 needs too many nodes! Breaking." | tee -a dynamic.log 46 exit 1 47 fi 48 ${MPIRUN} -machinefile $2 -np $nodes ${CRUNCHER} $3 $4 $1 2>/dev/stdout 1>${1/in/out} 49 check | tee -a dynamic.log 50 } 34 #function MultiRunSim { 35 # # 1 is config file dir (with all files) 36 # # 2 is the machine file 37 # 38 # ${JOBRUNNER} --mpqc ${CRUNCHER} -nprocpernode 2 -nprocperjob 1 -nthreadperproc 2 --threadgrp=posix --messagegrp=proc --memorygrp=proc --nodefile $2 --readdir $1 --inputprefix=${1}/ --outputprefix=${1}/ --autoout --verbose --rerun 2>/dev/stdout | tee -a dynamic.log 39 #} 51 40 52 41 function MultiRunSim { 53 # 1 is config file 54 # 2 is the number of groups 42 # 1 is the number of groups 43 # 2 is the directory 44 # 3, ... are config files 55 45 56 46 # find the next free proc group 57 DIR=`dirname $1` 47 divisor=$1 48 shift 49 DIR=$1 50 shift 58 51 started=0 52 pwd=`pwd` 59 53 while [ $started -eq 0 ]; do 60 54 groupnr=1 61 while [ $groupnr -le $ 2]; do55 while [ $groupnr -le $divisor ]; do 62 56 if [ ! -e "${DIR}/ProcRuns${groupnr}" ]; then 63 MaxNodes=`cat ${DIR}/ProcGroup${groupnr} | awk 'END{print NR}'` 64 gamma=`grep ProcPEGamma $1 | awk -F"\t" {'print $2'}` 65 psi=`grep ProcPEPsi $1 | awk -F"\t" {'print $2'}` 66 let nodes=$gamma*$psi 67 if [ $nodes -gt $MaxNodes ]; then 68 echo "Process $1 needs too many nodes! Breaking." | tee -a dynamic.log 69 exit 1 57 #MaxNodes=`cat ${DIR}/ProcGroup${groupnr} | awk 'END{print NR}'` 58 #gamma=`grep ProcPEGamma $1 | awk -F"\t" {'print $2'}` 59 #psi=`grep ProcPEPsi $1 | awk -F"\t" {'print $2'}` 60 #let nodes=$gamma*$psi 61 #if [ $nodes -gt $MaxNodes ]; then 62 # echo "Process $1 needs too many nodes! Breaking." | tee -a dynamic.log 63 # exit 1 64 #fi 65 nodes=1 66 echo "touch ${DIR}/ProcRuns${groupnr}" >"${DIR}/ProcBatch${groupnr}" 67 if [ ! -z $1 ]; then 68 echo -n "rsh `cat <${DIR}/ProcGroup${groupnr}` 'cd ${pwd}/${DIR}" >>"${DIR}/ProcBatch${groupnr}" 70 69 fi 71 echo "touch ${DIR}/ProcRuns${groupnr}" >"${DIR}/ProcBatch${groupnr}" 72 echo "#${MPIRUN} -machinefile ${DIR}/ProcGroup${groupnr} -np $nodes" >>"${DIR}/ProcBatch${groupnr}" 73 echo "${CRUNCHER} ${1/conf/in} 2>/dev/stdout 1>${1/conf/out}" >>"${DIR}/ProcBatch${groupnr}" 70 while [ ! -z $1 ]; do # add all config files as single lines 71 #echo -n "${MPIRUN} -machinefile ${DIR}/ProcGroup${groupnr} -np $nodes " >>"${DIR}/ProcBatch${groupnr}" 72 echo -n "; ${CRUNCHER} -o ${1/conf/out} ${1/conf/in}" >>"${DIR}/ProcBatch${groupnr}" 73 shift 74 done 75 echo "'" >>"${DIR}/ProcBatch${groupnr}" 74 76 echo "rm -f ${DIR}/ProcRuns${groupnr}" >>"${DIR}/ProcBatch${groupnr}" 75 77 /bin/sh "${DIR}/ProcBatch${groupnr}" & 76 78 started=1 77 let groupnr=${ 2}+179 let groupnr=${divisor}+1 78 80 else 79 81 let groupnr=$groupnr+1 … … 81 83 done 82 84 # wait a few seconds 83 if [ $2 -gt 1 ]; then84 sleep 285 fi85 #if [ $2 -gt 1 ]; then 86 # sleep 2 87 #fi 86 88 done 87 89 } 88 90 89 91 # get command line options 90 if [ -z $ 4]; then92 if [ -z $3 ]; then 91 93 echo "Usage: $0 <config file> <Order> <max. bond distance> <MaxNodes> [MaxMDsteps]" 92 94 echo -e "\t<config file> the pcp config file of the total molecule" 93 95 echo -e "\t<Order> the highest bond order (i.e. the cutoff number in ANOVA series expansion)" 94 96 echo -e "\t<max. bond distance> maximum distance to look for bonds (bonds are associated by element covalent radii criterion)" 95 echo -e "\t<MaxNodes> number of nodes to use"96 97 echo -e "\t[MaxMDSteps] overrides given MaxOuterStep in config file" 97 98 exit 1; … … 101 102 order=$2 102 103 distance=$3 103 MaxNodes=$4 104 if [ -z $5 ]; then 104 if [ -z $4 ]; then 105 105 MaxSteps=`grep MaxOuterStep $arg | awk -F"\t" {'print $2'}` 106 106 else 107 MaxSteps=$ 5107 MaxSteps=$4 108 108 fi 109 echo "Going to run for a total of $MaxSteps steps, bond order $order and maximum distance $distance of config file $arg with a total of $MaxNodes nodes." | tee -a dynamic.log109 echo "Going to run for a total of $MaxSteps steps, bond order $order and maximum distance $distance of config file $arg." | tee -a dynamic.log 110 110 fi 111 111 … … 131 131 132 132 # put nodes into groups 133 MaxNodes=0 134 for node in `cat <$PBS_NODEFILE`; do 135 let MaxNodes=$MaxNodes+1 136 done 133 137 gamma=`grep ProcPEGamma $arg | awk -F"\t" {'print $2'}` 134 138 psi=`grep ProcPEPsi $arg | awk -F"\t" {'print $2'}` … … 187 191 echo "There are $frag fragments." | tee -a dynamic.log 188 192 193 189 194 # evaluate each fragment 195 # j=0 196 # while [ $j -lt $frag ]; do 197 # number=`printf "%0${digits}d" $j` 198 # # convert all configs 199 # echo -n "Converting ${DIR}/BondFragment${number}.conf ..." | tee -a dynamic.log 200 # sh $CONVERTER ${DIR}/BondFragment${number}.conf 201 # check | tee -a dynamic.log 202 # let j=$j+1 203 # done 204 # 205 # MultiRunSim ${DIR} $PBS_NODEFILE 206 # 207 # j=0 208 # while [ $j -lt $frag ]; do 209 # number=`printf "%0${digits}d" $j` 210 # # rename output files 211 # echo -n "Renaming `ls ${DIR}/BondFragment${number}.out.001.02.02` ..." | tee -a dynamic.log 212 # mv ${DIR}/BondFragment${number}.out.001.02.02 ${DIR}/BondFragment${number}.out 213 # check | tee -a dynamic.log 214 # let j=$j+1 215 # done 216 217 # reset command arrays 218 grp=0; 219 while [ $grp -lt $divisor ]; do 220 command[$grp]="" 221 let grp=$grp+1 222 done 223 224 # distribute the jobs among the groups 190 225 j=0; 191 226 while [ $j -lt $frag ]; do 192 227 number=`printf "%0${digits}d" $j` 193 228 # convert all configs 194 echo -n "Converting ${DIR}/BondFragment${number}.conf ..."195 sh $CONVERTER ${DIR}/BondFragment${number}.conf196 check | tee -a dynamic.log197 # and evaluate198 echo -n "Starting calculation of Fragment $number at step $i ... " | tee -a dynamic.log199 MultiRunSim ${DIR}/BondFragment${number}.conf $divisor200 echo "done." | tee -a dynamic.log229 #echo -n "Converting ${DIR}/BondFragment${number}.conf ..." | tee -a dynamic.log 230 #sh $CONVERTER ${DIR}/BondFragment${number}.conf 231 #check | tee -a dynamic.log 232 # and distribute 233 let grp=${j}%${divisor} 234 #echo "BondFragment${number}.conf is evaluated by group $grp." 235 command[$grp]="${command[$grp]}BondFragment${number}.conf " 201 236 let j=$j+1 202 237 done 203 238 239 # go through all groups and run the job 240 grp=0; 241 while [ $grp -lt $divisor ]; do 242 number=`printf "%0${digits}d" $j` 243 echo -n "Starting calculation of group $grp with fragments \"${command[$grp]}\" at step $i ... " | tee -a dynamic.log 244 MultiRunSim $divisor ${DIR} ${command[$grp]} 245 echo "done." | tee -a dynamic.log 246 let grp=$grp+1 247 done 248 204 249 # wait till all ProcRuns files are gone 205 if [ $divisor -gt 1 ]; then250 # if [ $divisor -gt 1 ]; then 206 251 echo "Waiting for all running jobs at step $i to end ... " | tee -a dynamic.log 207 while [ ! -z "${DIR}/ProcRuns*" ]; do 208 sleep 3 252 while [ ! -z "`find ${DIR} -name 'ProcRuns*'`" ]; do 253 #if [ ! -z "`find ${DIR} -name 'ProcRuns*'`" ]; then 254 # echo "still `ls ${DIR}/ProcRuns*` present" 255 #fi 256 sleep 1 209 257 done 210 258 echo "done." | tee -a dynamic.log 211 fi 259 # fi 260 212 261 213 262 # convert results 214 263 sleep 1 # necessary for result files to close 215 echo -n "Converting all results ... " 264 echo -n "Converting all results ... " | tee -a dynamic.log 216 265 sh $PREPARER $DIR 217 266 check | tee -a dynamic.log 218 267 219 268 # join the resulting forces into a single file 220 # cp ${DIR}/pcp.full.energy.all ${DIR}/pcp.energy.all221 # cp ${DIR}/pcp.full.forces.all ${DIR}/pcp.forces.all222 269 echo -n "Joining fragment energies ... " | tee -a dynamic.log 223 270 ${JOINER} ${DIR}/ $mainname >/dev/null 2>/dev/null … … 239 286 done 240 287 241 # draw densities of each step242 #sed -e "s#DoOutVis.*\##DoOutVis\t2\t\##" ${arg}.MD.MD >${arg}.MD243 #echo -n "Calling simulation to draw final densities of all steps ... " | tee -a dynamic.log244 #RunSim ${arg}.MD $PBS_NODEFILE245 #echo "done." | tee -a dynamic.log246 247 288 exit 0
Note:
See TracChangeset
for help on using the changeset viewer.
