diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3372b57..27d30f33 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -125,6 +125,7 @@ include: - local: 'benchmarks/backwards_ecal/config.yml' - local: 'benchmarks/beamline/config.yml' - local: 'benchmarks/calo_pid/config.yml' + - local: 'benchmarks/campaign/config.yml' - local: 'benchmarks/ecal_gaps/config.yml' - local: 'benchmarks/tracking_detectors/config.yml' - local: 'benchmarks/tracking_performances/config.yml' @@ -139,7 +140,6 @@ include: - local: 'benchmarks/material_scan/config.yml' - local: 'benchmarks/pid/config.yml' - local: 'benchmarks/rich/config.yml' - - local: 'benchmarks/timing/config.yml' - local: 'benchmarks/b0_tracker/config.yml' - local: 'benchmarks/insert_muon/config.yml' - local: 'benchmarks/insert_tau/config.yml' @@ -161,6 +161,7 @@ deploy_results: - "collect_results:barrel_ecal" - "collect_results:beamline" - "collect_results:calo_pid" + - "collect_results:campaign" - "collect_results:ecal_gaps" - "collect_results:lfhcal" - "collect_results:material_scan" diff --git a/Snakefile b/Snakefile index 4526fcc9..78ac922e 100644 --- a/Snakefile +++ b/Snakefile @@ -35,6 +35,7 @@ include: "benchmarks/backwards_ecal/Snakefile" include: "benchmarks/barrel_ecal/Snakefile" include: "benchmarks/beamline/Snakefile" include: "benchmarks/calo_pid/Snakefile" +include: "benchmarks/campaign/Snakefile" include: "benchmarks/ecal_gaps/Snakefile" include: "benchmarks/material_scan/Snakefile" include: "benchmarks/tracking_performances/Snakefile" diff --git a/benchmarks/campaign/Snakefile b/benchmarks/campaign/Snakefile new file mode 100644 index 00000000..ed3ac506 --- /dev/null +++ b/benchmarks/campaign/Snakefile @@ -0,0 +1,81 @@ +rule campaign_run: + input: + run_script="/opt/campaigns/hepmc3/scripts/run.sh", + output: + expand( + "LOG/{{DETECTOR_VERSION}}/{{DETECTOR_CONFIG}}/{{BASENAME}}.{EXTENSION}", + EXTENSION=[ + "eicrecon.prmon.log", + "npsim.log", + "npsim.prmon.log", + "eicrecon.prmon.txt", + "npsim.prmon.json", + "hepmcmerger.prmon.txt", + "eicrecon.dot", + "hepmcmerger.prmon.json", + "eicrecon.prmon.json", + "npsim.prmon.txt", + "hepmcmerger.log", + "eicrecon.log", + ], + ), + #log: + # "log", + wildcard_constraints: + DETECTOR_VERSION="[^/]+", + DETECTOR_CONFIG="[^/]+", + params: + N_EVENTS=100, + shell: + """ +env \ + DETECTOR_VERSION={wildcards.DETECTOR_VERSION} \ + DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} \ + SLURM_TMPDIR=$PWD \ + {input.run_script} EVGEN/{wildcards.BASENAME} hepmc3.tree.root {params.N_EVENTS} +""" + + +rule campaign_prmon_plot_memory: + input: + "{PATH}.prmon.txt", + output: + "{PATH}.{MODE}.{EXTENSION}", + wildcard_constraints: + EXTENSION="(png|pdf|svg)", + MODE="(load|memory)", + shell: + """ +case "{wildcards.MODE}" in + load) + flags=( --xvar wtime --yvar utime,stime --yunit SEC --diff --stacked ) + ;; + + memory) + flags=( --xvar wtime --yvar vmem,pss,rss,swap --yunit GB ) + ;; +esac +prmon_plot.py --input "{wildcards.PATH}.prmon.txt" "${{flags[@]}}" --otype {wildcards.EXTENSION} --output "{wildcards.PATH}.{wildcards.MODE}" +""" + + +rule campaign_benchmark: + input: + expand( + "LOG/main/epic/DIS/NC/10x100/minQ2=1/pythia8NCDIS_10x100_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_1.{PROG}.{MODE}.png", + PROG=[ + "hepmcmerger", + "npsim", + "eicrecon", + ], + MODE=[ + "load", + "memory", + ], + ), + output: + directory("results/campaign"), + shell: + """ +cp {input} {output} +""" diff --git a/benchmarks/campaign/config.yml b/benchmarks/campaign/config.yml new file mode 100644 index 00000000..3d1942b2 --- /dev/null +++ b/benchmarks/campaign/config.yml @@ -0,0 +1,16 @@ +bench:campaign: + extends: .det_benchmark + stage: benchmarks + script: + - snakemake $SNAKEMAKE_FLAGS --cores 1 campaign_benchmark + +collect_results:campaign: + extends: .det_benchmark + stage: collect + needs: + - "bench:campaign" + script: + - ls -lrht + - mv results{,_save}/ # move results directory out of the way to preserve it + - snakemake $SNAKEMAKE_FLAGS --cores 1 --delete-all-output campaign_benchmark + - mv results{_save,}/ diff --git a/benchmarks/timing/config.yml b/benchmarks/timing/config.yml deleted file mode 100644 index 23b08327..00000000 --- a/benchmarks/timing/config.yml +++ /dev/null @@ -1,22 +0,0 @@ -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 diff --git a/benchmarks/timing/run_timing.sh b/benchmarks/timing/run_timing.sh deleted file mode 100755 index 0a272a2d..00000000 --- a/benchmarks/timing/run_timing.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash - -function print_the_help { - echo "USAGE: ${0} -nevents -p -e " - 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 "${DETECTOR}" ]] ; then - export DETECTOR="athena" -fi - -if [[ ! -n "${DETECTOR_PATH}" ]] ; then - export DETECTOR_PATH="/opt/detector/share/athena" -fi - -compact_path=${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml - -echo "DETECTOR_PATH = ${DETECTOR_PATH}" -echo "DETECTOR = ${DETECTOR}" - -# Run geant4 simulations -output_dir="data/timing/${particle}/${energy/\*/}" -output_file="sim_${nevents}.edm4hep.root" -mkdir -p ${output_dir} -timing_dir="results/timing/${particle}/${energy/\*/}" -timing_file="time_${nevents}events.log" -ddsim_file="npsim_${nevents}events.log" -mkdir -p ${timing_dir} -/usr/bin/time -v -o ${timing_dir}/time_${nevents}events.log \ - ddsim --runType batch \ - --printLevel WARNING \ - --filter.tracker edep0 \ - --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}/${ddsim_file} - -if [[ "$?" -ne "0" ]] ; then - echo "ERROR running npsim" - exit 1 -fi - -echo "For ${nevents} events:" -cat ${timing_dir}/${timing_file}