SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
Modernizing GOOFIT: A Case Study
Henry Schreiner
July 12, 2017
goofit.github.io/pearc17.pdf
History of GOOFIT
Timeline
This talk
2013 2014 2015 2016 2017
0.1 0.2 0.3
OpenMP
0.4
Work in forks Minor updates
1.0
CMAKE
2.0
/GooFit/GooFit
• Developed by Rolf Andreassen in 2013
• A lot of duplicated work in 2014-2016
• We will cover the 2016-2017 modernization
Henry Schreiner Modernizing GOOFIT: A Case Study 1/17
GOOFIT: Probability Density Function (PDF) Fitting
width
mean
−3 −2 −1 0 1 2 3
0
0.2
0.4
x
Design
• Resembles the popular ROOFIT package in ROOT
• Built with CUDA/OpenMP using THRUST
• Includes 30+ High Energy Physics (HEP) PDFs and examples
Henry Schreiner Modernizing GOOFIT: A Case Study 2/17
Features of a Fit
Composition
Variables
PDF1 PDF2
CombinePDF
DataSet
Fitter
Composition
• Changed often
• 100+ Variables possible
PDFs
• Many provided
• Users may add more
Backend
• Managed by core team
Henry Schreiner Modernizing GOOFIT: A Case Study 3/17
Why GOOFIT?
Charm Physics at CERN’s LHCb experiment
• 1,000,000+ events in dataset
• 5 or more independent variables common
• 20+ PDFs with complex coefficients
• Some analyses run 1,000+ fits
Henry Schreiner Modernizing GOOFIT: A Case Study 4/17
Why GOOFIT?
Charm Physics at CERN’s LHCb experiment
• 1,000,000+ events in dataset
• 5 or more independent variables common
• 20+ PDFs with complex coefficients
• Some analyses run 1,000+ fits
GOOFIT transforms fitting with 950x speedup over single-core ROOFIT
Henry Schreiner Modernizing GOOFIT: A Case Study 4/17
Why GOOFIT?
1 2 4 12 24 48
36
60
118
336
625
1,240
OpenMP Threads
Time[s]
GOOFIT is fast
• 142576 events
• Unbinned fit
• 24 physical Xeon cores
K40 96.6 seconds
P100 23.5 seconds
Henry Schreiner Modernizing GOOFIT: A Case Study 5/17
GOOFIT 0.4: A State of Disrepair
Research level code
• Written for CUDA 4.0 and Compute Architecture 2.0
• Hardcoded paths in Makefiles
• Little file organization
• Forked 10+ times, new features not in master
• Cludges: fake nvcc, globbing, fake ROOT, ...
Henry Schreiner Modernizing GOOFIT: A Case Study 6/17
Build System Updates
Iterative approach
1. Makefile cleanup and consolidation
2. Organization of file structure
• ModernizeGooFit.py script
3. Adding CMAKE
• Coexisted with makefiles for a while
#include "CompositePdf.hh"
abortWithCudaPrintFlush(__FILE__, __LINE__, "Failed");
ModernizeGooFit.py Uses regular expressions and Plumbum
#include <goofit/PDFs/combine/CompositePdf.h>
GooFit::abort(__FILE__, __LINE__, "Failed");
Henry Schreiner Modernizing GOOFIT: A Case Study 7/17
CMAKE
CMAKE CUDA support
• Require CMAKE 3.4+
• Backported FindCUDA from
CMAKE 3.7
• Keyword vs. standard targets
• CUDA in 3.8 massively
improved
Features
• IDE support (XCODE, QTCREATOR)
• Library discovery / configuration
• Multiple compiler support
• Integration with other tools
• Download datafiles from GitHub
releases
Git submodules
• Libraries as submodules
• Automatic checkout by CMAKE build
• Separate CMAKE folder ( /CLIUtils/cmake) and external libraries
Henry Schreiner Modernizing GOOFIT: A Case Study 8/17
Automation and Testing
Travis CI
• Verify OpenMP build
• Verify PRs
• Upload coverage reports
• Upload documentation
Challenges
C++11 • ROOT • Docs
Tests
• Run all examples with script
• Slowly added verification
• Unit-tests added with GOOGLETEST
(evaluating CATCH)
(NVIDIA-)DOCKER
• Added images with ROOT+Utils
• From scratch install
Henry Schreiner Modernizing GOOFIT: A Case Study 9/17
Modernization
C++11
• Limited to CUDA 7.0+
• Reduced # of lines / simplified
• Used CLANG-TIDY to convert
(CMAKE 3.6+ integration)
Major updates
nullptr • foreach • override
Variadic templates • Initializer lists
Cleanup
• Readability: CLANG-FORMAT
• Moved all code to namespace
• Compile-time logging choice
/fmtlib/fmt
• Smart color output
/agauniyal/rang
• Removed custom classes and
iterators (complex, etc)
Henry Schreiner Modernizing GOOFIT: A Case Study 10/17
Command Line Parsing
./MyAnalysis generate_toy
--params=file.ini
--release_K892_mass
--A12=0.3
--plot
Recurring theme
• Analyses require 40+ options and multiple procedures
• Found a lot of duplicated code for argument parsing
• Many bugs related to parsing (usually segfaults)
• Needed powerful solution, with direct access to values
Henry Schreiner Modernizing GOOFIT: A Case Study 11/17
CLI11
/CLIUtils/CLI11
• No dependencies
• Compiles to single header file
Features
• Nested subcommands
• Configuration files
• 100% test coverage
• CI tests on macOS/Linux/Windows
• + GOOFIT’s features
Use in GOOFIT
• Testbed for new build features
GooFit::Application
• Auto logging
• Optimization warnings
• GPU switches
• MPI support
• Completely optional
Henry Schreiner Modernizing GOOFIT: A Case Study 12/17
Improvements
Expanded physics tools
• Three body time-dependent amplitude analyses
• Four body time-integrated and time-dependent amplitude analyses
• Toy Monte Carlo generation using MCBOOSTER
Caching: /bryancatanzaro/generics
• Support for LDG caching
• LDG generalized form
• Performance boost for mid-age cards
MPI
• Available for Application
• Supports multiple GPUs
/MultithreadCorner/MCBooster is deprecated
in favor of /MultithreadCorner/Hydra
Henry Schreiner Modernizing GOOFIT: A Case Study 13/17
MINUIT 2
MINUIT in HEP
• MINUIT is a standard HEP parameter search algorithm (CPU)
• MINUIT 1 and 2 available in ROOT
• Old copy of MINUIT 2 was available stand-alone
Status in GOOFIT 0.4
• Internal MINUIT 1 copy
• Required manual upkeep
/GooFit/Minuit2
• Newly forked from ROOT 6.08
• CMAKE build, no other changes
• Already being used outside GOOFIT
Henry Schreiner Modernizing GOOFIT: A Case Study 14/17
PYTHON Bindings (GOOFIT 2.1 feature)
Pre-release syntax
from goofit import *
xvar = Variable("xvar", 0, 10)
xdata = UnbinnedDataSet(xvar)
xdata.from_numpy(np.random.exponential(size=100000))
alpha = Variable("alpha", -2, 0.1, -10, 10)
exppdf = ExpPdf("exppdf", xvar, alpha)
exppdf.fitTo(data)
/pybind/pybind11
• Only uses advanced C++11
• Full working example in GOOFIT 2.0
• Expanding for GOOFIT 2.1
• pip install with SCIKIT-BUILD
Current challenges
• CUDA vs. C++
• Pythonic syntax
• Example conversion
Henry Schreiner Modernizing GOOFIT: A Case Study 15/17
GOOFIT Future
/GooFit/GooFit
GOOFIT 2.0: Released
• Source code and docs on GitHub
GOOFIT 2.1: Coming soon
• Drastically expanded Python
bindings by Himadri Pandey
Plans
• HYDRA integration
• Use in D 0 → K −π−π+π+
amplitude analysis
• GOOFIT 2torial under development
at henryiii.gitbook.io/goofit
Henry Schreiner Modernizing GOOFIT: A Case Study 16/17
Build it yourself
docker run -it alpine
apk add --no-cache make cmake g++ git
git clone --branch=stable https://github.com/GooFit/GooFit.git
cd GooFit
make
Henry Schreiner Modernizing GOOFIT: A Case Study 17/17
Acknowledgments
• A. Augusto Alves Jr.
• Christoph Hasse
• Bradley Hittle
• Zachary Huard
• Brian Maddock
• Himadri Pandey
• Michael Sokoloff
• Karen Tomko
Development of GOOFIT 2.x is supported under NSF grant
PHY-1414736. GOOFIT was originally developed under
PHY-1005530. Any opinions, findings, and conclusions or recom-
mendations expressed in this presentation are those of the develop-
ers and do not necessarily reflect the views of the National Science
Foundation.
CERN image from project-hl-lhc-industry.web.cern.ch.
goofit.github.io
Henry Schreiner Modernizing GOOFIT: A Case Study 18/17
Questions?
henry.schreiner@uc.edu
Henry Schreiner Modernizing GOOFIT: A Case Study 19/17

Contenu connexe

Tendances

A Kernel of Truth: Intrusion Detection and Attestation with eBPF
A Kernel of Truth: Intrusion Detection and Attestation with eBPFA Kernel of Truth: Intrusion Detection and Attestation with eBPF
A Kernel of Truth: Intrusion Detection and Attestation with eBPF
oholiab
 

Tendances (20)

IRIS-HEP: Boost-histogram and Hist
IRIS-HEP: Boost-histogram and HistIRIS-HEP: Boost-histogram and Hist
IRIS-HEP: Boost-histogram and Hist
 
PyHEP 2019: Python 3.8
PyHEP 2019: Python 3.8PyHEP 2019: Python 3.8
PyHEP 2019: Python 3.8
 
carrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIcarrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-API
 
CHEP 2019: Recent developments in histogram libraries
CHEP 2019: Recent developments in histogram librariesCHEP 2019: Recent developments in histogram libraries
CHEP 2019: Recent developments in histogram libraries
 
A Kernel of Truth: Intrusion Detection and Attestation with eBPF
A Kernel of Truth: Intrusion Detection and Attestation with eBPFA Kernel of Truth: Intrusion Detection and Attestation with eBPF
A Kernel of Truth: Intrusion Detection and Attestation with eBPF
 
Goroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in GoGoroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in Go
 
lwref: insane idea on reference counting
lwref: insane idea on reference countinglwref: insane idea on reference counting
lwref: insane idea on reference counting
 
Debugging node in prod
Debugging node in prodDebugging node in prod
Debugging node in prod
 
new ifnet(9) KPI for FreeBSD network stack
new ifnet(9) KPI for FreeBSD network stacknew ifnet(9) KPI for FreeBSD network stack
new ifnet(9) KPI for FreeBSD network stack
 
Move from C to Go
Move from C to GoMove from C to Go
Move from C to Go
 
Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)
 
Effective Linux Development Using PetaLinux Tools 2017.4
Effective Linux Development Using PetaLinux Tools 2017.4Effective Linux Development Using PetaLinux Tools 2017.4
Effective Linux Development Using PetaLinux Tools 2017.4
 
What's new in FreeBSD 10
What's new in FreeBSD 10What's new in FreeBSD 10
What's new in FreeBSD 10
 
Beyond printk: Efficient Zynq UltraScale+ MPSoC Linux Debugging and Development
Beyond printk: Efficient Zynq UltraScale+ MPSoC Linux Debugging and DevelopmentBeyond printk: Efficient Zynq UltraScale+ MPSoC Linux Debugging and Development
Beyond printk: Efficient Zynq UltraScale+ MPSoC Linux Debugging and Development
 
PyPy - is it ready for production
PyPy - is it ready for productionPyPy - is it ready for production
PyPy - is it ready for production
 
Pypy is-it-ready-for-production-the-sequel
Pypy is-it-ready-for-production-the-sequelPypy is-it-ready-for-production-the-sequel
Pypy is-it-ready-for-production-the-sequel
 
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
 
NBIS RNA-seq course
NBIS RNA-seq courseNBIS RNA-seq course
NBIS RNA-seq course
 
Exploring the Programming Models for the LUMI Supercomputer
Exploring the Programming Models for the LUMI Supercomputer Exploring the Programming Models for the LUMI Supercomputer
Exploring the Programming Models for the LUMI Supercomputer
 
New Process/Thread Runtime
New Process/Thread Runtime	New Process/Thread Runtime
New Process/Thread Runtime
 

Similaire à PEARC17: Modernizing GooFit: A Case Study

Code Hosting: The Key to Autonomous, Self-Service Development
Code Hosting: The Key to Autonomous, Self-Service DevelopmentCode Hosting: The Key to Autonomous, Self-Service Development
Code Hosting: The Key to Autonomous, Self-Service Development
Rachel Maxwell
 

Similaire à PEARC17: Modernizing GooFit: A Case Study (20)

CHEP 2018: A Python upgrade to the GooFit package for parallel fitting
CHEP 2018: A Python upgrade to the GooFit package for parallel fittingCHEP 2018: A Python upgrade to the GooFit package for parallel fitting
CHEP 2018: A Python upgrade to the GooFit package for parallel fitting
 
Pharo 11: A stabilization release
Pharo 11: A stabilization releasePharo 11: A stabilization release
Pharo 11: A stabilization release
 
Moving applications to HDF5 1.8
Moving applications to HDF5 1.8Moving applications to HDF5 1.8
Moving applications to HDF5 1.8
 
[Mentor Graphics] A Perforce-based Automatic Document Generation System
[Mentor Graphics] A Perforce-based Automatic Document Generation System[Mentor Graphics] A Perforce-based Automatic Document Generation System
[Mentor Graphics] A Perforce-based Automatic Document Generation System
 
Cloud Foundry Roadmap Update - OSCON - May 2017
Cloud Foundry Roadmap Update - OSCON - May 2017Cloud Foundry Roadmap Update - OSCON - May 2017
Cloud Foundry Roadmap Update - OSCON - May 2017
 
HDF Update
HDF UpdateHDF Update
HDF Update
 
2013 t-dose - libre office easyhacks
2013   t-dose - libre office easyhacks2013   t-dose - libre office easyhacks
2013 t-dose - libre office easyhacks
 
Switching to Git
Switching to GitSwitching to Git
Switching to Git
 
Golang
GolangGolang
Golang
 
Golang
GolangGolang
Golang
 
Code Hosting: The Key to Autonomous, Self-Service Development
Code Hosting: The Key to Autonomous, Self-Service DevelopmentCode Hosting: The Key to Autonomous, Self-Service Development
Code Hosting: The Key to Autonomous, Self-Service Development
 
Multiconf - Python Configuration API
Multiconf - Python Configuration APIMulticonf - Python Configuration API
Multiconf - Python Configuration API
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Git at scale-helix4_git (1)
Git at scale-helix4_git (1)Git at scale-helix4_git (1)
Git at scale-helix4_git (1)
 
ACL-2022_tutorial_part_AB_V8 (1).pdf
ACL-2022_tutorial_part_AB_V8 (1).pdfACL-2022_tutorial_part_AB_V8 (1).pdf
ACL-2022_tutorial_part_AB_V8 (1).pdf
 
ACAT 2017: GooFit 2.0
ACAT 2017: GooFit 2.0ACAT 2017: GooFit 2.0
ACAT 2017: GooFit 2.0
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
ePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version ControlePOM - Fundamentals of Research Software Development - Code Version Control
ePOM - Fundamentals of Research Software Development - Code Version Control
 
Git version control and trunk based approach with VSTS
Git version control and trunk based approach with VSTSGit version control and trunk based approach with VSTS
Git version control and trunk based approach with VSTS
 
Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...
 

Plus de Henry Schreiner

HOW 2019: Machine Learning for the Primary Vertex Reconstruction
HOW 2019: Machine Learning for the Primary Vertex ReconstructionHOW 2019: Machine Learning for the Primary Vertex Reconstruction
HOW 2019: Machine Learning for the Primary Vertex Reconstruction
Henry Schreiner
 

Plus de Henry Schreiner (20)

Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
Princeton RSE Peer network first meeting
Princeton RSE Peer network first meetingPrinceton RSE Peer network first meeting
Princeton RSE Peer network first meeting
 
Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
 
Everything you didn't know you needed
Everything you didn't know you neededEverything you didn't know you needed
Everything you didn't know you needed
 
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
SciPy22 - Building binary extensions with pybind11, scikit build, and cibuild...
 
SciPy 2022 Scikit-HEP
SciPy 2022 Scikit-HEPSciPy 2022 Scikit-HEP
SciPy 2022 Scikit-HEP
 
PyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packaging
PyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packagingPyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packaging
PyCon 2022 -Scikit-HEP Developer Pages: Guidelines for modern packaging
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python Extensions
 
boost-histogram / Hist: PyHEP Topical meeting
boost-histogram / Hist: PyHEP Topical meetingboost-histogram / Hist: PyHEP Topical meeting
boost-histogram / Hist: PyHEP Topical meeting
 
RDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and PandasRDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and Pandas
 
HOW 2019: Machine Learning for the Primary Vertex Reconstruction
HOW 2019: Machine Learning for the Primary Vertex ReconstructionHOW 2019: Machine Learning for the Primary Vertex Reconstruction
HOW 2019: Machine Learning for the Primary Vertex Reconstruction
 
ACAT 2019: A hybrid deep learning approach to vertexing
ACAT 2019: A hybrid deep learning approach to vertexingACAT 2019: A hybrid deep learning approach to vertexing
ACAT 2019: A hybrid deep learning approach to vertexing
 
2019 CtD: A hybrid deep learning approach to vertexing
2019 CtD: A hybrid deep learning approach to vertexing2019 CtD: A hybrid deep learning approach to vertexing
2019 CtD: A hybrid deep learning approach to vertexing
 
2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and hist2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and hist
 
2019 IRIS-HEP AS workshop: Particles and decays
2019 IRIS-HEP AS workshop: Particles and decays2019 IRIS-HEP AS workshop: Particles and decays
2019 IRIS-HEP AS workshop: Particles and decays
 
PyHEP 2019: Python Histogramming Packages
PyHEP 2019: Python Histogramming PackagesPyHEP 2019: Python Histogramming Packages
PyHEP 2019: Python Histogramming Packages
 
2019 IML workshop: A hybrid deep learning approach to vertexing
2019 IML workshop: A hybrid deep learning approach to vertexing2019 IML workshop: A hybrid deep learning approach to vertexing
2019 IML workshop: A hybrid deep learning approach to vertexing
 
LHCb Computing Workshop 2018: PV finding with CNNs
LHCb Computing Workshop 2018: PV finding with CNNsLHCb Computing Workshop 2018: PV finding with CNNs
LHCb Computing Workshop 2018: PV finding with CNNs
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

PEARC17: Modernizing GooFit: A Case Study

  • 1. Modernizing GOOFIT: A Case Study Henry Schreiner July 12, 2017 goofit.github.io/pearc17.pdf
  • 2. History of GOOFIT Timeline This talk 2013 2014 2015 2016 2017 0.1 0.2 0.3 OpenMP 0.4 Work in forks Minor updates 1.0 CMAKE 2.0 /GooFit/GooFit • Developed by Rolf Andreassen in 2013 • A lot of duplicated work in 2014-2016 • We will cover the 2016-2017 modernization Henry Schreiner Modernizing GOOFIT: A Case Study 1/17
  • 3. GOOFIT: Probability Density Function (PDF) Fitting width mean −3 −2 −1 0 1 2 3 0 0.2 0.4 x Design • Resembles the popular ROOFIT package in ROOT • Built with CUDA/OpenMP using THRUST • Includes 30+ High Energy Physics (HEP) PDFs and examples Henry Schreiner Modernizing GOOFIT: A Case Study 2/17
  • 4. Features of a Fit Composition Variables PDF1 PDF2 CombinePDF DataSet Fitter Composition • Changed often • 100+ Variables possible PDFs • Many provided • Users may add more Backend • Managed by core team Henry Schreiner Modernizing GOOFIT: A Case Study 3/17
  • 5. Why GOOFIT? Charm Physics at CERN’s LHCb experiment • 1,000,000+ events in dataset • 5 or more independent variables common • 20+ PDFs with complex coefficients • Some analyses run 1,000+ fits Henry Schreiner Modernizing GOOFIT: A Case Study 4/17
  • 6. Why GOOFIT? Charm Physics at CERN’s LHCb experiment • 1,000,000+ events in dataset • 5 or more independent variables common • 20+ PDFs with complex coefficients • Some analyses run 1,000+ fits GOOFIT transforms fitting with 950x speedup over single-core ROOFIT Henry Schreiner Modernizing GOOFIT: A Case Study 4/17
  • 7. Why GOOFIT? 1 2 4 12 24 48 36 60 118 336 625 1,240 OpenMP Threads Time[s] GOOFIT is fast • 142576 events • Unbinned fit • 24 physical Xeon cores K40 96.6 seconds P100 23.5 seconds Henry Schreiner Modernizing GOOFIT: A Case Study 5/17
  • 8. GOOFIT 0.4: A State of Disrepair Research level code • Written for CUDA 4.0 and Compute Architecture 2.0 • Hardcoded paths in Makefiles • Little file organization • Forked 10+ times, new features not in master • Cludges: fake nvcc, globbing, fake ROOT, ... Henry Schreiner Modernizing GOOFIT: A Case Study 6/17
  • 9. Build System Updates Iterative approach 1. Makefile cleanup and consolidation 2. Organization of file structure • ModernizeGooFit.py script 3. Adding CMAKE • Coexisted with makefiles for a while #include "CompositePdf.hh" abortWithCudaPrintFlush(__FILE__, __LINE__, "Failed"); ModernizeGooFit.py Uses regular expressions and Plumbum #include <goofit/PDFs/combine/CompositePdf.h> GooFit::abort(__FILE__, __LINE__, "Failed"); Henry Schreiner Modernizing GOOFIT: A Case Study 7/17
  • 10. CMAKE CMAKE CUDA support • Require CMAKE 3.4+ • Backported FindCUDA from CMAKE 3.7 • Keyword vs. standard targets • CUDA in 3.8 massively improved Features • IDE support (XCODE, QTCREATOR) • Library discovery / configuration • Multiple compiler support • Integration with other tools • Download datafiles from GitHub releases Git submodules • Libraries as submodules • Automatic checkout by CMAKE build • Separate CMAKE folder ( /CLIUtils/cmake) and external libraries Henry Schreiner Modernizing GOOFIT: A Case Study 8/17
  • 11. Automation and Testing Travis CI • Verify OpenMP build • Verify PRs • Upload coverage reports • Upload documentation Challenges C++11 • ROOT • Docs Tests • Run all examples with script • Slowly added verification • Unit-tests added with GOOGLETEST (evaluating CATCH) (NVIDIA-)DOCKER • Added images with ROOT+Utils • From scratch install Henry Schreiner Modernizing GOOFIT: A Case Study 9/17
  • 12. Modernization C++11 • Limited to CUDA 7.0+ • Reduced # of lines / simplified • Used CLANG-TIDY to convert (CMAKE 3.6+ integration) Major updates nullptr • foreach • override Variadic templates • Initializer lists Cleanup • Readability: CLANG-FORMAT • Moved all code to namespace • Compile-time logging choice /fmtlib/fmt • Smart color output /agauniyal/rang • Removed custom classes and iterators (complex, etc) Henry Schreiner Modernizing GOOFIT: A Case Study 10/17
  • 13. Command Line Parsing ./MyAnalysis generate_toy --params=file.ini --release_K892_mass --A12=0.3 --plot Recurring theme • Analyses require 40+ options and multiple procedures • Found a lot of duplicated code for argument parsing • Many bugs related to parsing (usually segfaults) • Needed powerful solution, with direct access to values Henry Schreiner Modernizing GOOFIT: A Case Study 11/17
  • 14. CLI11 /CLIUtils/CLI11 • No dependencies • Compiles to single header file Features • Nested subcommands • Configuration files • 100% test coverage • CI tests on macOS/Linux/Windows • + GOOFIT’s features Use in GOOFIT • Testbed for new build features GooFit::Application • Auto logging • Optimization warnings • GPU switches • MPI support • Completely optional Henry Schreiner Modernizing GOOFIT: A Case Study 12/17
  • 15. Improvements Expanded physics tools • Three body time-dependent amplitude analyses • Four body time-integrated and time-dependent amplitude analyses • Toy Monte Carlo generation using MCBOOSTER Caching: /bryancatanzaro/generics • Support for LDG caching • LDG generalized form • Performance boost for mid-age cards MPI • Available for Application • Supports multiple GPUs /MultithreadCorner/MCBooster is deprecated in favor of /MultithreadCorner/Hydra Henry Schreiner Modernizing GOOFIT: A Case Study 13/17
  • 16. MINUIT 2 MINUIT in HEP • MINUIT is a standard HEP parameter search algorithm (CPU) • MINUIT 1 and 2 available in ROOT • Old copy of MINUIT 2 was available stand-alone Status in GOOFIT 0.4 • Internal MINUIT 1 copy • Required manual upkeep /GooFit/Minuit2 • Newly forked from ROOT 6.08 • CMAKE build, no other changes • Already being used outside GOOFIT Henry Schreiner Modernizing GOOFIT: A Case Study 14/17
  • 17. PYTHON Bindings (GOOFIT 2.1 feature) Pre-release syntax from goofit import * xvar = Variable("xvar", 0, 10) xdata = UnbinnedDataSet(xvar) xdata.from_numpy(np.random.exponential(size=100000)) alpha = Variable("alpha", -2, 0.1, -10, 10) exppdf = ExpPdf("exppdf", xvar, alpha) exppdf.fitTo(data) /pybind/pybind11 • Only uses advanced C++11 • Full working example in GOOFIT 2.0 • Expanding for GOOFIT 2.1 • pip install with SCIKIT-BUILD Current challenges • CUDA vs. C++ • Pythonic syntax • Example conversion Henry Schreiner Modernizing GOOFIT: A Case Study 15/17
  • 18. GOOFIT Future /GooFit/GooFit GOOFIT 2.0: Released • Source code and docs on GitHub GOOFIT 2.1: Coming soon • Drastically expanded Python bindings by Himadri Pandey Plans • HYDRA integration • Use in D 0 → K −π−π+π+ amplitude analysis • GOOFIT 2torial under development at henryiii.gitbook.io/goofit Henry Schreiner Modernizing GOOFIT: A Case Study 16/17
  • 19. Build it yourself docker run -it alpine apk add --no-cache make cmake g++ git git clone --branch=stable https://github.com/GooFit/GooFit.git cd GooFit make Henry Schreiner Modernizing GOOFIT: A Case Study 17/17
  • 20. Acknowledgments • A. Augusto Alves Jr. • Christoph Hasse • Bradley Hittle • Zachary Huard • Brian Maddock • Himadri Pandey • Michael Sokoloff • Karen Tomko Development of GOOFIT 2.x is supported under NSF grant PHY-1414736. GOOFIT was originally developed under PHY-1005530. Any opinions, findings, and conclusions or recom- mendations expressed in this presentation are those of the develop- ers and do not necessarily reflect the views of the National Science Foundation. CERN image from project-hl-lhc-industry.web.cern.ch. goofit.github.io Henry Schreiner Modernizing GOOFIT: A Case Study 18/17