hijing++, oop concepts and simple parallelization oop... · • dependency inversion principle...

22
HIJING++, OOP concepts and simple parallelization Contributor: 7 W. T. Deng Supervisors: 1 G. G. Barnaföldi, 6 G. Papp , 2,3 B. W. Zhang Founders: 2,3,4 X-N. Wang, 5 M. Gyulassy 1,6 Sz. M. Harangozó, 2,3 G. Y. Ma 2Institute of Partical Physics, Central China Normal University 3Key Laboratory of Quark & Lepton Physics, China 7Huazhong University of Science and Technology. 4Lawrence Berkeley National Laboratory 1Wigner Research Centre for Physics, Hungarian Academy of Sciences 5Columbia University in the City of New York. 6Department of Theroretical Physics, Eötvös Loránd University

Upload: others

Post on 22-Aug-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

HIJING++, OOP concepts and simple parallelization

Contributor:7W. T. Deng

Supervisors:1G. G. Barnaföldi, 6G. Papp , 2,3B. W. Zhang

Founders:2,3,4X-N. Wang, 5M. Gyulassy

1,6Sz. M. Harangozó, 2,3G. Y. Ma

2、Institute of Partical Physics, Central China Normal University

3、Key Laboratory of Quark & Lepton Physics, China

7、Huazhong University of Science and Technology.

4、Lawrence Berkeley National Laboratory

1、Wigner Research Centre for Physics, Hungarian Academy of Sciences

5、Columbia University in the City of New York.

6、Department of Theroretical Physics, Eötvös Loránd University

Page 2: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Introduction

adjoint representation 8 of SU(3)

Bagua (eight simbols)

fundamental principles of reality

• HIJING(Heavy-Ion Jet INteraction Generator)

易經

Page 3: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Introduction• HIJING(Heavy-Ion Jet INteraction Generator)

• HIJING versions

• FORTRAN v1.36, v2.553

• C++ v3.0

Reasons to use C++

Object oriented language: Hierarchy, Modularity

C++11/14 has thread support

and compatibility with OpenCL

Page 4: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Program Flow

• Pair by pair nucleon-nucleon events

• Multiple soft gluon exchangesbetween valence- and diquarks

• String hadronization according to Lund fragmentation scheme

𝜎𝑗𝑒𝑡

𝐸𝑙𝑎𝑠𝑡𝑖𝑐𝑃𝑌𝑇𝐻𝐼𝐴

𝑆𝑜𝑓𝑡𝑞ത𝑞 𝐴𝑅𝐼𝐴𝐷𝑁𝐸

𝑆𝑡𝑟𝑖𝑛𝑔 𝐹𝑟𝑎𝑔𝑚𝑒𝑛𝑡𝑎𝑡𝑖𝑜𝑛

Page 5: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

(Old) Program Flow

• Generation of kinetic variables for each hard scatteringwith Pythia 5.3

• Multiple soft gluon exchangesbetween valence- and diquarks

• String hadronization according to Lund fragmentation scheme

Page 6: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

(New) Program Structure

Event allpart

NucleusLevel

HIJING

PYTHIA

Info Event process Event string

Cronin-effect

Jet-quenching

Shadowing

• Pythia8 namespacecontainers

• Structure similarities

• Actual program flow is more complicated

Page 7: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

How should a class look like?

• Single responsibility principle

• Open/closed principle

• Liskov substitution principle

• Interface segregation principle

• Dependency inversion principle

Design Patterns

Page 8: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Program StructureHijing class

• Processes ordered in class hierarchy

• Former common blocks class variables

• Processes called through object functions

// Class for handling the hard collisions

// Class for handling the soft interactions

// Class for handling the Lund string fragmentation

// Class for the nuclear effects

Page 9: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Dependencies & External packages

• Boost

• LHAPDF 6

• Pythia 8

• GSL (optional)

sudo apt-get install libboost-all-dev

./configure –prefix=$HOME/.../share/LHAPDF

make all

insert downloaded PDF library to $HOME/.../share/LHAPDF

optionally modify pdfsets.index, add set if needed

export LD LIBRARY PATH=<library path>

./configure --with-lhapdf6-lib=$HOME/…/lib \--with-boost-lib=/usr/lib/x86_64-linux-gnumake –j4

HIJING make option

Page 10: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Main example

FORTRAN C++

Usual form kept for regular users Form also similar to Pythia 8.x

Page 11: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Program Features

• Calculation by improved models

• Pythia like prompt Histogram creation

• CPU level Parallel computing

• AliRoot compatibility (planned)

Page 12: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Data Analysis

Pythia 8 Histogram class available

Hist::fill(double Input);

standard output and file output both provided

Normalization

Selection has to be made for every particle

Page 13: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Multithreading

• The Naive Way

• STL <future> <thread>

• Hijing instanceencapsulated

• Each thread calculatesthe same number of events

• 𝜆-expression can be confusing

Thread#0

Thread#1

Thread#2

Main

Page 14: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Multithreading

• The Clever Way

• STL <mutex> <thread>

• Producer – Consumer design

• New ParaHijing classwith parameterlessfunctions

• Singleton QueueContinuous Queue

Thread#0

Thread#1

Thread#2

Page 15: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Parallel Computing

• Message Passing Interface

• Boost should be compiledwith MPI support

• HijHist class should be serialized

• Serialization provides saveopportunity

Page 16: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Runtime comparison

(gain) FORTRAN C++ single core C++ parallel

𝑝𝑝 0.2640s 0.5055s -91.5% 0.0044s 5055%

𝑝𝐴 3.5090s 6.274s -46.4% 0.0514s 6826%

𝐴𝐴 397.96s 482.28s -21.2% 5.688s 6896%

For 1e5 Events, 200 cores.

Page 17: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Apetizer plots for the RHIC era

STAR Collaboration, Phys.Lett. B637 page 161-169 (2006)

Code validation with „old” version and RHIC data

Page 18: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Apetizer plots for the LHC era

ALICE collaboration, Eur. Phys. J. C 73 2662 (2013)

Code validation with LHC pp data at 900, 2760, 7000 GeV c.m. energies.

Page 19: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Model Improvements

• Shadowing

• Jet-Quenching

• Soft QCD radiation

• (already implemented improvements since v1.36)

HIJING 2.0 fits RHIC data well

Improvements are needed for LHC energy

𝑅𝑖 𝑥, 𝑏 → 𝑅𝑖 𝑄, 𝑥, 𝑏

Various models: accuracy speed

updated ARIADNE calls

Page 20: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Updated Shadowing𝑅𝑖 𝑥, 𝑏, 𝐴 → 𝑅𝑖 𝑄, 𝑥, 𝑏, 𝐴

• High-𝑝𝑇 region – Still investigated

Page 21: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Ongoing activities and future plans

• Ongoing activities (HIJING++ v3.0)

code/compatibility tests & tuning

performance test

new physics (Shadowing, Quenching)

parallel version

• Future plans (HIJINGv3.x)

online access – documentation

AliRoot compatibility

multi thread / GPU support

GUI

Page 22: HIJING++, OOP concepts and simple parallelization OOP... · • Dependency inversion principle Design Patterns Program Structure Hijing class • Processes ordered in class hierarchy

Thank you!

This work is supported by the Hungarian-Chinese cooperation grant No TéT 12 CN-1-2012-0016and No. MOST 2014DFG02050, Hungarian National Research Fund (OTKA) grant NK106119.

We acknowledge the support of Wigner GPU laboratory, and discussions with Miklós Gyulassy, Xin-Nian Wang and Wei-Tian Deng.