From 6d2af32211027d405c0452540c9a5ef29b88a053 Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Wed, 11 Nov 2026 13:32:16 +0100 Subject: [PATCH] Set the static TLS reserve for Geant4 in the simulation tasks This fixes o2-sim in GRID jobs, where Geant4 cannot be loaded since it uses the initial-exec TLS model. - GLIBC_TUNABLES arrives truncated in GRID jobs, so glibc gets no static TLS reserve. - sgngen, sgnsim and bkgsim now set it in their task environment. - The global init environment would not replace a variable that already exists. --- MC/bin/o2dpg_sim_workflow.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MC/bin/o2dpg_sim_workflow.py b/MC/bin/o2dpg_sim_workflow.py index 89d98cede..ced94ae22 100755 --- a/MC/bin/o2dpg_sim_workflow.py +++ b/MC/bin/o2dpg_sim_workflow.py @@ -461,6 +461,9 @@ def extractVertexArgs(configKeyValuesStr, finalDiamondDict): SKIPMODULES = " ".join(["--skipModules"] + args.skipModules) if len(args.skipModules) > 0 else "" SIMENGINE=args.e +# Geant4 is loaded by dlopen and needs a glibc static TLS reserve. It is set per task, because the global +# environment does not replace a GLIBC_TUNABLES that already exists, as it does truncated in GRID jobs. +GEANT4_TASK_ENV={'GLIBC_TUNABLES': 'glibc.rtld.optional_static_tls=32768'} BFIELD=args.field RNDSEED=args.seed # typically the argument should be the jobid, but if we get None the current time is used for the initialisation random.seed(RNDSEED) @@ -787,6 +790,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True): if not isActive('all'): BKGtask['cmd'] += ' --readoutDetectors ' + " ".join(activeDetectors) + BKGtask['env'] = dict(GEANT4_TASK_ENV) workflow['stages'].append(BKGtask) @@ -991,6 +995,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True): + ' --seed ' + str(TFSEED) + ' -n ' + str(NSIGEVENTS) \ + ' --detectorList ' + args.detectorList \ + ' --fromCollContext collisioncontext.root:' + signalprefix + SGNGENtask['env'] = dict(GEANT4_TASK_ENV) if GENERATOR=="hepmc": SGNGENtask['cmd'] += "; RC=$?; ${O2DPG_ROOT}/UTILS/UpdateHepMCEventSkip.sh ../HepMCEventSkip.json " + str(tf) + '; [[ ${RC} == 0 ]]' if sep_event_mode == True: @@ -1021,6 +1026,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True): SGNtask['cmd'] += ' --readoutDetectors ' + " ".join(activeDetectors) SGNtask['cmd'] += ' --fromCollContext collisioncontext.root' + SGNtask['env'] = dict(GEANT4_TASK_ENV) workflow['stages'].append(SGNtask) # some tasks further below still want geometry + grp in fixed names, so we provide it here