da sunanka rabbi naka fara komai - shahid...
TRANSCRIPT
HEPfita real-world display scientific computing uses
S. AbdusSalam
Department of Physics,Shahid Beheshti University,
Islamic Republic of Iran
ICTP 5th Workshop on Advanced Techniques for ScientificProgramming and Management of Open Source Software
Packages (SMR 3107)2017 March 4-15
HEPfit
I Aims of presentation: the software development and structureaspect, not a physics talk per se.
I The Collaboration
I Package Development
I HEPfit Usage
I HEPfit with PolyChord/MultiNest
HEPfit Collaboration: members
Figure : The HEPfit collaboration members and their respective institutions.
HEPfit Collaboration: international collaboration
Figure : The HEPfit is an international collaboration. A global coverage view.
HEPfit: Development and maintainance
Figure : The HEPfit http://hepfit.roma1.infn.it.
HEPfit: code content & dependencies
HEPfit dependencies: C++ (compiler); GSL and boost (numericalintegrations, algebra, solving differential equations etc.); BAT(statistics); ROOT (histograms); openMPI (parallelisation)
HEPfit Usage: HEPfit is Bayesian
I Bayes: prior × likelihood = evidence, Z × posterior
p(θ|d ,H) × p(d |H) = p(d |θ,H) × p(θ|H)
Simple example:
p(d |θ,H) =∏i
exp[−(Oi − µi )
2/2σ2i]√
2πσ2i
I Evidence: Z = p(d |H) =∫
p(d |θ,H)p(θ|H) dθ
I Tools/Methods: MCMC (BAT); Nested Sampling(MultiNest/PolyChord) for computing Z
HEPfit Usage: MCMC mode
- Download: HEPfit-x.x.tar.gz from http://hepfit.roma1.infn.it
- Unpack: tar zxvf HEPfit-x.x.tar.gz
- Install:cd HEPfit-x.xcmake . -DLOCAL_INSTALL_ALL=ON -DMPIBAT=ONmakemake install
- Test run: ./analysis StandardModel.conf MonteCarlo.conf
HEPfit Usage: MCMC mode (GNU Built)1 #include <iostream>2 #include <HEPfit.h>3 #ifdef _MPI4 #include <mpi.h>5 #endif67 int main(int argc, char** argv){8 #ifdef _MPI9 MPI::Init();
10 int rank = MPI::COMM_WORLD.Get_rank();11 MPI::Status status;12 #else13 int rank = 0;14 #endif1516 try {17 if(argc != 3){18 if (rank == 0) std::cout19 << "\nusage: " << argv[0]20 << " ModelConf.conf --noMC/MonteCarlo.conf\n" << std::endl;21 return EXIT_SUCCESS;22 }2324 /* Define the model configuration file. */25 std::string ModelConf = argv[1];26 /* Define the Monte Carlo configuration file. */27 std::string MCMCConf = argv[2];2829 /* Define the ROOT output file (w/o extension, empty string will set it to MCout) */30 std::string FileOut = "";3132 /* Define the optional job tag. */33 std::string JobTag = "";34
HEPfit Usage: MCMC mode (GNU Built)35 /* Create objects of the classes ModelFactory and ThObsFactory */36 ThObsFactory ThObsF;37 ModelFactory ModelF;38 MonteCarlo MC(ModelF, ThObsF, ModelConf, MCMCConf, FileOut, JobTag);3940 if (MCMCConf.compare("--noMC") == 0) MC.TestRun(rank);41 else MC.Run(rank);4243 #ifdef _MPI44 MPI::Finalize();45 #endif4647 return EXIT_SUCCESS;48 } catch (const std::runtime_error& e) {49 std::cerr << e.what() << std::endl;50 return EXIT_FAILURE;51 }52 }
1 #ifndef HEPFIT_H2 #define HEPFIT_H34 #include "Model.h"5 #include "QCD.h"6 #include "Particle.h"7 #include "CKM.h"8 #include "StandardModel.h"9 // ...
10 #include "ThObservable.h"11 #include "ModelParameter.h"12 #include "Observable.h"13 #include "GenerateEvent.h"14 #include "ComputeObservables.h"15 #include "MonteCarlo.h"16 #include "MonteCarloEngine.h"17 #endif /* HEPFIT_H */[email protected] 14
HEPfit Usage: StandardModel.conf
1 StandardModel2 ######################################################################3 # Mandatory configuration files4 #---------------------------------------------------------------------5 IncludeFile Flavour.conf6 #7 ######################################################################8 # Optional configuration files9 #---------------------------------------------------------------------
10 #11 ######################################################################12 # Model Parameters13 # name ave errg errf14 #---------------------------------------------------------------------15 ### Parameters in StandardModel16 ModelParameter GF 1.1663787e-5 0. 0.17 # alpha=1/137.03599907418 ModelParameter ale 7.2973525698e-3 0. 0.19 ModelParameter AlsMz 0.116 0. 0.20 ModelParameter dAle5Mz 0.02750 0.000 0.21 ModelParameter Mz 91.1875 0.00 0.22 # mtpole23 ModelParameter mtop 169.54 0.76 0.24 ModelParameter mHl 125.5 0. 0.25 # ...26 ModelParameter delMw 0. 0. 0.27 ModelParameter delSin2th_l 0. 0. 0.28 ModelParameter delGammaZ 0. 0. 0.29 #
HEPfit Usage: StandardModel.conf
30 # light quark masses at 2 GeV31 ModelParameter mup 0.0023 0. 0.32 ModelParameter mdown 0.0048 0. 0.33 ModelParameter mstrange 0.0938 0.00 0.34 # mc(mc)35 ModelParameter mcharm 1.275 0. 0.36 # mb(mb)37 ModelParameter mbottom 4.18 0. 0.38 ModelParameter muc 1.275 0. 0.39 ModelParameter mub 4.18 0. 0.40 ModelParameter mut 164. 0. 0.41 #42 ModelParameter mneutrino_1 0. 0. 0.43 ModelParameter mneutrino_2 0. 0. 0.44 ModelParameter mneutrino_3 0. 0. 0.45 ModelParameter melectron 5.109989e-4 0. 0.46 ModelParameter mmu 0.10565837 0. 0.47 ModelParameter mtau 1.77682 0. 0.48 #49 ######################################################################50 # Observables:51 # use one of the following formats:52 # Observable name th label min max (no)MCMC weight ave errg errf53 Observable Mw Mw #Mw 79.4 81.4 MCMC weight 2. 20. 100.54 ######################################################################
HEPfit Usage: MonteCarlo.conf
1 #######################################2 ### Sample file for MonteCarlo run. ###3 #######################################4 ## Number of chains5 NChains 56 ## Max iterations in prerun7 PrerunMaxIter 100008 ## Analysis iterations9 Iterations 10000
10 ## Write Markov Chain11 WriteChain false12 ## Use a particular seed13 #Seed 014 ## Find mode with Minuit15 FindModeWithMinuit false16 ## Calculate the evidence (total normalization)17 CalculateNormalization false18 ## Print all marginalized plots19 PrintAllMarginalized true20 ## Print correlation matrix21 PrintCorrelationMatrix true22 ## Print knowledge update plots23 PrintKnowledgeUpdatePlots false24 ## Print parameter plots25 PrintParameterPlot true26 ## Use ordering of parameters in the MonteCarlo run27 OrderParameters false
HEPfit Usage: Results
AlsMz0.11600.11650.11700.11750.11800.11850.11900.11950.12000.12050.1210
p(A
lsM
z|d
ata)
0
100
200
300
400
500
600
700
800
smallest 99.7% interval(s)smallest 95.5% interval(s)smallest 68.3% interval(s)global modemean and standard deviation
HEPfit Usage: Results
mtop170 171 172 173 174 175 176 177
p(m
top
|dat
a)
0.0
0.1
0.2
0.3
0.4
0.5
smallest 99.7% interval(s)smallest 95.5% interval(s)smallest 68.3% interval(s)global modemean and standard deviation
HEPfit Usage: Results
AlsMz0.116 0.117 0.118 0.119 0.120 0.121
mto
p
170
171
172
173
174
175
176
177
smallest 99.7% interval(s)smallest 95.5% interval(s)smallest 68.3% interval(s)global modemean and standard deviation
HEPfit Usage: Results
1 -----------------------------------------------------2 Summary3 -----------------------------------------------------45 Model summary6 =============7 Model:8 Number of parameters: 29 List of Parameters and ranges:
10 (0) Parameter "AlsMz": [0.116, 0.121]11 (1) Parameter "mtop": [169.54, 177.14]1213 Results of the optimization14 ===========================15 Optimization algorithm used: Metropolis MCMC16 Log of the maximum posterior: 6.5799817 List of parameters and global mode:18 (0) Parameter "AlsMz": 0.118492 (no error estimate available)19 (1) Parameter "mtop": 173.329 (no error estimate available)2021 Results of the marginalization22 ==============================23 Marginalization algorithm used: Metropolis24 List of parameters and properties of the marginalized25 distributions:26 (0) Parameter "AlsMz":27 Mean +- sqrt(V): 0.1185 +- 0.000502628 Median +- central 68% interval: 0.1185 + 0.000495 - 0.000504629 (Marginalized) mode: 0.1185
HEPfit Usage: Results39 (1) Parameter "mtop":40 Mean +- sqrt(V): 173.3 +- 0.766141 Median +- central 68% interval: 173.3 + 0.7786 - 0.744642 (Marginalized) mode: 173.243 5% quantile: 172.144 10% quantile: 172.445 16% quantile: 172.646 84% quantile: 174.147 90% quantile: 174.348 95% quantile: 174.649 Smallest interval(s) containing at least 68% and local mode(s):50 (172.6, 174.3) (local mode at 173.2 with rel. height 1; rel. area 0.7048)5152 Status of the MCMC53 ==================54 Convergence reached: yes55 Number of iterations until convergence: 200056 Number of chains: 557 Number of iterations per chain: 1000058 Average pre-run efficiencies:59 (0) Parameter "AlsMz": 27.43%60 (1) Parameter "mtop": 27.43%6162 -----------------------------------------------------63 Notation:64 Mean : mean value of the marg. pdf65 Median : median of the marg. pdf66 Marg. mode : most probable value of the marg. pdf67 V : Variance of the marg. pdf68 Quantiles : most commonly used quantiles69 -----------------------------------------------------
HEPfit with PolyChord1 int main(){23 Settings settings;45 settings.nDims = NINPUT;6 settings.nDerived = NDERIV;7 settings.nlive = 500;8 settings.num_repeats = settings.nDims*5;9 settings.do_clustering = false;
1011 settings.precision_criterion = 1e-3;1213 settings.base_dir = "HEPfit_chains";14 settings.file_root = "run1";1516 settings.write_resume = true;17 settings.read_resume = true;18 settings.write_live = true;19 settings.write_dead = true;20 settings.write_stats = true;2122 settings.equals = true;23 settings.posteriors = true;24 settings.cluster_posteriors = false;2526 settings.feedback = 1;27 settings.update_files = settings.nlive;2829 settings.boost_posterior= 5.0;3031 setpriors();32 run_polychord(loglikelihood, prior, settings) ;33 }
Hepfit with PolyChord
1 double hepfit_call(double *theta, int nDims, double *phi, int nDerived, int index){23 std::string selected_pars[S_PARS] = {"mtop"};4 std::string selected_obsvs[S_OBSV] = {"Mw"};5 std::map<std::string, double> DObs;6 std::map<std::string, double> DPars;78 // Initialize the Observables to be returned9 for (int i = 0; i < S_OBSV; i++) DObs[ selected_obsvs[i] ] = 0.0;
1011 ComputeObservables CO(ModelConf, DObs);1213 // Set/Initialize the parameters, there is only one parameter mbottom=4.1814 for (int i = 0; i < S_PARS; i++) DPars[ selected_pars[i] ] = 1.0;1516 DObs = CO.compute(DPars);17 for (int i = 0; i < S_OBSV; i++) phi[i] = DObs[ selected_obsvs[i] ];1819 // returning likelihood20 // Observable: Mw = 80.3613 +- 0.03, say21 double Mw = 80.3613;22 double Mw_err = 0.03;2324 double MwPredicted = phi[0];2526 double chi = (MwPredicted - Mw) / ( sqrt(2.) * Mw_err );27 return - chi * chi - log( Mw_err * sqrt(2.0 * M_PI) );28 }