|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# TRACCC library, part of the ACTS project (R&D line) |
| 4 | +# |
| 5 | +# (c) 2023-2025 CERN for the benefit of the ACTS project |
| 6 | +# |
| 7 | +# Mozilla Public License Version 2.0 |
| 8 | +# |
| 9 | +# Simple script running the selected instance of the multi-threaded throughput |
| 10 | +# executable on a whole set of ITk ttbar simulations, with different pileup |
| 11 | +# values. |
| 12 | +# |
| 13 | + |
| 14 | +# Stop on errors. |
| 15 | +set -e |
| 16 | + |
| 17 | +# Function printing the usage information for the script. |
| 18 | +usage() { |
| 19 | + echo "Script running a suite of multi-threaded throughput tests" |
| 20 | + echo "" |
| 21 | + echo "Usage: traccc_throughput_mt_profiling.sh [options]" |
| 22 | + echo "" |
| 23 | + echo "Basic options:" |
| 24 | + echo " -x <executable> Selects the executable to use" |
| 25 | + echo " -i <inputDir> Selects the input directory with all files" |
| 26 | + echo " -m <minThreads> Minimum number of threads to test" |
| 27 | + echo " -t <maxThreads> Maximum number of threads to test" |
| 28 | + echo " -s <threadStep> Steps to increase the thread count by" |
| 29 | + echo " -r <repetitions> The number of repetitions in the test" |
| 30 | + echo " -e <eventMultiplier> Multiplier for the number of events per thread" |
| 31 | + echo " -c <csvFile> Name of the output CSV file" |
| 32 | + echo " -y <throughputType> Type of throughput test to run (traccc/g200/g100)" |
| 33 | + echo " -h Print this help" |
| 34 | + echo "" |
| 35 | +} |
| 36 | + |
| 37 | +# Parse the command line arguments. |
| 38 | +TRACCC_EXECUTABLE=${TRACCC_EXECUTABLE:-"traccc_throughput_mt"} |
| 39 | +TRACCC_INPUT_DIR=${TRACCC_INPUT_DIR:-"ATLAS-P2-RUN4-03-00-01/"} |
| 40 | +TRACCC_MIN_THREADS=${TRACCC_MIN_THREADS:-1} |
| 41 | +TRACCC_MAX_THREADS=${TRACCC_MAX_THREADS:-$(nproc)} |
| 42 | +TRACCC_THREAD_STEP=${TRACCC_THREAD_STEP:-1} |
| 43 | +TRACCC_REPETITIONS=${TRACCC_REPETITIONS:-5} |
| 44 | +TRACCC_CSV_FILE=${TRACCC_CSV_FILE:-"output.csv"} |
| 45 | +TRACCC_THROUGPUT_TYPE=${TRACCC_THROUGPUT_TYPE:-"traccc"} |
| 46 | +while getopts ":x:i:m:t:r:c:y:h" opt; do |
| 47 | + case $opt in |
| 48 | + x) |
| 49 | + TRACCC_EXECUTABLE=$OPTARG |
| 50 | + ;; |
| 51 | + i) |
| 52 | + TRACCC_INPUT_DIR=$OPTARG |
| 53 | + ;; |
| 54 | + m) |
| 55 | + TRACCC_MIN_THREADS=$OPTARG |
| 56 | + ;; |
| 57 | + t) |
| 58 | + TRACCC_MAX_THREADS=$OPTARG |
| 59 | + ;; |
| 60 | + s) |
| 61 | + TRACCC_THREAD_STEP=$OPTARG |
| 62 | + ;; |
| 63 | + r) |
| 64 | + TRACCC_REPETITIONS=$OPTARG |
| 65 | + ;; |
| 66 | + c) |
| 67 | + TRACCC_CSV_FILE=$OPTARG |
| 68 | + ;; |
| 69 | + y) |
| 70 | + TRACCC_THROUGPUT_TYPE=$OPTARG |
| 71 | + ;; |
| 72 | + h) |
| 73 | + usage |
| 74 | + exit 0 |
| 75 | + ;; |
| 76 | + :) |
| 77 | + echo "Argument -$OPTARG requires a parameter!" |
| 78 | + usage |
| 79 | + exit 1 |
| 80 | + ;; |
| 81 | + ?) |
| 82 | + echo "Unknown argument: -$OPTARG" |
| 83 | + usage |
| 84 | + exit 1 |
| 85 | + ;; |
| 86 | + esac |
| 87 | +done |
| 88 | + |
| 89 | +# Print the configuration received. |
| 90 | +echo "Using configuration:" |
| 91 | +echo " EXECUTABLE : ${TRACCC_EXECUTABLE}" |
| 92 | +echo " INPUT_DIR : ${TRACCC_INPUT_DIR}" |
| 93 | +echo " MIN_THREADS : ${TRACCC_MIN_THREADS}" |
| 94 | +echo " MAX_THREADS : ${TRACCC_MAX_THREADS}" |
| 95 | +echo " THREAD_STEP : ${TRACCC_THREAD_STEP}" |
| 96 | +echo " REPETITIONS : ${TRACCC_REPETITIONS}" |
| 97 | +echo " CSV_FILE : ${TRACCC_CSV_FILE}" |
| 98 | +echo " THROUGHPUT_TYPE : ${TRACCC_THROUGPUT_TYPE}" |
| 99 | + |
| 100 | +# Check whether the output file already exists. Refuse to overwrite existing |
| 101 | +# files. |
| 102 | +if [[ -f "${TRACCC_CSV_FILE}" ]]; then |
| 103 | + echo "***" |
| 104 | + echo "*** Will not overwrite ${TRACCC_CSV_FILE}!" |
| 105 | + echo "***" |
| 106 | + exit 1 |
| 107 | +fi |
| 108 | + |
| 109 | +# Additional flags tuning the cuts for the G100/G200 pipelines. |
| 110 | +G200_CUTS=(--seedfinder-z-range=-3000.:3000. |
| 111 | + --seedfinder-r-range=33.:320. |
| 112 | + --seedfinder-vertex-range=-200.:200. |
| 113 | + --seedfinder-minPt=0.9 |
| 114 | + --seedfinder-cotThetaMax=27.2899 |
| 115 | + --seedfinder-deltaR-range=20.:200. |
| 116 | + --seedfinder-impactMax=10. |
| 117 | + --seedfinder-sigmaScattering=3. |
| 118 | + --seedfinder-maxPtScattering=10. |
| 119 | + --seedfinder-maxSeedsPerSpM=1 |
| 120 | + --max-num-branches-per-seed=3 |
| 121 | + --max-num-branches-per-surface=5 |
| 122 | + --track-candidates-range=7:20 |
| 123 | + --min-step-length-for-next-surface=0.5 |
| 124 | + --max-step-counts-for-next-surface=100 |
| 125 | + --chi2-max=10. |
| 126 | + --max-num-skipping-per-cand=2 |
| 127 | + --stepping-min-stepsize=0.0001 |
| 128 | + --rk-tolerance-mm=0.0001 |
| 129 | + --stepping-path-limit=5. |
| 130 | + --stepping-max-rk-updates=10000 |
| 131 | + --stepping-use-mean-loss=1 |
| 132 | + --stepping-use-eloss-gradient=0 |
| 133 | + --stepping-use-field-gradient=0 |
| 134 | + --stepping-do-covariance-transport=1 |
| 135 | + --overstep-tolerance-um=-300. |
| 136 | + --min-mask-tolerance-mm=0.00001 |
| 137 | + --max-mask-tolerance-mm=3. |
| 138 | + --search-window=0:0) |
| 139 | + |
| 140 | +G100_CUTS=${G200_CUTS[@]} |
| 141 | +G100_CUTS+=(--reco-stage=seeding) |
| 142 | + |
| 143 | +# Select which of these flags to use. |
| 144 | +TRACCC_CUTS=() |
| 145 | +if [[ "${TRACCC_THROUGPUT_TYPE}" == "g200" ]]; then |
| 146 | + TRACCC_CUTS=${G200_CUTS[@]} |
| 147 | +elif [[ "${TRACCC_THROUGPUT_TYPE}" == "g100" ]]; then |
| 148 | + TRACCC_CUTS=${G100_CUTS[@]} |
| 149 | +elif [[ "${TRACCC_THROUGPUT_TYPE}" != "traccc" ]]; then |
| 150 | + echo "***" |
| 151 | + echo "*** Unknown throughput type: '${TRACCC_THROUGPUT_TYPE}'" |
| 152 | + echo "***" |
| 153 | + exit 1 |
| 154 | +fi |
| 155 | + |
| 156 | +# The input directories to use. |
| 157 | +TRACCC_INPUT_DIRS=("ttbar_mu140/hits" "ttbar_mu200/hits") |
| 158 | + |
| 159 | +# Put a header on the CSV file. |
| 160 | +echo "directory,threads,loaded_events,cold_run_events,processed_events,warm_up_time,processing_time" \ |
| 161 | + > "${TRACCC_CSV_FILE}" |
| 162 | + |
| 163 | +# Counter for a nice printout. |
| 164 | +COUNTER=1 |
| 165 | +COUNT=$((${#TRACCC_INPUT_DIRS[@]}*${TRACCC_MAX_THREADS}*${TRACCC_REPETITIONS})) |
| 166 | + |
| 167 | +# Iterate over the number of threads. |
| 168 | +for NTHREAD in $(seq ${TRACCC_MIN_THREADS} ${TRACCC_THREAD_STEP} ${TRACCC_MAX_THREADS}); do |
| 169 | + # Iterate over the input datasets. |
| 170 | + for EVTDIR in ${TRACCC_INPUT_DIRS[@]}; do |
| 171 | + # Perform the requested number of repetitions. |
| 172 | + for REPEAT in $(seq ${TRACCC_REPETITIONS}); do |
| 173 | + |
| 174 | + # Tell the user what's happening. |
| 175 | + echo "" |
| 176 | + echo "Running test ${COUNTER} / ${COUNT}" |
| 177 | + ((COUNTER++)) |
| 178 | + |
| 179 | + # Run the throughput test. |
| 180 | + ${TRACCC_EXECUTABLE} \ |
| 181 | + --detector-file="${TRACCC_INPUT_DIR}/ITk_DetectorBuilder_geometry.json" \ |
| 182 | + --material-file="${TRACCC_INPUT_DIR}/ITk_detector_material.json" \ |
| 183 | + --grid-file="${TRACCC_INPUT_DIR}/ITk_DetectorBuilder_surface_grids.json" \ |
| 184 | + --use-detray-detector=1 \ |
| 185 | + --digitization-file="${TRACCC_INPUT_DIR}/ITk_digitization_config_with_strips_with_shift_annulus_flip.json" \ |
| 186 | + --read-bfield-from-file \ |
| 187 | + --bfield-file="${TRACCC_INPUT_DIR}/ITk_bfield.cvf" \ |
| 188 | + --input-directory="${TRACCC_INPUT_DIR}/${EVTDIR}/" \ |
| 189 | + --use-acts-geom-source=0 \ |
| 190 | + --input-events=100 \ |
| 191 | + --cpu-threads=${NTHREAD} \ |
| 192 | + --cold-run-events=$((5*${NTHREAD})) \ |
| 193 | + --processed-events=$((100*${NTHREAD})) \ |
| 194 | + --log-file="${TRACCC_CSV_FILE}" \ |
| 195 | + ${TRACCC_CUTS[@]} |
| 196 | + done |
| 197 | + done |
| 198 | +done |
0 commit comments