Skip to content

Commit

Permalink
[runcard] improve lauX.sh to support <-FORTRAN|-CUDA|-CPP> options (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
valassi committed Jun 11, 2023
1 parent e0473e6 commit d55bca7
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions epochX/cudacpp/tlau/lauX.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@

set -e # fail on error

function usage()
{
echo "Usage: $0 <-FORTRAN|-CUDA|-CPP>"
exit 1
}

bckend=
while [ "$1" != "" ]; do
if [ "$1" == "-FORTRAN" ] || [ "$1" == "-CUDA" ] || [ "$1" == "-CPP" ]; then
if [ "$bckend" == "" ]; then bckend=${1/-/}; else echo "ERROR! Backend already set"; usage; fi
shift
else
echo "ERROR! Invalid option '$1'"
usage
fi
done
if [ "$bckend" == "" ]; then echo "ERROR! No backend was specified"; usage; fi

proc=gg_tt.mad

cd $(dirname $0)/..
Expand All @@ -24,12 +42,17 @@ function lauX_cleanup()
lauX_cleanup
rm -f SubProcesses/ME5_debug
cp SubProcesses/randinit SubProcesses/randinit.BKP # save the initial randinit
cp Cards/run_card.dat Cards/run_card.dat.BKP # save the initial run_card.dat

# Set the backend in run_card.dat
sed -i "s/FORTRAN = cudacpp_backend/${bckend} = cudacpp_backend/" Cards/run_card.dat

# Launch (generate_events)
set -x # verbose
###set -x # verbose
MG5AMC_CARD_PATH=$(pwd)/Cards ./bin/generate_events -f # (BUG #683: this does not return an error code even if it fails)
set +x # not verbose
###set +x # not verbose

# Cleanup after launch
lauX_cleanup
mv SubProcesses/randinit.BKP SubProcesses/randinit # restore the initial randinit
mv Cards/run_card.dat.BKP Cards/run_card.dat # restore the initial run_card.dat

0 comments on commit d55bca7

Please sign in to comment.