Modern programming languages for HEP Modern programming languages for HEP Sebastien Ponce sebastien.ponce@cern.ch CERN Thematic CERN School of Computing 2022 1/65 S.Ponce-CERN
Modern programming languages for HEP 1 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion Modern programming languages for HEP S´ebastien Ponce sebastien.ponce@cern.ch CERN Thematic CERN School of Computing 2022
Modern programming languages for HEP pyOr++UsahleCpp perfC++python Goal of this course Make a tour of latest improvements in HEP programming languages 。C++and python o Understand the use cases of each language the evolution of C++ how this impacts performances o Make a quick tour of python 3 changes 。and help migrating 2/65 S.Ponce-CERN
Modern programming languages for HEP 2 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion Goal of this course Make a tour of latest improvements in HEP programming languages C ++and python Understand the use cases of each language the evolution of C++ how this impacts performances Make a quick tour of python 3 changes and help migrating
Modern programming languages for HEP Outline Why python and C++ Pros and Cons of each language o Respective usecases ②C+getting usable o Language "simplifications" o Making bad code harder to write ③Performant C+ o New performance related features oTemplates o Avoiding virtuality when possible Migrating from Python 2 to python 3 Tour of python 3 changes How to support both versions How to migrate ⑤Conclusion 3/65 S.Ponce-CERN
Modern programming languages for HEP 3 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion Outline 1 Why python and C++ Pros and Cons of each language Respective usecases 2 C ++getting usable Language “simplifications” Making bad code harder to write 3 Performant C++ New performance related features Templates Avoiding virtuality when possible 4 Migrating from Python 2 to python 3 Tour of python 3 changes How to support both versions How to migrate 5 Conclusion
Modern programming languages for HEP 4心,Py0rC十+UsahleCpp perfC+ Why python and C++ ①Why python and C+ Pros and Cons of each language Respective usecases C+fgetting usable Performant C++ Migrating from Python 2 to python 3 Conclusion ProCons UhaeCate 4/65 S.Ponce-CERN
Modern programming languages for HEP 4 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion ProCons UseCase Why python and C++ 1 Why python and C++ Pros and Cons of each language Respective usecases 2 C ++getting usable 3 Performant C++ 4 Migrating from Python 2 to python 3 5 Conclusion
Modern programming languages for HEP 4心PyOrC-十+UsahleCpp perfC+ 花5 Why python and C++ ①Why python and C+ Pros and Cons of each language o Respective usecases C+fgetting usable Performant C++ Migrating from Python 2 to python 3 Conclusion ProCons UaeCate 5/65 S.Ponce-CERN
Modern programming languages for HEP 5 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion ProCons UseCase Why python and C++ 1 Why python and C++ Pros and Cons of each language Respective usecases 2 C ++getting usable 3 Performant C++ 4 Migrating from Python 2 to python 3 5 Conclusion
Modern programming languages for HEP PyOrC++UsahleCpp perfC++python C++pros and cons Adapted to large projects strongly typed,object oriented o widely used (and taught)with many available libraries Fast o compiled (unlike Java or C#) allows to go close to hardware when needed What we get o the most powerful language o the most complicated one o the most error prone ProCons UaeCate 6/65 S.Ponce-CERN
Modern programming languages for HEP 6 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion ProCons UseCase C ++pros and cons Adapted to large projects strongly typed, object oriented widely used (and taught) with many available libraries Fast compiled (unlike Java or C#) allows to go close to hardware when needed What we get the most powerful language the most complicated one the most error prone ?
Modern programming languages for HEP python pros and cons Adapted to large projects multi-paradigm language (object oriented,functional...) o widely used (and taught)with many available libraries Easy to use and ubiquitous interpreted,supported on all platforms o versatile:usages from ML to web dev or numeric code o smooth learning curve,integrated with online tools(SWAN) o compatible with C++,critical code can be written in C++in the back The price to pay o not suitable for performance o error prone(no strong typing) ProCons UaeCat 7/65 S.Ponce-CERN
Modern programming languages for HEP 7 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion ProCons UseCase python pros and cons Adapted to large projects multi-paradigm language (object oriented, functional ...) widely used (and taught) with many available libraries Easy to use and ubiquitous interpreted, supported on all platforms versatile : usages from ML to web dev or numeric code smooth learning curve, integrated with online tools (SWAN) compatible with C++, critical code can be written in C++in the back The price to pay not suitable for performance error prone (no strong typing)
Modern programming languages for HEP Evolving languages C++got 4 major releases in 10 years C++standards Year C++Standard Informal name o one every 3 years 19981S0EC1488219982C++98 200150EC14882200330C++03 major changes and improvements 201150EC148822011日C4+11,C440 201450EC14822014C++14,C+1y 。almost a new language 20170eC1488220177C++17.C4+12 2020150EC148B2202m口C++20,C++2a python went to version 3 major,backward incompatible changes o initial release in 2008 olatest release 3.9 o widely adopted only in the last 5 years 8/65 S.Ponce-CERN
Modern programming languages for HEP 8 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion ProCons UseCase Evolving languages C ++got 4 major releases in 10 years one every 3 years major changes and improvements almost a new language python went to version 3 major, backward incompatible changes initial release in 2008 latest release 3.9 widely adopted only in the last 5 years
Modern programming languages for HEP 4心pPy0rC十+UsahleCpp perfC+ 花5 Why python and C++ ①Why python and C+ o Pros and Cons of each language Respective usecases C+fgetting usable Performant C++ Migrating from Python 2 to python 3 Conclusion ProCons UseCase 9/65 S.Ponce-CERN
Modern programming languages for HEP 9 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion ProCons UseCase Why python and C++ 1 Why python and C++ Pros and Cons of each language Respective usecases 2 C ++getting usable 3 Performant C++ 4 Migrating from Python 2 to python 3 5 Conclusion
Modern programming languages for HEP 花5 A language for each task C++ o The definite winner for performance critical code o Also to be used for large,complex frameworks python o The definite winner for configuration Also to be used for "glue code" o In general end-user facing code ProCons UseCase 10/65 S.Ponce-CERN
Modern programming languages for HEP 10 / 65 S. Ponce - CERN pyOrC++ UsableCpp perfC++ python3 Conclusion ProCons UseCase A language for each task C ++ The definite winner for performance critical code Also to be used for large, complex frameworks python The definite winner for configuration Also to be used for “glue code” In general end-user facing code