SOFTWARE SUSTAINABILITY AND TOOLKITS: HOW TO PROGRAM FOR THE ACCELERATOR SIMULATION PROBLEMS OF TOMORROW David Sagan Cornell Laboratory for Accelerator Based Sciences and Education
Linac and Storage Ring Programs No Longer Used: ■ AGS, ■ MARYLIE ■ ALIGN ■ PATRICIA ■ COMFORT ■ PETROS ■ DESIGN ■ PLACET ■ DIMAD ■ RACETRACK ■ GUINEA-PIG ■ SYNCH ■ HARMON ■ TRACY ■ LEGO ■ TRANSPORT ■ LIAR ■ TURTLE ■ MAGIC ■ UAL Ho How many man-ye years of effort went into to these programs? Ho How can we, as an accelerator physics community do bet etter? Ho How can software be developed that is useful and is used year after year? 2 David Sagan KEK September 18-19, 2019
Outline of the Talk ■ Software Sustainability – What is it? ■ Software Toolkits – What is a toolkit? How do toolkits help sustainability? ■ Bmad – An example of a toolkit. 3 David Sagan KEK September 18-19, 2019
SOFTWARE SUSTAINABILITY 4 David Sagan KEK September 18-19, 2019
What is Software Sustainability? A definition of Software Sustainability: "the capacity of the software to endure. In other words, sustainability means that the software will continue to be available in the future, on on ne new plat pl atforms, s, meeting ng ne new ne needs .” From: Daviel Katz https://danielskatzblog.wordpress.com/2016/09/13/defining-software-sustainability/ David Sagan KEK September 18-19, 2019 5
What Goes Into Software Sustainability? Readability / Understandability Accessibility / Openly Available?-------- Extensibility / Evolvability Portability / Installability Usefulness--- Scalability Licensing- Speed Intrinsic Extrinsic Funding Learnability Community- Documentation Version-Control--- Modularity / Reusability Actively Maintained-------- Correctness / Testability ■ Intrinsic: The characteristics of the software itself. ■ Extrinsic: The environment in which the software is developed and/or used. 6 David Sagan KEK September 18-19, 2019
And there exists Standards for Code Quality S OFTWARE E VALUATION : C RITERIA - BASED N OVEMBER 2011 Software Evaluation: Criteria-based Assessment Mike Jackson, Steve Crouch and Rob Baxter Criteria-based assessment is a quan tjtatjve assessment of the so fu ware in terms of sustainability, maintainability, and usability. This can inform high- leve l decisions on speci fi c areas for so fu ware improv ement. A criteria-based assessment gives a measurement of quality in a number of areas. These areas are derived from ISO/IEC 9126-1 So fu ware engineering — Product quality 1 and include usability, sustainability and maintainability. The assessment involves checking whether the so fu ware, and the project that develops it, conforms 7 David Sagan KEK September 18-19, 2019
Example of Non-Sustainable Code ”Piled Higher and Deeper" by Jorge Cham www.phdcomics.com. Used with permission. "Software decays relatively quickly if it is not maintained and this is especially true for software used in research" Mario Rosado de Souza, Robert Haines, Markel Vigo, Caroline Jay, "What Makes Research Software Sustainable? An Interview Study With Research Software Engineers." David Sagan KEK September 18-19, 2019 8
SOFTWARE TOOLKITS 9 David Sagan KEK September 18-19, 2019
Problem: Developing simulation code takes time. In general, accelerator simulation problems have some common needs like reading in lattice De Desired Simulation on information or calculating orbits. Pr Program Writing code from scratch to do this is like reinventing the wheel. How can we do better? Accelerator Physicist What does it take to create Ac Actual Simulation programs efficiently? Pr Program ⾞輪の再発明 10 David Sagan KEK September 18-19, 2019
Definition of a Toolkit: What is a Software Toolkit? An integrated set of modular software routines that are used to develop and maintain applications or databases. David Sagan KEK September 18-19, 2019 11
A Toolkit is like a Toolkit Dynamic Aperture Program bunch of Lego blocks Advantages of a toolkit: Lattice Design Program •Cuts down on the time needed to develop programs. •Cuts down on programming errors (via module reuse). • Standardizes sharing of lattice information between Control System Programs programs. •Increased safety : Modular code provides a firewall. For example, a buggy module introduced into the toolkit will not affect programs that do not use it. IBS Simulation Programs Etc. A toolkit, by making the softwa ware more useful, helps make the softwa ware sustainable. David Sagan KEK September 18-19, 2019 12
Accelerator Matlab based. Used extensively at light sources Toolbox for such things as orbit response matrix analysis. Includes modules for spin tracking, low energy space Bmad charge, etc. Has interface to PTC Accelerator COSY INFINITY Uses Differential Algebra (DA) for tracking. Simulation Toolkits In development by Laurent Denieu (CERN). ____ __ ______ ______ /__/ /_/ /__/ /_/ /_____ / MAD-NG / \/ \ / _ \ / _ \ / __ / / /_/ / / /_/ / Replacement for MAD-X. Recent developments oriented towards simulating Merlin/Merlin++ wakefields and particle/matter interactions. Has Differential Algebra (DA), symplectic tracking, FPP/PTC power series map, normal form analysis, etc. 13 David Sagan KEK September 18-19, 2019
BMAD 14 David Sagan KEK September 18-19, 2019
In the Beginning… Brief History : § Born at Cornell in mid 1990’s § Started life as modest project: Just wanted to calculate Twiss functions and closed orbits within control system programs. § Initially Bmad used a subset of the MAD lattice syntax. Hence the name: “Baby MAD” or “Bmad” for short. 15 David Sagan KEK September 18-19, 2019
And Baby Grows Up... Currently: § >100,000 lines of code § ~1,000 routines 16 David Sagan KEK September 18-19, 2019
§ Lattice design § X-ray simulations § Spin tracking And Bmad § Wakefields and HOMs § Beam breakup (BBU) simulations in ERLs can do Much § Intra-beam scattering (IBS) simulations § Coherent Synchrotron Radiation (CSR) More: § Touschek Simulations § Frequency map analysis § Dark current tracking § Etc., etc. 17 David Sagan KEK September 18-19, 2019
Overview § Written in object oriented Fortran 2008. § With certain restrictions, Bmad can be run multi-threaded. § Lattice files use a MAD like syntax. § Well documented (Manual is >500 pages). § Open Source: http://www.classe.cornell.edu/bmad/ § And Bmad is indeed a toolkit: Data Lego block type (lat_struct) lat call bmad_parser (‘lat.bmad’, lat) Action Lego block 18 David Sagan KEK September 18-19, 2019
Bmad Features 6 MeV erposition – Define overlapping Super Sup Injector Merger Bmad has elements. a number Controller elements – Elements controlling Co of features attributes of other elements. that over Mu Multiple connected beam beam lines nes in n one one lat attice e the years Mirror Merger – Example: Injection line attached to a ring. have 42, 78, 114, 150 MeV Diagnostics lines – Multiple beams sharing a Mu Multipass lin proven common line such as the IR region in a dual useful. ring colliding beam machine. Among Custom elements and cu Example of how a lattice can contain multiple Cus cust stom particl cle these are: tr tracking . attached beam lines and this can be used to describe complicated machine geometries Define beam beam cham hamber ber wal alls . David Sagan KEK September 18-19, 2019 19
Bmad Ecosystem Due to its flexibility, Bmad has been used in a number of programs including: • Ta Tao: General purpose design and simulation. • Sy Synrad3d 3d: 3D tracking of synch photons, including Circles = design tunes, Diamonds = current tunes. reflections, within the beam chamber walls. • BBU BBU: Beam breakup instability simulations. Tune Scan for CESR Ring Upgrade Tu • dar dark_c k_cur urrent ent_t _trac acker er: Dark current electron simulation. • ib ibs_sim im: Analytic intra-beam scattering (IBS) calculation. • to touschek_track: Tracking of Touschek particles. • fre freq_map: Frequency map analysis. • MO MOGA: : Multi-Objective Genetic Algorithm optimization. • Lu Lux: Photon tracking in X-ray beam lines. • et etc ... use : Modules developed for one program Co Code de reus can, via Bmad, be used in other programs. BBU BBU threshold cur urrent nt for CBETA as a function of the phase advance between cavities. David Sagan KEK September 18-19, 2019 20
Recommend
More recommend