Skip to content

Heaptrack

Introduction

Heaptrack is another memory profiler and leak checker with similar features to valgrind/massif but without its overhead. To profile an Athena job, it is necessary to directly launch it as a python script as Heaptrack seems to have problems with the exec used in the athena.py shell script:

heaptrack $(which python) yourCAJob.py

Heaptrack is included in the LCG releases, thus it will be available once asetup Athena,main,latest is launched. To conveniently analyze the results, install the heaptrack_gui (which is not part of LCG) on your development machine or use the builtin heaptrack_print.

The example usage within job transform is to first generate the pickle file (to avoid profiling the configuration step):

ATHENA_CORE_NUMBER=8 \
Reco_tf.py \
  --multithreaded \
  --AMIConfig q449 \
  --imf False \
  --maxEvents 100 \
  --preExec="flags.Exec.FPE=500;" \
  --conditionsTag CONDBR2-BLKPA-2022-17 \
  --athenaopts="--config-only=reco_q449.pkl"

and then run the heaptrack:

heaptrack "$(which python)" "$(which athena.py)" reco_q449.pkl

This will create a heaptrack.python.xxxxx.zst file (where xxxxx is the PID). From this file you can create an analysis:

heaptrack --analyze "path_to_file" > analysis.txt