Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make test_dumpRecoGeometry run faster #46080

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Fireworks/Geometry/python/dumpRecoGeometry_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def recoGeoLoad(score, properties):

if ( options.tgeo == True):
if (options.out == defaultOutputFileName ):
options.out = "cmsTGeoRecoGeom-" + str(options.tag) + ".root"
options.out = "cmsTGeoRecoGeom-" + str(options.tag) + (f"_{options.version}" if options.version else "") + ".root"
process.add_(cms.ESProducer("FWTGeoRecoGeometryESProducer",
Tracker = cms.untracked.bool(options.tracker),
Muon = cms.untracked.bool(options.muon),
Expand All @@ -232,7 +232,7 @@ def recoGeoLoad(score, properties):
)
else:
if (options.out == defaultOutputFileName ):
options.out = "cmsRecoGeom-" + str(options.tag) + ".root"
options.out = "cmsRecoGeom-" + str(options.tag) + (f"_{options.version}" if options.version else "") + ".root"
process.add_(cms.ESProducer("FWRecoGeometryESProducer",
Tracker = cms.untracked.bool(options.tracker),
Muon = cms.untracked.bool(options.muon),
Expand Down
8 changes: 7 additions & 1 deletion Fireworks/Geometry/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
<test name="test_dumpRecoGeometry" command="test_dumpRecoGeometry.sh"/>
<!-- Possible choices are "Run1" "2015" "2017" "2021" "2026" -->
<test name="test_dumpRecoGeometry_Run1" command="test_dumpRecoGeometry.sh Run1"/>
<test name="test_dumpRecoGeometry_2015" command="test_dumpRecoGeometry.sh 2015"/>
<test name="test_dumpRecoGeometry_2017" command="test_dumpRecoGeometry.sh 2017"/>
<!-- currently commented as it crashes at runtime -->
<!-- <test name="test_dumpRecoGeometry_2021" command="test_dumpRecoGeometry.sh 2021"/> -->
<test name="test_dumpRecoGeometry_2026" command="test_dumpRecoGeometry.sh 2026"/>
69 changes: 43 additions & 26 deletions Fireworks/Geometry/test/test_dumpRecoGeometry.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -x
#!/bin/bash
function die { echo $1: status $2 ; exit $2; }

# Define the base directory where the geometry files are located
Expand All @@ -7,8 +7,14 @@ if [ ! -e ${GEOMETRY_DIR} ] ; then
GEOMETRY_DIR="${CMSSW_RELEASE_BASE}/src/Configuration/Geometry/python"
fi

# Define the list of tags
TAGS=("Run1" "2015" "2017" "2026") #"2021"
# Check if the TAG is provided as an argument
if [ -z "$1" ]; then
echo "Error: No TAG provided. Usage: ./script.sh <TAG>"
exit 1
fi

# Get the TAG from the command-line argument
TAG=$1

# Function to extract the available versions for 2026
get_2026_versions() {
Expand All @@ -30,27 +36,38 @@ get_2026_versions() {
echo "${versions[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '
}

# Iterate over each tag
for TAG in "${TAGS[@]}"; do
if [ "$TAG" == "2026" ]; then
# Get all the versions for 2026
VERSIONS=($(get_2026_versions))
for VERSION in "${VERSIONS[@]}"; do
echo "Running for 2026 with version $VERSION"
cmsRun $CMSSW_BASE/src/Fireworks/Geometry/python/dumpRecoGeometry_cfg.py tag=2026 version=$VERSION
# Check the exit status of the command
if [ $? -ne 0 ]; then
echo "Error running cmsRun for tag=2026 and version=$VERSION"
exit 1
fi
done
else
echo "Running for tag $TAG"
cmsRun $CMSSW_BASE/src/Fireworks/Geometry/python/dumpRecoGeometry_cfg.py tag=$TAG
# Check the exit status of the command
if [ $? -ne 0 ]; then
echo "Error running cmsRun for tag=$TAG"
exit 1
fi
# Set the number of parallel jobs (adjust based on system resources)
MAX_JOBS=4

# Function to run cmsRun and limit parallel jobs
run_cmsrun() {
local tag=$1
local version=$2

cmsRun $CMSSW_BASE/src/Fireworks/Geometry/python/dumpRecoGeometry_cfg.py tag=$tag version=$version &

# Wait for jobs to finish if the number of background jobs reaches MAX_JOBS
while [ $(jobs -r | wc -l) -ge $MAX_JOBS ]; do
sleep 1
done
}

# Check if the tag is 2026
if [ "$TAG" == "2026" ]; then
# Get all the versions for 2026
VERSIONS=($(get_2026_versions))
for VERSION in "${VERSIONS[@]}"; do
echo "Running for 2026 with version $VERSION"
run_cmsrun "2026" "$VERSION" || die "Failure running dumpRecoGeometry_cfg.py tag=$TAG" $?
done

# Wait for all background jobs to finish
wait
else
echo "Running for tag $TAG"
cmsRun $CMSSW_BASE/src/Fireworks/Geometry/python/dumpRecoGeometry_cfg.py tag=$TAG || die "Failure running dumpRecoGeometry_cfg.py tag=$TAG" $?
if [ $? -ne 0 ]; then
echo "Error running cmsRun for tag=$TAG"
exit 1
fi
done
fi