Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4...

13
Running ATLAS workloads within massively parallel distributed applications using Athena Multi-Process framework (AthenaMP) Paolo Calafiura, Charles Leggett, Rolf Seuster Vakho Tsulaia , Peter Van Gemmeren For the ATLAS Collaboration CHEP 2015, Okinawa, Japan April 14, 2015

Transcript of Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4...

Page 1: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

Running ATLAS workloads within massively parallel distributed applications using Athena Multi-Process

framework (AthenaMP)

Paolo Calafiura, Charles Leggett, Rolf Seuster

Vakho Tsulaia, Peter Van Gemmeren

For the ATLAS Collaboration

CHEP 2015, Okinawa, JapanApril 14, 2015

Page 2: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015

• Motivation✔ ATLAS reconstruction is memory-hungry✔ We needed to have a mechanism for optimizing memory footprint without

touching the algorithmic code-base

• AthenaMP leverages Linux Copy-On-Write for sharing memory pages between processes, which were forked from the same master process

✔ Thus the memory sharing comes “for free”

• Originally implemented as Python layer✔ Presented at CHEP 2009:

“Harnessing multicores: strategies and implementations in ATLAS”, S.Binet et al.

• Later on completely rewritten in C++ to follow Gaudi Component Model

• Currently being actively used for running ATLAS production jobs on multi-core resources on the Grid

- 2 -

History of AthenaMP

Page 3: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015- 3 -

Workflow

• The master process goes through the initialization phase and then forks N sub-processes (workers)

• By delaying fork as much as possible, we increase the amount of memory shared between the workers

• AthenaMP implements different strategies for scheduling workload to the worker processes. Each of these strategies is implemented by a specialized Gaudi AlgTool

• The workers retrieve event data independently from each other. They process events and write their own output files to the disc

• After all events assigned to the given job have been processed, the master usually proceeds with merging workers' outputs (for certain types of jobs the merge step is omitted)

Schematic View of ATLAS AthenaMP

Page 4: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015- 4 -

Saving memory

• Memory optimization for ATLAS digitization + reconstruction jobs

• RSS of 8 serial jobs compared to RSS of one AthenaMP job with 8 workers

• Actual memory savings depend on the job type and configuration

• In this example memory optimized by 45% at reconstruction step

• This plot was obtaining by running test jobs on otherwise empty machine and profiling system memory with free

Page 5: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015

• The complexity of ATLAS Event Data Model does not allow us to directly exchange event data objects between processes

✔ We intend to work on the ATLAS persistency infrastructure in order to address this issue

• For the time being, AthenaMP delivers workload to the worker processes in the form of event identifiers – either integers (event position in the input file) or strings (unique event token)

✔ In case of RAW data reconstruction we can also use the event data itself, in the form of void* memory buffer

• For each of the above scenarios AthenaMP uses a special auxiliary process, which distributes event identifiers/data between worker processes

● The sub-processes of AthenaMP communicate to each other using IPC mechanisms (shared memory, shared queue)

- 5 -

Assigning workloads to the worker processes

Page 6: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015

• AthenaMP uses shared event queue for distributing event numbers – either individually or in chunks – between worker processes

• The events are assigned to workers on the “first come first served” basis✔ A worker pulls new event from the queue after it finished processing the

previous one

• Such dynamic distribution of the workload guarantees load balancing on the workers

• Shared event queue is the default strategy for running AthenaMP jobs on the Grid

- 6 -

Distributing event numbers. Shared Queue

Page 7: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015

• Today ATLAS runs asubstantial fraction of itsproduction workloads onthe Grid using AthenaMP

• The workloads include(but are not limited to) Geant4 simulation and simulated data reconstruction

- 7 -

AthenaMP on the Grid

Number of CPU cores used by ATLAS production jobs

Serial MP

• The plot shows the number of CPU-cores used by ATLAS production jobs – serial and MP – on the Grid during one week in February-March 2015

Page 8: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015

• Event Service – a new approach to event processing in ATLAS✔ Job granularity changes from files to individual events✔ Deliver only those events to a compute node, which will be processed there by

the payload application, don't stage in entire input files

• Event Service is agile and efficient in exploring diverse, distributed, potentially short-lived (opportunistic) resources: “conventional resources” (Grid), supercomputers, spot market clouds, volunteer computing

• For more details about Event Service see the presentation by Torre Wenaus at CHEP2015: “The ATLAS Event Service: A new approach to event processing” (Contribution #183)

• Today's implementation of the Event Service uses AthenaMP as payload application for event processing

- 8 -

AthenaMP and the ATLAS Event Service

Page 9: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015- 9 -

AthenaMP and the ATLAS Event Service (2)

• For the Event Service AthenaMP uses the strategy of distributing event tokens to the worker processes

• The tokens are retrieved from external source by a specialized AthenaMP sub-process Token Scatterer

• Workers retrieve event data using the token. Data may be local or remote

• AthenaMP is configured to write new output file for each processed event range

• The latter functionality is implemented by the Output File Sequencer – a new mechanism developed in ATLAS, which is currently being used only by AthenaMP within Event Service

Page 10: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015

AthenaMP and Yoda

• Yoda – MPI-based implementation of the Event Service, designed to run on supercomputer systems with no internet connection from the compute nodes

• Yoda relies on MPI communications between its components, unlike HTTP communications used by the conventional Event Service

• For more information about Yoda see the presentation by V. Tsulaia at CHEP2015: “Fine grained event processing on HPCs with the ATLAS Yoda system” (Contribution #140)

• Payload components (AthenaMP) of the conventional event service and Yoda are absolutely identical

Page 11: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015

• “Killable queue” test on Edison HPC at NERSC (Berkeley, USA), November, 2015

• As the machine is emptied either for downtime or for large usage block (“reservation”), a “killable” queue makes transient cycles available

• Yoda uses the opportunistically for running its payloads at large scale

• Up to 3K instances of AthenaMP (72K workers) running simultaneously

- 11 -

Massively parallel event processing

Edison is getting ready for the reservation

Reservation time Machine Downtime

ATLAS Payload

Page 12: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015

• Current implementation of event data reading in AthenaMP is rather inefficient✔ Each worker reads event data separately from other workers✔ As a result, for the same basket we have many duplicate reads and decompressions

(wasting CPU), and the decompressed baskets are held in the memory of each worker (wasting memory)

● This problem can be addressed by using event ranges that match the ROOT basket size

• In order to optimize this process we plan to implement a Shared Event Reader (aka Event Source) process

✔ Single place for reading input data objects and decompressing ROOT baskets

• We also plan to develop a Shared Event Writer (aka Event Sink) process, for collecting output objects from the workers on-the-fly and writing out a single output file

✔ Eliminates the need to merge workers' output files

• Finally, the ATLAS meta-data infrastructure needs to be thoroughly changed in order to cope with fine-grained workloads, file sequencing and merging

- 12 -

Future developments

Page 13: Running ATLAS workloads within massively parallel distributed … · 2015-03-25 · Geant4 simulation and simulated data reconstruction - 7 - ... • The plot shows the number of

V.Tsulaia, ATLAS, CHEP 2015

Summary

• AthenaMP is the only parallel solution available for running ATLAS workloads on multi-core resources during LHC Run2

• After successfully passing the physics validation procedure, AthenaMP is currently widely used on the Grid

● AthenaMP has also become the event processing component of recently developed ATLAS Event Service – our approach to running ATLAS workloads on opportunistic resources

• Recent tests on supercomputers at NERSC demonstrated, that AthenaMP can run efficiently within distributed applications at large scale

- 13 -