Created
December 16, 2015 23:38
-
-
Save ftessier/f78d5e43b0b1e66959cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##################################################################################### | |
# | |
# usage: | |
# | |
# dosxyz-parallel <input> <pegs> <n> | |
# | |
# input: basename of input.template input file | |
# pegs: pegs file to use | |
# n: number of jobs | |
# | |
##################################################################################### | |
# parse command-line arguments | |
template=$1 | |
pegs=$2 | |
n=$3 | |
# launch n jobs, in the background | |
echo | |
echo "dosxyznrc -i $template -p $pegs (split in $n jobs)" | |
echo -------------------------------------------------------------------------------- | |
for i in `seq $n`; do | |
splitname=${template}_w$i | |
cat $template.template | sed "s/@irestart/0/" > $splitname.egsinp | |
dosxyznrc -i $splitname -p $pegs -b -P 1 -j $i -f $i >/dev/null 2>&1 & | |
processid=`printf %5d $!` | |
echo "LAUNCHED $processid: dosxyznrc -i $splitname -p $pegs -b -P 1 -j $i -f $i &" | |
done | |
# wait for completion and combine | |
wait | |
# combine results | |
for i in `seq $n`; do | |
\mv ${template}_w${i}_w${i}.pardose ${template}_w${i}.pardose | |
\rm ${template}_w${i}_w${i}.* | |
cat $template.template | sed "s/@irestart/4/" > $template.egsinp | |
done | |
dosxyznrc -i $template -p $pegs >$template.egslog & | |
processid=`printf %5d $!` | |
echo "LAUNCHED $processid: dosxyznrc -i $template -p $pegs (combine results)" | |
# end | |
echo -------------------------------------------------------------------------------- | |
echo "SIMULATION COMPLETED (results in $template.egslog and $template.3ddose)" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment