Skip to content

Commit 6d2af32

Browse files
committed
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.
1 parent 8263fe7 commit 6d2af32

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎MC/bin/o2dpg_sim_workflow.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ def extractVertexArgs(configKeyValuesStr, finalDiamondDict):
461461

462462
SKIPMODULES = " ".join(["--skipModules"] + args.skipModules) if len(args.skipModules) > 0 else ""
463463
SIMENGINE=args.e
464+
# Geant4 is loaded by dlopen and needs a glibc static TLS reserve. It is set per task, because the global
465+
# environment does not replace a GLIBC_TUNABLES that already exists, as it does truncated in GRID jobs.
466+
GEANT4_TASK_ENV={'GLIBC_TUNABLES': 'glibc.rtld.optional_static_tls=32768'}
464467
BFIELD=args.field
465468
RNDSEED=args.seed # typically the argument should be the jobid, but if we get None the current time is used for the initialisation
466469
random.seed(RNDSEED)
@@ -787,6 +790,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True):
787790

788791
if not isActive('all'):
789792
BKGtask['cmd'] += ' --readoutDetectors ' + " ".join(activeDetectors)
793+
BKGtask['env'] = dict(GEANT4_TASK_ENV)
790794

791795
workflow['stages'].append(BKGtask)
792796

@@ -991,6 +995,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True):
991995
+ ' --seed ' + str(TFSEED) + ' -n ' + str(NSIGEVENTS) \
992996
+ ' --detectorList ' + args.detectorList \
993997
+ ' --fromCollContext collisioncontext.root:' + signalprefix
998+
SGNGENtask['env'] = dict(GEANT4_TASK_ENV)
994999
if GENERATOR=="hepmc":
9951000
SGNGENtask['cmd'] += "; RC=$?; ${O2DPG_ROOT}/UTILS/UpdateHepMCEventSkip.sh ../HepMCEventSkip.json " + str(tf) + '; [[ ${RC} == 0 ]]'
9961001
if sep_event_mode == True:
@@ -1021,6 +1026,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True, runcommand=True):
10211026
SGNtask['cmd'] += ' --readoutDetectors ' + " ".join(activeDetectors)
10221027

10231028
SGNtask['cmd'] += ' --fromCollContext collisioncontext.root'
1029+
SGNtask['env'] = dict(GEANT4_TASK_ENV)
10241030
workflow['stages'].append(SGNtask)
10251031

10261032
# some tasks further below still want geometry + grp in fixed names, so we provide it here

0 commit comments

Comments
 (0)