Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2...

32
Synergia2 general release and benchmarking effort for CERN HL-LHC James Amundson and Eric Stern, et al. Fermilab July 11, 2013 James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 1/29 1 / 29

Transcript of Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2...

Page 1: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Synergia2 general release and benchmarking effortfor CERN HL-LHC

James Amundson and Eric Stern, et al.

Fermilab

July 11, 2013

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 1/29

1/29

Page 2: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Origin

Slightly modified version of talk given at

Space Charge 2013CERN, April 16-19

http://indico.cern.ch/conferenceDisplay.py?confId=221441

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 2/29

2/29

Page 3: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Synergia

• Accelerator simulation package◦ independent-particle physics

• linear or nonlinear

◦ collective effects• simple or computationally intensive

◦ can go from simple to complex, changing one thing at a time

• Goal: best available physics models◦ best may or may not mean computationally intensive

https://cdcvs.fnal.gov/redmine/projects/synergia2/wiki

• Designed for range of computing resources◦ laptops and desktops◦ clusters◦ supercomputers

• Goal: best available computer science for performance◦ significant interaction with computer science community

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 3/29

3/29

Page 4: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Personnel

Synergia is developed and maintained by theScientific Computing Division’s

Computational Physics for Accelerators groupvirtual member of APC

James Amundson, Paul Lebrun, Qiming Lu, Alex Macridin,Leo Michelotti (CHEF), Chong Shik Park, Panagiotis Spentzouris and

Eric Stern

With development contributions from Tech-X: Steve Goldhaber

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 4/29

4/29

Page 5: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Physics

• Single-particle physics are provided by CHEF◦ direct symplectic tracking

• magnets, cavities, drifts, etc.

◦ (and/or) arbitrary-order polynomial maps◦ many advanced analysis features

• nonlinear map analysis, including normal forms• lattice functions (multiple definitions)• tune and chromaticity calculation and adjustment• etc.

• Apertures

• Collective effects (single and multiple bunches)◦ space charge (3D, 2.5D, semi-analytic, multiple boundary conditions)◦ wake fields

• can accommodate arbitrary wake functions

◦ electron cloud

• proof of principle only

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 5/29

5/29

Page 6: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Space charge in Synergia

Variety of boundary conditions and levels of approximation

• 3D open transverse boundary conditions◦ Hockney algorithm◦ open or periodic longitudinally

• 3D conducting rectangular transverse boundary◦ periodic longitudinally

• 3D conducting circular transverse boundary◦ periodic longitudinally

• 2.5D open boundary conditions◦ 2D calculation, scaled by density in longitudinal slices

• 2D semi-analytic◦ uses Bassetti-Erskine formula◦ σx and σy calculated on-the-fly

• New space charge models can be implemented by the end user

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 6/29

6/29

Page 7: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Synergia aperture model

• Apertures can be associatedwith elements and/or steps

• 2D model◦ could be extended with slices

• Geometric◦ circular◦ elliptical◦ rectangular◦ polygon◦ wire

• Abstract◦ phase space◦ Lambertson

• removes particles

• New apertures can beimplemented by the end user

Engineering drawing of FNALDebuncher quad cross section

Synergia implementation:detailed, but fast

(inscribed circle optimization)

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 7/29

7/29

Page 8: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Synergia 2.1 design

• Synergia 2.1 is a major milestone◦ very different from Synergia 1◦ significantly different from Synergia 2◦ designed for widespread use

• Synergia is a mix of C++ and Python◦ all computationally-intensive code is written in C++◦ user-created simulations are usually written in Python

• pure-C++ simulations are possible

• Synergia provides a set of functions and classes for creatingsimulations◦ many examples available

• Virtually every aspect of Synergia is designed to be extendable bythe end-user◦ code in C++ and/or Python

• Synergia 2.1 is in beta release

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 8/29

8/29

Page 9: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Synergia simulations• A simulation consists of propagating a Bunch (or Bunches)

through a Lattice.• Inputs: machine lattice, initial bunch parameters• Outputs: user-selected Diagnostics.

• Diagnostics◦ 6D means◦ 6D std deviations◦ 6x6 covariance matrix◦ 6x6 correlation matrix◦ individual particle tracks◦ dump of all particles◦ losses at locations in lattice◦ can be extended. . .

• Actions can specify whenDiagnostics will be applied◦ every n steps◦ every m turns◦ at specified sets of steps◦ at specified sets of turns◦ by user-specified logic◦ more

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 9/29

9/29

Page 10: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Feature: checkpointing

• Synergia simulations can be saved to disk (checkpointed) at anypoint◦ allows recovery from hardware failure◦ allows jobs that take longer than batch queue limits

• All simulation objects can be checkpointed◦ even, e.g., objects with open files

• Checkpointing available for both C++ and Python objects◦ including end-user objects

• User specifies parameters◦ every n turns◦ do p out of q total turns◦ send a message to stop at the end of next turn

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 10/29

10/29

Page 11: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Feature: scalability

• Why?◦ statistics (many particles)◦ multiple bunches◦ take advantage of modern

computing resources

• I use Synergia every day on asingle CPU

• Synergia can take advantage ofmultiple cores on a single CPU

• We regularly run Synergia using256 cores of a Linux cluster

• Single-bunch Synergiasimulations scale well to over1024 cores on supercomputerssuch as IBM BlueGene or CrayXT

••

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 11/29

11/29

Page 12: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Weak scaling• Multi-bunch Synergia simulations have been shown to scale to

131,072 cores on Argonne Leadership Computing Facility’sIntrepid, a BlueGene/P supercomputer◦ > 1010 particles◦ INCITE13: 80M hours (> 9000 cores continuously)

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 12/29

12/29

Page 13: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Strong scaling• Single-bunch Synergia simulations have been shown to scale past

8192 cores on ALCF’s Mira, a BlueGene/Q supercomputer◦ Strong scaling, i.e., fixed problem size

• (32 × 32 × 1024 grid, 100 grid cells per particle, trivial apertures)

Number of Cores

Tim

e to S

olu

tion (

s)

1e0

1e1

1e2

1e3

1e4

16 32 64 128 256 512 1k 2k 4k 8k 16k

Propagate Total (actual)Propagate Total (ideal)Collective Ops.Independent Ops.Charge Deposition

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 12/29

12/29

Page 14: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Intrepid Today

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 13/29

13/29

Page 15: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Main Injector + Booster = 90%

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 14/29

14/29

Page 16: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Status

Synergia 2.1 is being used for allproduction work in our group.

• Main Injector◦ space charge, multipoles,

detailed apertures, orbit bumps

• Booster◦ space charge, wakes, 84

bunches

• Debuncher (Mu2e)◦ space charge, ramping,

resonant extraction

• Hybrid MPI-OpenMP andMPI-GPU versions

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 15/29

15/29

Page 17: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Requested upgrades for CERN acceleratorsIn Fall 2012 we received a list of requests for Synergia in order to beuseful for LIU. Some were already available, some were already on theto do list, a few were new.Status:• Read MadX lattice files

◦ Done. Was on to-do list.• Higher harmonics in RF cavities

◦ Done. Was on to-do list.• Test particle tracking

◦ New feature. In progress.• Bend edge effects

◦ New feature.• Foils

◦ New feature. Need to choose model.• Manual

◦ Started! Biggest item on to-do list.• http://compacc.fnal.gov/~amundson/html/

• Validation with space charge trapping benchmark.◦ See next slides...

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 16/29

16/29

Page 18: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Space charge trapping benchmark

• We do a great deal of testing inSynergia◦ ≈ 80k lines of code

• excluding CHEF

◦ > 40% tests

However, it is important to show that we can reproduce non-trivialsimulations done with other programs.

• Space charge trapping benchmark in GSI SIS18◦ http://web-docs.gsi.de/~giuliano/research_activity/

trapping_benchmarking/main.html

• The aim of the code benchmarking is to confirm the space chargeinduced trapping of particles in a bunch during long term storage.

• Much discussion of this benchmarking exercise at Space Charge2013

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 17/29

17/29

Page 19: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Benchmark step 1

Phase space with sextupole and no space charge.

BenchmarkSynergia

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 18/29

18/29

Page 20: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Benchmark step 2

Phase space with sextupole and no space charge.

Tune vs. initial x offset Tune vs. initial y offset

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 19/29

19/29

Page 21: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Some observations from tracking single particles in PIC (1)

Statistics have observable effects.

10 million particles 1 million particles

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 20/29

20/29

Page 22: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Some observations from tracking single particles in PIC (2)

• Single-particle tracking can reveal bugs that are washed out incollective diagnostics (beam widths, emittances, etc.)◦ Found a very subtle bug arising from two overlapping optimizations.

• Space charge kicks were shuffled once every 10000 steps.• Pathological (really well-hidden bug).• Not apparent in collective diagnostics.• Statistics made it difficult to sort out.• Found some kicks > 25σ from mean.

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 21/29

21/29

Page 23: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Some observations from tracking single particles in PIC (3)

• A particle at (0, 0) experiences no forces (under the rightconditions, of course...)◦ Therefore, it should not leave (0, 0).

• In a PIC simulation, a particle starting at (0, 0) does not behavethat way.◦ Why?◦ Does the center become hollow?

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 22/29

22/29

Page 24: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Why the (0, 0) particles moves

The figures below each contain ten curves from ten different turns ina PIC simulation with 1M particles.

• 1M particle simulation

• 10 field evaluations, different turns

• field units arbitrary, but consistent across plots

Ex(x , 0, 0) Ex(0, y , 0)

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 23/29

23/29

Page 25: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Why the (0, 0) particles moves

Zooming in:

Ex(x , 0, 0) Ex(0, y , 0)

• relative errors along x-axis are small

• similar magnitude errors along y -axis, but relative to 0(!)◦ sum of different curves tends to 0

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 24/29

24/29

Page 26: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Does the center become hollow?

x − y distributionsinitial

after 1000 turns

Particle occupancy within 100µ

Conclusion: particles moving awayfrom the origin are compensatedby particles moving toward theorigin.

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 25/29

25/29

Page 27: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Some observations from tracking single particles in PIC (4)

• With open boundary conditions, space charge cannot move thebeam.

• Is this true in our PIC simulations?◦ Our 3D and 2D solvers produce zero net space charge kick by

construction◦ 2.5D does not have this property

3D mean kicks

scale: ≈ 10−17

2.5D mean kicks

scale: ≈ 10−3

14 orders of magnitude difference!

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 26/29

26/29

Page 28: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Benchmark step 4

The fourth step is to benchmark the dependence of a test particletunes from its amplitude when the sextupole is on.

Tune vs. initial x offset Tune vs. initial y offset

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 27/29

27/29

Page 29: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Benchmark step 5

The fifth step is to benchmark the phase space with test particleswhen the sextupole is on and in presence of space charge.

Benchmark

Synergia

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 28/29

28/29

Page 30: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Conclusions

• Synergia 2.1 is◦ capable of both simple and complex simulations◦ being actively used in production◦ designed for end users◦ extensible◦ scalable◦ being enhanced for LIU◦ in beta release

• Benchmarking is proceeding well

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 29/29

29/29

Page 31: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Backup slides

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 29/29

29/29

Page 32: Synergia2 general release and benchmarking effort for … Documents/synergia-apc... · Synergia2 general release and benchmarking e ort ... Synergia 2.1 design ... Read MadX lattice

Weak scalingPerformed large-scale scaling benchmarks on production BlueGene/Pmachine at Argonne Leadership Computing Facility: Weak scaling,i.e., fixed ratio (problem size)/(compute size) (32 × 32 × 1024 grid,100 grid cells per particle, trivial apertures)

64 128 256 512 1024bunches

8192 16384 32768 65536 131072BG/P (Intrepid) cores

0

5

10

15

20

25

30

time

[s]

idealactual

James Amundson and Eric Stern, et al. Synergia2 and CERN benchmarking 29/29

29/29