Skip to content
Snippets Groups Projects
Commit b02c17f1 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

Benchmark for running time

parent c4dba70a
Branches
No related tags found
1 merge request!56Benchmark for running time
......@@ -86,6 +86,7 @@ include:
- local: 'benchmarks/zdc/config.yml'
- local: 'benchmarks/crystal_calorimeter/config.yml'
- local: 'benchmarks/pid/config.yml'
- local: 'benchmarks/timing/config.yml'
deploy_results:
stage: deploy
......
sim:timing:
extends: .det_benchmark
stage: simulate
timeout: 1 hours
script:
- bash benchmarks/timing/run_timing.sh -n "${NEVENTS}" -p "${PARTICLES}" -e "${ENERGIES}"
artifacts:
paths:
- results/
parallel:
matrix:
- PARTICLES: ["e-"]
ENERGIES: ["1*GeV"]
NEVENTS: ["1","100"]
#collect_results:timing:
# extends: .det_benchmark
# stage: collect
# needs:
# - ["sim:timing"]
# script:
# - ls -lrht
#!/bin/bash
function print_the_help {
echo "USAGE: ${0} -nevents <nevents> -p <particle> -e <energy>"
echo " OPTIONS: "
echo " -n,--nevents number of events"
echo " -p,--particle particle type"
echo " -e,--energy particle energy"
exit
}
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-n|--nevents)
nevents="$2"
shift # past argument
shift # past value
;;
-p|--particle)
particle="$2"
shift # past argument
shift # past value
;;
-e|--energy)
energy="$2"
shift
shift
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [[ ! -n "${nevents}" ]] ; then
nevents="1"
fi
if [[ ! -n "${particle}" ]] ; then
particle="e-"
fi
if [[ ! -n "${energy}" ]] ; then
energy="1*GeV"
fi
if [[ ! -n "${JUGGLER_DETECTOR}" ]] ; then
export JUGGLER_DETECTOR="athena"
fi
if [[ ! -n "${JUGGLER_DETECTOR_PATH}" ]] ; then
export JUGGLER_DETECTOR_PATH="/opt/detector/share/athena"
fi
if [[ ! -n "${JUGGLER_INSTALL_PREFIX}" ]] ; then
export JUGGLER_INSTALL_PREFIX="/usr/local"
fi
compact_path=${JUGGLER_DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml
echo "JUGGLER_DETECTOR_PATH = ${JUGGLER_DETECTOR_PATH}"
echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}"
# Run geant4 simulations
output_dir="data/timing/${particle}/${energy/\*/}"
output_file="sim_${nevents}.root"
mkdir -p ${output_dir}
timing_dir="results/timing/${particle}/${energy/\*/}"
timing_file="time_${nevents}events.log"
npsim_file="npsim_${nevents}events.log"
mkdir -p ${timing_dir}
/usr/bin/time -v -o ${timing_dir}/time_${nevents}events.log \
npsim --runType batch \
--printLevel WARNING \
--numberOfEvents ${nevents} \
--enableGun \
--gun.energy "${energy}" \
--gun.particle "${particle}" \
--gun.thetaMin "45*deg" \
--gun.thetaMax "135*deg" \
--gun.distribution "cos(theta)" \
--part.minimalKineticEnergy "1*TeV" \
--compactFile ${compact_path} \
--outputFile ${output_dir}/${output_file} \
2>&1 > ${timing_dir}/${npsim_file}
echo "For ${nevents} events:"
cat ${timing_dir}/${timing_file}
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running npsim"
exit 1
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment