From 4e99fac73bd73c13eed6d8a03719ed11610ab891 Mon Sep 17 00:00:00 2001 From: maciacco Date: Tue, 29 Oct 2024 19:19:55 +0100 Subject: [PATCH 1/3] enable parallel world inanchored simulation --- MC/bin/o2dpg_sim_workflow_anchored.py | 5 +++- MC/run/ANCHOR/anchorMC.sh | 28 ++++++++++++------- .../tests/test_anchor_2023_apass2_pp.sh | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/MC/bin/o2dpg_sim_workflow_anchored.py b/MC/bin/o2dpg_sim_workflow_anchored.py index 7aa1285d7..024f8bc44 100755 --- a/MC/bin/o2dpg_sim_workflow_anchored.py +++ b/MC/bin/o2dpg_sim_workflow_anchored.py @@ -312,6 +312,7 @@ def main(): parser.add_argument("-tf", type=int, help="number of timeframes per job", default=1) parser.add_argument("--ccdb-IRate", type=bool, help="whether to try fetching IRate from CCDB/CTP", default=True) parser.add_argument("--trig-eff", type=float, dest="trig_eff", help="Trigger eff needed for IR", default=-1.0) + parser.add_argument("-enable-parallel-world", type=int, dest="enable_parallel_world", help="Enable parallel geometry", default=0) parser.add_argument('forward', nargs=argparse.REMAINDER) # forward args passed to actual workflow creation args = parser.parse_args() print (args) @@ -398,8 +399,10 @@ def main(): # we finally pass forward to the unanchored MC workflow creation # TODO: this needs to be done in a pythonic way clearly # NOTE: forwardargs can - in principle - contain some of the arguments that are appended here. However, the last passed argument wins, so they would be overwritten. + pw_str = str(args.enable_parallel_world) forwardargs += " -tf " + str(args.tf) + " --sor " + str(run_start) + " --timestamp " + str(timestamp) + " --production-offset " + str(prod_offset) + " -run " + str(args.run_number) + " --run-anchored --first-orbit " \ - + str(GLOparams["FirstOrbit"]) + " -field ccdb -bcPatternFile ccdb" + " --orbitsPerTF " + str(GLOparams["OrbitsPerTF"]) + " -col " + str(ColSystem) + " -eCM " + str(eCM) + ' --readoutDets ' + GLOparams['detList'] + + str(GLOparams["FirstOrbit"]) + " -field ccdb -bcPatternFile ccdb" + " --orbitsPerTF " + str(GLOparams["OrbitsPerTF"]) + " -col " + str(ColSystem) + " -eCM " + str(eCM) + ' --readoutDets ' + GLOparams['detList'] \ + + ' -confKey \"GeometryManagerParam.useParallelWorld=' + pw_str + ';GeometryManagerParam.usePwGeoBVH=' + pw_str + ';GeometryManagerParam.usePwCaching=' + pw_str + '\"' print ("forward args ", forwardargs) cmd = "${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py " + forwardargs print ("Creating time-anchored workflow...") diff --git a/MC/run/ANCHOR/anchorMC.sh b/MC/run/ANCHOR/anchorMC.sh index 3c7b52336..b8417208d 100755 --- a/MC/run/ANCHOR/anchorMC.sh +++ b/MC/run/ANCHOR/anchorMC.sh @@ -210,7 +210,7 @@ MODULES="--skipModules ZDC" ALICEO2_CCDB_LOCALCACHE=${ALICEO2_CCDB_LOCALCACHE:-$(pwd)/ccdb} # these arguments will be digested by o2dpg_sim_workflow_anchored.py -baseargs="-tf ${NTIMEFRAMES} --split-id ${SPLITID} --prod-split ${PRODSPLIT} --cycle ${CYCLE} --run-number ${ALIEN_JDL_LPMRUNNUMBER}" +baseargs="-enable-parallel-world ${ENABLE_PARALLEL_WORLD} -tf ${NTIMEFRAMES} --split-id ${SPLITID} --prod-split ${PRODSPLIT} --cycle ${CYCLE} --run-number ${ALIEN_JDL_LPMRUNNUMBER}" # these arguments will be passed as well but only evetually be digested by o2dpg_sim_workflow.py which is called from o2dpg_sim_workflow_anchored.py remainingargs="-seed ${SEED} -ns ${NSIGEVENTS} --include-local-qc --pregenCollContext" @@ -235,20 +235,28 @@ TIMESTAMP=`grep "Determined timestamp to be" timestampsampling_${ALIEN_JDL_LPMRU echo_info "TIMESTAMP IS ${TIMESTAMP}" # -- Create aligned geometry using ITS ideal alignment to avoid overlaps in geant -CCDBOBJECTS_IDEAL_MC="ITS/Calib/Align" -TIMESTAMP_IDEAL_MC=1 -${O2_ROOT}/bin/o2-ccdb-downloadccdbfile --host http://alice-ccdb.cern.ch/ -p ${CCDBOBJECTS_IDEAL_MC} -d ${ALICEO2_CCDB_LOCALCACHE} --timestamp ${TIMESTAMP_IDEAL_MC} -CCDB_RC="${?}" -if [ ! "${CCDB_RC}" == "0" ]; then - echo_error "Problem during CCDB prefetching of ${CCDBOBJECTS_IDEAL_MC}. Exiting." - exit ${CCDB_RC} +if [ "${ENABLE_PARALLEL_WORLD}" == "0" ]; then + CCDBOBJECTS_IDEAL_MC="ITS/Calib/Align" + TIMESTAMP_IDEAL_MC=1 + ${O2_ROOT}/bin/o2-ccdb-downloadccdbfile --host http://alice-ccdb.cern.ch/ -p ${CCDBOBJECTS_IDEAL_MC} -d ${ALICEO2_CCDB_LOCALCACHE} --timestamp ${TIMESTAMP_IDEAL_MC} + CCDB_RC="${?}" + if [ ! "${CCDB_RC}" == "0" ]; then + echo_error "Problem during CCDB prefetching of ${CCDBOBJECTS_IDEAL_MC}. Exiting." + exit ${CCDB_RC} + fi fi # TODO This can potentially be removed or if needed, should be taken over by o2dpg_sim_workflow_anchored.py and O2_dpg_workflow_runner.py -echo "run with echo in pipe" | ${O2_ROOT}/bin/o2-create-aligned-geometry-workflow --configKeyValues "HBFUtils.startTime=${TIMESTAMP}" --condition-remap=file://${ALICEO2_CCDB_LOCALCACHE}=ITS/Calib/Align -b --run +if [ "${ENABLE_PARALLEL_WORLD}" == "0" ]; then + echo "run with echo in pipe" | ${O2_ROOT}/bin/o2-create-aligned-geometry-workflow --configKeyValues "HBFUtils.startTime=${TIMESTAMP}" --condition-remap=file://${ALICEO2_CCDB_LOCALCACHE}=ITS/Calib/Align -b --run +else + echo "run with echo in pipe" | ${O2_ROOT}/bin/o2-create-aligned-geometry-workflow --configKeyValues "HBFUtils.startTime=${TIMESTAMP}" -b --run +fi mkdir -p $ALICEO2_CCDB_LOCALCACHE/GLO/Config/GeometryAligned ln -s -f $PWD/o2sim_geometry-aligned.root $ALICEO2_CCDB_LOCALCACHE/GLO/Config/GeometryAligned/snapshot.root -[[ -f $PWD/its_GeometryTGeo.root ]] && mkdir -p $ALICEO2_CCDB_LOCALCACHE/ITS/Config/Geometry && ln -s -f $PWD/its_GeometryTGeo.root $ALICEO2_CCDB_LOCALCACHE/ITS/Config/Geometry/snapshot.root +if [ "${ENABLE_PARALLEL_WORLD}" == "0" ]; then + [[ -f $PWD/its_GeometryTGeo.root ]] && mkdir -p $ALICEO2_CCDB_LOCALCACHE/ITS/Config/Geometry && ln -s -f $PWD/its_GeometryTGeo.root $ALICEO2_CCDB_LOCALCACHE/ITS/Config/Geometry/snapshot.root +fi [[ -f $PWD/mft_GeometryTGeo.root ]] && mkdir -p $ALICEO2_CCDB_LOCALCACHE/MFT/Config/Geometry && ln -s -f $PWD/mft_GeometryTGeo.root $ALICEO2_CCDB_LOCALCACHE/MFT/Config/Geometry/snapshot.root # -- RUN THE MC WORKLOAD TO PRODUCE AOD -- diff --git a/MC/run/ANCHOR/tests/test_anchor_2023_apass2_pp.sh b/MC/run/ANCHOR/tests/test_anchor_2023_apass2_pp.sh index 9d8378044..cc8343411 100755 --- a/MC/run/ANCHOR/tests/test_anchor_2023_apass2_pp.sh +++ b/MC/run/ANCHOR/tests/test_anchor_2023_apass2_pp.sh @@ -30,6 +30,8 @@ export SEED=5 # for pp and 50 events per TF, we launch only 4 workers. export NWORKERS=2 +export ENABLE_PARALLEL_WORLD=1 + # run the central anchor steering script; this includes # * derive timestamp # * derive interaction rate From a83cd58fe411160d52dd2384a5269a5bc7f2fffa Mon Sep 17 00:00:00 2001 From: maciacco Date: Tue, 19 Nov 2024 16:46:42 +0100 Subject: [PATCH 2/3] direct forward of parallel world configuration --- MC/bin/o2dpg_sim_workflow_anchored.py | 7 ++----- MC/run/ANCHOR/anchorMC.sh | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/MC/bin/o2dpg_sim_workflow_anchored.py b/MC/bin/o2dpg_sim_workflow_anchored.py index 024f8bc44..5984a52e6 100755 --- a/MC/bin/o2dpg_sim_workflow_anchored.py +++ b/MC/bin/o2dpg_sim_workflow_anchored.py @@ -312,7 +312,6 @@ def main(): parser.add_argument("-tf", type=int, help="number of timeframes per job", default=1) parser.add_argument("--ccdb-IRate", type=bool, help="whether to try fetching IRate from CCDB/CTP", default=True) parser.add_argument("--trig-eff", type=float, dest="trig_eff", help="Trigger eff needed for IR", default=-1.0) - parser.add_argument("-enable-parallel-world", type=int, dest="enable_parallel_world", help="Enable parallel geometry", default=0) parser.add_argument('forward', nargs=argparse.REMAINDER) # forward args passed to actual workflow creation args = parser.parse_args() print (args) @@ -399,14 +398,12 @@ def main(): # we finally pass forward to the unanchored MC workflow creation # TODO: this needs to be done in a pythonic way clearly # NOTE: forwardargs can - in principle - contain some of the arguments that are appended here. However, the last passed argument wins, so they would be overwritten. - pw_str = str(args.enable_parallel_world) forwardargs += " -tf " + str(args.tf) + " --sor " + str(run_start) + " --timestamp " + str(timestamp) + " --production-offset " + str(prod_offset) + " -run " + str(args.run_number) + " --run-anchored --first-orbit " \ - + str(GLOparams["FirstOrbit"]) + " -field ccdb -bcPatternFile ccdb" + " --orbitsPerTF " + str(GLOparams["OrbitsPerTF"]) + " -col " + str(ColSystem) + " -eCM " + str(eCM) + ' --readoutDets ' + GLOparams['detList'] \ - + ' -confKey \"GeometryManagerParam.useParallelWorld=' + pw_str + ';GeometryManagerParam.usePwGeoBVH=' + pw_str + ';GeometryManagerParam.usePwCaching=' + pw_str + '\"' + + str(GLOparams["FirstOrbit"]) + " -field ccdb -bcPatternFile ccdb" + " --orbitsPerTF " + str(GLOparams["OrbitsPerTF"]) + " -col " + str(ColSystem) + " -eCM " + str(eCM) + ' --readoutDets ' + GLOparams['detList'] print ("forward args ", forwardargs) cmd = "${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py " + forwardargs print ("Creating time-anchored workflow...") os.system(cmd) if __name__ == "__main__": - sys.exit(main()) + sys.exit(main()) \ No newline at end of file diff --git a/MC/run/ANCHOR/anchorMC.sh b/MC/run/ANCHOR/anchorMC.sh index b8417208d..1bc96c8c0 100755 --- a/MC/run/ANCHOR/anchorMC.sh +++ b/MC/run/ANCHOR/anchorMC.sh @@ -210,12 +210,13 @@ MODULES="--skipModules ZDC" ALICEO2_CCDB_LOCALCACHE=${ALICEO2_CCDB_LOCALCACHE:-$(pwd)/ccdb} # these arguments will be digested by o2dpg_sim_workflow_anchored.py -baseargs="-enable-parallel-world ${ENABLE_PARALLEL_WORLD} -tf ${NTIMEFRAMES} --split-id ${SPLITID} --prod-split ${PRODSPLIT} --cycle ${CYCLE} --run-number ${ALIEN_JDL_LPMRUNNUMBER}" +baseargs="-tf ${NTIMEFRAMES} --split-id ${SPLITID} --prod-split ${PRODSPLIT} --cycle ${CYCLE} --run-number ${ALIEN_JDL_LPMRUNNUMBER}" # these arguments will be passed as well but only evetually be digested by o2dpg_sim_workflow.py which is called from o2dpg_sim_workflow_anchored.py remainingargs="-seed ${SEED} -ns ${NSIGEVENTS} --include-local-qc --pregenCollContext" remainingargs="${remainingargs} -e ${ALIEN_JDL_SIMENGINE} -j ${NWORKERS}" remainingargs="${remainingargs} -productionTag ${ALIEN_JDL_LPMPRODUCTIONTAG:-alibi_anchorTest_tmp}" +remainingargs="${remainingargs} -confKey \"GeometryManagerParam.useParallelWorld=${ENABLE_PARALLEL_WORLD};GeometryManagerParam.usePwGeoBVH=${ENABLE_PARALLEL_WORLD};GeometryManagerParam.usePwCaching=${ENABLE_PARALLEL_WORLD}\"" # prepend(!) ALIEN_JDL_ANCHOR_SIM_OPTIONS # since the last passed argument wins, e.g. -productionTag cannot be overwritten by the user remainingargs="${ALIEN_JDL_ANCHOR_SIM_OPTIONS} ${remainingargs} --anchor-config config-json.json" From 2423a154a0f0d1a2040aab27573a2109a8f0c179 Mon Sep 17 00:00:00 2001 From: maciacco Date: Tue, 19 Nov 2024 16:53:46 +0100 Subject: [PATCH 3/3] add empty line at the end --- MC/bin/o2dpg_sim_workflow_anchored.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MC/bin/o2dpg_sim_workflow_anchored.py b/MC/bin/o2dpg_sim_workflow_anchored.py index 5984a52e6..7aa1285d7 100755 --- a/MC/bin/o2dpg_sim_workflow_anchored.py +++ b/MC/bin/o2dpg_sim_workflow_anchored.py @@ -406,4 +406,4 @@ def main(): os.system(cmd) if __name__ == "__main__": - sys.exit(main()) \ No newline at end of file + sys.exit(main())