├── Geoms ├── CMS-2017 │ ├── bbs.root │ └── tncdefs.h └── Makefile ├── web ├── copyphp.sh ├── makereadable.sh ├── move-toymcval.sh ├── move-cmsswval-ttbar-extrectracks.sh ├── move-cmsswval-ttbar.sh ├── move-benchmarks.sh ├── move-cmsswval-10mu-extrectracks.sh ├── move-cmsswval-10mu.sh ├── tarAndSendToLXPLUS.sh ├── index.php └── collectBenchmarks-multi.sh ├── xeon_scripts ├── check.sh ├── init-env.sh ├── data-dir-location.sh ├── init-gcc10-env.sh ├── trashSKL-SP.sh ├── debug-test.sh ├── generateToyMCsamples.sh ├── benchmark-cmssw-ttbar-fulldet-build-remote.sh ├── throughput-test-common.sh ├── benchmarkMIC-build.sh ├── tarAndSendToRemote.sh └── runBenchmark.sh ├── plotting ├── makeBenchmarkPlots.C ├── makePlotsFromDump.C ├── makeMEIFBenchmarkPlots.C ├── makeValidation.C ├── makeThroughputPlots.sh ├── makeStressPlot.sh ├── PlotBenchmarks.hh ├── runValidation.C ├── textDumpPlots.sh ├── benchmarkPlots.sh ├── PlotMEIFBenchmarks.hh ├── makePlotsFromDump.py ├── StackValidation.hh ├── PlotsFromDump.cpp ├── PlotsFromDump.hh ├── makeMEIFBenchmarkPlots.py ├── PlotValidation.hh └── PlotMEIFBenchmarks.cpp ├── Matrix.cc ├── mkFit ├── fittestMPlex.h ├── config-parse │ ├── ConfigLinkDef.h │ ├── Makefile │ ├── extracto.pl │ ├── test.json │ └── dump_vars.C ├── MkBuilderWrapper.cc ├── seedtestMPlex.h ├── ConformalUtilsMPlex.h ├── MkBuilderWrapper.h ├── FindingFoos.cc ├── Ice │ ├── IcePreprocessor.h │ ├── IceRevisitedRadix.h │ └── IceMemoryMacros.h ├── buildtestMPlex.h ├── chi2-debug │ ├── chichi.txt │ └── chichi.pl ├── Pool.h ├── FindingFoos.h ├── Makefile ├── PropagationMPlex.h ├── DumpHitSearchStats.icc ├── ref_slurm.out ├── fittestMPlex.cc ├── MkFitter.h ├── MkBase.h ├── KalmanUtilsMPlex.h ├── scaling.C └── align_alloc.h ├── .gitignore ├── Validation.cc ├── ConfigWrapper.h ├── Hit.cc ├── from-root └── Math │ ├── MConfig.h │ ├── SMatrixFfwd.h │ ├── SMatrixDfwd.h │ ├── BinaryOpPolicy.h │ ├── StaticCheck.h │ ├── Dsfact.h │ ├── Dfactir.h │ └── Dfinv.h ├── ConfigWrapper.cc ├── Matriplex ├── Makefile ├── test │ ├── m512_test.cxx │ └── GMtest.pl └── MatriplexCommon.h ├── val_scripts ├── validation-toymc-fulldet-build.sh ├── validation-cmssw-10mu-fulldet-build-extrectracks.sh ├── validation-cmssw-10mu-fulldet-build.sh ├── validation-cmssw-ttbar-fulldet-build-extrectracks.sh ├── validation-cmssw-ttbar-fulldet-build.sh ├── validationMIC-build-10mu.sh └── validationMIC-build-PU70.sh ├── tkNtuple ├── DictsLinkDef.h └── Makefile ├── MatrixSTypes.h ├── Makefile ├── cmssw-trackerinfo-desc.txt ├── test ├── mtt1.1.cxx ├── CMS-2017.C ├── CylCowWLids.C ├── mttbb1.cxx ├── lastlyr.C ├── mtt1.cxx └── mtt2.cxx ├── Validation.h ├── Debug.h ├── nlohmann └── json_fwd.hpp ├── Matrix.h ├── Config.cc ├── README_multipleIterations.txt └── Event.h /Geoms/CMS-2017/bbs.root: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trackreco/mkFit/HEAD/Geoms/CMS-2017/bbs.root -------------------------------------------------------------------------------- /web/copyphp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dir=${1} 4 | 5 | #cp index.php into all subdirectories 6 | find ${dir} -mindepth 0 -type d -exec cp web/index.php {} \; 7 | -------------------------------------------------------------------------------- /web/makereadable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dir=${1} 4 | 5 | fs setacl ${dir} webserver:afs read 6 | afind ${dir} -t d -e "fs setacl -dir {} -acl webserver:afs read" 7 | -------------------------------------------------------------------------------- /xeon_scripts/check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo $PATH 4 | echo "++++++++++++++++++++++++++++++++++" 5 | which gcc 6 | echo "----------------------------------" 7 | gcc --version 8 | echo "==================================" 9 | -------------------------------------------------------------------------------- /plotting/makeBenchmarkPlots.C: -------------------------------------------------------------------------------- 1 | #include "plotting/PlotBenchmarks.cpp+" 2 | 3 | void makeBenchmarkPlots(const TString & arch, const TString & sample, const TString & suite) 4 | { 5 | PlotBenchmarks Benchmarks(arch,sample,suite); 6 | Benchmarks.RunBenchmarkPlots(); 7 | } 8 | -------------------------------------------------------------------------------- /Matrix.cc: -------------------------------------------------------------------------------- 1 | #include "Matrix.h" 2 | 3 | namespace mkfit { 4 | 5 | std::default_random_engine g_gen(0xbeef0133); 6 | std::normal_distribution g_gaus(0.0, 1.0); 7 | std::uniform_real_distribution g_unif(0.0, 1.0); 8 | 9 | } // end namespace mkfit 10 | -------------------------------------------------------------------------------- /mkFit/fittestMPlex.h: -------------------------------------------------------------------------------- 1 | #ifndef _fittest_mplex_ 2 | #define _fittest_mplex_ 3 | 4 | #include "Event.h" 5 | #include "Track.h" 6 | 7 | namespace mkfit { 8 | 9 | double runFittingTestPlex(Event& ev, std::vector& rectracks); 10 | 11 | } // end namespace mkfit 12 | #endif 13 | -------------------------------------------------------------------------------- /plotting/makePlotsFromDump.C: -------------------------------------------------------------------------------- 1 | #include "plotting/PlotsFromDump.cpp+" 2 | 3 | void makePlotsFromDump(const TString & sample, const TString & build, const TString & suite, const int useARCH) 4 | { 5 | PlotsFromDump Plots(sample,build,suite,useARCH); 6 | Plots.RunPlotsFromDump(); 7 | } 8 | -------------------------------------------------------------------------------- /mkFit/config-parse/ConfigLinkDef.h: -------------------------------------------------------------------------------- 1 | #pragma link C++ class mkfit::IterationLayerConfig; 2 | #pragma link C++ class mkfit::IterationParams; 3 | // #pragma link C++ class mkfit::IterationSeedPartition; 4 | #pragma link C++ class mkfit::IterationConfig; 5 | #pragma link C++ class mkfit::IterationsInfo; 6 | -------------------------------------------------------------------------------- /plotting/makeMEIFBenchmarkPlots.C: -------------------------------------------------------------------------------- 1 | #include "plotting/PlotMEIFBenchmarks.cpp+" 2 | 3 | void makeMEIFBenchmarkPlots(const TString & arch, const TString & sample, const TString & build) 4 | { 5 | PlotMEIFBenchmarks MEIFBenchmarks(arch,sample,build); 6 | MEIFBenchmarks.RunMEIFBenchmarkPlots(); 7 | } 8 | -------------------------------------------------------------------------------- /plotting/makeValidation.C: -------------------------------------------------------------------------------- 1 | #include "plotting/StackValidation.cpp+" 2 | 3 | void makeValidation(const TString & label = "", const TString & extra = "", const Bool_t cmsswComp = false, const TString & suite = "forPR") 4 | { 5 | StackValidation Stacks(label,extra,cmsswComp,suite); 6 | Stacks.MakeValidationStacks(); 7 | } 8 | -------------------------------------------------------------------------------- /mkFit/MkBuilderWrapper.cc: -------------------------------------------------------------------------------- 1 | #include "MkBuilderWrapper.h" 2 | #include "MkBuilder.h" 3 | 4 | namespace mkfit { 5 | MkBuilderWrapper::MkBuilderWrapper(): 6 | builder_(MkBuilder::make_builder()) 7 | {} 8 | 9 | MkBuilderWrapper::~MkBuilderWrapper() {} 10 | 11 | void MkBuilderWrapper::populate() { 12 | MkBuilder::populate(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /mkFit/seedtestMPlex.h: -------------------------------------------------------------------------------- 1 | #ifndef _seedtest_mplex_ 2 | #define _seedtest_mplex_ 3 | 4 | #include "Event.h" 5 | #include "Track.h" 6 | #include "HitStructures.h" 7 | 8 | namespace mkfit { 9 | 10 | void findSeedsByRoadSearch(TripletIdxConVec & seed_idcs, std::vector& evt_lay_hits, int lay1_size, Event *& ev); 11 | 12 | } // end namespace mkfit 13 | #endif 14 | -------------------------------------------------------------------------------- /plotting/makeThroughputPlots.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## source environment (get ROOT) 4 | source xeon_scripts/init-env.sh 5 | 6 | ## Command line config 7 | infile_name=${1:-"benchmark2_SKL-SP_results.txt"} 8 | outfile_name=${2:-"sklsp"} 9 | graph_label=${3:-""} 10 | 11 | ## Run little macro 12 | ./plotting/plotThroughput.py ${infile_name} ${outfile_name} ${graph_label} 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *#* 3 | *.pdf 4 | *.png 5 | *.log 6 | log* 7 | *.root 8 | *.o 9 | *.so 10 | *.pcm 11 | *.om 12 | *.d 13 | *.ah 14 | *.optrpt 15 | *.gdb_history 16 | main 17 | main-mic 18 | auto-matriplex 19 | mkFit/mkFit 20 | mkFit/mkFit-mic 21 | mkFit/auto-genmplex 22 | mkFit/auto-matriplex 23 | benchmark_*_dump.txt 24 | .*swp 25 | .*swo 26 | slurm-[0-9]*.out 27 | /.ptp-sync/ 28 | -------------------------------------------------------------------------------- /Validation.cc: -------------------------------------------------------------------------------- 1 | #include "TTreeValidation.h" 2 | 3 | namespace mkfit { 4 | 5 | Validation* Validation::make_validation(const std::string& fileName) 6 | { 7 | #ifndef NO_ROOT 8 | if (Config::sim_val_for_cmssw || Config::sim_val || Config::fit_val || Config::cmssw_val) { 9 | return new TTreeValidation(fileName); 10 | } 11 | #endif 12 | return new Validation(); 13 | } 14 | 15 | Validation::Validation() {} 16 | 17 | } // end namespace mkfit 18 | -------------------------------------------------------------------------------- /mkFit/ConformalUtilsMPlex.h: -------------------------------------------------------------------------------- 1 | #ifndef _conformalutils_mplex_ 2 | #define _conformalutils_mplex_ 3 | 4 | #include "Matrix.h" 5 | 6 | namespace mkfit { 7 | 8 | // write to iC --> next step will be a propagation no matter what 9 | void conformalFitMPlex(bool fitting, const MPlexQI seedID, MPlexLS& outErr, MPlexLV& outPar, 10 | const MPlexHV& msPar0, const MPlexHV& msPar1, const MPlexHV& msPar2); 11 | 12 | } // end namespace mkfit 13 | #endif 14 | -------------------------------------------------------------------------------- /xeon_scripts/init-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /cvmfs/cms.cern.ch/slc7_amd64_gcc820/lcg/root/6.18.04-bcolbf/etc/profile.d/init.sh 3 | export TBB_GCC=/cvmfs/cms.cern.ch/slc7_amd64_gcc820/external/tbb/2019_U9 4 | # workaround for https://github.com/cms-sw/cmsdist/issues/5574 5 | # remove when we switch to a ROOT build where that issues is fixed 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBJPEG_TURBO_ROOT/lib64 7 | source /opt/intel/bin/compilervars.sh intel64 8 | -------------------------------------------------------------------------------- /xeon_scripts/data-dir-location.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # To be sourced where needed 4 | 5 | host=`hostname` 6 | 7 | if [[ $host == phi2.t2.* ]]; then 8 | dir=/data1/scratch/toymc 9 | n_sim_thr=128 10 | elif [[ $host == phiphi.t2.* ]]; then 11 | dir=/data/nfsmic/scratch/toymc 12 | n_sim_thr=12 13 | elif [[ $host == phi3.t2.* ]]; then 14 | dir=/data2/scratch/toymc 15 | n_sim_thr=64 16 | else 17 | dir=/tmp/${USER}/toymc 18 | n_sim_thr=8 19 | fi 20 | -------------------------------------------------------------------------------- /xeon_scripts/init-gcc10-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /cvmfs/cms.cern.ch/slc7_amd64_gcc10/lcg/root/6.20.06-cms/etc/profile.d/init.sh 3 | export TBB_GCC=/cvmfs/cms.cern.ch/slc7_amd64_gcc10/external/tbb/2020_U2 4 | # workaround for https://github.com/cms-sw/cmsdist/issues/5574 5 | # remove when we switch to a ROOT build where that issues is fixed 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBJPEG_TURBO_ROOT/lib64 7 | ### source /opt/intel/bin/compilervars.sh intel64 8 | -------------------------------------------------------------------------------- /mkFit/config-parse/Makefile: -------------------------------------------------------------------------------- 1 | include ../../Makefile.config 2 | 3 | all: libConfigDict.so 4 | 5 | libConfigDict.so: ConfigDict.cc 6 | ${CXX} -I.. -I../.. -I$(shell root-config --incdir) ${CPPFLAGS} -fPIC -shared -o $@ $^ 7 | 8 | ConfigDict.cc: ../IterationConfig.h ../SteeringParams.h ConfigLinkDef.h 9 | rootcling -f -I=.. -I=../.. $@ $^ 10 | 11 | clean: 12 | rm -f libConfigDict.so ConfigDict.cc ConfigDict_rdict.pcm 13 | find . -size 0 -delete # rootcling leaves some junk around 14 | -------------------------------------------------------------------------------- /xeon_scripts/trashSKL-SP.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | useARCH=${1:-4} 4 | 5 | # Final cleanup script for benchmarks 6 | if [[ ${useARCH} -eq 3 ]] || [[ ${useARCH} -eq 4 ]] 7 | then 8 | rm -rf benchmark_knl_dump.txt benchmark_snb_dump.txt 9 | fi 10 | if [[ ${useARCH} -eq 1 ]] || [[ ${useARCH} -eq 2 ]] || [[ ${useARCH} -eq 4 ]] 11 | then 12 | rm -rf benchmark_lnx-g_dump.txt benchmark_lnx-s_dump.txt 13 | fi 14 | 15 | rm -rf log_*.txt 16 | rm -rf *.root 17 | rm -rf *.png 18 | rm -rf validation_* 19 | -------------------------------------------------------------------------------- /ConfigWrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef ConfigWrapper_h 2 | #define ConfigWrapper_h 3 | 4 | namespace mkfit { 5 | /** 6 | * The purpose of this namespace is to hide the header of Config.h 7 | * from CMSSW. This header contain uses of the build-time 8 | * configuration macros, that should remain as internal details of 9 | * MkFit package. 10 | */ 11 | namespace ConfigWrapper { 12 | void initializeForCMSSW(bool silent); 13 | 14 | void setNTotalLayers(int nTotalLayers); 15 | } 16 | } 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /mkFit/config-parse/extracto.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -n 2 | 3 | if (m/^(class|struct)\s(\w+)/) 4 | { 5 | my $soc = $1; 6 | my $cls = $2; 7 | push @c, $cls if ($soc eq class and $cls =~ m/Iteration/); 8 | } 9 | 10 | END 11 | { 12 | print "// For ConfigLinkDef.h\n"; 13 | print map { "#pragma link C++ class mkfit::$_;\n" } @c; 14 | 15 | print "\n// For dictgen:\n"; 16 | print "std::vector classes = {\n"; 17 | print join(",\n", map { " \"mkfit::$_\"" } @c); 18 | print "\n};\n"; 19 | } 20 | -------------------------------------------------------------------------------- /Hit.cc: -------------------------------------------------------------------------------- 1 | #include "Hit.h" 2 | #include "Matrix.h" 3 | 4 | namespace mkfit { 5 | 6 | void MCHitInfo::reset() 7 | { 8 | } 9 | 10 | void print(std::string label, const MeasurementState& s) 11 | { 12 | std::cout << label << std::endl; 13 | std::cout << "x: " << s.parameters()[0] 14 | << " y: " << s.parameters()[1] 15 | << " z: " << s.parameters()[2] << std::endl 16 | << "errors: " << std::endl; 17 | dumpMatrix(s.errors()); 18 | std::cout << std::endl; 19 | } 20 | 21 | } // end namespace mkfit 22 | -------------------------------------------------------------------------------- /from-root/Math/MConfig.h: -------------------------------------------------------------------------------- 1 | // @(#)root/smatrix:$Id$ 2 | // Authors: T. Glebe, L. Moneta 2005 3 | 4 | #ifndef ROOT_Math_MConfig 5 | #define ROOT_Math_MConfig 6 | 7 | // for alpha streams 8 | #if defined(__alpha) && !defined(linux) 9 | # include 10 | # ifndef __USE_STD_IOSTREAM 11 | # define __USE_STD_IOSTREAM 12 | # endif 13 | #endif 14 | 15 | 16 | #if defined(__sun) && !defined(linux) 17 | #include 18 | // Solaris does not support expression like D1*(D1+1)/2 as template parameters 19 | #define UNSUPPORTED_TEMPLATE_EXPRESSION 20 | #endif 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ConfigWrapper.cc: -------------------------------------------------------------------------------- 1 | #include "ConfigWrapper.h" 2 | #include "Config.h" 3 | #include "MaterialEffects.h" 4 | #include "TrackerInfo.h" 5 | 6 | namespace mkfit { 7 | namespace ConfigWrapper { 8 | void initializeForCMSSW(bool silent) { 9 | Config::seedInput = cmsswSeeds; 10 | Config::silent = silent; 11 | 12 | // to do backward fit to the first layer, not point of closest approach 13 | Config::includePCA = false; 14 | 15 | fillZRgridME(); 16 | } 17 | 18 | void setNTotalLayers(int nTotalLayers) { 19 | Config::nTotalLayers = nTotalLayers; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Matriplex/Makefile: -------------------------------------------------------------------------------- 1 | all: auto 2 | 3 | auto: std_sym intr_sym 4 | 5 | clean: 6 | rm -f *.ah 7 | 8 | distclean: clean 9 | 10 | # ---------------------------------------------------------------- # 11 | 12 | std_sym: std_sym_3x3.ah std_sym_6x6.ah 13 | 14 | intr_sym: intr_sym_3x3.ah intr_sym_6x6.ah 15 | 16 | 17 | # ================================================================ # 18 | 19 | GM := ./gen_mul.pl 20 | 21 | std_sym_3x3.ah: 22 | ${GM} "mult_sym(3);" > $@ 23 | 24 | std_sym_6x6.ah: 25 | ${GM} "mult_sym(6);" > $@ 26 | 27 | intr_sym_3x3.ah: 28 | ${GM} "mult_sym_fma_intrinsic(3);" > $@ 29 | 30 | intr_sym_6x6.ah: 31 | ${GM} "mult_sym_fma_intrinsic(6);" > $@ 32 | -------------------------------------------------------------------------------- /mkFit/MkBuilderWrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef MkBuilderWrapper_h 2 | #define MkBuilderWrapper_h 3 | 4 | #include 5 | 6 | namespace mkfit { 7 | class MkBuilder; 8 | 9 | /** 10 | * The purpose of this class is to hide the header of MkBuilder.h 11 | * from CMSSW. The headers included by MkBuilder.h contain uses of 12 | * the build-time configuration macros, that should remain as 13 | * internal details of MkFit package. 14 | */ 15 | class MkBuilderWrapper { 16 | public: 17 | MkBuilderWrapper(); 18 | ~MkBuilderWrapper(); 19 | 20 | MkBuilder& get() { return *builder_; } 21 | 22 | static void populate(); 23 | 24 | private: 25 | std::unique_ptr builder_; 26 | }; 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /mkFit/config-parse/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "m_iterations/0": { 3 | "m_layer_configs": [ 4 | { 5 | "[4..10]": { 6 | "m_select_max_dphi": 0.04, 7 | "m_select_min_dphi": 0.02 8 | } 9 | }, 10 | { 11 | "15/m_select_max_dq" : 14 12 | } 13 | ] 14 | 15 | }, 16 | "m_iterations" : { 17 | "[1..2]": [ 18 | { 19 | "m_params/chi2Cut": 25 20 | }, 21 | { 22 | "m_params": { 23 | "c_drmax_bh": 0.01, 24 | "c_dzmax_bh": 0.01 25 | } 26 | } 27 | ] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /plotting/makeStressPlot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## source environment (get ROOT) 4 | source xeon_scripts/init-env.sh 5 | 6 | ## Command line config 7 | infile_name=${1:-"stress_test_SKL-SP_results.txt"} 8 | graph_label=${2:-"[Turbo=OFF(Long)]"} 9 | outfile_name=${3:-"noturbo1_long.pdf"} 10 | 11 | ## reduce stress test results to results used in macro only 12 | tmp_infile_name="tmp_results.txt" 13 | > "${tmp_infile_name}" 14 | 15 | grep "SSE3" "${infile_name}" >> "${tmp_infile_name}" 16 | grep "AVX2" "${infile_name}" >> "${tmp_infile_name}" 17 | grep "AVX512" "${infile_name}" >> "${tmp_infile_name}" 18 | 19 | ## Run little macro 20 | root -l -b -q plotting/plotStress.C\(\"${tmp_infile_name}\",\"${graph_label}\",\"${outfile_name}\"\) 21 | 22 | ## remove tmp file 23 | rm "${tmp_infile_name}" 24 | -------------------------------------------------------------------------------- /mkFit/FindingFoos.cc: -------------------------------------------------------------------------------- 1 | #include "FindingFoos.h" 2 | #include "MkBase.h" 3 | #include "KalmanUtilsMPlex.h" 4 | 5 | namespace { 6 | using namespace mkfit; 7 | const FindingFoos s_fndfoos_brl( kalmanPropagateAndComputeChi2, kalmanPropagateAndUpdate, &MkBase::PropagateTracksToR ); 8 | const FindingFoos s_fndfoos_ec ( kalmanPropagateAndComputeChi2Endcap, kalmanPropagateAndUpdateEndcap, &MkBase::PropagateTracksToZ ); 9 | } 10 | 11 | namespace mkfit { 12 | 13 | const FindingFoos& FindingFoos::get_barrel_finding_foos() { return s_fndfoos_brl; } 14 | const FindingFoos& FindingFoos::get_endcap_finding_foos() { return s_fndfoos_ec; } 15 | 16 | const FindingFoos& FindingFoos::get_finding_foos(bool is_barrel) 17 | { 18 | return is_barrel ? s_fndfoos_brl : s_fndfoos_ec; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /mkFit/Ice/IcePreprocessor.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | /** 3 | * Contains preprocessor stuff. This should be the first included header. 4 | * \file IcePreprocessor.h 5 | * \author Pierre Terdiman 6 | * \date April, 4, 2000 7 | */ 8 | //---------------------------------------------------------------------- 9 | 10 | //---------------------------------------------------------------------- 11 | // Include Guard 12 | #ifndef __ICEPREPROCESSOR_H__ 13 | #define __ICEPREPROCESSOR_H__ 14 | 15 | #define FUNCTION extern "C" 16 | 17 | // Cosmetic stuff [mainly useful with multiple inheritance] 18 | #define override(base_class) virtual 19 | 20 | // Down the hatch 21 | // #pragma inline_depth( 255 ) // MT: this annoys gcc. 22 | 23 | #endif // __ICEPREPROCESSOR_H__ 24 | -------------------------------------------------------------------------------- /val_scripts/validation-toymc-fulldet-build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | make -j 32 WITH_ROOT:=1 4 | 5 | dir=/data2/scratch/toymc 6 | file=simtracks_fulldet_400x2p5k_val.bin 7 | 8 | base=SKL-SP_ToyMC_FullDet 9 | 10 | for bV in "BH bh" "STD std" "CE ce" 11 | do echo $bV | while read -r bN bO 12 | do 13 | oBase=${base}_${bN} 14 | echo "${oBase}: validation [nTH:32, nVU:32]" 15 | ./mkFit/mkFit --sim-val --read-simtrack-states --seed-input sim --input-file ${dir}/${file} --build-${bO} --num-thr 32 >& log_${oBase}_NVU32int_NTH32_val.txt 16 | mv valtree.root valtree_${oBase}.root 17 | done 18 | done 19 | 20 | for build in BH STD CE 21 | do 22 | root -b -q -l plotting/runValidation.C\(\"_SNB_ToyMC_FullDet_${build}\"\) 23 | done 24 | root -b -q -l plotting/makeValidation.C\(\"SNB_ToyMC_FullDet\"\) 25 | 26 | make clean 27 | -------------------------------------------------------------------------------- /Geoms/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.config 2 | 3 | CPPEXTRA := ${USER_CPPFLAGS} ${DEFS} -I.. 4 | LDEXTRA := ${USER_LDFLAGS} 5 | 6 | CPPFLAGS := ${CPPEXTRA} ${CPPFLAGS} 7 | CXXFLAGS += -fPIC ${USER_CXXFLAGS} 8 | LDFLAGS += ${LDEXTRA} 9 | 10 | CPPFLAGS_NO_ROOT := ${CPPEXTRA} ${CPPFLAGS_NO_ROOT} 11 | 12 | .PHONY: all clean distclean echo 13 | 14 | SRCS := $(wildcard *.cc) 15 | DEPS := $(SRCS:.cc=.d) 16 | 17 | TGTS := $(SRCS:.cc=) 18 | 19 | TGTS := $(addsuffix .so, ${TGTS}) 20 | 21 | all: ${TGTS} 22 | 23 | %.o: %.cc %.d 24 | ${CXX} ${CPPFLAGS} ${CXXFLAGS} ${VEC_HOST} -c -o $@ $< 25 | 26 | %.so: %.o 27 | ${CXX} -shared -L../lib -lMicCore -o $@ $< 28 | 29 | ifeq ($(filter clean distclean, ${MAKECMDGOALS}),) 30 | include ${DEPS} 31 | endif 32 | 33 | clean: 34 | rm -f *.so *.o *.om *.d *.optrpt 35 | 36 | distclean: clean 37 | -------------------------------------------------------------------------------- /plotting/PlotBenchmarks.hh: -------------------------------------------------------------------------------- 1 | #ifndef _PlotBenchmarks_ 2 | #define _PlotBenchmarks_ 3 | 4 | #include "Common.hh" 5 | 6 | typedef std::vector TGEVec; 7 | 8 | class PlotBenchmarks 9 | { 10 | public: 11 | PlotBenchmarks(const TString & arch, const TString & sample, const TString & suite); 12 | ~PlotBenchmarks(); 13 | void RunBenchmarkPlots(); 14 | void MakeOverlay(const TString & text, const TString & title, const TString & xtitle, const TString & ytitle, 15 | const Double_t xmin, const Double_t xmax, const Double_t ymin, const Double_t ymax); 16 | void GetGraphs(TGEVec & graphs, const TString & text, const TString & title, const TString & xtitle, const TString & ytitle); 17 | 18 | private: 19 | const TString arch; 20 | const TString sample; 21 | const TString suite; 22 | 23 | TFile * file; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /plotting/runValidation.C: -------------------------------------------------------------------------------- 1 | #include "plotting/PlotValidation.cpp+" 2 | 3 | void runValidation(const TString & test = "", const Bool_t cmsswComp = false, const int algo = 0, const Bool_t mvInput = true, const Bool_t rmSuffix = true, 4 | const Bool_t saveAs = false, const TString & image = "pdf") 5 | { 6 | // PlotValidation arguments 7 | // First is additional input name of root file 8 | // Second is name of output directory 9 | // First boolean argument is to do special CMSSW validation 10 | // The second boolean argument == true to move input root file to output directory, false to keep input file where it is. 11 | // Third Bool is saving the image files 12 | // Last argument is output type of plots 13 | 14 | PlotValidation Val(Form("valtree%s.root",test.Data()),Form("validation%s",test.Data()),cmsswComp,algo,mvInput,rmSuffix,saveAs,image); 15 | Val.Validation(algo); 16 | } 17 | -------------------------------------------------------------------------------- /web/move-toymcval.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir=${1:-plots} 4 | outdir=${dir}/toymcval 5 | base=SKL-SP_ToyMC_FullDet 6 | 7 | echo "Moving plots and text files locally to ${outdir}" 8 | mkdir -p ${outdir} 9 | mv ${base}_*.png ${outdir} 10 | for build in BH STD CE 11 | do 12 | vbase=validation_${base}_${build} 13 | mv ${vbase}/totals_${vbase}.txt ${outdir} 14 | done 15 | 16 | host=kmcdermo@lxplus.cern.ch 17 | whost=${host}":~/www" 18 | echo "Moving plots and text files remotely to ${whost}" 19 | scp -r ${dir} ${whost} 20 | 21 | echo "Executing remotely ./makereadable.sh ${outdir}" 22 | ssh ${host} bash -c "' 23 | cd www 24 | ./makereadable.sh ${outdir} 25 | exit 26 | '" 27 | 28 | echo "Removing local files" 29 | for build in BH STD CE 30 | do 31 | testbase=${base}_${build} 32 | rm -rf validation_${testbase} 33 | rm -rf log_${testbase}_NVU8int_NTH24_val.txt 34 | done 35 | 36 | rm -rf ${dir} 37 | -------------------------------------------------------------------------------- /tkNtuple/DictsLinkDef.h: -------------------------------------------------------------------------------- 1 | #include "Rtypes.h" 2 | #include "vector" 3 | 4 | #ifdef __CINT__ 5 | #pragma link C++ class vector >+ ; 6 | #pragma link C++ class vector >+ ; 7 | #pragma link C++ class vector >+ ; 8 | #ifdef G__VECTOR_HAS_CLASS_ITERATOR 9 | #pragma link C++ operators vector >::iterator; 10 | #pragma link C++ operators vector >::const_iterator; 11 | #pragma link C++ operators vector >::reverse_iterator; 12 | 13 | #pragma link C++ operators vector >::iterator; 14 | #pragma link C++ operators vector >::const_iterator; 15 | #pragma link C++ operators vector >::reverse_iterator; 16 | 17 | #pragma link C++ operators vector >::iterator; 18 | #pragma link C++ operators vector >::const_iterator; 19 | #pragma link C++ operators vector >::reverse_iterator; 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /val_scripts/validation-cmssw-10mu-fulldet-build-extrectracks.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | make -j 32 WITH_ROOT:=1 4 | 5 | dir=/data2/slava77/samples/2021/ 6 | subdir=10muPt0p2to10HS/ 7 | file=memoryFile.fv6.default.211008-c6b7c67.bin 8 | fin10mu=${dir}/${subdir}/${file} 9 | 10 | base=SNB_CMSSW_10mu 11 | 12 | for bV in "BH bh" "STD std" "CE ce" 13 | do echo $bV | while read -r bN bO 14 | do 15 | oBase=${base}_10muPt0p2to10HS_${bN} 16 | echo "${oBase}: validation [nTH:32, nVU:32]" 17 | ./mkFit/mkFit --cmssw-n2seeds --cmssw-val-trkparam --input-file ${fin10mu} --build-${bO} --num-thr 32 >& log_${oBase}_NVU32int_NTH32_cmsswval.txt 18 | mv valtree.root valtree_${oBase}.root 19 | done 20 | done 21 | 22 | make clean 23 | 24 | oBase=${base}_10muPt0p2to10HS 25 | for build in BH STD CE 26 | do 27 | root -b -q -l plotting/runValidation.C\(\"_${oBase}_${build}\",1\) 28 | done 29 | root -b -q -l plotting/makeValidation.C\(\"${oBase}\",\"\",1\) 30 | 31 | make distclean 32 | -------------------------------------------------------------------------------- /plotting/textDumpPlots.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | ## input 4 | suite=${1:-"forPR"} 5 | useARCH=${2:-0} 6 | lnxuser=${3:-${USER}} 7 | 8 | ## In case this is run separately from the main script 9 | source xeon_scripts/common-variables.sh ${suite} ${useARCH} ${lnxuser} 10 | source xeon_scripts/init-env.sh 11 | 12 | ##### Make plots of track properties (kinematics, nHits, etc) from text files, comparing different machine configurations ##### 13 | for build in "${text_builds[@]}" 14 | do echo ${!build} | while read -r bN bO 15 | do 16 | echo "Making plots from text files for" ${sample} ":" ${bN} 17 | for archV in "${arch_array_textdump[@]}" 18 | do echo ${archV} | while read -r archN archO 19 | do 20 | echo "Extracting plots from dump for" ${archN} ${archO} 21 | python plotting/makePlotsFromDump.py ${archN} ${sample} ${bN} ${archO} 22 | done 23 | done 24 | 25 | echo "Making comparison plots from dump for" ${sample} ":" ${bN} 26 | root -b -q -l plotting/makePlotsFromDump.C\(\"${sample}\",\"${bN}\",\"${suite}\",${useARCH}\) 27 | done 28 | done 29 | -------------------------------------------------------------------------------- /Matriplex/test/m512_test.cxx: -------------------------------------------------------------------------------- 1 | #include "immintrin.h" 2 | 3 | #include 4 | 5 | const int NN = 64; 6 | 7 | #define LD(a, i) _mm512_load_ps(&a[i*16]) 8 | #define ADD(a, b) _mm512_add_ps(a, b) 9 | #define MUL(a, b) _mm512_mul_ps(a, b) 10 | #define FMA(a, b, v) _mm512_fmadd_ps(a, b, v) 11 | #define ST(a, i, r) _mm512_store_ps(&a[i*16], r) 12 | 13 | // Can even be global! 14 | __m512 all_ones = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; 15 | 16 | int main() 17 | { 18 | float *p = (float*) _mm_malloc(NN*sizeof(float), 64); 19 | float *q = (float*) _mm_malloc(NN*sizeof(float), 64); 20 | 21 | for (int i = 0; i < NN; ++i) 22 | { 23 | p[i] = i; 24 | } 25 | 26 | __m512 a = LD(p, 0); 27 | __m512 b = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };//LD(p, 1); 28 | 29 | b = all_ones; 30 | 31 | __m512 c = ADD(a, b); 32 | 33 | ST(q, 0, c); 34 | 35 | for (int i = 0; i < 16; ++i) 36 | { 37 | printf("%2d %4.0f %4.0f %4.0f\n", i, p[i], p[i+16], q[i]); 38 | } 39 | 40 | _mm_free(p); 41 | _mm_free(q); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /web/move-cmsswval-ttbar-extrectracks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir=${1:-plots} 4 | outdir=${dir}/cmsswval-ttbar-extrectracks 5 | base=SKL-SP_CMSSW_TTbar 6 | 7 | echo "Moving plots and text files locally to ${outdir}" 8 | for ttbar in NoPU PU35 PU70 9 | do 10 | fulldir=${outdir}/${ttbar} 11 | mkdir -p ${fulldir} 12 | 13 | mv ${base}_${ttbar}_*.png ${fulldir} 14 | for build in BH STD CE 15 | do 16 | vbase=validation_${base}_${ttbar}_${build} 17 | mv ${vbase}/totals_${vbase}_cmssw.txt ${fulldir} 18 | done 19 | done 20 | 21 | host=kmcdermo@lxplus.cern.ch 22 | whost=${host}":~/www" 23 | echo "Moving plots and text files remotely to ${whost}" 24 | scp -r ${dir} ${whost} 25 | 26 | echo "Executing remotely ./makereadable.sh ${outdir}" 27 | ssh ${host} bash -c "' 28 | cd www 29 | ./makereadable.sh ${outdir} 30 | exit 31 | '" 32 | 33 | echo "Removing local files" 34 | for ttbar in NoPU PU35 PU70 35 | do 36 | for build in BH STD CE 37 | do 38 | testbase=${base}_${ttbar}_${build} 39 | rm -rf validation_${testbase} 40 | rm -rf log_${testbase}_NVU8int_NTH24_cmsswval.txt 41 | done 42 | done 43 | 44 | rm -rf ${dir} 45 | -------------------------------------------------------------------------------- /val_scripts/validation-cmssw-10mu-fulldet-build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | make -j 32 WITH_ROOT:=1 4 | 5 | dir=/data2/slava77/samples/2021/ 6 | subdir=10muPt0p2to10HS/ 7 | file=memoryFile.fv6.default.211008-c6b7c67.bin 8 | fin10mu=${dir}/${subdir}/${file} 9 | 10 | base=SKL-SP_CMSSW_10mu 11 | 12 | for sV in "SimSeed --cmssw-simseeds" "CMSSeed --cmssw-n2seeds" 13 | do echo $sV | while read -r sN sO 14 | do 15 | for bV in "BH bh" "STD std" "CE ce" 16 | do echo $bV | while read -r bN bO 17 | do 18 | oBase=${base}_${sN}_10muPt0p2to10HS_${bN} 19 | echo "${oBase}: validation [nTH:32, nVU:32]" 20 | ./mkFit/mkFit ${sO} --sim-val --input-file ${fin10mu} --build-${bO} --num-thr 32 >& log_${oBase}_NVU32int_NTH32_val.txt 21 | mv valtree.root valtree_${oBase}.root 22 | done 23 | done 24 | done 25 | done 26 | 27 | make clean 28 | 29 | for seed in SimSeed CMSSeed 30 | do 31 | oBase=${base}_${seed}_10muPt0p2to10HS 32 | for build in BH STD CE 33 | do 34 | root -b -q -l plotting/runValidation.C\(\"_${oBase}_${build}\"\) 35 | done 36 | root -b -q -l plotting/makeValidation.C\(\"${oBase}\"\) 37 | done 38 | 39 | make distclean 40 | -------------------------------------------------------------------------------- /val_scripts/validation-cmssw-ttbar-fulldet-build-extrectracks.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | make -j 32 WITH_ROOT:=1 4 | 5 | dir=/data2/slava77/samples/2021/11834.0_TTbar_14TeV+2021/ 6 | file=memoryFile.fv6.default.211008-c6b7c67.bin 7 | 8 | NoPU=AVE_0_BX01_25ns/ 9 | PU35=AVE_35_BX01_25ns/ 10 | PU50=AVE_50_BX01_25ns/ 11 | PU70=AVE_70_BX01_25ns/ 12 | 13 | base=SKL-SP_CMSSW_TTbar 14 | 15 | for ttbar in NoPU PU35 PU50 PU70 16 | do 17 | for bV in "BH bh" "STD std" "CE ce" 18 | do echo $bV | while read -r bN bO 19 | do 20 | oBase=${base}_${ttbar}_${bN} 21 | echo "${oBase}: validation [nTH:32, nVU:32]" 22 | ./mkFit/mkFit --cmssw-n2seeds --cmssw-val-trkparam --input-file ${dir}/${!ttbar}/${file} --build-${bO} --num-thr 32 >& log_${oBase}_NVU32int_NTH32_cmsswval.txt 23 | mv valtree.root valtree_${oBase}.root 24 | done 25 | done 26 | done 27 | 28 | make clean 29 | 30 | for ttbar in NoPU PU35 PU50 PU70 31 | do 32 | tbase=${base}_${ttbar} 33 | for build in BH STD CE 34 | do 35 | root -b -q -l plotting/runValidation.C\(\"_${tbase}_${build}\",1\) 36 | done 37 | root -b -q -l plotting/makeValidation.C\(\"${tbase}\",\"\",1\) 38 | done 39 | 40 | make distclean 41 | -------------------------------------------------------------------------------- /mkFit/buildtestMPlex.h: -------------------------------------------------------------------------------- 1 | #ifndef _buildtest_mplex_ 2 | #define _buildtest_mplex_ 3 | 4 | #include "Event.h" 5 | #include "Track.h" 6 | 7 | #include "HitStructures.h" 8 | 9 | namespace mkfit { 10 | 11 | class IterationConfig; 12 | class MkBuilder; 13 | 14 | void runBuildingTestPlexDumbCMSSW (Event& ev, const EventOfHits &eoh, MkBuilder& builder); 15 | 16 | double runBuildingTestPlexBestHit (Event& ev, const EventOfHits &eoh, MkBuilder& builder); 17 | double runBuildingTestPlexStandard (Event& ev, const EventOfHits &eoh, MkBuilder& builder); 18 | double runBuildingTestPlexCloneEngine(Event& ev, const EventOfHits &eoh, MkBuilder& builder); 19 | 20 | std::vector runBtpCe_MultiIter(Event& ev, const EventOfHits &eoh, MkBuilder& builder, int n); 21 | 22 | // nullptr is a valid mask ... means no mask for these layers. 23 | void run_OneIteration(const TrackerInfo& trackerInfo, const IterationConfig &itconf, const EventOfHits &eoh, 24 | const std::vector*>& hit_masks, 25 | MkBuilder& builder, TrackVec &seeds, TrackVec &out_tracks, 26 | bool do_seed_clean, bool do_backward_fit, bool do_remove_duplicates); 27 | 28 | } // end namespace mkfit 29 | #endif 30 | -------------------------------------------------------------------------------- /web/move-cmsswval-ttbar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir=${1:-plots} 4 | outdir=${dir}/cmsswval-ttbar 5 | base=SKL-SP_CMSSW_TTbar 6 | 7 | echo "Moving plots and text files locally to ${outdir}" 8 | for ttbar in NoPU PU35 PU70 9 | do 10 | for seed in SimSeed CMSSeed 11 | do 12 | fulldir=${outdir}/${ttbar}/${seed} 13 | mkdir -p ${fulldir} 14 | 15 | mv ${base}_${ttbar}_${seed}_*.png ${fulldir} 16 | for build in BH STD CE 17 | do 18 | vbase=validation_${base}_${ttbar}_${seed}_${build} 19 | mv ${vbase}/totals_${vbase}.txt ${fulldir} 20 | done 21 | done 22 | done 23 | 24 | host=kmcdermo@lxplus.cern.ch 25 | whost=${host}":~/www" 26 | echo "Moving plots and text files remotely to ${whost}" 27 | scp -r ${dir} ${whost} 28 | 29 | echo "Executing remotely ./makereadable.sh ${outdir}" 30 | ssh ${host} bash -c "' 31 | cd www 32 | ./makereadable.sh ${outdir} 33 | exit 34 | '" 35 | 36 | echo "Removing local files" 37 | for ttbar in NoPU PU35 PU70 38 | do 39 | for seed in SimSeed CMSSeed 40 | do 41 | for build in BH STD CE 42 | do 43 | testbase=${base}_${ttbar}_${seed}_${build} 44 | rm -rf validation_${testbase} 45 | rm -rf log_${testbase}_NVU8int_NTH24_val.txt 46 | done 47 | done 48 | done 49 | 50 | rm -rf ${dir} 51 | -------------------------------------------------------------------------------- /xeon_scripts/debug-test.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | ## Use this script to turn auto debug printouts. Warning: debug statements are ifdef'ed and not maintained 4 | 5 | ## initialize 6 | source xeon_scripts/common-variables.sh 7 | source xeon_scripts/init-env.sh 8 | 9 | 10 | ## Common setup 11 | dir=/data2/slava77/samples/2021/ 12 | subdir=10muPt0p2to10HS 13 | file=memoryFile.fv6.default.211008-c6b7c67.bin 14 | 15 | ## config for debug 16 | nevents=10 17 | maxth=1 18 | maxvu=1 19 | maxev=1 20 | 21 | ## base executable 22 | exe="./mkFit/mkFit --cmssw-n2seeds --num-thr ${maxth} --num-thr-ev ${maxev} --input-file ${dir}/${subdir}/${file} --num-events ${nevents}" 23 | 24 | ## Compile once 25 | mOpt="DEBUG:=1 WITH_ROOT:=1 USE_INTRINSICS:=-DMPT_SIZE=${maxvu} AVX_512:=1" 26 | make distclean ${mOpt} 27 | make -j 32 ${mOpt} 28 | 29 | ## test each build routine to be sure it works! 30 | for bV in "BH bh" "STD std" "CE ce" 31 | do echo ${bV} | while read -r bN bO 32 | do 33 | oBase=${val_arch}_${sample}_${bN} 34 | bExe="${exe} --build-${bO}" 35 | 36 | echo "${oBase}: ${vN} [nTH:${maxth}, nVU:${maxvu}, nEV:${maxev}]" 37 | ${bExe} >& log_${oBase}_NVU${maxvu}_NTH${maxth}_NEV${maxev}_"DEBUG".txt 38 | done 39 | done 40 | 41 | ## clean up 42 | make distclean ${mOpt} 43 | -------------------------------------------------------------------------------- /web/move-benchmarks.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # command line input 4 | dir=${1:-"benchmarks"} # Main output dir name 5 | suite=${2:-"forPR"} # which set of benchmarks to run: full, forPR, forConf 6 | afs_or_eos=${3:-"eos"} # which user space to use: afs or eos 7 | lxpuser=${4:-${USER}} 8 | useARCH=${5:-0} 9 | multi=${6:-0} 10 | 11 | collect=collectBenchmarks.sh 12 | if [ ${multi} -gt 0 ] 13 | then 14 | dir=${dir}"-multi" 15 | collect=collectBenchmarks-multi.sh 16 | fi 17 | 18 | # source global variables 19 | source xeon_scripts/common-variables.sh ${suite} ${useARCH} 20 | source xeon_scripts/init-env.sh 21 | 22 | # First collect all plots and text files into common dir 23 | echo "Moving plots and text files locally to ${dir}" 24 | ./web/${collect} ${dir} ${suite} ${useARCH} 25 | 26 | # Next copy index.php into ouput dir 27 | echo "Copying index.php into ${dir}" 28 | ./web/copyphp.sh ${dir} 29 | 30 | # Then copy to lxplus 31 | echo "Moving plots and text files remotely to lxplus" 32 | ./web/tarAndSendToLXPLUS.sh ${dir} ${suite} ${afs_or_eos} ${lxpuser} 33 | 34 | # Final cleanup of directory 35 | echo "Removing local files" 36 | ./xeon_scripts/trashSKL-SP.sh ${useARCH} 37 | rm -rf ${dir} 38 | 39 | # Final message 40 | echo "Finished moving benchmark plots to LXPLUS!" 41 | -------------------------------------------------------------------------------- /web/move-cmsswval-10mu-extrectracks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir=${1:-plots} 4 | outdir=${dir}/cmsswval-10mu-extrectracks 5 | base=SKL-SP_CMSSW_10mu 6 | 7 | echo "Moving plots and text files locally to ${outdir}" 8 | for region in ECN2 ECN1 BRL ECP1 ECP2 FullDet 9 | do 10 | fulldir=${outdir}/${region} 11 | mkdir -p ${fulldir} 12 | 13 | mv ${base}_${region}_*.png ${fulldir} 14 | for build in BH STD CE 15 | do 16 | vbase=validation_${base}_${region}_${build} 17 | mv ${vbase}/totals_${vbase}_cmssw.txt ${fulldir} 18 | done 19 | done 20 | 21 | mv ${outdir}/FullDet/*png ${outdir}/FullDet/*txt ${outdir} 22 | rm -rf ${outdir}/FullDet 23 | 24 | host=kmcdermo@lxplus.cern.ch 25 | whost=${host}":~/www" 26 | echo "Moving plots and text files remotely to ${whost}" 27 | scp -r ${dir} ${whost} 28 | 29 | echo "Executing remotely ./makereadable.sh ${outdir}" 30 | ssh ${host} bash -c "' 31 | cd www 32 | ./makereadable.sh ${outdir} 33 | exit 34 | '" 35 | 36 | echo "Removing local files" 37 | for region in ECN2 ECN1 BRL ECP1 ECP2 FullDet 38 | do 39 | for build in BH STD CE 40 | do 41 | testbase=${base}_${region}_${build} 42 | rm -rf validation_${testbase} 43 | rm -rf log_${testbase}_NVU8int_NTH24_cmsswval.txt 44 | done 45 | done 46 | 47 | rm -rf ${dir} 48 | -------------------------------------------------------------------------------- /mkFit/chi2-debug/chichi.txt: -------------------------------------------------------------------------------- 1 | echo $# $1 2 | 3 | exit 4 | 5 | files="/bar/mic/mu_brl-1000-10.bin-5 /bar/mic/mu_ecn-1000-10.bin-5 /bar/mic/mu_ecp-1000-10.bin-5 /bar/mic/mu_trn-1000-10.bin-5 /bar/mic/mu_trp-1000-10.bin-5" 6 | 7 | flds_chi="layer/I:chi2/F:x_h:y_h:z_h:r_h:ex_h:ey_h:ez_h:x_t:y_t:z_t:r_t:ex_t:ey_t:ez_t:pt:phi:theta:phi_h:phi_t:ephi_h:ephi_t" 8 | flds_trk="n_hits/I:chi2/F:chi2pdof:pt:phi:theta" 9 | 10 | opts="--build-ce --geom CMS-2017 --num-events 990 --backward-fit-pca" 11 | #opts+=" --kludge-cms-hit-errors" 12 | 13 | rm -f chichi-pure.txt chitrk-pure.txt 14 | echo $flds_chi > chichi-pure.txt 15 | echo $flds_trk > chitrk-pure.txt 16 | for f in $files; do 17 | echo $f 18 | ./mkFit --cmssw-seeds --read --file-name $f ${opts} | grep CHICHI >> chichi-pure.txt 19 | ./mkFit --cmssw-seeds --read --file-name $f ${opts} | grep CHITRK >> chitrk-pure.txt 20 | done 21 | 22 | rm -f chichi-sim.txt chitrk-sim.txt 23 | echo $flds_chi > chichi-sim.txt 24 | echo $flds_trk > chitrk-sim.txt 25 | for f in $files; do 26 | echo $f 27 | ./mkFit --read --file-name $f ${opts} | grep CHICHI >> chichi-sim.txt 28 | ./mkFit --read --file-name $f ${opts} | grep CHITRK >> chitrk-sim.txt 29 | done 30 | 31 | perl -pi -e 's/CHICHI //o;' chichi-pure.txt chichi-sim.txt 32 | perl -pi -e 's/CHITRK //o;' chitrk-pure.txt chitrk-sim.txt 33 | -------------------------------------------------------------------------------- /val_scripts/validation-cmssw-ttbar-fulldet-build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | make -j 32 WITH_ROOT:=1 4 | 5 | dir=/data2/slava77/samples/2021/11834.0_TTbar_14TeV+2021/ 6 | file=memoryFile.fv6.default.211008-c6b7c67.bin 7 | 8 | NoPU=AVE_0_BX01_25ns/ 9 | PU35=AVE_35_BX01_25ns/ 10 | PU50=AVE_50_BX01_25ns/ 11 | PU70=AVE_70_BX01_25ns/ 12 | 13 | base=SKL-SP_CMSSW_TTbar 14 | 15 | for ttbar in NoPU PU35 PU50 PU70 16 | do 17 | for sV in "SimSeed --cmssw-simseeds" "CMSSeed --cmssw-n2seeds" 18 | do echo $sV | while read -r sN sO 19 | do 20 | for bV in "BH bh" "STD std" "CE ce" 21 | do echo $bV | while read -r bN bO 22 | do 23 | oBase=${base}_${ttbar}_${sN}_${bN} 24 | echo "${oBase}: validation [nTH:32, nVU:32]" 25 | ./mkFit/mkFit ${sO} --sim-val --input-file ${dir}/${!ttbar}/${file} --build-${bO} --num-thr 32 >& log_${oBase}_NVU32int_NTH32_val.txt 26 | mv valtree.root valtree_${oBase}.root 27 | done 28 | done 29 | done 30 | done 31 | done 32 | 33 | make clean 34 | 35 | for ttbar in NoPU PU35 PU50 PU70 36 | do 37 | for seed in SimSeed CMSSeed 38 | do 39 | oBase=${base}_${ttbar}_${seed} 40 | for build in BH STD CE 41 | do 42 | root -b -q -l plotting/runValidation.C\(\"_${oBase}_${build}\"\) 43 | done 44 | root -b -q -l plotting/makeValidation.C\(\"${oBase}\"\) 45 | done 46 | done 47 | 48 | make distclean 49 | -------------------------------------------------------------------------------- /from-root/Math/SMatrixFfwd.h: -------------------------------------------------------------------------------- 1 | // @(#)root/smatrix:$Id$ 2 | // Authors: T. Glebe, L. Moneta 2005 3 | 4 | #ifndef ROOT_Math_SMatrixFfwd 5 | #define ROOT_Math_SMatrixFfwd 6 | 7 | namespace ROOT { 8 | 9 | namespace Math{ 10 | 11 | template class SMatrix; 12 | 13 | template class MatRepStd; 14 | template class MatRepSym; 15 | 16 | typedef SMatrix > SMatrix2F; 17 | typedef SMatrix > SMatrix3F; 18 | typedef SMatrix > SMatrix4F; 19 | typedef SMatrix > SMatrix5F; 20 | typedef SMatrix > SMatrix6F; 21 | typedef SMatrix > SMatrix7F; 22 | 23 | typedef SMatrix > SMatrixSym2F; 24 | typedef SMatrix > SMatrixSym3F; 25 | typedef SMatrix > SMatrixSym4F; 26 | typedef SMatrix > SMatrixSym5F; 27 | typedef SMatrix > SMatrixSym6F; 28 | typedef SMatrix > SMatrixSym7F; 29 | 30 | 31 | } // namespace Math 32 | 33 | } // namespace ROOT 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /from-root/Math/SMatrixDfwd.h: -------------------------------------------------------------------------------- 1 | // @(#)root/smatrix:$Id$ 2 | // Authors: T. Glebe, L. Moneta 2005 3 | 4 | #ifndef ROOT_Math_SMatrixDfwd 5 | #define ROOT_Math_SMatrixDfwd 6 | 7 | namespace ROOT { 8 | 9 | namespace Math{ 10 | 11 | template class SMatrix; 12 | 13 | template class MatRepStd; 14 | template class MatRepSym; 15 | 16 | typedef SMatrix > SMatrix2D; 17 | typedef SMatrix > SMatrix3D; 18 | typedef SMatrix > SMatrix4D; 19 | typedef SMatrix > SMatrix5D; 20 | typedef SMatrix > SMatrix6D; 21 | typedef SMatrix > SMatrix7D; 22 | 23 | 24 | typedef SMatrix > SMatrixSym2D; 25 | typedef SMatrix > SMatrixSym3D; 26 | typedef SMatrix > SMatrixSym4D; 27 | typedef SMatrix > SMatrixSym5D; 28 | typedef SMatrix > SMatrixSym6D; 29 | typedef SMatrix > SMatrixSym7D; 30 | 31 | } // namespace Math 32 | 33 | } // namespace ROOT 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /mkFit/Pool.h: -------------------------------------------------------------------------------- 1 | #ifndef Pool_h 2 | #define Pool_h 3 | #include 4 | 5 | #include "tbb/concurrent_queue.h" 6 | 7 | namespace mkfit { 8 | 9 | template 10 | struct Pool 11 | { 12 | typedef std::function CFoo_t; 13 | typedef std::function DFoo_t; 14 | 15 | CFoo_t m_create_foo = []() { return new (_mm_malloc(sizeof(TT), 64)) TT; }; 16 | DFoo_t m_destroy_foo = [](TT* x){ x->~TT(); _mm_free(x); }; 17 | 18 | tbb::concurrent_queue m_stack; 19 | 20 | size_t size() { return m_stack.unsafe_size(); } 21 | 22 | void populate(int threads = Config::numThreadsFinder) 23 | { 24 | for (int i = 0; i < threads; ++i) 25 | { 26 | m_stack.push(m_create_foo()); 27 | } 28 | } 29 | 30 | Pool() {} 31 | Pool(CFoo_t cf, DFoo_t df) : m_create_foo(cf), m_destroy_foo(df) {} 32 | 33 | ~Pool() 34 | { 35 | TT *x; 36 | while (m_stack.try_pop(x)) 37 | { 38 | m_destroy_foo(x); 39 | } 40 | } 41 | 42 | void SetCFoo(CFoo_t cf) { m_create_foo = cf; } 43 | void SetDFoo(DFoo_t df) { m_destroy_foo = df; } 44 | 45 | TT* GetFromPool() 46 | { 47 | TT *x; 48 | if (m_stack.try_pop(x)) { 49 | return x; 50 | } else { 51 | return m_create_foo(); 52 | } 53 | } 54 | 55 | void ReturnToPool(TT *x) 56 | { 57 | m_stack.push(x); 58 | } 59 | }; 60 | 61 | 62 | } // end namespace mkfit 63 | #endif 64 | -------------------------------------------------------------------------------- /xeon_scripts/generateToyMCsamples.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | . data-dir-location.sh 4 | 5 | mkdir -p ${dir} 6 | 7 | # Building test [1 event in flight] 8 | if [ ! -f ${dir}/simtracks_fulldet_100x2p5k.bin ]; then 9 | echo "++++Generating 2.5k tracks/event * 100 events for ToyMC building tests with one event in flight++++" 10 | make -j 12 11 | ./mkFit/mkFit --num-thr-sim ${n_sim_thr} --num-events 100 --num-tracks 2500 --output-file simtracks_fulldet_100x2p5k.bin 12 | mv simtracks_fulldet_100x2p5k.bin ${dir}/ 13 | make clean 14 | fi 15 | 16 | # Building test [n Events in flight] 17 | if [ ! -f ${dir}/simtracks_fulldet_5kx2p5k.bin ]; then 18 | echo "++++Generating 2.5k tracks/event * 5k events for ToyMC building tests with nEvents in flight++++" 19 | make -j 12 20 | ./mkFit/mkFit --num-thr-sim ${n_sim_thr} --num-events 5000 --num-tracks 2500 --output-file simtracks_fulldet_5kx2p5k.bin 21 | mv simtracks_fulldet_5kx2p5k.bin ${dir}/ 22 | make clean 23 | fi 24 | 25 | # Validation tests 26 | if [ ! -f ${dir}/simtracks_fulldet_500x2p5k_val.bin ]; then 27 | echo "++++Generating 2.5k tracks/event * 500 events for ToyMC validation tests++++" 28 | make -j 12 WITH_ROOT:=1 29 | ./mkFit/mkFit --num-thr-sim ${n_sim_thr} --sim-val --num-events 500 --num-tracks 2500 --output-file simtracks_fulldet_500x2p5k_val.bin 30 | mv simtracks_fulldet_500x2p5k_val.bin ${dir}/ 31 | make clean 32 | fi 33 | -------------------------------------------------------------------------------- /web/move-cmsswval-10mu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir=${1:-plots} 4 | outdir=${dir}/cmsswval-10mu 5 | base=SKL-SP_CMSSW_10mu 6 | 7 | echo "Moving plots and text files locally to ${outdir}" 8 | for seed in SimSeed CMSSeed 9 | do 10 | for region in ECN2 ECN1 BRL ECP1 ECP2 FullDet 11 | do 12 | fulldir=${outdir}/${seed}/${region} 13 | mkdir -p ${fulldir} 14 | 15 | srbase=${seed}_${region} 16 | mv ${base}_${srbase}_*.png ${fulldir} 17 | for build in BH STD CE 18 | do 19 | vbase=validation_${base}_${srbase}_${build} 20 | mv ${vbase}/totals_${vbase}.txt ${fulldir} 21 | done 22 | done 23 | sdir=${outdir}/${seed} 24 | mv ${sdir}/FullDet/*png ${sdir}/FullDet/*txt ${sdir} 25 | rm -rf ${sdir}/FullDet 26 | done 27 | 28 | host=kmcdermo@lxplus.cern.ch 29 | whost=${host}":~/www" 30 | echo "Moving plots and text files remotely to ${whost}" 31 | scp -r ${dir} ${whost} 32 | 33 | echo "Executing remotely ./makereadable.sh ${outdir}" 34 | ssh ${host} bash -c "' 35 | cd www 36 | ./makereadable.sh ${outdir} 37 | exit 38 | '" 39 | 40 | echo "Removing local files" 41 | for seed in SimSeed CMSSeed 42 | do 43 | for region in ECN2 ECN1 BRL ECP1 ECP2 FullDet 44 | do 45 | srbase=${seed}_${region} 46 | for build in BH STD CE 47 | do 48 | testbase=${base}_${srbase}_${build} 49 | rm -rf validation_${testbase} 50 | rm -rf log_${testbase}_NVU8int_NTH24_val.txt 51 | done 52 | done 53 | done 54 | 55 | rm -rf ${dir} 56 | -------------------------------------------------------------------------------- /MatrixSTypes.h: -------------------------------------------------------------------------------- 1 | #ifndef _matrixstypes_ 2 | #define _matrixstypes_ 3 | 4 | #include "Math/SMatrix.h" 5 | 6 | namespace mkfit { 7 | 8 | typedef ROOT::Math::SMatrix > SMatrixSym66; 9 | typedef ROOT::Math::SMatrix SMatrix66; 10 | typedef ROOT::Math::SVector SVector6; 11 | 12 | typedef ROOT::Math::SMatrix SMatrix33; 13 | typedef ROOT::Math::SMatrix > SMatrixSym33; 14 | typedef ROOT::Math::SVector SVector3; 15 | 16 | typedef ROOT::Math::SMatrix SMatrix22; 17 | typedef ROOT::Math::SMatrix > SMatrixSym22; 18 | typedef ROOT::Math::SVector SVector2; 19 | 20 | typedef ROOT::Math::SMatrix SMatrix36; 21 | typedef ROOT::Math::SMatrix SMatrix63; 22 | 23 | typedef ROOT::Math::SMatrix SMatrix26; 24 | typedef ROOT::Math::SMatrix SMatrix62; 25 | 26 | template 27 | inline void diagonalOnly(Matrix& m) 28 | { 29 | for (int r=0; r 37 | void dumpMatrix(Matrix m) 38 | { 39 | for (int r=0;r& log_${oBase}_NVU8int_NTH${nTH}_val.txt 17 | mv valtree.root valtree_${oBase}.root 18 | done 19 | done 20 | done 21 | done 22 | 23 | for opt in sim see 24 | do 25 | oBase=${base}_${opt}_10muPt0p2to10HS 26 | for build in BH STD CE 27 | do 28 | root -b -q -l plotting/runValidation.C+\(\"_${oBase}_${build}\"\) 29 | done 30 | root -b -q -l plotting/makeValidation.C+\(\"${oBase}\"\) 31 | done 32 | } 33 | 34 | #cleanup first 35 | make clean 36 | make distclean 37 | make -j 12 WITH_ROOT:=1 38 | 39 | export base=SNB_CMSSW_10mu 40 | echo Run default with base = ${base} 41 | runValidation 0 42 | 43 | export base=SNB_CMSSW_10mu_cleanSeed 44 | echo Run CLEAN_SEEDS with base = ${base} 45 | runValidation 1 46 | 47 | make distclean 48 | 49 | unset base 50 | -------------------------------------------------------------------------------- /val_scripts/validationMIC-build-PU70.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | [ -e "$BIN_DATA_PATH" ] || BIN_DATA_PATH=/data2/slava77/samples/2021/11834.0_TTbar_14TeV+2021/ 4 | fin=${BIN_DATA_PATH}/AVE_70_BX01_25ns/memoryFile.fv6.default.211008-c6b7c67.bin 5 | 6 | runValidation() 7 | { 8 | for sV in "sim --cmssw-simseeds" "see --cmssw-stdseeds"; do echo $sV | while read -r sN sO; do 9 | if [ "${1}" == "1" ]; then 10 | sO="--cmssw-n2seeds" 11 | fi 12 | for bV in "BH bh" "STD std" "CE ce"; do echo $bV | while read -r bN bO; do 13 | oBase=${base}_${sN}_${bN} 14 | nTH=8 15 | echo "${oBase}: validation [nTH:${nTH}, nVU:8]" 16 | ./mkFit/mkFit --sim-val --input-file ${fin} --build-${bO} ${sO} --num-thr ${nTH} >& log_${oBase}_NVU8int_NTH${nTH}_val.txt 17 | mv valtree.root valtree_${oBase}.root 18 | done 19 | done 20 | done 21 | done 22 | 23 | for opt in sim see 24 | do 25 | oBase=${base}_${opt} 26 | for build in BH STD CE 27 | do 28 | root -b -q -l plotting/runValidation.C+\(\"_${oBase}_${build}\"\) 29 | done 30 | root -b -q -l plotting/makeValidation.C+\(\"${oBase}\"\) 31 | done 32 | } 33 | 34 | #cleanup first 35 | make clean 36 | make distclean 37 | make -j 12 WITH_ROOT:=1 38 | 39 | export base=SNB_CMSSW_PU70_clean 40 | echo Run default build with base = ${base} 41 | runValidation 0 42 | 43 | export base=SNB_CMSSW_PU70_clean_cleanSeed 44 | echo Run CLEAN_SEEDS with base = ${base} 45 | runValidation 1 46 | 47 | make distclean 48 | 49 | unset base 50 | -------------------------------------------------------------------------------- /mkFit/config-parse/dump_vars.C: -------------------------------------------------------------------------------- 1 | #include "TClass.h" 2 | 3 | #include 4 | #include 5 | 6 | // Begin AUTO code, some classes commented out. 7 | 8 | std::vector classes = { 9 | // "mkfit::IterationConfig", 10 | "mkfit::IterationLayerConfig", 11 | "mkfit::IterationParams", 12 | // "mkfit::IterationSeedPartition", 13 | "mkfit::IterationConfig", 14 | "mkfit::IterationsInfo" 15 | }; 16 | 17 | // End AUTO code. 18 | 19 | /* 20 | 1. When running for the first time, after changing of classes: 21 | Review extracto.pl 22 | Run: ./extracto.pl ../SteeringParams.h 23 | Cut-n-paste code fragments above and into Config.LinkDef.h 24 | 25 | 2. To run: 26 | # setup root environment 27 | make 28 | root.exe dump_vars.C 29 | Then cut-n-paste NLOHMANN defines into SteeringParams.cc 30 | */ 31 | 32 | void dump_vars() 33 | { 34 | gSystem->Load("libConfigDict.so"); 35 | 36 | for (auto &cls : classes) 37 | { 38 | printf("NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(%s,\n", cls.c_str()); 39 | 40 | TClass *tc = TClass::GetClass(cls.c_str()); 41 | TList *ml = tc->GetListOfDataMembers(); 42 | TIter it(ml); 43 | TDataMember *dm = (TDataMember*) it.Next(); 44 | while (dm) 45 | { 46 | // dm->GetTypeName(), dm->GetFullTypeName(), dm->GetTrueTypeName(), 47 | printf(" /* %s */ %s", dm->GetTypeName(), dm->GetName()); 48 | dm = (TDataMember*) it.Next(); 49 | if (dm) printf(","); 50 | printf("\n"); 51 | } 52 | printf(")\n\n"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Matriplex/test/GMtest.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use lib ".."; 4 | 5 | use GenMul; 6 | 7 | ### If you're going to run GMtest.cxx and you do some changes here 8 | ### you *MUST* bring DIM, DOM and pattern assumptions in sync! 9 | 10 | my $DIM = 3; 11 | my $DOM = 6; 12 | 13 | $a = new GenMul::MatrixSym('name'=>'a', 'M'=>$DIM); 14 | $a->set_pattern(<<"FNORD"); 15 | x 16 | x 1 17 | x x x 18 | FNORD 19 | 20 | $b = new GenMul::Matrix('name'=>'b', 'M'=>$DIM, 'N'=>$DOM); 21 | $b->set_pattern(<<"FNORD"); 22 | x x x x 0 x 23 | x 1 x 1 0 x 24 | x x x x 0 x 25 | FNORD 26 | 27 | $c = new GenMul::Matrix('name'=>'c', 'M'=>$DIM, 'N'=>$DOM); 28 | 29 | 30 | $bt = new GenMul::MatrixTranspose($b); 31 | $bt->print_info(); 32 | $bt->print_pattern(); 33 | 34 | $ct = new GenMul::Matrix('name'=>'c', 'M'=>$DOM, 'N'=>$DIM); 35 | 36 | # ---------------------------------------------------------------------- 37 | 38 | # E.g. to skip matrix size check: 39 | # $m = new GenMul::Multiply('no_size_check'=>1); 40 | # Note that matrix dimensions that you pass into auto-generated 41 | # function still has to match matrix dimensions set here. 42 | 43 | $m = new GenMul::Multiply; 44 | 45 | $m->dump_multiply_std_and_intrinsic("multify.ah", $a, $b, $c); 46 | 47 | $m->dump_multiply_std_and_intrinsic("multify-transpose.ah", $bt, $a, $ct); 48 | 49 | # To separate outputs of each function: 50 | # 51 | # open STD, ">multify.ah"; 52 | # select STD; 53 | 54 | # $m->multiply_standard($a, $b, $c); 55 | 56 | # close STD; 57 | 58 | # # print "\n", '-' x 80, "\n\n"; 59 | 60 | # open INT, ">multify_intr.ah"; 61 | # select INT; 62 | 63 | # $m->multiply_intrinsic($a, $b, $c); 64 | 65 | # close INT; 66 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include Makefile.config 2 | 3 | LIB_CORE := lib/libMicCore.so 4 | 5 | TGTS := ${LIB_CORE} 6 | 7 | .PHONY: all clean distclean 8 | 9 | all: ${TGTS} 10 | cd Geoms && ${MAKE} 11 | cd mkFit && ${MAKE} 12 | 13 | SRCS := $(wildcard *.cc) 14 | OBJS := $(SRCS:.cc=.o) 15 | DEPS := $(SRCS:.cc=.d) 16 | 17 | CORE_OBJS := $(filter-out main.o, ${OBJS}) 18 | 19 | AUTO_TGTS := 20 | 21 | # Begin Matriplex 22 | 23 | auto-matriplex: 24 | ${MAKE} -C Matriplex auto && touch $@ 25 | 26 | AUTO_TGTS += auto-matriplex 27 | 28 | ${DEPS}: auto-matriplex 29 | 30 | # End Matriplex 31 | 32 | ifeq ($(filter clean-local clean distclean, ${MAKECMDGOALS}),) 33 | include ${DEPS} 34 | endif 35 | 36 | clean-local: 37 | -rm -f ${TGTS} *.d *.o *.om *.so 38 | -rm -rf main.dSYM 39 | -rm -rf plotting/*.so plotting/*.d plotting/*.pcm 40 | 41 | clean: clean-local 42 | cd mkFit && ${MAKE} clean 43 | 44 | distclean: clean-local 45 | -rm -f ${AUTO_TGTS} 46 | -rm -f *.optrpt 47 | -rm -rf lib 48 | cd Geoms && ${MAKE} distclean 49 | cd Matriplex && ${MAKE} distclean 50 | cd mkFit && ${MAKE} distclean 51 | 52 | ${LIB_CORE}: ${CORE_OBJS} 53 | @mkdir -p $(@D) 54 | ${CXX} ${CXXFLAGS} ${VEC_HOST} ${CORE_OBJS} -shared -o $@ ${LDFLAGS_HOST} ${LDFLAGS} 55 | 56 | main: ${AUTO_TGTS} ${LIB_CORE} main.o 57 | ${CXX} ${CXXFLAGS} ${VEC_HOST} -o $@ main.o ${LDFLAGS_HOST} ${LDFLAGS} -Llib -lMicCore -Wl,-rpath,lib 58 | 59 | ${OBJS}: %.o: %.cc %.d 60 | ${CXX} ${CPPFLAGS} ${CXXFLAGS} ${VEC_HOST} -c -o $@ $< 61 | 62 | echo: 63 | @echo "CXX=${CXX}" 64 | 65 | echo_cc_defs: 66 | ${CXX} -dM -E -mavx2 - < /dev/null 67 | 68 | echo-srcs: 69 | @echo ${SRCS} 70 | 71 | echo-flags: 72 | @echo "CPPFLAGS=${CPPFLAGS}" 73 | 74 | echo-tbb: 75 | @echo "TBB_GCC=${TBB_GCC}, TBB_PREFIX=${TBB_PREFIX}, TBB_ROOT=${TBB_ROOT}" 76 | -------------------------------------------------------------------------------- /cmssw-trackerinfo-desc.txt: -------------------------------------------------------------------------------- 1 | Storage of hits in Track objects 2 | ================================ 3 | 4 | struct HitOnTrack 5 | { 6 | int index : 24; 7 | int layer : 8; 8 | 9 | HitOnTrack() : index(-1), layer (-1) {} 10 | HitOnTrack(int i, int l) : index( i), layer ( l) {} 11 | }; 12 | 13 | index - index of hit withint the layer it belongs to; 14 | layer - mapped from CMSSW detector/layer as described below. 15 | 16 | 17 | CMSSW -> TrackerInfo layer numbering 18 | ==================================== 19 | 20 | CMSSW uses detector (1 - 6) / layer numbering, our code uses a single layer 21 | index. 22 | 23 | stereo = simhit_detId & 3; 0 - single layer, 1 - stereo, 2 - dual layer 24 | 25 | *** 1. PIXB, 4 layers 26 | 1 -> 0 27 | 2 -> 1 28 | 3 -> 2 29 | 4 -> 3 30 | 31 | *** 3. TIB, 4 layers, 2 innermost are stereo 32 | 1m -> 4 33 | 1s -> 5 34 | 2m -> 6 35 | 2s -> 7 36 | 3 -> 8 37 | 4 -> 9 38 | 39 | *** 5. TOB, 6 layers, 2 innermost are stereo 40 | 1m -> 10 41 | 1s -> 11 42 | 2m -> 12 43 | 2s -> 13 44 | 3 -> 14 45 | 4 -> 15 46 | 5 -> 16 47 | 6 -> 17 48 | 49 | *** 2. PIXE, 3 layers; separate +z | -z !!! 50 | 1 -> 18 | 45 51 | 2 -> 19 | 46 52 | 3 -> 20 | 47 53 | 54 | *** 4. TID, 3 layers, all partially stereo (bottom 2 modules) 55 | 1m -> 21 | 48 56 | 1s -> 22 | 49 57 | 2m -> 23 | 50 58 | 2s -> 24 | 51 59 | 3m -> 25 | 52 60 | 3s -> 26 | 53 61 | 62 | *** 6. TOD, 9, layers, all partially stereo (middle one modules, some bottomfringes) 63 | 1m -> 27 | 54 64 | 1s -> 28 | 55 65 | 2m -> 29 | 56 66 | 2s -> 30 | 57 67 | 3m -> 31 | 58 68 | 3s -> 32 | 59 69 | 4m -> 33 | 60 70 | 4s -> 34 | 61 71 | 5m -> 35 | 62 72 | 5s -> 36 | 63 73 | 6m -> 37 | 64 74 | 6s -> 38 | 65 75 | 7m -> 39 | 66 76 | 7s -> 40 | 67 77 | 8m -> 41 | 68 78 | 8s -> 42 | 69 79 | 9m -> 43 | 70 80 | 9s -> 44 | 71 81 | -------------------------------------------------------------------------------- /mkFit/chi2-debug/chichi.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | =head1 4 | 5 | ./chichi.pl std 6 | ./chichi.pl wfix --kludge-cms-hit-errors 7 | 8 | =cut 9 | 10 | @files = map { "/bar/mic/mu_$_-1000-10.bin-5" } qw(brl ecn ecp trn trp); 11 | 12 | $flds_hit = "layer/I:chi2/F:x_h:y_h:z_h:r_h:ex_h:ey_h:ez_h:x_t:y_t:z_t:r_t:ex_t:ey_t:ez_t:pt:phi:theta:phi_h:phi_t:ephi_h:ephi_t"; 13 | $flds_trk = "n_hits/I:chi2/F:chi2pdof:pt:phi:theta"; 14 | 15 | $base_opts = "--build-ce --geom CMS-2017 --num-events 990 --backward-fit-pca"; 16 | 17 | #----------------------------------------------------------------------- 18 | 19 | die "Usage: $0 output-stem [additional mkFit arguments]" if ($#ARGV < 0); 20 | 21 | $stem = shift @ARGV; 22 | $extra_opts = join(" ", @ARGV); 23 | 24 | print "$0 using stem='$stem', extra_opts='$extra_opts'\n"; 25 | 26 | #----------------------------------------------------------------------- 27 | 28 | sub make_with_opts 29 | { 30 | my $name = shift; 31 | my $opts = shift; 32 | 33 | my $hit = "$stem-hit-$name.rtt", $trk = "$stem-trk-$name.rtt"; 34 | 35 | unlink $hit, $trk; 36 | 37 | open H, ">$hit"; print H $flds_hit, "\n"; 38 | open T, ">$trk"; print T $flds_trk, "\n"; 39 | 40 | print "make_with_opts $name - opts='$opts'\n"; 41 | 42 | for $f (@files) 43 | { 44 | print " processing $f\n"; 45 | 46 | open MKF, "./mkFit --read --file-name $f ${base_opts} ${extra_opts} ${opts} |"; 47 | 48 | while ($_ = ) 49 | { 50 | print H if s/^CHIHIT //o; 51 | print T if s/^CHITRK //o; 52 | } 53 | 54 | close MKF; 55 | } 56 | 57 | close H; 58 | close T; 59 | } 60 | 61 | #----------------------------------------------------------------------- 62 | 63 | make_with_opts("pure", "--cmssw-seeds"); 64 | 65 | make_with_opts("sim", ""); 66 | -------------------------------------------------------------------------------- /xeon_scripts/benchmark-cmssw-ttbar-fulldet-build-remote.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | ######################## 4 | ## Command Line Input ## 5 | ######################## 6 | 7 | remote_arch=${1} # SNB, KNL, SKL-SP 8 | suite=${2:-"forPR"} # which set of benchmarks to run: full, forPR, forConf 9 | useARCH=${3:-0} 10 | lnxuser=${4:-${USER}} 11 | 12 | ################### 13 | ## Configuration ## 14 | ################### 15 | 16 | source xeon_scripts/common-variables.sh ${suite} ${useARCH} ${lnxuser} 17 | source xeon_scripts/init-env.sh 18 | 19 | # architecture dependent settings 20 | if [[ "${remote_arch}" == "SNB" ]] 21 | then 22 | HOST=${SNB_HOST} 23 | DIR=${SNB_WORKDIR}/${SNB_TEMPDIR} 24 | elif [[ "${remote_arch}" == "KNL" ]] 25 | then 26 | HOST=${KNL_HOST} 27 | DIR=${KNL_WORKDIR}/${KNL_TEMPDIR} 28 | elif [[ "${remote_arch}" == "LNX-G" ]] 29 | then 30 | HOST=${LNXG_HOST} 31 | DIR=${LNXG_WORKDIR}/${LNXG_TEMPDIR} 32 | elif [[ "${remote_arch}" == "LNX-S" ]] 33 | then 34 | HOST=${LNXS_HOST} 35 | DIR=${LNXS_WORKDIR}/${LNXS_TEMPDIR} 36 | else 37 | echo ${remote_arch} "is not a valid architecture! Exiting..." 38 | exit 39 | fi 40 | 41 | ################### 42 | ## Run The Tests ## 43 | ################### 44 | 45 | # execute tests remotely 46 | echo "Executing ${remote_arch} tests remotely..." 47 | SSHO ${HOST} bash -c "' 48 | cd ${DIR} 49 | ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build.sh ${remote_arch} ${suite} ${useARCH} ${lnxuser} 50 | exit 51 | '" 52 | 53 | # copy logs back for plotting 54 | echo "Copying logs back from ${remote_arch} for plotting" 55 | scp ${HOST}:${DIR}/log_${remote_arch}_${sample}_*.txt . 56 | 57 | # destroy tmp files 58 | echo "Removing tmp dir on ${remote_arch} remotely" 59 | SSHO ${HOST} bash -c "' 60 | rm -rf ${DIR} 61 | exit 62 | '" 63 | -------------------------------------------------------------------------------- /plotting/PlotMEIFBenchmarks.hh: -------------------------------------------------------------------------------- 1 | #ifndef _PlotMEIFBenchmarks_ 2 | #define _PlotMEIFBenchmarks_ 3 | 4 | #include "Common.hh" 5 | 6 | #include "TGraph.h" 7 | 8 | struct EventOpts 9 | { 10 | EventOpts() {} 11 | EventOpts(const Int_t nev, const Color_t color) 12 | : nev(nev), color(color) {} 13 | 14 | Int_t nev; 15 | Color_t color; 16 | }; 17 | typedef std::vector EOVec; 18 | 19 | namespace 20 | { 21 | EOVec events; 22 | UInt_t nevents; 23 | void setupEvents() 24 | { 25 | // N.B.: Consult ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build.sh for matching MEIF to arch 26 | 27 | events.emplace_back(1,kBlack); 28 | events.emplace_back(2,kBlue); 29 | events.emplace_back(4,kGreen+1); 30 | events.emplace_back(8,kRed); 31 | events.emplace_back((ARCH==SNB?12:16),kMagenta); 32 | 33 | if (ARCH == KNL || ARCH == SKL || ARCH == LNXG || ARCH == LNXS) 34 | { 35 | events.emplace_back(32,kAzure+10); 36 | events.emplace_back(64,kOrange+3); 37 | } 38 | if (ARCH == KNL) 39 | { 40 | events.emplace_back(128,kViolet-1); 41 | } 42 | 43 | // set nevents once events is set 44 | nevents = events.size(); 45 | } 46 | }; 47 | 48 | typedef std::vector TGVec; 49 | 50 | class PlotMEIFBenchmarks 51 | { 52 | public: 53 | PlotMEIFBenchmarks(const TString & arch, const TString & sample, const TString & build); 54 | ~PlotMEIFBenchmarks(); 55 | void RunMEIFBenchmarkPlots(); 56 | void MakeOverlay(const TString & text, const TString & title, const TString & xtitle, const TString & ytitle, 57 | const Double_t xmin, const Double_t xmax, const Double_t ymin, const Double_t ymax); 58 | 59 | private: 60 | const TString arch; 61 | const TString sample; 62 | const TString build; 63 | 64 | ArchEnum ARCH; 65 | TFile * file; 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /web/tarAndSendToLXPLUS.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # command line input 4 | dir=${1:-"benchmarks"} # Main output dir name 5 | suite=${2:-"forPR"} # which set of benchmarks to run: full, forPR, forConf 6 | afs_or_eos=${3:-"eos"} # which user space to use: afs or eos 7 | lxpuser=${4:=${USER}} 8 | 9 | # in case this is run alone 10 | source xeon_scripts/common-variables.sh ${suite} 11 | source xeon_scripts/init-env.sh 12 | 13 | # first tar the directory to be sent 14 | echo "Tarring plot directory" 15 | tarball=${dir}.tar.gz 16 | tar -zcvf ${tarball} ${dir} 17 | 18 | # vars for LXPLUS 19 | LXPLUS_HOST=${lxpuser}@lxplus.cern.ch 20 | LXPLUS_OUTDIR=www 21 | LXPLUS_WORKDIR=user/${lxpuser:0:1}/${lxpuser} 22 | 23 | if [[ "${afs_or_eos}" == "afs" ]] 24 | then 25 | LXPLUS_WORKDIR=/afs/cern.ch/${LXPLUS_WORKDIR} 26 | elif [[ "${afs_or_eos}" == "eos" ]] 27 | then 28 | LXPLUS_WORKDIR=/eos/${LXPLUS_WORKDIR} 29 | else 30 | echo "${afs_or_eos} is not a valid option! Choose either 'afs' or 'eos'! Exiting..." 31 | exit 32 | fi 33 | 34 | # then send it! 35 | scp -r ${tarball} ${LXPLUS_HOST}:${LXPLUS_WORKDIR}/${LXPLUS_OUTDIR} 36 | 37 | # Make outdir nice and pretty 38 | if [[ "${afs_or_eos}" == "afs" ]] 39 | then 40 | echo "Unpacking tarball and executing remotely: ./makereadable.sh ${dir}" 41 | SSHO ${LXPLUS_HOST} bash -c "' 42 | cd ${LXPLUS_WORKDIR}/${LXPLUS_OUTDIR} 43 | tar -zxvf ${tarball} 44 | ./makereadable.sh ${dir} 45 | rm -rf ${tarball} 46 | exit 47 | '" 48 | else 49 | echo "Unpacking tarball" 50 | SSHO ${LXPLUS_HOST} bash -c "' 51 | cd ${LXPLUS_WORKDIR}/${LXPLUS_OUTDIR} 52 | tar -zxvf ${tarball} 53 | rm -rf ${tarball} 54 | exit 55 | '" 56 | fi 57 | 58 | # remove local tarball 59 | echo "Removing local tarball of plots" 60 | rm ${tarball} 61 | 62 | # Final message 63 | echo "Finished tarring and sending plots to LXPLUS!" 64 | -------------------------------------------------------------------------------- /test/mtt1.1.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // c++ -mavx -std=c++11 -I.. -DNO_ROOT mtt1.cxx Matrix.cc -o mtt1 3 | // c++ -mavx2 -std=c++11 mtt1.cxx -o mtt1 4 | // icc -mmic -std=c++11 mtt1.cxx -o mtt1 && scp mtt1 mic0: 5 | // icc -mavx -std=c++11 mtt1.1.cxx -o mtt1.1 6 | // 7 | 8 | #include 9 | 10 | #include 11 | 12 | //#include "Matriplex/MatriplexSym.h" 13 | 14 | //#include "Matrix.h" 15 | 16 | void print_m256(const __m256 &vm) 17 | { 18 | const float *v = (const float *) & vm; 19 | 20 | printf("%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n", 21 | v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]); 22 | 23 | } 24 | 25 | void print_m512(const __m512 &vm) 26 | { 27 | const float *v = (const float *) & vm; 28 | 29 | printf("%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f " 30 | "%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n", 31 | v[ 0], v[ 1], v[ 2], v[ 3], v[ 4], v[ 5], v[ 6], v[ 7], 32 | v[ 8], v[ 9], v[10], v[11], v[12], v[13], v[14], v[15]); 33 | 34 | } 35 | 36 | void print_m512i(const __m512i &vm) 37 | { 38 | const int *v = (const int *) & vm; 39 | 40 | printf("%8d %8d %8d %8d %8d %8d %8d %8d " 41 | "%8d %8d %8d %8d %8d %8d %8d %8d\n", 42 | v[ 0], v[ 1], v[ 2], v[ 3], v[ 4], v[ 5], v[ 6], v[ 7], 43 | v[ 8], v[ 9], v[10], v[11], v[12], v[13], v[14], v[15]); 44 | 45 | } 46 | 47 | inline __m256 FMA(const __m256 &a, const __m256 &b, const __m256 &v) 48 | { 49 | __m256 temp = _mm256_mul_ps(a, b); return _mm256_add_ps(temp, v); 50 | } 51 | 52 | int main() 53 | { 54 | __m256 v0 = { 0, 0, 0, 0, 0, 0, 0, 0 }; 55 | __m256 v1 = { 1, 1, 2, 2, 4, 4, 8, 8 }; 56 | __m256 v2 = { 1, 2, 3, 4, 5, 6, 7, 8 }; 57 | __m256 v3 = { 0, 1, 2, 3, 4, 5, 6, 7 }; 58 | 59 | // print_m256(v0); 60 | print_m256(v1); 61 | print_m256(v2); 62 | print_m256(v3); 63 | 64 | // { __m256 temp = _mm256_mul_ps(v1, v2); v3 = _mm256_add_ps(temp, v3); }; 65 | 66 | v0 = FMA(v1,v2,v3); 67 | 68 | print_m256(v0); 69 | 70 | v3 = FMA(v1,v2,v3); 71 | 72 | print_m256(v3); 73 | 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /Validation.h: -------------------------------------------------------------------------------- 1 | #ifndef _validation_ 2 | #define _validation_ 3 | #include "Track.h" 4 | 5 | namespace mkfit { 6 | 7 | class Event; 8 | 9 | // Fit Validation objects -- mplex only 10 | struct FitVal 11 | { 12 | public: 13 | FitVal() {} 14 | FitVal(float ppz, float eppz, float ppphi, float eppphi, 15 | float upt, float eupt, float umphi, float eumphi, float umeta, float eumeta) : 16 | ppz(ppz), eppz(eppz), ppphi(ppphi), eppphi(eppphi), upt(upt), eupt(eupt), umphi(umphi), eumphi(eumphi), umeta(umeta), eumeta(eumeta) {} 17 | 18 | // first p or u = propagated or updated 19 | // middle: p or m/nothing = position or momentum 20 | // begining: e = error (already sqrt) 21 | float ppz, eppz, ppphi, eppphi; 22 | float upt, eupt, umphi, eumphi, umeta, eumeta; 23 | }; 24 | 25 | class Validation { 26 | public: 27 | virtual ~Validation() {} 28 | 29 | virtual void alignTracks(TrackVec&, TrackExtraVec&, bool) {} 30 | 31 | virtual void resetValidationMaps() {} 32 | virtual void resetDebugVectors() {} 33 | 34 | virtual void collectFitInfo(const FitVal&, int, int) {} 35 | 36 | virtual void setTrackExtras(Event& ev) {} 37 | virtual void makeSimTkToRecoTksMaps(Event&) {} 38 | virtual void makeSeedTkToRecoTkMaps(Event&) {} 39 | virtual void makeRecoTkToRecoTkMaps(Event&) {} 40 | virtual void makeCMSSWTkToRecoTksMaps(Event&) {} 41 | virtual void makeSeedTkToCMSSWTkMap(Event&) {} 42 | virtual void makeCMSSWTkToSeedTkMap(Event&) {} 43 | virtual void makeRecoTkToSeedTkMapsDumbCMSSW(Event&) {} 44 | 45 | virtual void setTrackScoresDumbCMSSW(Event &) {} 46 | 47 | virtual void fillEfficiencyTree(const Event&) {} 48 | virtual void fillFakeRateTree(const Event&) {} 49 | virtual void fillConfigTree() {} 50 | virtual void fillCMSSWEfficiencyTree(const Event&) {} 51 | virtual void fillCMSSWFakeRateTree(const Event&) {} 52 | virtual void fillFitTree(const Event&) {} 53 | 54 | virtual void saveTTrees() {} 55 | 56 | static Validation* make_validation(const std::string&); 57 | 58 | protected: 59 | Validation(); 60 | }; 61 | 62 | } // end namespace mkfit 63 | #endif 64 | -------------------------------------------------------------------------------- /plotting/makePlotsFromDump.py: -------------------------------------------------------------------------------- 1 | import os.path, glob, sys 2 | import ROOT 3 | 4 | arch = sys.argv[1] 5 | sample = sys.argv[2] 6 | build = sys.argv[3] 7 | suffix = sys.argv[4] 8 | 9 | g = ROOT.TFile("test_"+arch+"_"+sample+"_"+build+"_"+suffix+".root","recreate") 10 | 11 | # declare hists: reco only 12 | h_MXNH = ROOT.TH1F("h_MXNH_"+suffix, "nHits/Track", 35, 0, 35) 13 | h_MXPT = ROOT.TH1F("h_MXPT_"+suffix, "p_{T}^{mkFit}", 100, 0, 100) 14 | h_MXETA = ROOT.TH1F("h_MXETA_"+suffix, "#eta^{mkFit}", 25, -2.5, 2.5) 15 | h_MXPHI = ROOT.TH1F("h_MXPHI_"+suffix, "#phi^{mkFit}", 32, -3.2, 3.2) 16 | 17 | h_MXNH.Sumw2() 18 | h_MXPT.Sumw2() 19 | h_MXETA.Sumw2() 20 | h_MXPHI.Sumw2() 21 | 22 | # declare hists: diffs 23 | h_DCNH = ROOT.TH1F("h_DCNH_"+suffix, "#DeltanHits(mkFit,CMSSW)", 46, -20.5, 25.5) 24 | h_DCPT = ROOT.TH1F("h_DCPT_"+suffix, "#Deltap_{T}(mkFit,CMSSW)", 63, -2.5, 2.5) 25 | h_DCETA = ROOT.TH1F("h_DCETA_"+suffix, "#Delta#eta(mkFit,CMSSW)", 45, -0.5, 0.5) 26 | h_DCPHI = ROOT.TH1F("h_DCPHI_"+suffix, "#Delta#phi(mkFit,CMSSW)", 45, -0.5, 0.5) 27 | 28 | h_DCNH.Sumw2() 29 | h_DCPT.Sumw2() 30 | h_DCETA.Sumw2() 31 | h_DCPHI.Sumw2() 32 | 33 | with open('log_'+arch+'_'+sample+'_'+build+'_'+suffix+'_DumpForPlots.txt') as f : 34 | for line in f : 35 | if "MX - found track with chi2" in line : 36 | lsplit = line.split() 37 | 38 | NH = float(lsplit[8]) 39 | h_MXNH.Fill(NH) 40 | 41 | PT = float(lsplit[10]) 42 | h_MXPT.Fill(PT) 43 | 44 | ETA = float(lsplit[12]) 45 | h_MXETA.Fill(ETA) 46 | 47 | PHI = float(lsplit[14]) 48 | h_MXPHI.Fill(PHI) 49 | 50 | NHC = float(lsplit[24]) 51 | if NHC > 0 : 52 | h_DCNH.Fill(NH-NHC) 53 | 54 | PTC = float(lsplit[26]) 55 | h_DCPT.Fill(PT-PTC) 56 | 57 | ETAC = float(lsplit[28]) 58 | h_DCETA.Fill(ETA-ETAC) 59 | 60 | PHIC = float(lsplit[30]) 61 | h_DCPHI.Fill(PHI-PHIC) 62 | 63 | g.Write() 64 | g.Close() 65 | -------------------------------------------------------------------------------- /xeon_scripts/throughput-test-common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source xeon_scripts/stress-test-common.sh 4 | 5 | #################### 6 | ## Core Test Loop ## 7 | #################### 8 | 9 | function MkFitThroughput () 10 | { 11 | local test_exe=${1} 12 | local nproc=${2} 13 | local njob=${3} 14 | local tmp_output_file=${4} 15 | 16 | ## launch jobs in parallel to background : let scheduler put jobs all around 17 | for (( ijob = 0 ; ijob < ${njob} ; ijob++ )) 18 | do 19 | ## run the executable 20 | { time ${test_exe} --num-events ${nproc} > /dev/null 2>&1 ; } 2> "${tmp_output_file}.${ijob}" & 21 | done 22 | 23 | ## wait for all background processes to finish --> non-ideal as we would rather "stream" jobs launching 24 | wait 25 | } 26 | export -f MkFitThroughput 27 | 28 | #################################### 29 | ## Dump Tmp Output into Main File ## 30 | #################################### 31 | 32 | function DumpIntoFileThroughput () 33 | { 34 | local tmp_output_file=${1} 35 | local output_file=${2} 36 | 37 | ## get wall-clock time, split 38 | total_time=0 39 | while read -ra time_arr 40 | do 41 | local tmp_time=${time_arr[1]} 42 | local mins=$( echo "${tmp_time}" | cut -d "m" -f 1 ) 43 | local secs=$( echo "${tmp_time}" | cut -d "m" -f 2 | cut -d "s" -f 1 ) 44 | local total_time=$( bc -l <<< "${total_time} + ${mins} * 60 + ${secs}" ) 45 | done < <(fgrep "real" "${tmp_output_file}") 46 | 47 | ## get physical cores used 48 | local ncore=$( grep "${ncore_label}" "${tmp_output_file}" | cut -d " " -f 2 ) 49 | 50 | ## compute total events processed per core 51 | local njob=$( grep "${nloop_label}" "${tmp_output_file}" | cut -d " " -f 2 ) 52 | local nproc=$( grep "${nproc_label}" "${tmp_output_file}" | cut -d " " -f 2 ) 53 | 54 | ## divide total events by time 55 | local throughput=$( bc -l <<< "(${njob} * ${nproc}) / ${total_time}" ) 56 | 57 | ## dump result into final output file 58 | echo "${test_label} ${throughput}" >> "${output_file}" 59 | } 60 | export -f DumpIntoFileThroughput 61 | -------------------------------------------------------------------------------- /test/CMS-2017.C: -------------------------------------------------------------------------------- 1 | // To be used in compiled mode 2 | 3 | #include "../Geoms/CMS-2017.cc" 4 | 5 | #include "TCanvas.h" 6 | #include "TLine.h" 7 | 8 | TrackerInfo g_tracker_info; 9 | 10 | //------------------------------------------------------------------------------ 11 | 12 | void print_etas(LayerInfo &li, float dz) 13 | { 14 | float r, z; 15 | if (li.is_barrel()) 16 | { 17 | r = li.r_mean(); 18 | z = li.m_zmax; 19 | } else { 20 | r = li.m_rout; 21 | z = li.z_mean(); 22 | } 23 | 24 | printf("%2d %6.4f %6.4f %6.4f", li.m_layer_id, 25 | getEta(r, z - dz), getEta(r, z), getEta(r, z + dz)); 26 | 27 | if ( ! li.is_barrel()) 28 | { 29 | r = li.m_rin; 30 | 31 | printf(" - %6.4f %6.4f %6.4f", 32 | getEta(r, z - dz), getEta(r, z), getEta(r, z + dz)); 33 | } 34 | 35 | printf("\n"); 36 | } 37 | 38 | //------------------------------------------------------------------------------ 39 | 40 | void CylCowWLids() 41 | { 42 | Create_TrackerInfo(g_tracker_info, true); 43 | 44 | float zM = 300; 45 | float rM = 120; 46 | 47 | float cScale = 6; 48 | TCanvas *c = new TCanvas("cvs", "", cScale*zM, cScale*rM); 49 | TPad *p = new TPad("pad", "", 0, 0, 1, 1); 50 | p->Draw(); 51 | p->Update(); 52 | p->cd(); 53 | 54 | p->DrawFrame(0, 0, zM, rM); 55 | 56 | printf("Eta coordinates of edges for z0 (-3, 0, +3) cm\n"); 57 | printf("----------------------------------------------\n"); 58 | 59 | for (auto i : g_tracker_info.m_barrel) 60 | { 61 | LayerInfo &li = g_tracker_info.m_layers[i]; 62 | 63 | TLine * l = new TLine(0, li.r_mean(), li.m_zmax, li.r_mean()); 64 | l->SetLineColor(kBlue); 65 | l->SetLineWidth(2); 66 | l->Draw(); 67 | 68 | print_etas(li, 3); 69 | } 70 | 71 | for (auto i : g_tracker_info.m_ecap_pos) 72 | { 73 | LayerInfo &li = g_tracker_info.m_layers[i]; 74 | 75 | TLine *l = new TLine(li.z_mean(), li.m_rin, li.z_mean(), li.m_rout); 76 | l->SetLineColor(kMagenta + 3); 77 | l->SetLineWidth(2); 78 | l->Draw(); 79 | 80 | print_etas(li, 3); 81 | } 82 | 83 | p->Modified(); 84 | p->Update(); 85 | } 86 | -------------------------------------------------------------------------------- /test/CylCowWLids.C: -------------------------------------------------------------------------------- 1 | // To be used in compiled mode 2 | 3 | #include "../CylCowWLids.cc" 4 | 5 | #include "TCanvas.h" 6 | #include "TLine.h" 7 | 8 | TrackerInfo g_tracker_info; 9 | 10 | //------------------------------------------------------------------------------ 11 | 12 | void print_etas(LayerInfo &li, float dz) 13 | { 14 | float r, z; 15 | if (li.is_barrel()) 16 | { 17 | r = li.r_mean(); 18 | z = li.m_zmax; 19 | } else { 20 | r = li.m_rout; 21 | z = li.z_mean(); 22 | } 23 | 24 | printf("%2d %6.4f %6.4f %6.4f", li.m_layer_id, 25 | getEta(r, z - dz), getEta(r, z), getEta(r, z + dz)); 26 | 27 | if ( ! li.is_barrel()) 28 | { 29 | r = li.m_rin; 30 | 31 | printf(" - %6.4f %6.4f %6.4f", 32 | getEta(r, z - dz), getEta(r, z), getEta(r, z + dz)); 33 | } 34 | 35 | printf("\n"); 36 | } 37 | 38 | //------------------------------------------------------------------------------ 39 | 40 | void CylCowWLids() 41 | { 42 | Create_TrackerInfo(g_tracker_info, true); 43 | 44 | float zM = 120; 45 | float rM = 100; 46 | 47 | float cScale = 6; 48 | TCanvas *c = new TCanvas("cvs", "", cScale*zM, cScale*rM); 49 | TPad *p = new TPad("pad", "", 0, 0, 1, 1); 50 | p->Draw(); 51 | p->Update(); 52 | p->cd(); 53 | 54 | p->DrawFrame(0, 0, zM, rM); 55 | 56 | printf("Eta coordinates of edges for z0 (-3, 0, +3) cm\n"); 57 | printf("----------------------------------------------\n"); 58 | 59 | for (auto i : g_tracker_info.m_barrel) 60 | { 61 | LayerInfo &li = g_tracker_info.m_layers[i]; 62 | 63 | TLine * l = new TLine(0, li.r_mean(), li.m_zmax, li.r_mean()); 64 | l->SetLineColor(kBlue); 65 | l->SetLineWidth(2); 66 | l->Draw(); 67 | 68 | print_etas(li, 3); 69 | } 70 | 71 | for (auto i : g_tracker_info.m_ecap_pos) 72 | { 73 | LayerInfo &li = g_tracker_info.m_layers[i]; 74 | 75 | TLine *l = new TLine(li.z_mean(), li.m_rin, li.z_mean(), li.m_rout); 76 | l->SetLineColor(kMagenta + 3); 77 | l->SetLineWidth(2); 78 | l->Draw(); 79 | 80 | print_etas(li, 3); 81 | } 82 | 83 | p->Modified(); 84 | p->Update(); 85 | } 86 | -------------------------------------------------------------------------------- /test/mttbb1.cxx: -------------------------------------------------------------------------------- 1 | // g++ -std=c++11 -o mttbb1 mttbb1.cxx -ltbb 2 | 3 | #include "tbb/task.h" 4 | 5 | #include 6 | #include 7 | 8 | double hypot(double a, double b, double c) 9 | { 10 | return std::sqrt(a*a + b*b + c*c); 11 | } 12 | 13 | double sum3_cube(double a, double b, double c) 14 | { 15 | const double asqr = a*a; 16 | const double bsqr = b*b; 17 | const double csqr = c*c; 18 | 19 | return a*asqr + b*bsqr + c*csqr + 6*a*b*c + 20 | 3*(asqr*(b + c) + bsqr*(a + c) + csqr*(a + b)); 21 | } 22 | 23 | struct FooTask : public tbb::task 24 | { 25 | long long count = 0; 26 | double sum_sum = 0; 27 | int mt_id = -1; 28 | 29 | std::default_random_engine g_gen; 30 | std::normal_distribution g_gaus; 31 | std::uniform_real_distribution g_unif; 32 | 33 | FooTask(int id, int seed) : 34 | mt_id(id), 35 | g_gen(seed), g_gaus(0.0, 1.0), g_unif(0.0, 1.0) 36 | {} 37 | 38 | tbb::task* execute() 39 | { 40 | int cpuid0, cpuid1; 41 | 42 | cpuid0 = sched_getcpu(); 43 | 44 | for (int i = 0; i < 50; ++i) 45 | { 46 | double sum = 0; 47 | 48 | for (double i = 1; i <= 10000; i += 1) 49 | { 50 | double a = g_gaus(g_gen); 51 | double b = g_gaus(g_gen); 52 | double c = g_unif(g_gen); 53 | 54 | sum += hypot(a, b, c) + sum3_cube(a, b, c); 55 | } 56 | ++count; 57 | sum_sum += sum; 58 | } 59 | 60 | cpuid1 = sched_getcpu(); 61 | 62 | printf("Thread %3d finishing on cpu %3d (%3d). N=%6lld, sum=%f\n", 63 | mt_id, cpuid1, cpuid0, count, sum_sum); 64 | 65 | return 0; 66 | } 67 | }; 68 | 69 | struct RootTask : public tbb::task 70 | { 71 | RootTask() {} 72 | 73 | tbb::task* execute() 74 | { 75 | set_ref_count(101); 76 | 77 | std::srand(std::time(0)); 78 | 79 | for (int i = 1; i <= 100; ++i) 80 | { 81 | spawn(* new (allocate_child()) FooTask(i, std::rand())); 82 | } 83 | 84 | wait_for_all(); 85 | } 86 | }; 87 | 88 | int main() 89 | { 90 | RootTask &rt = * new (tbb::task::allocate_root()) RootTask; 91 | 92 | tbb::task::spawn_root_and_wait(rt); 93 | 94 | return 0; 95 | } 96 | -------------------------------------------------------------------------------- /from-root/Math/BinaryOpPolicy.h: -------------------------------------------------------------------------------- 1 | // @(#)root/smatrix:$Id$ 2 | // Authors: J. Palacios 2006 3 | #ifndef ROOT_Math_BinaryOpPolicy 4 | #define ROOT_Math_BinaryOpPolicy 1 5 | 6 | // Include files 7 | 8 | /** @class BinaryOpPolicy BinaryOpPolicy.h Math/BinaryOpPolicy.h 9 | * 10 | * 11 | * @author Juan PALACIOS 12 | * @date 2006-01-10 13 | * 14 | * Classes to define matrix representation binary combination policy. 15 | * At the moment deals with symmetric and generic representation, and 16 | * establishes policies for multiplication (and division) and addition 17 | * (and subtraction) 18 | */ 19 | 20 | 21 | #ifndef ROOT_Math_MatrixRepresentationsStatic 22 | #include "Math/MatrixRepresentationsStatic.h" 23 | #endif 24 | 25 | namespace ROOT { 26 | 27 | namespace Math { 28 | 29 | /** 30 | matrix-matrix multiplication policy 31 | */ 32 | template 33 | struct MultPolicy 34 | { 35 | enum { 36 | N1 = R1::kRows, 37 | N2 = R2::kCols 38 | }; 39 | typedef MatRepStd RepType; 40 | }; 41 | 42 | /** 43 | matrix addition policy 44 | */ 45 | template 46 | struct AddPolicy 47 | { 48 | enum { 49 | N1 = R1::kRows, 50 | N2 = R1::kCols 51 | }; 52 | typedef MatRepStd RepType; 53 | }; 54 | 55 | template 56 | struct AddPolicy, MatRepSym > 57 | { 58 | typedef MatRepSym RepType; 59 | }; 60 | 61 | /** 62 | matrix transpose policy 63 | */ 64 | template 65 | struct TranspPolicy 66 | { 67 | enum { 68 | N1 = R::kRows, 69 | N2 = R::kCols 70 | }; 71 | typedef MatRepStd RepType; 72 | }; 73 | // specialized case of transpose of sym matrices 74 | template 75 | struct TranspPolicy > 76 | { 77 | typedef MatRepSym RepType; 78 | }; 79 | } // namespace Math 80 | 81 | } // namespace ROOT 82 | 83 | #endif // MATH_BINARYOPPOLICY_H 84 | -------------------------------------------------------------------------------- /plotting/StackValidation.hh: -------------------------------------------------------------------------------- 1 | #ifndef _StackValidation_ 2 | #define _StackValidation_ 3 | 4 | #include "Common.hh" 5 | 6 | #include "TEfficiency.h" 7 | #include "TGraphAsymmErrors.h" 8 | 9 | struct RateOpts 10 | { 11 | RateOpts() {} 12 | RateOpts(const TString & dir, const TString & sORr, const TString & rate) 13 | : dir(dir), sORr(sORr), rate(rate) {} 14 | 15 | TString dir; 16 | TString sORr; // sim or reco 17 | TString rate; 18 | }; 19 | typedef std::vector ROVec; 20 | 21 | namespace 22 | { 23 | TString ref; 24 | TString refdir; 25 | void setupRef(const Bool_t cmsswComp) 26 | { 27 | ref = (cmsswComp?"cmssw" :"sim"); 28 | refdir = (cmsswComp?"_cmssw":""); 29 | } 30 | 31 | ROVec rates; 32 | UInt_t nrates; 33 | void setupRates(const Bool_t cmsswComp) 34 | { 35 | rates.emplace_back("efficiency",ref,"eff"); 36 | rates.emplace_back("inefficiency",ref,"ineff_brl"); 37 | rates.emplace_back("inefficiency",ref,"ineff_trans"); 38 | rates.emplace_back("inefficiency",ref,"ineff_ec"); 39 | rates.emplace_back("fakerate","reco","fr"); 40 | rates.emplace_back("duplicaterate",ref,"dr"); 41 | 42 | // set nrates after rates is set 43 | nrates = rates.size(); 44 | } 45 | 46 | std::vector ptcuts; 47 | UInt_t nptcuts; 48 | void setupPtCuts() 49 | { 50 | std::vector tmp_ptcuts = {0.f,0.9f,2.f}; 51 | 52 | for (const auto tmp_ptcut : tmp_ptcuts) 53 | { 54 | TString ptcut = Form("%3.1f",tmp_ptcut); 55 | ptcut.ReplaceAll(".","p"); 56 | ptcuts.emplace_back(ptcut); 57 | } 58 | 59 | // set nptcuts once ptcuts is set 60 | nptcuts = ptcuts.size(); 61 | } 62 | }; 63 | 64 | class StackValidation 65 | { 66 | public: 67 | StackValidation(const TString & label, const TString & extra, const Bool_t cmsswComp, const TString & suite); 68 | ~StackValidation(); 69 | void MakeValidationStacks(); 70 | void MakeRatioStacks(const TString & trk); 71 | void MakeKinematicDiffStacks(const TString & trk); 72 | void MakeQualityStacks(const TString & trk); 73 | 74 | private: 75 | const TString label; 76 | const TString extra; 77 | const Bool_t cmsswComp; 78 | const TString suite; 79 | 80 | // legend height 81 | Double_t y1; 82 | Double_t y2; 83 | 84 | std::vector files; 85 | }; 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /mkFit/Makefile: -------------------------------------------------------------------------------- 1 | ##### Random stuff ##### 2 | # 3 | # To disable vectorization set USER_CXXFLAGS := -no-simd -no-vec 4 | # Setting only one of the above has little effect. 5 | # Note, this also screws-up prefetching so it's a lousy deal. 6 | # 7 | # -opt-prefetch-distance=64,8 8 | 9 | include ../Makefile.config 10 | 11 | CPPEXTRA := -I.. ${USER_CPPFLAGS} ${DEFS} 12 | LDEXTRA := -ltbb ${USER_LDFLAGS} 13 | 14 | CPPFLAGS := ${CPPEXTRA} ${CPPFLAGS} 15 | CXXFLAGS += ${USER_CXXFLAGS} 16 | LDFLAGS += ${LDEXTRA} 17 | 18 | CPPFLAGS_NO_ROOT += ${CPPEXTRA} 19 | LDFLAGS_NO_ROOT += ${LDEXTRA} 20 | 21 | .PHONY: all clean distclean echo 22 | 23 | all: default 24 | 25 | LIB_MKFIT := ../lib/libMkFit.so 26 | 27 | TGTS := mkFit ${LIB_MKFIT} 28 | 29 | auto-genmplex: GenMPlexOps.pl 30 | ./GenMPlexOps.pl && touch $@ 31 | 32 | AUTO_TGTS := auto-genmplex 33 | 34 | default: ${AUTO_TGTS} ${TGTS} 35 | 36 | clean: 37 | rm -f ${TGTS} *.d *.o Ice/*.d Ice/*.o 38 | rm -rf mkFit.dSYM 39 | 40 | distclean: clean 41 | rm -f *.optrpt Ice/*.optrpt 42 | rm -f ${AUTO_TGTS} *.ah 43 | 44 | echo: 45 | @echo "CXX = ${CXX}" 46 | @echo "CPPFLAGS = ${CPPFLAGS}" 47 | @echo "CXXFLAGS = ${CXXFLAGS}" 48 | @echo "LDFLAGS = ${LDFLAGS}" 49 | @echo "EXES = ${EXES}" 50 | 51 | 52 | ################################################################ 53 | 54 | MKFSRCS := $(wildcard *.cc) $(wildcard Ice/*.cc) 55 | MKFHDRS := $(wildcard *.h) 56 | 57 | MKFOBJS := $(MKFSRCS:.cc=.o) 58 | MKFDEPS := $(MKFSRCS:.cc=.d) 59 | 60 | ALLOBJS := ${MKFOBJS} 61 | LIBOBJS := $(filter-out mkFit.o, ${ALLOBJS}) 62 | 63 | ${MKFDEPS}: auto-genmplex 64 | 65 | ifeq ($(filter clean distclean, ${MAKECMDGOALS}),) 66 | include ${MKFDEPS} 67 | endif 68 | 69 | mkFit: ${ALLOBJS} 70 | ${CXX} ${CXXFLAGS} ${VEC_HOST} ${LDFLAGS} ${ALLOBJS} -o $@ ${LDFLAGS_HOST} -L../lib -lMicCore -Wl,-rpath,../lib,-rpath,./lib 71 | 72 | ${LIB_MKFIT}: ${LIBOBJS} 73 | ${CXX} ${CXXFLAGS} ${VEC_HOST} ${LIBOBJS} -shared -o $@ ${LDFLAGS_HOST} ${LDFLAGS} -L../lib -lMicCore -Wl,-rpath,../lib,-rpath,./lib 74 | 75 | ifdef WITH_ROOT 76 | fittestMPlex.o : CPPFLAGS += $(shell root-config --cflags) 77 | 78 | TFile.h: 79 | echo "Using dummy rule for TFile.h" 80 | 81 | TTree.h: 82 | echo "Using dummy rule for TTree.h" 83 | endif 84 | 85 | ${MKFOBJS}: %.o: %.cc %.d 86 | ${CXX} ${CPPFLAGS} ${CXXFLAGS} ${VEC_HOST} -c -o $@ $< 87 | -------------------------------------------------------------------------------- /Debug.h: -------------------------------------------------------------------------------- 1 | #ifndef _debug_ 2 | #ifdef DEBUG 3 | #define _debug_ 4 | 5 | #ifdef dprint 6 | 7 | #undef dprint 8 | #undef dprint_np 9 | #undef dcall 10 | #undef dprintf 11 | #undef dprintf_np 12 | 13 | #endif 14 | /* 15 | Usage: DEBUG must be defined before this header file is included, typically 16 | 17 | #define DEBUG 18 | #include "Debug.h" 19 | 20 | This defines macros dprint(), dcall() and dprintf(); 21 | dprint(x) is equivalent to std::cout << x << std::endl; 22 | example: dprint("Hits in layer=" << ilayer); 23 | 24 | dcall(x) simply calls x 25 | example: dcall(pre_prop_print(ilay, mkfp)); 26 | 27 | dprintf(x) is equivalent to printf(x) 28 | example: dprintf("Bad label for simtrack %d -- %d\n", itrack, track.label()); 29 | 30 | All printouts are also controlled by a bool variable "debug" 31 | bool debug = true; is declared as a file global in an anonymous 32 | namespace, and thus can be overridden within any interior scope 33 | as needed, so one could change the global to false and only set 34 | a local to true within certain scopes. 35 | 36 | All are protected by a file scope mutex to avoid mixed printouts. 37 | This mutex can also be acquired within a block via dmutex_guard: 38 | 39 | if (debug) { 40 | dmutex_guard; 41 | [do complicated stuff] 42 | } 43 | 44 | The mutex is not reentrant, so avoid using dprint et al. within a scope 45 | where the mutex has already been acquired, as doing so will deadlock. 46 | */ 47 | #include 48 | 49 | #define dmutex_guard std::lock_guard dlock(debug_mutex) 50 | #define dprint(x) if (debug) { dmutex_guard; std::cout << x << std::endl; } 51 | #define dprint_np(n,x) if(debug && n < N_proc) { dmutex_guard; std::cout << n << ": " << x << std::endl; } 52 | #define dcall(x) if (debug) { dmutex_guard; x; } 53 | #define dprintf(...) if (debug) { dmutex_guard; printf(__VA_ARGS__); } 54 | #define dprintf_np(n, ...) if (debug && n < N_proc) { dmutex_guard; std::cout << n << ": "; printf(__VA_ARGS__); } 55 | 56 | namespace 57 | { 58 | bool debug = false; // default, can be overridden locally 59 | std::mutex debug_mutex; 60 | 61 | struct foo_doo_debug_unused { void foo() { debug = true; } }; 62 | } 63 | 64 | #else 65 | 66 | #define dprint(x) (void(0)) 67 | #define dprint_np(n,x) (void(0)) 68 | #define dcall(x) (void(0)) 69 | #define dprintf(...) (void(0)) 70 | #define dprintf_np(n,...) (void(0)) 71 | 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /nlohmann/json_fwd.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ 2 | #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ 3 | 4 | #include // int64_t, uint64_t 5 | #include // map 6 | #include // allocator 7 | #include // string 8 | #include // vector 9 | 10 | /*! 11 | @brief namespace for Niels Lohmann 12 | @see https://github.com/nlohmann 13 | @since version 1.0.0 14 | */ 15 | namespace nlohmann 16 | { 17 | /*! 18 | @brief default JSONSerializer template argument 19 | 20 | This serializer ignores the template arguments and uses ADL 21 | ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) 22 | for serialization. 23 | */ 24 | template 25 | struct adl_serializer; 26 | 27 | template class ObjectType = 28 | std::map, 29 | template class ArrayType = std::vector, 30 | class StringType = std::string, class BooleanType = bool, 31 | class NumberIntegerType = std::int64_t, 32 | class NumberUnsignedType = std::uint64_t, 33 | class NumberFloatType = double, 34 | template class AllocatorType = std::allocator, 35 | template class JSONSerializer = 36 | adl_serializer, 37 | class BinaryType = std::vector> 38 | class basic_json; 39 | 40 | /*! 41 | @brief JSON Pointer 42 | 43 | A JSON pointer defines a string syntax for identifying a specific value 44 | within a JSON document. It can be used with functions `at` and 45 | `operator[]`. Furthermore, JSON pointers are the base for JSON patches. 46 | 47 | @sa [RFC 6901](https://tools.ietf.org/html/rfc6901) 48 | 49 | @since version 2.0.0 50 | */ 51 | template 52 | class json_pointer; 53 | 54 | /*! 55 | @brief default JSON class 56 | 57 | This type is the default specialization of the @ref basic_json class which 58 | uses the standard template types. 59 | 60 | @since version 1.0.0 61 | */ 62 | using json = basic_json<>; 63 | 64 | template 65 | struct ordered_map; 66 | 67 | /*! 68 | @brief ordered JSON class 69 | 70 | This type preserves the insertion order of object keys. 71 | 72 | @since version 3.9.0 73 | */ 74 | using ordered_json = basic_json; 75 | 76 | } // namespace nlohmann 77 | 78 | #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ 79 | -------------------------------------------------------------------------------- /mkFit/Ice/IceRevisitedRadix.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | /** 3 | * Contains source code from the article "Radix Sort Revisited". 4 | * \file IceRevisitedRadix.h 5 | * \author Pierre Terdiman 6 | * \date April, 4, 2000 7 | */ 8 | //---------------------------------------------------------------------- 9 | 10 | //---------------------------------------------------------------------- 11 | // Include Guard 12 | #ifndef __ICERADIXSORT_H__ 13 | #define __ICERADIXSORT_H__ 14 | 15 | #include "IcePreprocessor.h" 16 | #include "IceTypes.h" 17 | 18 | //! Allocate histograms & offsets locally 19 | #define RADIX_LOCAL_RAM 20 | 21 | enum RadixHint 22 | { 23 | RADIX_SIGNED, //!< Input values are signed 24 | RADIX_UNSIGNED, //!< Input values are unsigned 25 | 26 | RADIX_FORCE_DWORD = 0x7fffffff 27 | }; 28 | 29 | class RadixSort 30 | { 31 | public: 32 | // Constructor/Destructor 33 | RadixSort(); 34 | ~RadixSort(); 35 | // Sorting methods 36 | RadixSort& Sort(const udword* input, udword nb, RadixHint hint=RADIX_SIGNED); 37 | RadixSort& Sort(const float* input, udword nb); 38 | 39 | //! Access to results. mRanks is a list of indices in sorted order, 40 | //i.e. in the order you may further process your data 41 | const udword* GetRanks() const { return mRanks; } 42 | 43 | //! Detach mRanks. After this the caller is responsible for 44 | //! freeing this array via delete [] operator. 45 | udword* RelinquishRanks(); 46 | 47 | //! mIndices2 gets trashed on calling the sort routine, but 48 | //otherwise you can recycle it the way you want. 49 | udword* GetRecyclable() const { return mRanks2; } 50 | 51 | // Stats 52 | udword GetUsedRam() const; 53 | //! Returns the total number of calls to the radix sorter. 54 | udword GetNbTotalCalls() const { return mTotalCalls; } 55 | //! Returns the number of eraly exits due to temporal coherence. 56 | udword GetNbHits() const { return mNbHits; } 57 | 58 | private: 59 | #ifndef RADIX_LOCAL_RAM 60 | udword* mHistogram; //!< Counters for each byte 61 | udword* mLink; //!< Offsets (nearly a cumulative distribution function) 62 | #endif 63 | udword mCurrentSize; //!< Current size of the indices list 64 | udword* mRanks; //!< Two lists, swapped each pass 65 | udword* mRanks2; 66 | // Stats 67 | udword mTotalCalls; //!< Total number of calls to the sort routine 68 | udword mNbHits; //!< Number of early exits due to coherence 69 | 70 | // Internal methods 71 | void CheckResize(udword nb); 72 | bool Resize(udword nb); 73 | }; 74 | 75 | #endif // __ICERADIXSORT_H__ 76 | -------------------------------------------------------------------------------- /test/lastlyr.C: -------------------------------------------------------------------------------- 1 | // Recipe: 2 | // Makefile.config --> WITH_ROOT = yes (uncommented) 3 | // make -j 12 4 | // ./mkFit/mkFit --num-thr-sim 12 --sim-val --num-events 100000 --num-tracks 1 --write --file-name simtracks_fulldet_100kx1_val.bin 5 | // ./mkFit/mkFit --sim-val --read --file-name simtracks_fulldet_100kx1_val.bin --build-bh --num-thr 24 >& log_SNB_ToyMC_Barrel_BH_NVU8int_NTH24_val.txt 6 | 7 | void lastlyr() 8 | { 9 | gStyle->SetOptStat(0); 10 | 11 | TFile * file = TFile::Open("valtree_SNB_ToyMC_Barrel_BH.root"); 12 | TTree * tree = (TTree*)file->Get("efftree"); 13 | 14 | Float_t gen_eta = 0; TBranch * b_gen_eta = 0; tree->SetBranchAddress("eta_mc_gen",&gen_eta,&b_gen_eta); 15 | Int_t mc_lyr = 0; TBranch * b_mc_lyr = 0; tree->SetBranchAddress("lastlyr_mc",&mc_lyr,&b_mc_lyr); 16 | Int_t build_lyr = 0; TBranch * b_build_lyr = 0; tree->SetBranchAddress("lastlyr_build",&build_lyr,&b_build_lyr); 17 | 18 | TH1F * h_bl = new TH1F("h_bl","MC Last Layer - Reco Last Layer",10,0,10); h_bl->Sumw2(); 19 | TH1F * h_em = new TH1F("h_em","MC Last Layer - Reco Last Layer",10,0,10); h_em->Sumw2(); 20 | TH1F * h_ep = new TH1F("h_ep","MC Last Layer - Reco Last Layer",10,0,10); h_ep->Sumw2(); 21 | 22 | h_bl->SetLineColor(kRed); 23 | h_em->SetLineColor(kBlue); 24 | h_ep->SetLineColor(kGreen); 25 | 26 | h_bl->SetMarkerColor(kRed); 27 | h_em->SetMarkerColor(kBlue); 28 | h_ep->SetMarkerColor(kGreen); 29 | 30 | h_bl->SetMarkerStyle(kFullCircle); 31 | h_em->SetMarkerStyle(kFullSquare); 32 | h_ep->SetMarkerStyle(kFullTriangleUp); 33 | 34 | for (UInt_t ientry = 0; ientry < tree->GetEntries(); ientry++) 35 | { 36 | tree->GetEntry(ientry); 37 | 38 | // barrel 39 | if (std::abs(gen_eta) <= 1.0) 40 | { 41 | h_bl->Fill(mc_lyr-build_lyr); 42 | } 43 | // end cap minus 44 | else if (gen_eta < -1.0) 45 | { 46 | h_em->Fill(mc_lyr-build_lyr); 47 | } 48 | // end cap plus 49 | else if (gen_eta > 1.0) 50 | { 51 | h_ep->Fill(mc_lyr-build_lyr); 52 | } 53 | } 54 | 55 | h_bl->Scale(1.0/h_bl->Integral()); 56 | h_em->Scale(1.0/h_em->Integral()); 57 | h_ep->Scale(1.0/h_ep->Integral()); 58 | 59 | TCanvas * canv = new TCanvas(); canv->cd(); canv->SetLogy(); 60 | h_bl->Draw("epl"); 61 | h_em->Draw("same epl"); 62 | h_ep->Draw("same epl"); 63 | 64 | TLegend * leg = new TLegend(0.6,0.6,0.9,0.9); 65 | leg->AddEntry(h_bl,Form("Barrel : %4.2f",h_bl->GetMean()),"epl"); 66 | leg->AddEntry(h_em,Form("Endcap-: %4.2f",h_em->GetMean()),"epl"); 67 | leg->AddEntry(h_ep,Form("Endcap+: %4.2f",h_ep->GetMean()),"epl"); 68 | leg->Draw("same"); 69 | 70 | canv->SaveAs("lyrdiff.png"); 71 | } 72 | -------------------------------------------------------------------------------- /xeon_scripts/benchmarkMIC-build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | [ -e "$BIN_DATA_PATH" ] || BIN_DATA_PATH=/data2/slava77/samples/2021/11834.0_TTbar_14TeV+2021/ 4 | fin=${BIN_DATA_PATH}/AVE_70_BX01_25ns/memoryFile.fv6.default.211008-c6b7c67.bin 5 | 6 | runBenchmark() 7 | { 8 | # for sV in "sim --cmssw-simseeds" "see --cmssw-stdseeds"; do echo $sV | while read -r sN sO; do 9 | for sV in "see --cmssw-stdseeds"; do echo $sV | while read -r sN sO; do 10 | if [ "${1}" == "1" ]; then 11 | sO="--cmssw-n2seeds" 12 | fi 13 | for bV in "BH bh" "STD std" "CE ce"; do echo $bV | while read -r bN bO; do 14 | oBase=${base}_${sN}_${bN} 15 | for nTH in 1 4 8 16 32; do 16 | echo "${oBase}: benchmark [nTH:${nTH}, nVU:8]" 17 | time ./mkFit/mkFit --input-file ${fin} --build-${bO} ${sO} --num-thr ${nTH} >& log_${oBase}_NVU8int_NTH${nTH}_benchmark.txt 18 | done 19 | done 20 | done 21 | done 22 | done 23 | } 24 | 25 | #cleanup first 26 | make clean 27 | make distclean 28 | 29 | make -j 12 30 | export base=SNB_CMSSW_PU70_clean 31 | echo Run default build with base = ${base} 32 | runBenchmark 0 33 | 34 | export base=SNB_CMSSW_PU70_clean_cleanSeed 35 | echo Run CLEAN_SEEDS build with base = ${base} 36 | runBenchmark 1 37 | make clean 38 | make distclean 39 | 40 | 41 | make -j 12 CPPUSERFLAGS+="-march=native -mtune=native" CXXUSERFLAGS+="-march=native -mtune=native" 42 | export base=SNB_CMSSW_PU70_clean_native 43 | echo Run native build with base = ${base} 44 | runBenchmark 0 45 | 46 | export base=SNB_CMSSW_PU70_clean_native_cleanSeed 47 | echo Run CLEAN_SEEDS build with base = ${base} 48 | runBenchmark 1 49 | make clean 50 | make distclean 51 | 52 | fin10mu=/data2/slava77/samples/2021/10muPt0p2to10HS/memoryFile.fv6.default.211008-c6b7c67.bin 53 | 54 | runBenchmark10mu() 55 | { 56 | for sV in "sim --cmssw-seeds" "see --cmssw-stdseeds"; do echo $sV | while read -r sN sO; do 57 | if [ "${1}" == "1" ]; then 58 | sO="--cmssw-n2seeds" 59 | fi 60 | for bV in "BH bh" "STD std" "CE ce"; do echo $bV | while read -r bN bO; do 61 | oBase=${base}_${sN}_10muPt0p2to10HS_${bN} 62 | nTH=8 63 | echo "${oBase}: benchmark [nTH:${nTH}, nVU:8]" 64 | time ./mkFit/mkFit --input-file ${fin10mu} --build-${bO} ${sO} --num-thr ${nTH} >& log_${oBase}_NVU8int_NTH${nTH}_benchmark.txt 65 | done 66 | done 67 | done 68 | done 69 | 70 | } 71 | 72 | #this part has a pretty limited value due to the tiny load in the muon samples 73 | make -j 12 74 | export base=SNB_CMSSW_10mu 75 | echo Run default build with base = ${base} 76 | runBenchmark10mu 1 77 | 78 | make clean 79 | make distclean 80 | 81 | 82 | unset base 83 | 84 | -------------------------------------------------------------------------------- /mkFit/PropagationMPlex.h: -------------------------------------------------------------------------------- 1 | #ifndef _propagation_mplex_ 2 | #define _propagation_mplex_ 3 | 4 | #include "Matrix.h" 5 | 6 | namespace mkfit { 7 | 8 | inline void squashPhiMPlex(MPlexLV& par, const int N_proc) 9 | { 10 | #pragma omp simd 11 | for (int n = 0; n < NN; ++n) { 12 | if (par(n, 4, 0) >= Config::PI) par(n, 4, 0) -= Config::TwoPI; 13 | if (par(n, 4, 0) < -Config::PI) par(n, 4, 0) += Config::TwoPI; 14 | } 15 | } 16 | 17 | inline void squashPhiMPlexGeneral(MPlexLV& par, const int N_proc) 18 | { 19 | #pragma omp simd 20 | for (int n = 0; n < NN; ++n) { 21 | par(n, 4, 0) -= std::floor(0.5f*Config::InvPI*(par(n, 4, 0)+Config::PI)) * Config::TwoPI; 22 | } 23 | } 24 | 25 | void propagateLineToRMPlex(const MPlexLS &psErr, const MPlexLV& psPar, 26 | const MPlexHS &msErr, const MPlexHV& msPar, 27 | MPlexLS &outErr, MPlexLV& outPar, 28 | const int N_proc); 29 | 30 | void propagateHelixToRMPlex(const MPlexLS &inErr, const MPlexLV& inPar, 31 | const MPlexQI &inChg, const MPlexQF& msRad, 32 | MPlexLS &outErr, MPlexLV& outPar, 33 | const int N_proc, const PropagationFlags pflags, 34 | const MPlexQI *noMatEffPtr=nullptr); 35 | 36 | void helixAtRFromIterativeCCSFullJac(const MPlexLV& inPar, const MPlexQI& inChg, const MPlexQF &msRad, 37 | MPlexLV& outPar, MPlexLL& errorProp, 38 | const int N_proc); 39 | 40 | void helixAtRFromIterativeCCS(const MPlexLV& inPar, const MPlexQI& inChg, const MPlexQF &msRad, 41 | MPlexLV& outPar, MPlexLL& errorProp, 42 | MPlexQI& outFailFlag, 43 | const int N_proc, const PropagationFlags pflags); 44 | 45 | void propagateHelixToZMPlex(const MPlexLS &inErr, const MPlexLV& inPar, 46 | const MPlexQI &inChg, const MPlexQF& msZ, 47 | MPlexLS &outErr, MPlexLV& outPar, 48 | const int N_proc, const PropagationFlags pflags, 49 | const MPlexQI *noMatEffPtr=nullptr); 50 | 51 | void helixAtZ(const MPlexLV& inPar, const MPlexQI& inChg, const MPlexQF &msZ, 52 | MPlexLV& outPar, MPlexLL& errorProp, 53 | const int N_proc, const PropagationFlags pflags); 54 | 55 | void applyMaterialEffects(const MPlexQF &hitsRl, const MPlexQF& hitsXi, const MPlexQF& propSign, 56 | MPlexLS &outErr, MPlexLV& outPar, 57 | const int N_proc, const bool isBarrel); 58 | 59 | } // end namespace mkfit 60 | #endif 61 | -------------------------------------------------------------------------------- /test/mtt1.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // c++ -mavx -std=c++11 -I.. -DNO_ROOT mtt1.cxx Matrix.cc -o mtt1 3 | // c++ -mavx2 -std=c++11 mtt1.cxx -o mtt1 4 | // icc -mmic -std=c++11 mtt1.cxx -o mtt1 && scp mtt1 mic0: 5 | // 6 | 7 | #include 8 | 9 | #include 10 | 11 | //#include "Matriplex/MatriplexSym.h" 12 | 13 | //#include "Matrix.h" 14 | 15 | void print_m256(const __m256 &vm) 16 | { 17 | const float *v = (const float *) & vm; 18 | 19 | printf("%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n", 20 | v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]); 21 | 22 | } 23 | 24 | void print_m512(const __m512 &vm) 25 | { 26 | const float *v = (const float *) & vm; 27 | 28 | printf("%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f " 29 | "%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n", 30 | v[ 0], v[ 1], v[ 2], v[ 3], v[ 4], v[ 5], v[ 6], v[ 7], 31 | v[ 8], v[ 9], v[10], v[11], v[12], v[13], v[14], v[15]); 32 | 33 | } 34 | 35 | void print_m512i(const __m512i &vm) 36 | { 37 | const int *v = (const int *) & vm; 38 | 39 | printf("%8d %8d %8d %8d %8d %8d %8d %8d " 40 | "%8d %8d %8d %8d %8d %8d %8d %8d\n", 41 | v[ 0], v[ 1], v[ 2], v[ 3], v[ 4], v[ 5], v[ 6], v[ 7], 42 | v[ 8], v[ 9], v[10], v[11], v[12], v[13], v[14], v[15]); 43 | 44 | } 45 | 46 | int main() 47 | { 48 | __m512 v0 = { 0, 0, 0, 0, 0, 0, 0, 0 }; 49 | __m512 v1 = { 1, 1, 1, 1, 1, 1, 1, 1 }; 50 | __m512 v2 = { 2, 2, 2, 2, 2, 2, 2, 2 }; 51 | __m512 v3 = { 0, 1, 2, 3, 4, 5, 6, 7 }; 52 | 53 | print_m512(v0); 54 | print_m512(v3); 55 | 56 | float float_arr[16384]; 57 | for (int i = 0; i < 16384; ++i) float_arr[i] = i; 58 | 59 | __m512i idx_arr = _mm512_setr_epi32( 5, 23, 45, 87, 134, 234, 654, 1023, 12, 35, 45, 4097, 8000, 83, 111, 16222); 60 | 61 | print_m512i(idx_arr); 62 | 63 | // __m512 gr = _mm512_i32gather_ps(idx_arr, float_arr, 4); 64 | 65 | // __mmask16 msk = _mm512_int2mask (0xf3fc); 66 | __mmask16 msk = _mm512_int2mask ((1 << 6) - 1); 67 | 68 | // __m512 gr = _mm512_mask_i32gather_ps(v1, msk, idx_arr, float_arr, 4); 69 | __m512 gr = _mm512_i32gather_ps(idx_arr, float_arr, 4); 70 | 71 | print_m512(gr); 72 | 73 | int imask = _mm512_mask2int(msk); 74 | 75 | printf("mask after gather = 0x%x\n", imask); 76 | 77 | return 0; 78 | } 79 | 80 | // 81 | // --- main 256 avx2 82 | // 83 | // int main() 84 | // { 85 | // __m256 v0 = { 0, 0, 0, 0, 0, 0, 0, 0 }; 86 | // __m256 v1 = { 1, 1, 1, 1, 1, 1, 1, 1 }; 87 | // __m256 v2 = { 2, 2, 2, 2, 2, 2, 2, 2 }; 88 | // __m256 v3 = { 0, 1, 2, 3, 4, 5, 6, 7 }; 89 | 90 | // print_m256(v0); 91 | // print_m256(v3); 92 | 93 | // float float_arr[16384]; 94 | // for (int i = 0; i < 16384; ++i) float_arr[i] = i; 95 | 96 | // __m256i idx_arr = _mm256_setr_epi32( 5, 23, 45, 134, 234, 1023, 4097, 16222); 97 | 98 | // __m256 gr = _mm256_i32gather_ps(float_arr, idx_arr, 4); 99 | 100 | // print_m256(gr); 101 | 102 | // return 0; 103 | // } 104 | -------------------------------------------------------------------------------- /web/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | <?php echo getcwd(); ?> 4 | 33 | 34 | 35 |

36 |

Plots

37 |

Filter:

38 |
39 | \n"; 50 | print "

$filename

"; 51 | print ""; 52 | $others = array(); 53 | foreach ($other_exts as $ex) { 54 | $other_filename = str_replace('.png', $ex, $filename); 55 | if (file_exists($other_filename)) { 56 | array_push($others, "[" . $ex . "]"); 57 | if ($ex != '.txt') array_push($displayed, $other_filename); 58 | } 59 | } 60 | if ($others) print "

Also as ".implode(', ',$others)."

"; 61 | print "
"; 62 | } 63 | } 64 | ?> 65 | 66 |
67 |

Other files

68 |
    69 | [DIR] $filename"; 75 | } else { 76 | print "
  • $filename
  • "; 77 | } 78 | } 79 | } 80 | ?> 81 |
82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /mkFit/DumpHitSearchStats.icc: -------------------------------------------------------------------------------- 1 | // To be included after SelectHitRange / Indices(). 2 | 3 | #define MKFP(_V_) mkfp->_V_.ConstAt(mi,0,0) 4 | #define MKFPI(_V_,_i_,_j_) mkfp->_V_[iI].ConstAt(mi,_i_,_j_) 5 | #define MKFPAR(_i_) mkfp->Par[iI].ConstAt(mi,_i_,0) 6 | #define MKFERR(_i_,_j_) mkfp->Err[iI].ConstAt(mi,_i_,_j_) 7 | 8 | const int iI = MkFitter::iP; 9 | TrackVec &recseeds = m_event->seedTracks_; 10 | int mi = 0; // mplex index 11 | for (int ti=itrack; ti < end; ++ti, ++mi) 12 | { 13 | int label = MKFP(Label); 14 | int seed = MKFP(SeedIdx); 15 | 16 | float x = std::min(1000.f, MKFPAR(0)), y = std::min(1000.f, MKFPAR(1)), z = std::min(1000.f, MKFPAR(2)); 17 | float r2 = x*x + y*y, r = std::sqrt(r2), phi = getPhi(x, y); 18 | float dphidx = -y/r2, dphidy = x/r2; 19 | float dphi2 = dphidx*dphidx*MKFERR(0,0) + dphidy*dphidy*MKFERR(1,1) + 20 | 2 * dphidx*dphidy*MKFERR(0,1); 21 | float Dphi = dphi2 >= 0 ? 3 * std::sqrt(dphi2) : dphi2; 22 | float Dz = MKFERR(2,2) >= 0 ? 3 * std::sqrt(MKFERR(2,2)) : -1; 23 | 24 | float px = std::min(1000.f, MKFPAR(3)), py = std::min(1000.f, MKFPAR(4)); 25 | 26 | std::vector indices; 27 | m_event_of_hits.m_layers_of_hits[ilay].SelectHitIndices(z, phi, Dz, Dphi, indices, false); 28 | int nshi = indices.size(); 29 | 30 | // Dump for 31 | // printf("Select hits: %2d %2d\n", MKFP(XHitSize), nshi); 32 | // if (MKFP(XHitSize) != nshi) 33 | // { 34 | // // printf("Select hits: %2d %2d\n", MKFP(XHitSize), nshi); 35 | // m_event_of_hits.m_layers_of_hits[ilay].SelectHitIndices(z, phi, Dz, Dphi, indices, false, true); 36 | // printf("\n"); 37 | // } 38 | 39 | static bool first = true; 40 | if (first) 41 | { 42 | printf("ZZZ_ERR event/I:label/I:mc_pt/F:seed/I:seed_pt/F:seed_chi/F:cand/I:layer/I:chi2/F:Nh/I:" 43 | "pT/F:r/F:z/F:phi/F:eta/F:Dphi/F:Dz/F:" 44 | "etam/F:etaM/F:Nh2p/I:" 45 | "err00/F:err11/F:err22/F:err33/F:err44/F:err55/F" 46 | "\n"); 47 | first = false; 48 | } 49 | 50 | // ./mkFit | perl -ne 'if (/^ZZZ_ERR/) { s/^ZZZ_ERR //og; print; }' xxx.rtt 51 | 52 | printf("ZZZ_ERR %d %d %f " 53 | "%d %f %f %d " 54 | "%d %f %d " 55 | "%f %f %f %f %f %f %f " 56 | "%f %f %d " 57 | "%f %f %f %f %f %f\n", 58 | m_event->evtID(), label, m_event->simTracks_[label].pT(), 59 | seed, recseeds[seed].pT(), recseeds[seed].chi2(), MKFP(CandIdx), 60 | ilay, MKFP(Chi2), mkfp->countValidHits(mi), 61 | std::hypot(px,py), r, MKFPAR(2), phi, getEta(r, MKFPAR(2)), Dphi, Dz, 62 | getEta(r, z-Dz), getEta(r, z+Dz), MKFP(XHitSize), 63 | MKFERR(0,0), MKFERR(1,1), MKFERR(2,2), MKFERR(3,3), MKFERR(4,4), MKFERR(5,5) 64 | ); 65 | } 66 | 67 | #undef MKFP 68 | #undef MKFPI 69 | #undef MKFPAR 70 | #undef MKFERR 71 | -------------------------------------------------------------------------------- /xeon_scripts/tarAndSendToRemote.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | ######################## 4 | ## Command Line Input ## 5 | ######################## 6 | 7 | remote_arch=${1} # SNB, KNL, SKL-SP 8 | suite=${2:-"forPR"} # which set of benchmarks to run: full, forPR, forConf 9 | useARCH=${3:-0} 10 | lnxuser=${4:-${USER}} 11 | 12 | ################### 13 | ## Configuration ## 14 | ################### 15 | 16 | source xeon_scripts/common-variables.sh ${suite} ${useARCH} ${lnxuser} 17 | source xeon_scripts/init-env.sh 18 | 19 | # architecture dependent settings 20 | if [[ "${remote_arch}" == "SNB" ]] 21 | then 22 | HOST=${SNB_HOST} 23 | DIR=${SNB_WORKDIR}/${SNB_TEMPDIR} 24 | elif [[ "${remote_arch}" == "KNL" ]] 25 | then 26 | HOST=${KNL_HOST} 27 | DIR=${KNL_WORKDIR}/${KNL_TEMPDIR} 28 | elif [[ "${remote_arch}" == "LNX-G" ]] 29 | then 30 | HOST=${LNXG_HOST} 31 | DIR=${LNXG_WORKDIR}/${LNXG_TEMPDIR} 32 | elif [[ "${remote_arch}" == "LNX-S" ]] 33 | then 34 | HOST=${LNXS_HOST} 35 | DIR=${LNXS_WORKDIR}/${LNXS_TEMPDIR} 36 | else 37 | echo ${remote_arch} "is not a valid architecture! Exiting..." 38 | exit 39 | fi 40 | 41 | ################## 42 | ## Tar and Send ## 43 | ################## 44 | 45 | assert_settings=true 46 | echo "--------Showing System Settings--------" 47 | # unzip tarball remotely 48 | echo "Untarring repo on ${remote_arch} remotely" 49 | SSHO ${HOST} bash -c "' 50 | echo "--------Showing System Settings--------" 51 | ##### Check Settings ##### 52 | echo "turbo status: "$(cat /sys/devices/system/cpu/intel_pstate/no_turbo) 53 | echo "scaling governor setting: "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) 54 | echo "--------End System Settings ------------" 55 | if ${assert_settings}; 56 | then 57 | echo "Ensuring correct settings" 58 | if [[ $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) != "performance" ]] 59 | then 60 | echo "performance mode is OFF. Exiting" 61 | exit 1 62 | fi 63 | if [[ $(cat /sys/devices/system/cpu/intel_pstate/no_turbo) == "0" ]] 64 | then 65 | echo "Turbo is ON. Exiting" 66 | exit 1 67 | fi 68 | fi 69 | sleep 3 ## so you can see the settings 70 | '" 71 | bad=$(SSHO ${HOST} echo $?) 72 | if [ $bad -eq 1 ]; then 73 | echo "killed" 74 | exit 1 75 | fi 76 | 77 | # tar up the directory 78 | echo "Tarring directory for ${remote_arch}... make sure it is clean!" 79 | repo=mictest.tar.gz 80 | tar --exclude-vcs --exclude='*.gz' --exclude='validation*' --exclude='*.root' --exclude='log_*' --exclude='*.png' --exclude='*.o' --exclude='*.om' --exclude='*.d' --exclude='*.optrpt' -zcvf ${repo} * 81 | 82 | # mkdir tmp dir on remote arch 83 | echo "Making tmp dir on ${remote_arch} remotely" 84 | SSHO ${HOST} bash -c "' 85 | mkdir -p ${DIR} 86 | exit 87 | '" 88 | 89 | # copy tarball 90 | echo "Copying tarball to ${remote_arch}" 91 | scp ${repo} ${HOST}:${DIR} 92 | 93 | # unzip tarball remotely 94 | echo "Untarring repo on ${remote_arch} remotely" 95 | SSHO ${HOST} bash -c "' 96 | cd ${DIR} 97 | tar -zxvf ${repo} 98 | rm ${repo} 99 | '" 100 | 101 | # remove local tarball 102 | echo "Remove local repo tarball" 103 | rm ${repo} 104 | -------------------------------------------------------------------------------- /plotting/PlotsFromDump.cpp: -------------------------------------------------------------------------------- 1 | #include "PlotsFromDump.hh" 2 | 3 | PlotsFromDump::PlotsFromDump(const TString & sample, const TString & build, const TString & suite, const int useARCH) 4 | : sample(sample), build(build), suite(suite), useARCH(useARCH) 5 | { 6 | // setup style for plotting 7 | setupStyle(); 8 | 9 | // setup suite enum 10 | setupSUITEEnum(suite); 11 | 12 | // setup build options : true for isBenchmark-type plots, false for no CMSSW 13 | setupBuilds(true,false); 14 | 15 | // get the right build label 16 | label = std::find_if(builds.begin(),builds.end(),[&](const auto & ibuild){return build.EqualTo(ibuild.name);})->label; 17 | if (label == "") 18 | { 19 | std::cerr << build.Data() << " build routine not specified in list of builds! Exiting..." << std::endl; 20 | exit(1); 21 | } 22 | 23 | // Setup test opts 24 | setupTests(useARCH); 25 | 26 | // Setup plot opts 27 | setupPlots(); 28 | } 29 | 30 | PlotsFromDump::~PlotsFromDump() {} 31 | 32 | void PlotsFromDump::RunPlotsFromDump() 33 | { 34 | // Open ROOT files first 35 | std::vector files(ntests); 36 | for (auto t = 0U; t < ntests; t++) 37 | { 38 | const auto & test = tests[t]; 39 | auto & file = files[t]; 40 | 41 | file = TFile::Open("test_"+test.arch+"_"+sample+"_"+build+"_"+test.suffix+".root"); 42 | } 43 | 44 | // Outer loop over all overplots 45 | for (auto p = 0U; p < nplots; p++) 46 | { 47 | const auto & plot = plots[p]; 48 | 49 | // declare standard stuff 50 | const Bool_t isLogy = !(plot.name.Contains("MXPHI",TString::kExact) || plot.name.Contains("MXETA",TString::kExact)); 51 | auto canv = new TCanvas(); 52 | canv->cd(); 53 | canv->SetLogy(isLogy); 54 | 55 | auto leg = new TLegend(0.7,0.68,0.98,0.92); 56 | 57 | Double_t min = 1e9; 58 | Double_t max = -1e9; 59 | 60 | std::vector hists(ntests); 61 | for (auto t = 0U; t < ntests; t++) 62 | { 63 | const auto & test = tests[t]; 64 | auto & file = files[t]; 65 | auto & hist = hists[t]; 66 | 67 | hist = (TH1F*)file->Get(plot.name+"_"+test.suffix); 68 | const TString title = hist->GetTitle(); 69 | hist->SetTitle(title+" ["+label+" - "+sample+"]"); 70 | hist->GetXaxis()->SetTitle(plot.xtitle.Data()); 71 | hist->GetYaxis()->SetTitle(plot.ytitle.Data()); 72 | 73 | hist->SetLineColor(test.color); 74 | hist->SetMarkerColor(test.color); 75 | hist->SetMarkerStyle(test.marker); 76 | 77 | hist->Scale(1.f/hist->Integral()); 78 | GetMinMaxHist(hist,min,max); 79 | } 80 | 81 | for (auto t = 0U; t < ntests; t++) 82 | { 83 | const auto & test = tests[t]; 84 | auto & hist = hists[t]; 85 | 86 | SetMinMaxHist(hist,min,max,isLogy); 87 | hist->Draw(t>0?"P SAME":"P"); 88 | 89 | const TString mean = Form("%4.1f",hist->GetMean()); 90 | leg->AddEntry(hist,test.arch+" "+test.suffix+" [#mu = "+mean+"]","p"); 91 | } 92 | 93 | // draw legend and save plot 94 | leg->Draw("SAME"); 95 | canv->SaveAs(sample+"_"+build+"_"+plot.outname+".png"); 96 | 97 | // delete temps 98 | for (auto & hist : hists) delete hist; 99 | delete leg; 100 | delete canv; 101 | } 102 | 103 | // delete files 104 | for (auto & file : files) delete file; 105 | } 106 | -------------------------------------------------------------------------------- /from-root/Math/StaticCheck.h: -------------------------------------------------------------------------------- 1 | // @(#)root/smatrix:$Id$ 2 | // Authors: T. Glebe, L. Moneta 2005 3 | 4 | 5 | //////////////////////////////////////////////////////////////////////////////// 6 | // The Loki Library 7 | // Copyright (c) 2001 by Andrei Alexandrescu 8 | // This code accompanies the book: 9 | // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design 10 | // Patterns Applied". Copyright (c) 2001. Addison-Wesley. 11 | // Permission to use, copy, modify, distribute and sell this software for any 12 | // purpose is hereby granted without fee, provided that the above copyright 13 | // notice appear in all copies and that both that copyright notice and this 14 | // permission notice appear in supporting documentation. 15 | // The author or Addison-Wesley Longman make no representations about the 16 | // suitability of this software for any purpose. It is provided "as is" 17 | // without express or implied warranty. 18 | //////////////////////////////////////////////////////////////////////////////// 19 | 20 | // Last update: June 20, 2001 21 | 22 | #ifndef Root_Math_StaticCheck 23 | #define Root_Math_StaticCheck 24 | 25 | 26 | // case of dictionary generator 27 | #if defined(__MAKECINT__) || defined(G__DICTIONARY) 28 | 29 | #include "Math/MConfig.h" 30 | #include 31 | #include 32 | 33 | #define STATIC_CHECK(expr, msg) \ 34 | if (!(expr) ) std::cerr << "ERROR: " << #msg << std::endl; \ 35 | assert(expr); 36 | 37 | #else 38 | 39 | namespace ROOT 40 | { 41 | 42 | namespace Math { 43 | 44 | #ifndef USE_OLD_SC 45 | 46 | 47 | template struct CompileTimeChecker 48 | { 49 | CompileTimeChecker(void *) {} 50 | }; 51 | template<> struct CompileTimeChecker {}; 52 | 53 | } // end namespace Math 54 | } // end namespace ROOT 55 | 56 | #define STATIC_CHECK(expr, msg) \ 57 | { class ERROR_##msg {}; \ 58 | ERROR_##msg e; \ 59 | (void) (ROOT::Math::CompileTimeChecker<(expr) != 0> (&e)); } 60 | 61 | 62 | #else 63 | //////////////////////////////////////////////////////////////////////////////// 64 | // Helper structure for the STATIC_CHECK macro 65 | //////////////////////////////////////////////////////////////////////////////// 66 | 67 | template struct CompileTimeError; 68 | template<> struct CompileTimeError {}; 69 | 70 | } // end namespace Math 71 | } // end namespace ROOT 72 | 73 | //////////////////////////////////////////////////////////////////////////////// 74 | // macro STATIC_CHECK 75 | // Invocation: STATIC_CHECK(expr, id) 76 | // where: 77 | // expr is a compile-time integral or pointer expression 78 | // id is a C++ identifier that does not need to be defined 79 | // If expr is zero, id will appear in a compile-time error message. 80 | //////////////////////////////////////////////////////////////////////////////// 81 | 82 | #define STATIC_CHECK(expr, msg) \ 83 | { ROOT::Math::CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; } 84 | 85 | 86 | //////////////////////////////////////////////////////////////////////////////// 87 | // Change log: 88 | // March 20, 2001: add extra parens to STATIC_CHECK - it looked like a fun 89 | // definition 90 | // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! 91 | //////////////////////////////////////////////////////////////////////////////// 92 | 93 | #endif 94 | 95 | #endif 96 | 97 | #endif // STATIC_CHECK_INC_ 98 | -------------------------------------------------------------------------------- /mkFit/ref_slurm.out: -------------------------------------------------------------------------------- 1 | Running with n_threads=1, cloner_single_thread=0, best_out_of=1 2 | Running test_standard(), operation="simulate_and_process" 3 | vusize=8, num_th_sim=12, num_th_finder=1 4 | sizeof(Track)=184, sizeof(Hit)=40, sizeof(SVector3)=12, sizeof(SMatrixSym33)=32, sizeof(MCHitInfo)=16 5 | Constructing SimpleGeometry Cylinder geometry 6 | ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths! 7 | Invoking: 8 | echo | LC_ALL=C g++ -pipe -m64 -Wall -W -Woverloaded-virtual -fsigned-char -fPIC -pthread -std=c++11 -Wno-deprecated-declarations -Wno-comment -Wno-unused-parameter -Wno-maybe-uninitialized -Wno-unused-but-set-variable -Wno-missing-field-initializers -fPIC -fvisibility-inlines-hidden -std=c++11 -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -O2 -DNDEBUG -xc++ -E -v - 2>&1 >/dev/null | awk '/^#include 13 | ^ 14 | input_line_3:38:10: fatal error: 'string' file not found 15 | #include 16 | ^ 17 | 18 | Processing event 1 19 | Matriplex fit = 10.90850 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 20 | 21 | Mean value for (pt_mc-pt_fit)/pt_err: -0.0957188 standard dev: 1.17029 22 | 23 | Processing event 2 24 | Matriplex fit = 10.73082 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 25 | 26 | Mean value for (pt_mc-pt_fit)/pt_err: -0.0874507 standard dev: 1.17868 27 | 28 | Processing event 3 29 | Matriplex fit = 10.68509 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 30 | 31 | Mean value for (pt_mc-pt_fit)/pt_err: -0.0941957 standard dev: 1.17393 32 | 33 | Processing event 4 34 | Matriplex fit = 10.66165 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 35 | 36 | Mean value for (pt_mc-pt_fit)/pt_err: -0.0883954 standard dev: 1.16259 37 | 38 | Processing event 5 39 | Matriplex fit = 10.64726 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 40 | 41 | Mean value for (pt_mc-pt_fit)/pt_err: -0.0932676 standard dev: 1.15382 42 | 43 | Processing event 6 44 | Matriplex fit = 10.67642 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 45 | 46 | Mean value for (pt_mc-pt_fit)/pt_err: -0.100164 standard dev: 1.17903 47 | 48 | Processing event 7 49 | Matriplex fit = 10.58684 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 50 | 51 | Mean value for (pt_mc-pt_fit)/pt_err: -0.0783475 standard dev: 1.15683 52 | 53 | Processing event 8 54 | Matriplex fit = 10.64275 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 55 | 56 | Mean value for (pt_mc-pt_fit)/pt_err: -0.0896003 standard dev: 1.14851 57 | 58 | Processing event 9 59 | Matriplex fit = 10.59830 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 60 | 61 | Mean value for (pt_mc-pt_fit)/pt_err: -0.0874693 standard dev: 1.17137 62 | 63 | Processing event 10 64 | Matriplex fit = 10.59522 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 65 | 66 | Mean value for (pt_mc-pt_fit)/pt_err: -0.0830755 standard dev: 1.17693 67 | ================================================================ 68 | === TOTAL for 10 events 69 | ================================================================ 70 | Total Matriplex fit = 106.73285 --- Build BHMX = 0.00000 MX = 0.00000 CEMX = 0.00000 71 | -------------------------------------------------------------------------------- /mkFit/fittestMPlex.cc: -------------------------------------------------------------------------------- 1 | #include "Matrix.h" 2 | //#define DEBUG 3 | #include 4 | 5 | #include "MkFitter.h" 6 | 7 | #ifndef NO_ROOT 8 | #include "TFile.h" 9 | #include "TTree.h" 10 | #include 11 | #endif 12 | 13 | #include "tbb/parallel_for.h" 14 | 15 | #include 16 | #include 17 | 18 | #if defined(USE_VTUNE_PAUSE) 19 | #include "ittnotify.h" 20 | #endif 21 | 22 | //============================================================================== 23 | // runFittingTestPlex 24 | //============================================================================== 25 | 26 | #include "Pool.h" 27 | namespace 28 | { 29 | struct ExecutionContext 30 | { 31 | mkfit::Pool m_fitters; 32 | 33 | void populate(int n_thr) 34 | { 35 | m_fitters.populate(n_thr - m_fitters.size()); 36 | } 37 | }; 38 | 39 | ExecutionContext g_exe_ctx; 40 | auto retfitr = [](mkfit::MkFitter* mkfp ) { g_exe_ctx.m_fitters.ReturnToPool(mkfp); }; 41 | } 42 | 43 | namespace mkfit { 44 | 45 | double runFittingTestPlex(Event& ev, std::vector& rectracks) 46 | { 47 | g_exe_ctx.populate(Config::numThreadsFinder); 48 | std::vector& simtracks = ev.simTracks_; 49 | 50 | const int Nhits = Config::nLayers; 51 | // XXX What if there's a missing / double layer? 52 | // Eventually, should sort track vector by number of hits! 53 | // And pass the number in on each "setup" call. 54 | // Reserves should be made for maximum possible number (but this is just 55 | // measurments errors, params). 56 | 57 | int theEnd = simtracks.size(); 58 | int count = (theEnd + NN - 1)/NN; 59 | 60 | #ifdef USE_VTUNE_PAUSE 61 | __SSC_MARK(0x111); // use this to resume Intel SDE at the same point 62 | __itt_resume(); 63 | #endif 64 | 65 | double time = dtime(); 66 | 67 | tbb::parallel_for(tbb::blocked_range(0, count, std::max(1, Config::numSeedsPerTask/NN)), 68 | [&](const tbb::blocked_range& i) 69 | { 70 | std::unique_ptr mkfp(g_exe_ctx.m_fitters.GetFromPool(), retfitr); 71 | mkfp->SetNhits(Nhits); 72 | for (int it = i.begin(); it < i.end(); ++it) 73 | { 74 | int itrack = it * NN; 75 | int end = itrack + NN; 76 | /* 77 | * MT, trying to slurp and fit at the same time ... 78 | if (theEnd < end) { 79 | end = theEnd; 80 | mkfp->InputTracksAndHits(simtracks, ev.layerHits_, itrack, end); 81 | } else { 82 | mkfp->SlurpInTracksAndHits(simtracks, ev.layerHits_, itrack, end); // only safe for a full matriplex 83 | } 84 | 85 | if (Config::cf_fitting) mkfp->ConformalFitTracks(true, itrack, end); 86 | mkfp->FitTracks(end - itrack, &ev, true); 87 | */ 88 | 89 | mkfp->InputTracksForFit(simtracks, itrack, end); 90 | 91 | // XXXX MT - for this need 3 points in ... right 92 | // XXXX if (Config::cf_fitting) mkfp->ConformalFitTracks(true, itrack, end); 93 | 94 | mkfp->FitTracksWithInterSlurp(ev.layerHits_, end - itrack); 95 | 96 | mkfp->OutputFittedTracks(rectracks, itrack, end); 97 | } 98 | }); 99 | 100 | time = dtime() - time; 101 | 102 | #ifdef USE_VTUNE_PAUSE 103 | __itt_pause(); 104 | __SSC_MARK(0x222); // use this to pause Intel SDE at the same point 105 | #endif 106 | 107 | if (Config::fit_val) ev.Validate(); 108 | 109 | return time; 110 | } 111 | 112 | } // end namespace mkfit 113 | -------------------------------------------------------------------------------- /plotting/PlotsFromDump.hh: -------------------------------------------------------------------------------- 1 | #ifndef _PlotsFromDump_ 2 | #define _PlotsFromDump_ 3 | 4 | #include "Common.hh" 5 | 6 | struct TestOpts 7 | { 8 | TestOpts() {} 9 | TestOpts(const TString & arch, const TString & suffix, const Color_t color, const Marker_t marker) 10 | : arch(arch), suffix(suffix), color(color), marker(marker) {} 11 | 12 | TString arch; 13 | TString suffix; 14 | Color_t color; 15 | Marker_t marker; 16 | }; 17 | typedef std::vector TOVec; 18 | 19 | namespace 20 | { 21 | TOVec tests; 22 | UInt_t ntests; 23 | void setupTests(const int useARCH) 24 | { 25 | // N.B.: Consult ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build.sh for info on which VU and TH tests were used for making text dumps 26 | 27 | if(useARCH ==0 or useARCH==2 or useARCH==3 or useARCH==4){ 28 | tests.emplace_back("SKL-SP","NVU1_NTH1",kRed+1,kOpenTriangleUp); 29 | tests.emplace_back("SKL-SP","NVU16int_NTH64",kMagenta+1,kOpenTriangleDown); 30 | } 31 | if(useARCH ==3 or useARCH==4){ 32 | tests.emplace_back("SNB","NVU1_NTH1",kBlue,kOpenDiamond); 33 | tests.emplace_back("SNB","NVU8int_NTH24",kBlack,kOpenCross); 34 | tests.emplace_back("KNL","NVU1_NTH1",kGreen+1,kOpenTriangleUp); 35 | tests.emplace_back("KNL","NVU16int_NTH256",kOrange+1,kOpenTriangleDown); 36 | } 37 | if(useARCH == 1 or useARCH == 2 or useARCH==4){ 38 | tests.emplace_back("LNX-G","NVU1_NTH1",7,40); 39 | tests.emplace_back("LNX-G","NVU16int_NTH64",8,42); 40 | tests.emplace_back("LNX-S","NVU1_NTH1",46,49); 41 | tests.emplace_back("LNX-S","NVU16int_NTH64",30,48); 42 | } 43 | // set ntests after tests is set up 44 | ntests = tests.size(); 45 | } 46 | }; 47 | 48 | struct PlotOpts 49 | { 50 | PlotOpts() {} 51 | PlotOpts(const TString & name, const TString & xtitle, const TString & ytitle, const TString & outname) 52 | : name(name), xtitle(xtitle), ytitle(ytitle), outname(outname) {} 53 | 54 | TString name; 55 | TString xtitle; 56 | TString ytitle; 57 | TString outname; 58 | }; 59 | typedef std::vector POVec; 60 | 61 | namespace 62 | { 63 | POVec plots; 64 | UInt_t nplots; 65 | void setupPlots() 66 | { 67 | // N.B. Consult plotting/makePlotsFromDump.py for info on hist names 68 | 69 | plots.emplace_back("h_MXNH","Number of Hits Found","Fraction of Tracks","nHits"); 70 | plots.emplace_back("h_MXPT","p_{T}^{mkFit}","Fraction of Tracks","pt"); 71 | plots.emplace_back("h_MXPHI","#phi^{mkFit}","Fraction of Tracks","phi"); 72 | plots.emplace_back("h_MXETA","#eta^{mkFit}","Fraction of Tracks","eta"); 73 | 74 | plots.emplace_back("h_DCNH","nHits^{mkFit}-nHits^{CMSSW}","Fraction of Tracks","dnHits"); 75 | plots.emplace_back("h_DCPT","p_{T}^{mkFit}-p_{T}^{CMSSW}","Fraction of Tracks","dpt"); 76 | plots.emplace_back("h_DCPHI","#phi^{mkFit}-#phi^{CMSSW}","Fraction of Tracks","dphi"); 77 | plots.emplace_back("h_DCETA","#eta^{mkFit}-#eta^{CMSSW}","Fraction of Tracks","deta"); 78 | 79 | // set nplots after plots are set 80 | nplots = plots.size(); 81 | } 82 | }; 83 | 84 | class PlotsFromDump 85 | { 86 | public: 87 | PlotsFromDump(const TString & sample, const TString & build, const TString & suite, const int useARCH); 88 | ~PlotsFromDump(); 89 | void RunPlotsFromDump(); 90 | 91 | private: 92 | const TString sample; 93 | const TString build; 94 | const TString suite; 95 | const int useARCH; 96 | 97 | TString label; 98 | }; 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /Matriplex/MatriplexCommon.h: -------------------------------------------------------------------------------- 1 | #ifndef MatriplexCommon_H 2 | #define MatriplexCommon_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | // Use intrinsics version of code when available, done via CPP flags. 9 | // #define MPLEX_USE_INTRINSICS 10 | 11 | //============================================================================== 12 | // Intrinsics -- preamble 13 | //============================================================================== 14 | 15 | #include "immintrin.h" 16 | 17 | #if defined(MPLEX_USE_INTRINSICS) 18 | // This seems unnecessary: __AVX__ is usually defined for all higher ISA extensions 19 | #if defined(__AVX__) || defined(__AVX512F__) 20 | 21 | #define MPLEX_INTRINSICS 22 | 23 | #endif 24 | 25 | #if defined(__AVX512F__) 26 | 27 | typedef __m512 IntrVec_t; 28 | #define MPLEX_INTRINSICS_WIDTH_BYTES 64 29 | #define MPLEX_INTRINSICS_WIDTH_BITS 512 30 | #define AVX512_INTRINSICS 31 | #define GATHER_INTRINSICS 32 | #define GATHER_IDX_LOAD(name, arr) __m512i name = _mm512_load_epi32(arr); 33 | 34 | #define LD(a, i) _mm512_load_ps(&a[i*N+n]) 35 | #define ST(a, i, r) _mm512_store_ps(&a[i*N+n], r) 36 | #define ADD(a, b) _mm512_add_ps(a, b) 37 | #define MUL(a, b) _mm512_mul_ps(a, b) 38 | #define FMA(a, b, v) _mm512_fmadd_ps(a, b, v) 39 | 40 | #elif defined(__AVX2__) && defined(__FMA__) 41 | 42 | typedef __m256 IntrVec_t; 43 | #define MPLEX_INTRINSICS_WIDTH_BYTES 32 44 | #define MPLEX_INTRINSICS_WIDTH_BITS 256 45 | #define AVX2_INTRINSICS 46 | #define GATHER_INTRINSICS 47 | // Previously used _mm256_load_epi32(arr) here, but that's part of AVX-512F, not AVX2 48 | #define GATHER_IDX_LOAD(name, arr) __m256i name = _mm256_load_si256(reinterpret_cast(arr)); 49 | 50 | #define LD(a, i) _mm256_load_ps(&a[i*N+n]) 51 | #define ST(a, i, r) _mm256_store_ps(&a[i*N+n], r) 52 | #define ADD(a, b) _mm256_add_ps(a, b) 53 | #define MUL(a, b) _mm256_mul_ps(a, b) 54 | #define FMA(a, b, v) _mm256_fmadd_ps(a, b, v) 55 | 56 | #elif defined(__AVX__) 57 | 58 | typedef __m256 IntrVec_t; 59 | #define MPLEX_INTRINSICS_WIDTH_BYTES 32 60 | #define MPLEX_INTRINSICS_WIDTH_BITS 256 61 | #define AVX_INTRINSICS 62 | 63 | #define LD(a, i) _mm256_load_ps(&a[i*N+n]) 64 | #define ST(a, i, r) _mm256_store_ps(&a[i*N+n], r) 65 | #define ADD(a, b) _mm256_add_ps(a, b) 66 | #define MUL(a, b) _mm256_mul_ps(a, b) 67 | // #define FMA(a, b, v) { __m256 temp = _mm256_mul_ps(a, b); v = _mm256_add_ps(temp, v); } 68 | inline __m256 FMA(const __m256 &a, const __m256 &b, const __m256 &v) 69 | { 70 | __m256 temp = _mm256_mul_ps(a, b); return _mm256_add_ps(temp, v); 71 | } 72 | 73 | #endif 74 | 75 | #endif 76 | 77 | //============================================================================== 78 | // Intrinsics -- postamble 79 | //============================================================================== 80 | 81 | // #ifdef MPLEX_INTRINSICS 82 | 83 | // #undef LD(a, i) 84 | // #undef ADD(a, b) 85 | // #undef MUL(a, b) 86 | // #undef FMA(a, b, v) 87 | // #undef ST(a, i, r) 88 | 89 | // #undef MPLEX_INTRINSICS 90 | 91 | // #endif 92 | 93 | namespace Matriplex 94 | { 95 | typedef int idx_t; 96 | 97 | inline void align_check(const char* pref, void *adr) 98 | { 99 | printf("%s 0x%llx - modulo 64 = %lld\n", pref, (long long unsigned)adr, (long long)adr%64); 100 | } 101 | } 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /Matrix.h: -------------------------------------------------------------------------------- 1 | #ifndef _matrix_ 2 | #define _matrix_ 3 | 4 | #include "Config.h" 5 | #include "MatrixSTypes.h" 6 | 7 | // This should go elsewhere, eventually. 8 | 9 | #ifdef __cpp_lib_clamp 10 | using std::clamp; 11 | #else 12 | template inline 13 | constexpr const T clamp( const T v, const T lo, const T hi, Compare comp ) 14 | { 15 | return comp(v, lo) ? lo : comp(hi, v) ? hi : v; 16 | } 17 | 18 | template inline 19 | constexpr const T clamp( const T v, const T lo, const T hi ) 20 | { 21 | return clamp( v, lo, hi, std::less() ); 22 | } 23 | #endif 24 | 25 | #include 26 | 27 | namespace mkfit { 28 | 29 | inline double dtime() 30 | { 31 | double tseconds = 0.0; 32 | struct timeval mytime; 33 | gettimeofday(&mytime,(struct timezone*)0); 34 | tseconds = (double)(mytime.tv_sec + mytime.tv_usec*1.0e-6); 35 | return( tseconds ); 36 | } 37 | 38 | inline float hipo(float x, float y) 39 | { 40 | return std::sqrt(x*x + y*y); 41 | } 42 | 43 | inline float hipo_sqr(float x, float y) 44 | { 45 | return x*x + y*y; 46 | } 47 | 48 | inline void sincos4(const float x, float& sin, float& cos) 49 | { 50 | // Had this writen with explicit division by factorial. 51 | // The *whole* fitting test ran like 2.5% slower on MIC, sigh. 52 | 53 | const float x2 = x*x; 54 | cos = 1.f - 0.5f*x2 + 0.04166667f*x2*x2; 55 | sin = x - 0.16666667f*x*x2; 56 | } 57 | } // end namespace mkfit 58 | 59 | //============================================================================== 60 | 61 | // Matriplex dimensions and typedefs 62 | 63 | #ifdef __INTEL_COMPILER 64 | #define ASSUME_ALIGNED(a, b) __assume_aligned(a, b) 65 | #else 66 | #define ASSUME_ALIGNED(a, b) a = static_cast(__builtin_assume_aligned(a, b)) 67 | #endif 68 | 69 | #include "Matriplex/MatriplexSym.h" 70 | 71 | namespace mkfit { 72 | 73 | constexpr Matriplex::idx_t NN = MPT_SIZE; // "Length" of MPlex. 74 | 75 | constexpr Matriplex::idx_t LL = 6; // Dimension of large/long MPlex entities 76 | constexpr Matriplex::idx_t HH = 3; // Dimension of small/short MPlex entities 77 | 78 | typedef Matriplex::Matriplex MPlexLL; 79 | typedef Matriplex::Matriplex MPlexLV; 80 | typedef Matriplex::MatriplexSym MPlexLS; 81 | 82 | typedef Matriplex::Matriplex MPlexHH; 83 | typedef Matriplex::Matriplex MPlexHV; 84 | typedef Matriplex::MatriplexSym MPlexHS; 85 | 86 | typedef Matriplex::Matriplex MPlex22; 87 | typedef Matriplex::Matriplex MPlex2V; 88 | typedef Matriplex::MatriplexSym MPlex2S; 89 | 90 | typedef Matriplex::Matriplex MPlexLH; 91 | typedef Matriplex::Matriplex MPlexHL; 92 | 93 | typedef Matriplex::Matriplex MPlexL2; 94 | 95 | typedef Matriplex::Matriplex MPlexQF; 96 | typedef Matriplex::Matriplex MPlexQI; 97 | typedef Matriplex::Matriplex MPlexQUI; 98 | 99 | typedef Matriplex::Matriplex MPlexQB; 100 | 101 | } // end namespace mkfit 102 | 103 | //============================================================================== 104 | 105 | #include 106 | 107 | namespace mkfit { 108 | extern std::default_random_engine g_gen; 109 | extern std::normal_distribution g_gaus; 110 | extern std::uniform_real_distribution g_unif; 111 | } // end namespace mkfit 112 | 113 | #endif 114 | -------------------------------------------------------------------------------- /mkFit/MkFitter.h: -------------------------------------------------------------------------------- 1 | #ifndef MkFitter_h 2 | #define MkFitter_h 3 | 4 | #include "MkBase.h" 5 | 6 | #include "Event.h" 7 | 8 | #include "HitStructures.h" 9 | 10 | //#define DEBUG 1 11 | 12 | //#define USE_BOHS 13 | 14 | namespace mkfit { 15 | 16 | class CandCloner; 17 | 18 | const int MPlexHitIdxMax = 16; 19 | using MPlexHitIdx = Matriplex::Matriplex; 20 | using MPlexQHoT = Matriplex::Matriplex; 21 | 22 | class MkFitter : public MkBase 23 | { 24 | public: 25 | MPlexQF Chi2; 26 | 27 | MPlexHS msErr[Config::nMaxTrkHits]; 28 | MPlexHV msPar[Config::nMaxTrkHits]; 29 | 30 | MPlexQI Label; //this is the seed index in global seed vector (for MC truth match) 31 | MPlexQI SeedIdx;//this is the seed index in local thread (for bookkeeping at thread level) 32 | MPlexQI CandIdx;//this is the candidate index for the given seed (for bookkeeping of clone engine) 33 | 34 | MPlexQHoT HoTArr[Config::nMaxTrkHits]; 35 | 36 | // Hold hit indices to explore at current layer. 37 | MPlexQI XHitSize; 38 | MPlexHitIdx XHitArr; 39 | 40 | int Nhits; 41 | 42 | public: 43 | MkFitter() : Nhits(0) 44 | {} 45 | 46 | // Copy-in timing tests. 47 | MPlexLS& GetErr0() { return Err[0]; } 48 | MPlexLV& GetPar0() { return Par[0]; } 49 | 50 | void CheckAlignment(); 51 | 52 | void PrintPt(int idx); 53 | 54 | void SetNhits(int newnhits) { Nhits = std::min(newnhits, Config::nMaxTrkHits - 1); } 55 | 56 | int countValidHits (int itrack, int end_hit) const; 57 | int countInvalidHits(int itrack, int end_hit) const; 58 | int countValidHits (int itrack) const { return countValidHits (itrack, Nhits); } 59 | int countInvalidHits(int itrack) const { return countInvalidHits(itrack, Nhits); } 60 | 61 | void InputTracksAndHits(const std::vector& tracks, const std::vector& layerHits, int beg, int end); 62 | void InputTracksAndHits(const std::vector& tracks, const std::vector& layerHits, int beg, int end); 63 | void SlurpInTracksAndHits(const std::vector& tracks, const std::vector& layerHits, int beg, int end); 64 | void InputTracksAndHitIdx(const std::vector& tracks, 65 | int beg, int end, bool inputProp); 66 | void InputTracksAndHitIdx(const std::vector >& tracks, const std::vector >& idxs, 67 | int beg, int end, bool inputProp); 68 | void InputSeedsTracksAndHits(const std::vector& seeds, const std::vector& tracks, const std::vector& layerHits, int beg, int end); 69 | 70 | void InputTracksForFit(const std::vector& tracks, int beg, int end); 71 | void FitTracksWithInterSlurp(const std::vector& layersohits, int N_proc); 72 | 73 | void ConformalFitTracks(bool fitting, int beg, int end); 74 | void FitTracks(const int N_proc, const Event * ev, const PropagationFlags pflags); 75 | void FitTracksSteered(const bool is_barrel[], const int N_proc, const Event * ev, const PropagationFlags pflags); 76 | 77 | void CollectFitValidation(const int hi, const int N_proc, const Event * ev) const; 78 | 79 | void OutputTracks(std::vector& tracks, int beg, int end, int iCP) const; 80 | 81 | void OutputFittedTracks(std::vector& tracks, int beg, int end) const 82 | { return OutputTracks(tracks,beg,end,iC); } 83 | 84 | void OutputPropagatedTracks(std::vector& tracks, int beg, int end) const 85 | { return OutputTracks(tracks,beg,end,iP); } 86 | 87 | void OutputFittedTracksAndHitIdx(std::vector& tracks, int beg, int end, bool outputProp) const; 88 | 89 | }; 90 | 91 | } // end namespace mkfit 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /mkFit/MkBase.h: -------------------------------------------------------------------------------- 1 | #ifndef MkBase_h 2 | #define MkBase_h 3 | 4 | #include "Matrix.h" 5 | 6 | #include "PropagationMPlex.h" 7 | 8 | namespace mkfit { 9 | 10 | //============================================================================== 11 | // MkBase 12 | //============================================================================== 13 | 14 | class MkBase 15 | { 16 | public: 17 | MPlexLS Err[2]; 18 | MPlexLV Par[2]; 19 | 20 | MPlexQI Chg; 21 | 22 | static constexpr int iC = 0; // current 23 | static constexpr int iP = 1; // propagated 24 | 25 | float getPar(int itrack, int i, int par) const { return Par[i].ConstAt(itrack, par, 0); } 26 | 27 | float RadiusSqr(int itrack, int i) const { return hipo_sqr(getPar(itrack, i, 0), getPar(itrack, i, 1)); } 28 | 29 | //---------------------------------------------------------------------------- 30 | 31 | MkBase() {} 32 | 33 | //---------------------------------------------------------------------------- 34 | 35 | void PropagateTracksToR(float r, const int N_proc, const PropagationFlags pf) 36 | { 37 | MPlexQF msRad; 38 | #pragma omp simd 39 | for (int n = 0; n < NN; ++n) 40 | { 41 | msRad.At(n, 0, 0) = r; 42 | } 43 | 44 | propagateHelixToRMPlex(Err[iC], Par[iC], Chg, msRad, 45 | Err[iP], Par[iP], N_proc, pf); 46 | } 47 | 48 | void PropagateTracksToHitR(const MPlexHV& par, const int N_proc, const PropagationFlags pf, 49 | const MPlexQI *noMatEffPtr=nullptr) 50 | { 51 | MPlexQF msRad; 52 | #pragma omp simd 53 | for (int n = 0; n < NN; ++n) 54 | { 55 | msRad.At(n, 0, 0) = std::hypot(par.ConstAt(n, 0, 0), par.ConstAt(n, 1, 0)); 56 | } 57 | 58 | propagateHelixToRMPlex(Err[iC], Par[iC], Chg, msRad, 59 | Err[iP], Par[iP], N_proc, pf, noMatEffPtr); 60 | } 61 | 62 | //---------------------------------------------------------------------------- 63 | 64 | void PropagateTracksToZ(float z, const int N_proc, const PropagationFlags pf) 65 | { 66 | MPlexQF msZ; 67 | #pragma omp simd 68 | for (int n = 0; n < NN; ++n) 69 | { 70 | msZ.At(n, 0, 0) = z; 71 | } 72 | 73 | propagateHelixToZMPlex(Err[iC], Par[iC], Chg, msZ, 74 | Err[iP], Par[iP], N_proc, pf); 75 | } 76 | 77 | void PropagateTracksToHitZ(const MPlexHV& par, const int N_proc, const PropagationFlags pf, 78 | const MPlexQI *noMatEffPtr=nullptr) 79 | { 80 | MPlexQF msZ; 81 | #pragma omp simd 82 | for (int n = 0; n < NN; ++n) 83 | { 84 | msZ.At(n, 0, 0) = par.ConstAt(n, 2, 0); 85 | } 86 | 87 | propagateHelixToZMPlex(Err[iC], Par[iC], Chg, msZ, 88 | Err[iP], Par[iP], N_proc, pf, noMatEffPtr); 89 | } 90 | 91 | void PropagateTracksToPCAZ(const int N_proc, const PropagationFlags pf) 92 | { 93 | MPlexQF msZ; // PCA z-coordinate 94 | #pragma omp simd 95 | for (int n = 0; n < NN; ++n) 96 | { 97 | const float slope = std::tan(Par[iC].ConstAt(n, 5, 0)); 98 | // msZ.At(n, 0, 0) = ( Config::beamspotz0 + slope * ( Config::beamspotr0 - std::hypot(Par[iC].ConstAt(n, 0, 0), Par[iC].ConstAt(n, 1, 0))) + slope * slope * Par[iC].ConstAt(n, 2, 0) ) / ( 1+slope*slope); // PCA w.r.t. z0, r0 99 | msZ.At(n, 0, 0) = (slope * (slope * Par[iC].ConstAt(n, 2, 0) - std::hypot(Par[iC].ConstAt(n, 0, 0), Par[iC].ConstAt(n, 1, 0)))) / (1 + slope * slope); // PCA to origin 100 | } 101 | 102 | propagateHelixToZMPlex(Err[iC], Par[iC], Chg, msZ, 103 | Err[iP], Par[iP], N_proc, pf); 104 | } 105 | 106 | }; 107 | 108 | } // end namespace mkfit 109 | #endif 110 | -------------------------------------------------------------------------------- /Config.cc: -------------------------------------------------------------------------------- 1 | #include "Config.h" 2 | 3 | #include "TrackerInfo.h" 4 | #include "mkFit/IterationConfig.h" 5 | 6 | namespace mkfit { 7 | 8 | namespace Config 9 | { 10 | TrackerInfo TrkInfo; 11 | IterationsInfo ItrInfo; 12 | 13 | int nTracks = 10000; 14 | int nEvents = 20; 15 | int nItersCMSSW = 0; 16 | bool loopOverFile = false; 17 | 18 | int nTotalLayers = -1; 19 | 20 | std::string geomPlugin = "CylCowWLids"; 21 | 22 | // Multi threading and Clone engine configuration 23 | int numThreadsFinder = 1; 24 | int numThreadsEvents = 1; 25 | 26 | #if defined(__AVX512F__) 27 | int numThreadsSimulation = 60; 28 | #else 29 | int numThreadsSimulation = 12; 30 | #endif 31 | 32 | int finderReportBestOutOfN = 1; 33 | 34 | /*MM: moving out to IterationParams*/ 35 | //int nlayers_per_seed = 3; // can be overriden from Geom plugin; a very confusing variable :) 36 | int numSeedsPerTask = 32; 37 | 38 | // number of hits per task for finding seeds 39 | int numHitsPerTask = 32; 40 | 41 | // material effects 42 | float RlgridME[Config::nBinsZME][Config::nBinsRME]; 43 | float XigridME[Config::nBinsZME][Config::nBinsRME]; 44 | 45 | //float chi2Cut = 15.; 46 | //float chi2CutOverlap = 5.; 47 | //float pTCutOverlap = 0.; 48 | 49 | seedOpts seedInput = simSeeds; 50 | cleanOpts seedCleaning = noCleaning; 51 | 52 | bool finding_requires_propagation_to_hit_pos; 53 | PropagationFlags finding_inter_layer_pflags; 54 | PropagationFlags finding_intra_layer_pflags; 55 | PropagationFlags backward_fit_pflags; 56 | PropagationFlags forward_fit_pflags; 57 | PropagationFlags seed_fit_pflags; 58 | PropagationFlags pca_prop_pflags; 59 | 60 | #ifdef CONFIG_PhiQArrays 61 | bool usePhiQArrays = true; 62 | #endif 63 | 64 | bool useCMSGeom = false; 65 | bool readCmsswTracks = false; 66 | 67 | bool dumpForPlots = false; 68 | bool silent = false; 69 | 70 | bool cf_seeding = false; 71 | bool cf_fitting = false; 72 | 73 | bool quality_val = false; 74 | bool sim_val_for_cmssw = false; 75 | bool sim_val = false; 76 | bool cmssw_val = false; 77 | bool fit_val = false; 78 | bool readSimTrackStates = false; 79 | bool inclusiveShorts = false; 80 | bool keepHitInfo = false; 81 | bool tryToSaveSimInfo = false; 82 | matchOpts cmsswMatchingFW = hitBased; 83 | matchOpts cmsswMatchingBK = trkParamBased; 84 | 85 | bool removeDuplicates = false; 86 | bool useHitsForDuplicates = true; 87 | const float maxdPt = 0.5; 88 | const float maxdPhi = 0.25; 89 | const float maxdEta = 0.05; 90 | const float maxdR = 0.0025; 91 | const float minFracHitsShared = 0.75; 92 | 93 | const float maxd1pt = 1.8; //windows for hit 94 | const float maxdphi = 0.37; //and/or dr 95 | const float maxdcth = 0.37; //comparisons 96 | const float maxcth_ob = 1.99; //eta 1.44 97 | const float maxcth_fw = 6.05; //eta 2.5 98 | 99 | bool useDeadModules = false; 100 | 101 | bool mtvLikeValidation = false; 102 | bool mtvRequireSeeds = false; 103 | int cmsSelMinLayers = 12; 104 | int nMinFoundHits = 10; 105 | 106 | bool kludgeCmsHitErrors = false; 107 | bool backwardFit = false; 108 | bool backwardSearch = true; 109 | bool includePCA = false; 110 | 111 | bool json_dump_before = false; 112 | bool json_dump_after = false; 113 | bool json_verbose = false; 114 | std::vector json_patch_filenames; 115 | std::vector json_load_filenames; 116 | std::string json_save_iters_fname_fmt; 117 | bool json_save_iters_include_iter_info_preamble = false; 118 | 119 | void RecalculateDependentConstants() 120 | { 121 | } 122 | } 123 | 124 | } // end namespace mkfit 125 | -------------------------------------------------------------------------------- /mkFit/KalmanUtilsMPlex.h: -------------------------------------------------------------------------------- 1 | #ifndef _kalmanutils_mplex_ 2 | #define _kalmanutils_mplex_ 3 | 4 | #include "Track.h" 5 | #include "Matrix.h" 6 | 7 | namespace mkfit { 8 | 9 | //------------------------------------------------------------------------------ 10 | 11 | enum KalmanFilterOperation 12 | { 13 | KFO_Calculate_Chi2 = 1, 14 | KFO_Update_Params = 2 15 | }; 16 | 17 | 18 | //------------------------------------------------------------------------------ 19 | 20 | void kalmanUpdate(const MPlexLS &psErr, const MPlexLV& psPar, 21 | const MPlexHS &msErr, const MPlexHV& msPar, 22 | MPlexLS &outErr, MPlexLV& outPar, 23 | const int N_proc); 24 | 25 | void kalmanPropagateAndUpdate(const MPlexLS &psErr, const MPlexLV& psPar, MPlexQI &Chg, 26 | const MPlexHS &msErr, const MPlexHV& msPar, 27 | MPlexLS &outErr, MPlexLV& outPar, 28 | const int N_proc, const PropagationFlags propFlags); 29 | 30 | 31 | void kalmanComputeChi2(const MPlexLS &psErr, const MPlexLV& psPar, const MPlexQI &inChg, 32 | const MPlexHS &msErr, const MPlexHV& msPar, 33 | MPlexQF& outChi2, 34 | const int N_proc); 35 | 36 | void kalmanPropagateAndComputeChi2(const MPlexLS &psErr, const MPlexLV& psPar, const MPlexQI &inChg, 37 | const MPlexHS &msErr, const MPlexHV& msPar, 38 | MPlexQF& outChi2, MPlexLV& propPar, 39 | const int N_proc, const PropagationFlags propFlags); 40 | 41 | 42 | void kalmanOperation(const int kfOp, 43 | const MPlexLS &psErr, const MPlexLV& psPar, 44 | const MPlexHS &msErr, const MPlexHV& msPar, 45 | MPlexLS &outErr, MPlexLV& outPar, MPlexQF& outChi2, 46 | const int N_proc); 47 | 48 | //------------------------------------------------------------------------------ 49 | 50 | 51 | void kalmanUpdateEndcap(const MPlexLS &psErr, const MPlexLV& psPar, 52 | const MPlexHS &msErr, const MPlexHV& msPar, 53 | MPlexLS &outErr, MPlexLV& outPar, 54 | const int N_proc); 55 | 56 | void kalmanPropagateAndUpdateEndcap(const MPlexLS &psErr, const MPlexLV& psPar, MPlexQI &Chg, 57 | const MPlexHS &msErr, const MPlexHV& msPar, 58 | MPlexLS &outErr, MPlexLV& outPar, 59 | const int N_proc, const PropagationFlags propFlags); 60 | 61 | 62 | void kalmanComputeChi2Endcap(const MPlexLS &psErr, const MPlexLV& psPar, const MPlexQI &inChg, 63 | const MPlexHS &msErr, const MPlexHV& msPar, 64 | MPlexQF& outChi2, 65 | const int N_proc); 66 | 67 | void kalmanPropagateAndComputeChi2Endcap(const MPlexLS &psErr, const MPlexLV& psPar, const MPlexQI &inChg, 68 | const MPlexHS &msErr, const MPlexHV& msPar, 69 | MPlexQF& outChi2, MPlexLV& propPar, 70 | const int N_proc, const PropagationFlags propFlags); 71 | 72 | 73 | void kalmanOperationEndcap(const int kfOp, 74 | const MPlexLS &psErr, const MPlexLV& psPar, 75 | const MPlexHS &msErr, const MPlexHV& msPar, 76 | MPlexLS &outErr, MPlexLV& outPar, MPlexQF& outChi2, 77 | const int N_proc); 78 | 79 | 80 | } // end namespace mkfit 81 | #endif 82 | -------------------------------------------------------------------------------- /test/mtt2.cxx: -------------------------------------------------------------------------------- 1 | // To print out cpus/cores: 2 | // a=`cat /proc/cpuinfo | egrep -i "processor|physical id|core id|cpu cores"`;echo $a|sed 's/processor/\n&/g' 3 | // 4 | // c++ -mavx -std=c++11 -I.. -DNO_ROOT mtt2.cxx Matrix.cc -o mtt2 5 | // icc -mavx -std=c++11 -lpthread mtt2.cxx -o mtt2 6 | // icc -mmic -std=c++11 -lpthread mtt2.cxx -o mtt2-mic && scp mtt2-mic mic0: 7 | // 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | std::mutex m_moo; 21 | std::condition_variable m_cnd; 22 | 23 | int num_threads = 0; 24 | bool stop_threads = false; 25 | 26 | double hypot(double a, double b, double c) 27 | { 28 | return std::sqrt(a*a + b*b + c*c); 29 | } 30 | 31 | double sum3_cube(double a, double b, double c) 32 | { 33 | const double asqr = a*a; 34 | const double bsqr = b*b; 35 | const double csqr = c*c; 36 | 37 | return a*asqr + b*bsqr + c*csqr + 6*a*b*c + 38 | 3*(asqr*(b + c) + bsqr*(a + c) + csqr*(a + b)); 39 | } 40 | 41 | 42 | void thr_foo(int id, int loc_id) 43 | { 44 | cpu_set_t cpuset; 45 | CPU_ZERO(&cpuset); 46 | CPU_SET(loc_id, &cpuset); 47 | sched_setaffinity(0, sizeof(cpu_set_t), &cpuset); 48 | 49 | int cpuid0, cpuid1; 50 | 51 | cpuid0 = sched_getcpu(); 52 | printf("Thread %3d starting on cpu %3d, requested %d\n", id, cpuid0, loc_id); 53 | 54 | std::default_random_engine g_gen(0xbeef0133); 55 | std::normal_distribution g_gaus(0.0, 1.0); 56 | std::uniform_real_distribution g_unif(0.0, 1.0); 57 | 58 | { 59 | std::unique_lock lk(m_moo); 60 | ++num_threads; 61 | m_cnd.wait(lk); 62 | } 63 | 64 | long long count = 0; 65 | double sum_sum = 0; 66 | 67 | while (true) 68 | { 69 | double sum = 0; 70 | for (double i = 1; i <= 10000; i += 1) 71 | { 72 | double a = g_gaus(g_gen); 73 | double b = g_gaus(g_gen); 74 | double c = g_unif(g_gen); 75 | 76 | sum += hypot(a, b, c) + sum3_cube(a, b, c); 77 | } 78 | ++count; 79 | sum_sum += sum; 80 | 81 | { 82 | std::unique_lock lk(m_moo); 83 | if (stop_threads) 84 | break; 85 | } 86 | } 87 | 88 | cpuid1 = sched_getcpu(); 89 | printf("Thread %3d finishing on cpu %3d (%3d). N=%6lld, sum=%f\n", 90 | loc_id, cpuid1, cpuid0, count, sum_sum); 91 | } 92 | 93 | int main() 94 | { 95 | const int N_threads = 26; 96 | const int T_sleep = 100; 97 | 98 | int locids[N_threads] = { 99 | // 1111 1100 1010 1001 0110 0101 0011 100 | 1,2,3,4, 5,6, 9,11, 13,16, 18,19, 22,24, 27,28, 101 | // 1000 0100 0010 0001 1110 1011 102 | 29, 34, 39, 44, 45,46,47, 49,51,52 }; 103 | 104 | int cpuid = sched_getcpu(); 105 | 106 | printf("main thread: sched_getcpu -> %d\n", cpuid); 107 | 108 | printf("Starting %d threads ...\n", N_threads); 109 | 110 | std::vector threads(N_threads); 111 | 112 | for (int i = 0; i < N_threads; ++i) 113 | { 114 | threads[i] = std::thread(thr_foo, i, locids[i]); 115 | } 116 | 117 | while (true) 118 | { 119 | std::unique_lock lk(m_moo); 120 | if (num_threads != N_threads) 121 | { 122 | continue; 123 | } 124 | printf("Broadcasting GO!\n"); 125 | m_cnd.notify_all(); 126 | break; 127 | } 128 | 129 | printf("Sleeping %d seconds to let the guys run for a while ...\n", T_sleep); 130 | sleep(T_sleep); 131 | printf("Setting stop_threads to true ...\n"); 132 | 133 | { 134 | std::unique_lock lk(m_moo); 135 | stop_threads = true; 136 | } 137 | 138 | for (auto &t : threads) 139 | { 140 | t.join(); 141 | } 142 | 143 | return 0; 144 | } 145 | -------------------------------------------------------------------------------- /plotting/makeMEIFBenchmarkPlots.py: -------------------------------------------------------------------------------- 1 | import os.path, glob, sys 2 | import ROOT 3 | import array 4 | import math 5 | 6 | # N.B.: Consult ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build.sh for info on nTHs, nVUs, and text file names 7 | 8 | arch = sys.argv[1] # SNB, KNL, SKL-SP 9 | sample = sys.argv[2] 10 | build = sys.argv[3] # CE, FV 11 | 12 | g = ROOT.TFile('benchmarkMEIF_'+arch+'_'+sample+'_'+build+'.root','recreate') 13 | 14 | # Parallelization datapoints 15 | if arch == 'KNL' : 16 | nvu = '16int' 17 | thvals = ['1','2','4','8','16','32','64','96','128','160','192','224','256'] 18 | evvals = ['1','2','4','8','16','32','64','128'] 19 | elif arch == 'SNB' : 20 | nvu = '8int' 21 | thvals = ['1','2','4','6','8','12','16','20','24'] 22 | evvals = ['1','2','4','8','12'] 23 | elif arch == 'SKL-SP' : 24 | nvu = '16int' 25 | thvals = ['1','2','4','8','16','32','48','64'] 26 | evvals = ['1','2','4','8','16','32','64'] 27 | elif arch == 'LNX-G' : 28 | nvu = '16int' 29 | thvals = ['1','2','4','8','16','32','48','64'] 30 | evvals = ['1','2','4','8','16','32','64'] 31 | elif arch == 'LNX-S' : 32 | nvu = '16int' 33 | thvals = ['1','2','4','8','16','32','48','64'] 34 | evvals = ['1','2','4','8','16','32','64'] 35 | else : 36 | print arch,"is not a valid architecture! Exiting..." 37 | sys.exit(0) 38 | 39 | # extra text label 40 | text = 'MEIF' 41 | 42 | # text for grepping 43 | grepnEV = '=== TOTAL for' 44 | grepTime = 'Total event loop time' 45 | 46 | # needed for speedups 47 | xval0 = array.array('d',[0]) 48 | yval0 = array.array('d',[0]) 49 | 50 | # time 51 | for evval in evvals : 52 | print arch,sample,build,"nEV:",evval 53 | 54 | # define event float 55 | ev = float(evval) 56 | 57 | # define tgraphs vs absolute time and speedup 58 | g_time = ROOT.TGraph() 59 | g_speedup = ROOT.TGraph() 60 | 61 | point = 0 62 | for thval in thvals : 63 | xval = float(thval) 64 | if ev > xval: continue; 65 | 66 | # extracted time 67 | yval = float(0) 68 | nev = float(1) 69 | 70 | # open log file, grep for relevant lines 71 | with open('log_'+arch+'_'+sample+'_'+build+'_NVU'+nvu+'_NTH'+thval+'_NEV'+evval+'.txt') as f : 72 | for line in f : 73 | if grepnEV in line : 74 | lsplit = line.split() 75 | nev = float(lsplit[3]) 76 | elif grepTime in line : 77 | lsplit = line.split() 78 | yval = float(lsplit[4]) 79 | 80 | yval /= nev 81 | 82 | # Printout value for good measure 83 | print xval,yval 84 | 85 | # store val 86 | g_time.SetPoint(point,xval,yval) 87 | point = point+1 88 | 89 | # write out the plot 90 | g_time.Write('g_'+build+'_'+text+'_nEV'+evval+'_time') 91 | 92 | # needed for speedup calculation 93 | if evval is '1' : 94 | g_time.GetPoint(0,xval0,yval0) 95 | 96 | # speedup plots 97 | point = 0 98 | for thval in thvals : 99 | xval = float(thval) 100 | if ev > xval: continue; 101 | 102 | # set up inputs 103 | xval = array.array('d',[0]) 104 | yval = array.array('d',[0]) 105 | 106 | # get point from time 107 | g_time.GetPoint(point,xval,yval) 108 | 109 | speedup = 0. 110 | if yval[0] > 0. : 111 | speedup = yval0[0]/yval[0] 112 | 113 | # store in speedup plot 114 | g_speedup.SetPoint(point,xval[0],speedup) 115 | point = point+1 116 | 117 | # always write out speedup 118 | g_speedup.Write('g_'+build+'_'+text+'_nEV'+evval+'_speedup') 119 | 120 | g.Write() 121 | g.Close() 122 | -------------------------------------------------------------------------------- /from-root/Math/Dsfact.h: -------------------------------------------------------------------------------- 1 | // @(#)root/smatrix:$Id$ 2 | // Authors: T. Glebe, L. Moneta 2005 3 | 4 | #ifndef ROOT_Math_Dsfact 5 | #define ROOT_Math_Dsfact 6 | // ******************************************************************** 7 | // 8 | // source: 9 | // 10 | // type: source code 11 | // 12 | // created: 22. Mar 2001 13 | // 14 | // author: Thorsten Glebe 15 | // HERA-B Collaboration 16 | // Max-Planck-Institut fuer Kernphysik 17 | // Saupfercheckweg 1 18 | // 69117 Heidelberg 19 | // Germany 20 | // E-mail: T.Glebe@mpi-hd.mpg.de 21 | // 22 | // Description: Determinant of a symmetric, positive definite matrix. 23 | // Code was taken from CERNLIB::kernlib dsfact function, translated 24 | // from FORTRAN to C++ and optimized. 25 | // 26 | // changes: 27 | // 22 Mar 2001 (TG) creation 28 | // 18 Apr 2001 (TG) removed internal copying of array. 29 | // 30 | // ******************************************************************** 31 | 32 | 33 | namespace ROOT { 34 | 35 | namespace Math { 36 | 37 | 38 | 39 | 40 | /** Dsfact. 41 | Compute determinant of a symmetric, positive definite matrix of dimension 42 | $idim$ and order $n$. 43 | 44 | @author T. Glebe 45 | */ 46 | 47 | template 48 | class SDeterminant { 49 | 50 | public: 51 | template 52 | static bool Dsfact(MatRepStd& rhs, T& det) { 53 | 54 | #ifdef XXX 55 | /* Function Body */ 56 | if (idim < n || n <= 0) { 57 | return false; 58 | } 59 | #endif 60 | 61 | #ifdef OLD_IMPL 62 | typename MatrixRep::value_type* a = rhs.Array(); 63 | #endif 64 | 65 | #ifdef XXX 66 | const typename MatrixRep::value_type* A = rhs.Array(); 67 | typename MatrixRep::value_type array[MatrixRep::kSize]; 68 | typename MatrixRep::value_type* a = array; 69 | 70 | // copy contents of matrix to working place 71 | for(unsigned int i=0; i 117 | static bool Dsfact(MatRepSym & rhs, T & det) { 118 | // not very efficient but need to re-do Dsinv for new storage of 119 | // symmetric matrices 120 | MatRepStd tmp; 121 | for (unsigned int i = 0; i< n*n; ++i) 122 | tmp[i] = rhs[i]; 123 | if (! SDeterminant::Dsfact(tmp,det) ) return false; 124 | // // recopy the data 125 | // for (int i = 0; i< idim*n; ++i) 126 | // rhs[i] = tmp[i]; 127 | 128 | return true; 129 | } 130 | 131 | 132 | }; // end of clas Sdeterminant 133 | 134 | } // namespace Math 135 | 136 | } // namespace ROOT 137 | 138 | #endif /* ROOT_Math_Dsfact */ 139 | 140 | -------------------------------------------------------------------------------- /Geoms/CMS-2017/tncdefs.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | const int Mdet = 7, Mlay = 10; 5 | const int Xlay[] = { -1, 5, 4, 5, 4, 7, 10 }; 6 | 7 | const bool isbrl[] = { 0, 1, 0, 1, 0, 1, 0 }; 8 | 9 | struct RZBox 10 | { 11 | int m_cnt = 0; 12 | float m_minr, m_maxr; 13 | float m_minz, m_maxz; 14 | 15 | void fill(float r, float z) 16 | { 17 | if (m_cnt == 0) 18 | { 19 | m_minr = m_maxr = r; 20 | m_minz = m_maxz = z; 21 | } 22 | else 23 | { 24 | if (r < m_minr) m_minr = r; 25 | else if (r > m_maxr) m_maxr = r; 26 | if (z < m_minz) m_minz = z; 27 | else if (z > m_maxz) m_maxz = z; 28 | } 29 | ++m_cnt; 30 | } 31 | 32 | void print(bool nl=true) 33 | { 34 | printf("r~[%.4f, %.4f] z~[%.4f, %.4f]%s", 35 | m_minr, m_maxr, m_minz, m_maxz, nl ? "\n" : ""); 36 | } 37 | 38 | RZBox Extend(float eps=0.05) const 39 | { 40 | float dr = eps * (m_maxr - m_minr); 41 | float dz = eps * (m_maxz - m_minz); 42 | 43 | RZBox e = *this; 44 | e.m_minr -= dr; e.m_maxr += dr; 45 | e.m_minz -= dz; e.m_maxz += dz; 46 | 47 | return e; 48 | } 49 | 50 | RZBox Round(double base=100) const 51 | { 52 | RZBox e; 53 | e.m_cnt = m_cnt; 54 | 55 | e.m_minr = std::floor(m_minr * base) / base; 56 | e.m_maxr = std::ceil (m_maxr * base) / base; 57 | e.m_minz = std::floor(m_minz * base) / base; 58 | e.m_maxz = std::ceil (m_maxz * base) / base; 59 | 60 | return e; 61 | } 62 | 63 | void MergeWith(const RZBox &o) 64 | { 65 | if (m_cnt == 0) *this = o; 66 | if (o.m_cnt == 0) return; 67 | 68 | m_cnt += o.m_cnt; 69 | 70 | m_minr = std::min(m_minr, o.m_minr); 71 | m_maxr = std::max(m_maxr, o.m_maxr); 72 | m_minz = std::min(m_minz, o.m_minz); 73 | m_maxz = std::max(m_maxz, o.m_maxz); 74 | } 75 | }; 76 | 77 | struct BBS 78 | { 79 | int cnt[Mdet][Mlay] = { 0 }; 80 | RZBox b[Mdet][Mlay]; 81 | RZBox p[Mdet][Mlay]; 82 | RZBox n[Mdet][Mlay]; 83 | 84 | RZBox& select_rzbox(int det, int lay, float z) 85 | { 86 | if (isbrl[det]) return b[det][lay]; 87 | return (z > 0) ? p[det][lay] : n[det][lay]; 88 | } 89 | 90 | void reset() 91 | { 92 | for (int d = 1; d < Mdet; ++d) 93 | { 94 | for (int l = 1; l < Mlay; ++l) 95 | { 96 | cnt[d][l] = 0; 97 | b[d][l].m_cnt = 0; 98 | p[d][l].m_cnt = 0; 99 | n[d][l].m_cnt = 0; 100 | } 101 | } 102 | } 103 | 104 | void print() 105 | { 106 | for (int d = 1; d < Mdet; ++d) 107 | { 108 | printf("det %d, is_brl=%d:\n", d, isbrl[d]); 109 | for (int l = 1; l < Xlay[d]; ++l) 110 | { 111 | if (isbrl[d]) 112 | { 113 | printf(" lay %d: cnt=%5d, ", l, cnt[d][l]); b[d][l].print(); 114 | } 115 | else 116 | { 117 | printf(" pos %d: cnt=%5d, ", l, p[d][l].m_cnt); p[d][l].print(); 118 | printf(" neg %d: cnt=%5d, ", l, n[d][l].m_cnt); n[d][l].print(); 119 | } 120 | } 121 | printf("\n"); 122 | } 123 | } 124 | 125 | void save(const char* fname="bbs.root") 126 | { 127 | auto f = TFile::Open(fname, "RECREATE"); 128 | f->WriteObject(this, "bbs"); 129 | f->Close(); 130 | delete f; 131 | } 132 | 133 | void load(const char* fname="bbs.root") 134 | { 135 | auto f = TFile::Open(fname); 136 | if ( ! f) throw std::runtime_error("tnc::load could not open file"); 137 | 138 | BBS *b = 0; 139 | gFile->GetObject("bbs", b); 140 | if ( ! b) throw std::runtime_error("tnc::load could not read bbs"); 141 | 142 | b->print(); 143 | memcpy(this, b, sizeof(BBS)); 144 | 145 | delete b; 146 | f->Close(); 147 | delete f; 148 | } 149 | }; 150 | 151 | void tncdefs() 152 | { 153 | printf("tncdefs() loaded\n"); 154 | } 155 | 156 | #pragma link C++ class RZBox; 157 | #pragma link C++ class BBS; 158 | -------------------------------------------------------------------------------- /web/collectBenchmarks-multi.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | ########### 4 | ## Input ## 5 | ########### 6 | 7 | dir=${1:-"benchmarks"} 8 | suite=${2:-"forConf"} # which set of benchmarks to run: full, forPR, forConf 9 | useARCH=${3:-0} 10 | whichcands=${4:-"build"} 11 | 12 | ################### 13 | ## Configuration ## 14 | ################### 15 | source xeon_scripts/common-variables.sh ${suite} ${useARCH} 16 | source xeon_scripts/init-env.sh 17 | export MIMI="CE mimi" 18 | declare -a val_builds=(MIMI) 19 | 20 | ###################################### 21 | ## Move Physics Performance Results ## 22 | ###################################### 23 | 24 | # Make SimTrack Validation directories 25 | simdir=("SIMVAL_MTV_iter4" "SIMVAL_MTV_SEED_iter4" "SIMVAL_MTV_iter22" "SIMVAL_MTV_SEED_iter22" "SIMVAL_MTV_iter23" "SIMVAL_MTV_SEED_iter23" "SIMVAL_MTV_iter5" "SIMVAL_MTV_SEED_iter5" "SIMVAL_MTV_iter24" "SIMVAL_MTV_SEED_iter24" "SIMVAL_MTV_iter7" "SIMVAL_MTV_SEED_iter7" "SIMVAL_MTV_iter8" "SIMVAL_MTV_SEED_iter8" "SIMVAL_MTV_iter9" "SIMVAL_MTV_SEED_iter9" "SIMVAL_MTV_iter10" "SIMVAL_MTV_SEED_iter10" "SIMVAL_MTV_iter6" "SIMVAL_MTV_SEED_iter6" ) 26 | simval=("SIMVAL_iter4" "SIMVALSEED_iter4" "SIMVAL_iter22" "SIMVALSEED_iter22" "SIMVAL_iter23" "SIMVALSEED_iter23" "SIMVAL_iter5" "SIMVALSEED_iter5" "SIMVAL_iter24" "SIMVALSEED_iter24" "SIMVAL_iter7" "SIMVALSEED_iter7" "SIMVAL_iter8" "SIMVALSEED_iter8" "SIMVAL_iter9" "SIMVALSEED_iter9" "SIMVAL_iter10" "SIMVALSEED_iter10" "SIMVAL_iter6" "SIMVALSEED_iter6" ) 27 | 28 | for((i=0;i<${#simdir[@]};++i));do 29 | 30 | mkdir -p ${dir}/${simdir[i]} 31 | mkdir -p ${dir}/${simdir[i]}/logx 32 | mkdir -p ${dir}/${simdir[i]}/diffs 33 | mkdir -p ${dir}/${simdir[i]}/nHits 34 | mkdir -p ${dir}/${simdir[i]}/score 35 | 36 | # Move text file dumps for SimTrack Validation 37 | for build in "${val_builds[@]}" 38 | do echo ${!build} | while read -r bN bO 39 | do 40 | vBase=${val_arch}_${sample}_${bN} 41 | mv "validation"_${vBase}_${simval[i]}/"totals_validation"_${vBase}_${simval[i]}.txt ${dir}/${simdir[i]} 42 | done 43 | done 44 | 45 | # Move dummy CMSSW text file (SimTrack Validation) 46 | vBase=${val_arch}_${sample}_CMSSW 47 | mv validation_${vBase}_${simval[i]}/totals_validation_${vBase}_${simval[i]}.txt ${dir}/${simdir[i]} 48 | 49 | # Move rate plots for SimTrack Validation 50 | for rate in eff ineff_brl ineff_trans ineff_ec dr fr 51 | do 52 | for pt in 0p0 0p9 2p0 53 | do 54 | for var in phi eta nLayers 55 | do 56 | mv ${val_arch}_${sample}_${rate}_${var}_${whichcands}_"pt"${pt}_${simval[i]}.png ${dir}/${simdir[i]} 57 | done 58 | done 59 | 60 | # only copy pt > 0 for pt rate plots 61 | for var in pt pt_zoom 62 | do 63 | mv ${val_arch}_${sample}_${rate}_${var}_${whichcands}_"pt0p0"_${simval[i]}.png ${dir}/${simdir[i]} 64 | done 65 | 66 | mv ${val_arch}_${sample}_${rate}_"pt_logx"_${whichcands}_"pt0p0"_${simval[i]}.png ${dir}/${simdir[i]}/logx 67 | done 68 | 69 | # Move kinematic diff plots for SimTrack Validation 70 | for coll in bestmatch allmatch 71 | do 72 | for var in nHits invpt phi eta 73 | do 74 | for pt in 0p0 0p9 2p0 75 | do 76 | mv ${val_arch}_${sample}_${coll}_"d"${var}_${whichcands}_"pt"${pt}_${simval[i]}.png ${dir}/${simdir[i]}/diffs 77 | done 78 | done 79 | done 80 | 81 | # Move track quality plots for SimTrack Validation (nHits,score) 82 | for coll in allreco fake bestmatch allmatch 83 | do 84 | for pt in 0p0 0p9 2p0 85 | do 86 | for qual in nHits score 87 | do 88 | mv ${val_arch}_${sample}_${coll}_${qual}_${whichcands}_"pt"${pt}_${simval[i]}.png ${dir}/${simdir[i]}/${qual} 89 | done 90 | done 91 | done 92 | done 93 | 94 | # Final message 95 | echo "Finished collecting benchmark plots into ${dir}!" 96 | 97 | find ${dir} -mindepth 0 -type d -exec cp web/index.php {} \; 98 | 99 | rm -rf log_*.txt 100 | rm -rf *.root 101 | rm -rf *.png 102 | rm -rf validation_* 103 | 104 | -------------------------------------------------------------------------------- /mkFit/Ice/IceMemoryMacros.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | /** 3 | * Contains all memory macros. 4 | * \file IceMemoryMacros.h 5 | * \author Pierre Terdiman 6 | * \date April, 4, 2000 7 | */ 8 | //---------------------------------------------------------------------- 9 | 10 | //---------------------------------------------------------------------- 11 | // Include Guard 12 | #ifndef __ICEMEMORYMACROS_H__ 13 | #define __ICEMEMORYMACROS_H__ 14 | 15 | #undef ZeroMemory 16 | #undef CopyMemory 17 | #undef MoveMemory 18 | #undef FillMemory 19 | 20 | #include 21 | 22 | //! Clears a buffer. 23 | //! \param addr [in] buffer address 24 | //! \param size [in] buffer length 25 | //! \see FillMemory 26 | //! \see StoreDwords 27 | //! \see CopyMemory 28 | //! \see MoveMemory 29 | inline void ZeroMemory(void* addr, udword size) { memset(addr, 0, size); } 30 | 31 | //! Fills a buffer with a given byte. 32 | //! \param addr [in] buffer address 33 | //! \param size [in] buffer length 34 | //! \param val [in] the byte value 35 | //! \see StoreDwords 36 | //! \see ZeroMemory 37 | //! \see CopyMemory 38 | //! \see MoveMemory 39 | inline void FillMemory(void* dest, udword size, ubyte val) { memset(dest, val, size); } 40 | 41 | #ifdef WIN32 42 | //! Fills a buffer with a given dword. 43 | //! \param addr [in] buffer address 44 | //! \param nb [in] number of dwords to write 45 | //! \param value [in] the dword value 46 | //! \see FillMemory 47 | //! \see ZeroMemory 48 | //! \see CopyMemory 49 | //! \see MoveMemory 50 | //! \warning writes nb*4 bytes ! 51 | inline_ void StoreDwords(udword* dest, udword nb, udword value) 52 | { 53 | // The asm code below **SHOULD** be equivalent to one of those C versions 54 | // or the other if your compiled is good: (checked on VC++ 6.0) 55 | // 56 | // 1) while(nb--) *dest++ = value; 57 | // 58 | // 2) for(udword i=0;iRelease(); (x) = 0; } //!< Safe D3D-style release 98 | #define SAFE_DESTRUCT(x) if (x) { (x)->SelfDestruct(); (x) = 0; } //!< Safe ICE-style release 99 | 100 | #ifdef __ICEERROR_H__ 101 | #define CHECKALLOC(x) if(!x) return SetIceError("Out of memory.", EC_OUT_OF_MEMORY); //!< Standard alloc checking. HANDLE WITH CARE. 102 | #else 103 | #define CHECKALLOC(x) if(!x) return false; 104 | #endif 105 | 106 | //! Standard allocation cycle 107 | #define SAFE_ALLOC(ptr, type, count) DELETEARRAY(ptr); ptr = new type[count]; CHECKALLOC(ptr); 108 | 109 | #endif // __ICEMEMORYMACROS_H__ 110 | -------------------------------------------------------------------------------- /from-root/Math/Dfactir.h: -------------------------------------------------------------------------------- 1 | // @(#)root/smatrix:$Id$ 2 | // Authors: T. Glebe, L. Moneta 2005 3 | 4 | #ifndef ROOT_Math_Dfactir 5 | #define ROOT_Math_Dfactir 6 | // ******************************************************************** 7 | // 8 | // source: 9 | // 10 | // type: source code 11 | // 12 | // created: 02. Apr 2001 13 | // 14 | // author: Thorsten Glebe 15 | // HERA-B Collaboration 16 | // Max-Planck-Institut fuer Kernphysik 17 | // Saupfercheckweg 1 18 | // 69117 Heidelberg 19 | // Germany 20 | // E-mail: T.Glebe@mpi-hd.mpg.de 21 | // 22 | // Description: Determinant of a square matrix, needed for Dfinv() 23 | // Code was taken from CERNLIB::kernlib dfact function, translated 24 | // from FORTRAN to C++ and optimized. 25 | // 26 | // changes: 27 | // 02 Apr 2001 (TG) creation 28 | // 29 | // ******************************************************************** 30 | 31 | #include 32 | 33 | namespace ROOT { 34 | 35 | namespace Math { 36 | 37 | 38 | /** Dfactir. 39 | Function to compute the determinant from a square matrix, Det(A) of 40 | dimension idim and order n. A working area ir is returned which is 41 | needed by the Dfinv routine. 42 | 43 | @author T. Glebe 44 | */ 45 | template 46 | bool Dfactir(Matrix& rhs, typename Matrix::value_type& det, unsigned int* ir) 47 | // int *n, float *a, int *idim, int *ir, int *ifail, float *det, int *jfail) 48 | { 49 | 50 | #ifdef XXX 51 | if (idim < n || n <= 0) { 52 | return false; 53 | } 54 | #endif 55 | 56 | 57 | /* Initialized data */ 58 | typename Matrix::value_type* a = rhs.Array(); 59 | 60 | /* Local variables */ 61 | static unsigned int nxch, i, j, k, l; 62 | static typename Matrix::value_type p, q, tf; 63 | 64 | /* Parameter adjustments */ 65 | a -= idim + 1; 66 | --ir; 67 | 68 | /* Function Body */ 69 | 70 | // fact.inc 71 | nxch = 0; 72 | det = 1.; 73 | for (j = 1; j <= n; ++j) { 74 | const unsigned int ji = j * idim; 75 | const unsigned int jj = j + ji; 76 | 77 | k = j; 78 | p = std::abs(a[jj]); 79 | 80 | if (j != n) { 81 | for (i = j + 1; i <= n; ++i) { 82 | q = std::abs(a[i + ji]); 83 | if (q > p) { 84 | k = i; 85 | p = q; 86 | } 87 | } // for i 88 | 89 | if (k != j) { 90 | for (l = 1; l <= n; ++l) { 91 | const unsigned int li = l*idim; 92 | const unsigned int jli = j + li; 93 | const unsigned int kli = k + li; 94 | tf = a[jli]; 95 | a[jli] = a[kli]; 96 | a[kli] = tf; 97 | } // for l 98 | ++nxch; 99 | ir[nxch] = (j << 12) + k; 100 | } // if k != j 101 | } // if j!=n 102 | 103 | if (p <= 0.) { 104 | det = 0; 105 | return false; 106 | } 107 | 108 | det *= a[jj]; 109 | #ifdef XXX 110 | t = std::abs(det); 111 | if (t < 1e-19 || t > 1e19) { 112 | det = 0; 113 | return false; 114 | } 115 | #endif 116 | 117 | a[jj] = 1. / a[jj]; 118 | if (j == n) { 119 | continue; 120 | } 121 | 122 | const unsigned int jm1 = j - 1; 123 | const unsigned int jpi = (j + 1) * idim; 124 | const unsigned int jjpi = j + jpi; 125 | 126 | for (k = j + 1; k <= n; ++k) { 127 | const unsigned int ki = k * idim; 128 | const unsigned int jki = j + ki; 129 | const unsigned int kji = k + jpi; 130 | if (j != 1) { 131 | for (i = 1; i <= jm1; ++i) { 132 | const unsigned int ii = i * idim; 133 | a[jki] -= a[i + ki] * a[j + ii]; 134 | a[kji] -= a[i + jpi] * a[k + ii]; 135 | } // for i 136 | } 137 | a[jki] *= a[jj]; 138 | a[kji] -= a[jjpi] * a[k + ji]; 139 | } // for k 140 | } // for j 141 | 142 | if (nxch % 2 != 0) { 143 | det = -(det); 144 | } 145 | ir[n] = nxch; 146 | return true; 147 | } // end of Dfact 148 | 149 | 150 | } // namespace Math 151 | 152 | } // namespace ROOT 153 | 154 | 155 | 156 | #endif /* ROOT_Math_Dfactir */ 157 | -------------------------------------------------------------------------------- /from-root/Math/Dfinv.h: -------------------------------------------------------------------------------- 1 | // @(#)root/smatrix:$Id$ 2 | // Authors: T. Glebe, L. Moneta 2005 3 | 4 | #ifndef ROOT_Math_Dfinv 5 | #define ROOT_Math_Dfinv 6 | // ******************************************************************** 7 | // 8 | // source: 9 | // 10 | // type: source code 11 | // 12 | // created: 03. Apr 2001 13 | // 14 | // author: Thorsten Glebe 15 | // HERA-B Collaboration 16 | // Max-Planck-Institut fuer Kernphysik 17 | // Saupfercheckweg 1 18 | // 69117 Heidelberg 19 | // Germany 20 | // E-mail: T.Glebe@mpi-hd.mpg.de 21 | // 22 | // Description: Matrix inversion 23 | // Code was taken from CERNLIB::kernlib dfinv function, translated 24 | // from FORTRAN to C++ and optimized. 25 | // 26 | // changes: 27 | // 03 Apr 2001 (TG) creation 28 | // 29 | // ******************************************************************** 30 | 31 | 32 | namespace ROOT { 33 | 34 | namespace Math { 35 | 36 | 37 | 38 | 39 | /** Dfinv. 40 | Function to compute the inverse of a square matrix ($A^{-1}$) of 41 | dimension $idim$ and order $n$. The routine Dfactir must be called 42 | before Dfinv! 43 | 44 | @author T. Glebe 45 | */ 46 | template 47 | bool Dfinv(Matrix& rhs, unsigned int* ir) { 48 | #ifdef XXX 49 | if (idim < n || n <= 0 || n==1) { 50 | return false; 51 | } 52 | #endif 53 | 54 | typename Matrix::value_type* a = rhs.Array(); 55 | 56 | /* Local variables */ 57 | static unsigned int nxch, i, j, k, m, ij; 58 | static unsigned int im2, nm1, nmi; 59 | static typename Matrix::value_type s31, s34, ti; 60 | 61 | /* Parameter adjustments */ 62 | a -= idim + 1; 63 | --ir; 64 | 65 | /* Function Body */ 66 | 67 | /* finv.inc */ 68 | 69 | a[idim + 2] = -a[(idim << 1) + 2] * (a[idim + 1] * a[idim + 2]); 70 | a[(idim << 1) + 1] = -a[(idim << 1) + 1]; 71 | 72 | if (n != 2) { 73 | for (i = 3; i <= n; ++i) { 74 | const unsigned int ii = i * idim; 75 | const unsigned int iii = i + ii; 76 | const unsigned int imi = ii - idim; 77 | const unsigned int iimi = i + imi; 78 | im2 = i - 2; 79 | for (j = 1; j <= im2; ++j) { 80 | const unsigned int ji = j * idim; 81 | const unsigned int jii = j + ii; 82 | s31 = 0.; 83 | for (k = j; k <= im2; ++k) { 84 | s31 += a[k + ji] * a[i + k * idim]; 85 | a[jii] += a[j + (k + 1) * idim] * a[k + 1 + ii]; 86 | } // for k 87 | a[i + ji] = -a[iii] * (a[i - 1 + ji] * a[iimi] + s31); 88 | a[jii] *= -1; 89 | } // for j 90 | a[iimi] = -a[iii] * (a[i - 1 + imi] * a[iimi]); 91 | a[i - 1 + ii] *= -1; 92 | } // for i 93 | } // if n!=2 94 | 95 | nm1 = n - 1; 96 | for (i = 1; i <= nm1; ++i) { 97 | const unsigned int ii = i * idim; 98 | nmi = n - i; 99 | for (j = 1; j <= i; ++j) { 100 | const unsigned int ji = j * idim; 101 | const unsigned int iji = i + ji; 102 | for (k = 1; k <= nmi; ++k) { 103 | a[iji] += a[i + k + ji] * a[i + (i + k) * idim]; 104 | } // for k 105 | } // for j 106 | 107 | for (j = 1; j <= nmi; ++j) { 108 | const unsigned int ji = j * idim; 109 | s34 = 0.; 110 | for (k = j; k <= nmi; ++k) { 111 | s34 += a[i + k + ii + ji] * a[i + (i + k) * idim]; 112 | } // for k 113 | a[i + ii + ji] = s34; 114 | } // for j 115 | } // for i 116 | 117 | nxch = ir[n]; 118 | if (nxch == 0) { 119 | return true; 120 | } 121 | 122 | for (m = 1; m <= nxch; ++m) { 123 | k = nxch - m + 1; 124 | ij = ir[k]; 125 | i = ij / 4096; 126 | j = ij % 4096; 127 | const unsigned int ii = i * idim; 128 | const unsigned int ji = j * idim; 129 | for (k = 1; k <= n; ++k) { 130 | ti = a[k + ii]; 131 | a[k + ii] = a[k + ji]; 132 | a[k + ji] = ti; 133 | } // for k 134 | } // for m 135 | 136 | return true; 137 | } // Dfinv 138 | 139 | 140 | } // namespace Math 141 | 142 | } // namespace ROOT 143 | 144 | 145 | 146 | #endif /* ROOT_Math_Dfinv */ 147 | -------------------------------------------------------------------------------- /plotting/PlotValidation.hh: -------------------------------------------------------------------------------- 1 | #ifndef _PlotValidation_ 2 | #define _PlotValidation_ 3 | 4 | #include "TFile.h" 5 | #include "TTree.h" 6 | #include "TBranch.h" 7 | #include "TDirectory.h" 8 | #include "TString.h" 9 | #include "TEfficiency.h" 10 | #include "TH1F.h" 11 | #include "TCanvas.h" 12 | #include "TROOT.h" 13 | #include "TSystem.h" 14 | #include "TStyle.h" 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | typedef std::vector FltVec; 26 | typedef std::vector FltVecVec; 27 | typedef std::vector DblVec; 28 | typedef std::vector DblVecVec; 29 | typedef std::vector IntVec; 30 | typedef std::vector TStrVec; 31 | 32 | typedef std::vector TBrRefVec; 33 | typedef std::vector TBrRefVecVec; 34 | typedef std::vector TDirRefVec; 35 | 36 | typedef std::map TH1FRefMap; 37 | typedef std::map TEffRefMap; 38 | 39 | struct EffStruct 40 | { 41 | EffStruct(){} 42 | ~EffStruct(){} 43 | 44 | Float_t passed_; 45 | Float_t total_; 46 | 47 | Float_t eff_; 48 | Float_t elow_; 49 | Float_t eup_; 50 | }; 51 | 52 | class PlotValidation 53 | { 54 | public: 55 | PlotValidation(const TString & inName, const TString & outName, const Bool_t cmsswComp,const int algo, 56 | const Bool_t mvInput, const Bool_t rmSuffix, const Bool_t saveAs, const TString & outType); 57 | ~PlotValidation(); 58 | 59 | // setup functions 60 | void SetupStyle(); 61 | void SetupBins(); 62 | void SetupVariableBins(const std::string & s_bins, DblVec & bins); 63 | void SetupFixedBins(const UInt_t nBins, const Double_t low, const Double_t high, DblVec & bins); 64 | void SetupCommonVars(); 65 | 66 | // main call 67 | void Validation(int algo=0); 68 | void PlotEffTree(int algo=0); 69 | void PlotFRTree(int algo=0); 70 | void PrintTotals(int algo=0); 71 | 72 | // output functions 73 | template 74 | void DrawWriteSavePlot(T *& plot, TDirectory *& subdir, const TString & subdirname, const TString & option); 75 | 76 | // helper functions 77 | void MakeOutDir(const TString & outdirname); 78 | void GetTotalEfficiency(const TEfficiency * eff, EffStruct & effs); 79 | TDirectory * MakeSubDirs(const TString & subdirname); 80 | void MoveInput(); 81 | 82 | private: 83 | // input+output config 84 | const TString fInName; 85 | const Bool_t fCmsswComp; 86 | const Bool_t fMvInput; 87 | const Bool_t fRmSuffix; 88 | const Bool_t fSaveAs; 89 | const TString fOutType; 90 | 91 | const int fAlgo; 92 | 93 | // main input 94 | TFile * fInRoot; 95 | TTree * efftree; 96 | TTree * frtree; 97 | 98 | // binning for rate plots 99 | DblVec fPtBins; 100 | DblVec fEtaBins; 101 | DblVec fPhiBins; 102 | DblVec fNLayersBins; 103 | 104 | // binning for track quality hists 105 | DblVec fNHitsBins; 106 | DblVec fFracHitsBins; 107 | DblVec fScoreBins; 108 | 109 | // binning for diff hists 110 | DblVec fDNHitsBins; 111 | DblVec fDInvPtBins; 112 | DblVec fDPhiBins; 113 | DblVec fDEtaBins; 114 | 115 | // rate vars 116 | TStrVec fVars; 117 | TStrVec fSVars; 118 | TStrVec fSUnits; 119 | UInt_t fNVars; 120 | 121 | TString fSVarPt; 122 | TString fSUnitPt; 123 | 124 | // rate bins 125 | DblVecVec fVarBins; 126 | 127 | // track collections 128 | TStrVec fTrks; 129 | TStrVec fSTrks; 130 | UInt_t fNTrks; 131 | 132 | // pt cuts 133 | FltVec fPtCuts; 134 | TStrVec fSPtCuts; 135 | TStrVec fHPtCuts; 136 | UInt_t fNPtCuts; 137 | 138 | // track quality plots 139 | TStrVec fTrkQual; 140 | TStrVec fSTrkQual; 141 | UInt_t fNTrkQual; 142 | 143 | // reference related strings 144 | TString fSRefTitle; 145 | TString fSRefVar; 146 | TString fSRefMask; 147 | TString fSRefVarTrk; 148 | TString fSRefDir; 149 | TString fSRefOut; 150 | 151 | // output variables 152 | TString fOutName; 153 | TFile * fOutRoot; 154 | }; 155 | 156 | #endif 157 | -------------------------------------------------------------------------------- /xeon_scripts/runBenchmark.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | ##### Command Line Input ##### 4 | suite=${1:-"forPR"} # which set of benchmarks to run: full, forPR, forConf 5 | useARCH=${2:-0} # 0 phi3 only, 1 lnx only, 2 phi3 + lnx, 3 phi123, 4 phi123 + lnx 6 | lnxuser=${3:-${USER}} 7 | 8 | ##### Initialize Benchmarks ##### 9 | source xeon_scripts/common-variables.sh ${suite} ${useARCH} ${lnxuser} 10 | source xeon_scripts/init-env.sh 11 | make distclean 12 | 13 | ##### Check Settings ##### 14 | assert_settings=true 15 | echo "--------Showing System Settings--------" 16 | echo "turbo status: "$(cat /sys/devices/system/cpu/intel_pstate/no_turbo) 17 | echo "scaling governor setting: "$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) 18 | echo "--------End System Settings ------------" 19 | if ${assert_settings} 20 | then 21 | echo "Ensuring correct settings" 22 | if [[ $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) != "performance" ]] 23 | then 24 | echo "performance mode is OFF. Exiting" 25 | exit 1 26 | fi 27 | if [[ $(cat /sys/devices/system/cpu/intel_pstate/no_turbo) == "0" ]] 28 | then 29 | echo "Turbo is ON. Exiting" 30 | exit 1 31 | fi 32 | fi 33 | sleep 3 ## so you can see the settings 34 | 35 | ##### Launch Tests ##### 36 | if [[ ${useARCH} -eq 1 ]] || [[ ${useARCH} -eq 2 ]] || [[ ${useARCH} -eq 4 ]] 37 | then 38 | echo "Tar and send to LNX7188" 39 | ./xeon_scripts/tarAndSendToRemote.sh LNX-G ${suite} ${useARCH} ${lnxuser} 40 | if [ $? -eq 1 ]; then 41 | echo "lnx7188 has bad settings. Please fix them and try again" 42 | exit 1 43 | fi 44 | 45 | echo "Run benchmarking on LNX7188 concurrently with SKL-SP benchmarks" 46 | ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build-remote.sh LNX-G ${suite} ${useARCH} ${lnxuser} >& benchmark_lnx-g_dump.txt & 47 | 48 | echo "Tar and send to LNX4108" 49 | ./xeon_scripts/tarAndSendToRemote.sh LNX-S ${suite} ${useARCH} ${lnxuser} 50 | if [ $? -eq 1 ]; then 51 | echo "lnx4108 has bad settings. Please fix them and try again" 52 | exit 1 53 | fi 54 | 55 | echo "Run benchmarking on LNX4108 concurrently with SKL-SP benchmarks" 56 | ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build-remote.sh LNX-S ${suite} ${useARCH} ${lnxuser} >& benchmark_lnx-s_dump.txt & 57 | fi 58 | 59 | if [[ ${useARCH} -eq 3 ]] || [[ ${useARCH} -eq 4 ]] 60 | then 61 | 62 | echo "Tar and send to KNL" 63 | ./xeon_scripts/tarAndSendToRemote.sh KNL ${suite} ${useARCH} ${lnxuser} 64 | if [ $? -eq 1 ]; then 65 | echo "KNL has bad settings. Please fix them and try again" 66 | exit 1 67 | fi 68 | 69 | echo "Run benchmarking on KNL concurrently with SKL-SP benchmarks" 70 | ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build-remote.sh KNL ${suite} ${useARCH} ${lnxuser} >& benchmark_knl_dump.txt & 71 | 72 | echo "Tar and send to SNB" 73 | ./xeon_scripts/tarAndSendToRemote.sh SNB ${suite} ${useARCH} ${lnxuser} 74 | if [ $? -eq 1 ]; then 75 | echo "SNB has bad settings. Please fix them and try again" 76 | exit 1 77 | fi 78 | 79 | echo "Run benchmarking on SNB concurrently with SKL-SP benchmarks" 80 | ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build-remote.sh SNB ${suite} ${useARCH} ${lnxuser} >& benchmark_snb_dump.txt & 81 | fi 82 | 83 | if [[ ${useARCH} -eq 0 ]] || [[ ${useARCH} -eq 2 ]] || [[ ${useARCH} -eq 3 ]] || [[ ${useARCH} -eq 4 ]] 84 | then 85 | echo "Run benchmarking on SKL-SP" 86 | ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build.sh SKL-SP ${suite} ${useARCH} ${lnxuser} 87 | fi 88 | 89 | ##### Validation tests ##### 90 | echo "Running ROOT based validation" 91 | ./val_scripts/validation-cmssw-benchmarks.sh ${suite} --mtv-like-val 92 | 93 | if [[ ${useARCH} -eq 1 ]] || [[ ${useARCH} -eq 2 ]] 94 | then 95 | echo "Waiting for LNX-G and LNX-S" 96 | elif [[ ${useARCH} -eq 3 ]] 97 | then 98 | echo "Waiting for KNL and SNB" 99 | elif [[ ${useARCH} -eq 4 ]] 100 | then 101 | echo "Waiting for LNX-G, LNX-S, KNL, and SNB" 102 | fi 103 | wait 104 | 105 | ##### Benchmark Plots ##### 106 | echo "Producing benchmarking plots" 107 | ./plotting/benchmarkPlots.sh ${suite} ${useARCH} ${lnxuser} 108 | 109 | ##### Plots from Text Files ##### 110 | echo "Producing plots from text files" 111 | ./plotting/textDumpPlots.sh ${suite} ${useARCH} ${lnxuser} 112 | 113 | ##### Final cleanup ##### 114 | make distclean 115 | 116 | ##### Final message ##### 117 | echo "Finished benchmarking and validation suite!" 118 | -------------------------------------------------------------------------------- /README_multipleIterations.txt: -------------------------------------------------------------------------------- 1 | # Description of implementation of multiple mkFit iterations 2 | 3 | - The branch is up-to-date with respect to devel. 4 | 5 | - The main changes in this branch affect the following files: 6 | 7 | (1) mkFit/SteeringParams.h: 8 | - three additional classes, which are iteration-dependent: 9 | (a) IterationParams: a container for 'nlayers_per_seed', 'maxCandsPerSeed', 'maxHolesPerCand', 'maxConsecHoles', and 'chi2Cut'; 10 | (b) IterationLayerConfig: a container for layer-specific iteration-dependent configurations (e.g., hit selection windows); 11 | (c) IterationConfig: a container for all of the above, including a virtual functions to import seeds (import_seeds) 12 | - one additional struct, which is iteration-dependent: 13 | (a) MkSeedPacket: a container of iteration-specific event objects ('m_seedEtaSeparators_', 'm_seedMinLastLayer_', 'm_seedMaxLastLayer_', 'm_layerHits_', 'm_inseeds', 'm_outtrks') 14 | 15 | (2) Geoms/CMS-2017.cc: 16 | - an instance of IterationConfig is created in Geoms/CMS-2017.cc, to be passed to MkBuilder constructor, which sets all iteration-dependent objects/parameters. 17 | 18 | (3) mkFit/MkBuilder[.cc,.h] 19 | - all iteration-dependent parameters (regions, steering parameters, etc.) are moved out of MkBuilder, and into IterationConfig, which must be passed to MkBuilder constructor to have one MkBuilder per iteration. 20 | 21 | 22 | ------------------------------------------------------------------------------- 23 | 24 | MT Notes: 25 | 26 | * RegionOfSeedIndices rosi(m_event, region); <---- event 27 | 28 | * bkfit --> takes tracks from event->candidateTracks 29 | This is a somewhat more general probelm ... flow of tracks through processing and 30 | when should they be copied out / extracted (found / fitted / etc). 31 | Especially re validation. 32 | 33 | 34 | 35 | ------------------------------------------------------------------------------- 36 | 37 | VALIDATION 38 | 39 | tested validation with 3 iterations scripts (for running validation forConf) 40 | 41 | ./val_scripts/validation-cmssw-benchmarks-multiiter.sh 42 | ./web/collectBenchmarks-multi.sh 43 | 44 | the features added to the validation Trees are the following 45 | 46 | FR Trees 47 | - algorithm: as the tree entries are by seed, the seed "algorithm" (i.e. the iteration number used in cmssw) is saved 48 | 49 | EFF Trees 50 | 51 | - itermask_[seed/build//fit] 52 | - iterduplmask_[seed/build//fit] 53 | - algo_seed 54 | 55 | these are 3 binary masks of 64 bits, where bits are tunred on depending on the iteration matching a sim track, as the entries are organized by sim track 56 | 57 | itermask_ : 58 | a sim track is matching at least to a track with algorithm M if the bit M of the bit mask is on 59 | multiple bits can be on, if the sim track matched to tracks of muktiple iterations 60 | 61 | iterduplmask_ : 62 | a sim track is matching at least twice (duplicate in the iteration) a track with algorithm M if the bit M of the bit mask is on 63 | 64 | algo_seed: 65 | to be used in SIMVALSEED 66 | bit M is on if the seed matching to the sim track comes from the iteration with code M 67 | 68 | 69 | how to use binary masks (example) : 70 | 71 | the simtrack matches to the iteration with algo = 4, 22, 23 ... -> (itermask_[]>>algo)&1 72 | the simtrack matches twice to the iteration with algo = 4, 22, 23 ... -> (iterduplmask_[]>>algo)&1 73 | the simtrack matches to a seed with algo = 4, 22, 23 ... -> (algo_seed>>algo)&1 74 | 75 | 76 | The script val_scripts/validation-cmssw-benchmarks-multiiter.sh produces 4 sets of plots: 3 iteration specific validation plots and 1 global validation 77 | 78 | The settings are the same as for the forConf suite, i.e. comparing CE (build-mimi) to CMSSW - no STD build. the validation setups are the usual SIMVAL and SIMVALSEED (MTV). 79 | In the iteration specific the itermask_[seed/build//fit] and iterduplmask_[seed/build//fit] are used to define efficiency and duplicate rates, algo_seed is also required in SIMVALSEED. 80 | The global validation is similar to the one used for the initial step only (no bit masks used). It can be useful to check the global absolute efficiency after adding iterations after each other. 81 | On the other hand, the comparison of fakes and duplicates between mkFit and cmssw is not totally fair, as different types of cleaning are applied to the two collections. 82 | 83 | 84 | -------------------------------------------------------------------------------- /Event.h: -------------------------------------------------------------------------------- 1 | #ifndef _event_ 2 | #define _event_ 3 | 4 | #include "Track.h" 5 | #include "Validation.h" 6 | #include "Config.h" 7 | 8 | #include 9 | 10 | namespace mkfit { 11 | 12 | struct DataFile; 13 | 14 | class Event 15 | { 16 | public: 17 | explicit Event(int evtID); 18 | Event(Validation& v, int evtID); 19 | 20 | void Reset(int evtID); 21 | void Validate(); 22 | void PrintStats(const TrackVec&, TrackExtraVec&); 23 | 24 | int evtID() const {return evtID_;} 25 | void resetLayerHitMap(bool resetSimHits); 26 | 27 | void write_out(DataFile &data_file); 28 | void read_in (DataFile &data_file, FILE *in_fp=0); 29 | int write_tracks(FILE *fp, const TrackVec& tracks); 30 | int read_tracks (FILE *fp, TrackVec& tracks, bool skip_reading = false); 31 | 32 | void setInputFromCMSSW(std::vector hits, TrackVec seeds); 33 | 34 | void kludge_cms_hit_errors(); 35 | 36 | int use_seeds_from_cmsswtracks(); //special mode --> use only seeds which generated cmssw reco track 37 | int clean_cms_simtracks(); 38 | int clean_cms_seedtracks(TrackVec *seed_ptr = nullptr); //operates on seedTracks_; returns the number of cleaned seeds 39 | int clean_cms_seedtracks_badlabel(); //operates on seedTracks_, removes those with label == -1; 40 | void relabel_bad_seedtracks(); 41 | void relabel_cmsswtracks_from_seeds(); 42 | 43 | int select_tracks_iter(unsigned int n=0);//for cmssw input 44 | 45 | void fill_hitmask_bool_vectors(int track_algo, std::vector> &layer_masks); 46 | void fill_hitmask_bool_vectors(std::vector &track_algo_vec, std::vector> &layer_masks); 47 | 48 | void print_tracks(const TrackVec& tracks, bool print_hits) const; 49 | 50 | Validation& validation_; 51 | 52 | private: 53 | int evtID_; 54 | 55 | public: 56 | BeamSpot beamSpot_; // XXXX Read/Write of BeamSpot + file-version bump or extra-section to be added. 57 | std::vector layerHits_; 58 | std::vector > layerHitMasks_;//aligned with layerHits_ 59 | MCHitInfoVec simHitsInfo_; 60 | 61 | TrackVec simTracks_, seedTracks_, candidateTracks_, fitTracks_; 62 | TrackVec cmsswTracks_; 63 | // validation sets these, so needs to be mutable 64 | mutable TrackExtraVec simTracksExtra_, seedTracksExtra_, candidateTracksExtra_, fitTracksExtra_; 65 | mutable TrackExtraVec cmsswTracksExtra_; 66 | 67 | TSVec simTrackStates_; 68 | static std::mutex printmutex; 69 | }; 70 | 71 | typedef std::vector EventVec; 72 | 73 | 74 | struct DataFileHeader 75 | { 76 | int f_magic = 0xBEEF; 77 | int f_format_version = 6; 78 | int f_sizeof_track = sizeof(Track); 79 | int f_sizeof_hit = sizeof(Hit); 80 | int f_sizeof_hot = sizeof(HitOnTrack); 81 | int f_n_layers = -1; 82 | int f_n_events = -1; 83 | 84 | int f_extra_sections = 0; 85 | 86 | DataFileHeader() 87 | { 88 | f_n_layers = Config::nTotalLayers; 89 | } 90 | }; 91 | 92 | struct DataFile 93 | { 94 | enum ExtraSection 95 | { 96 | ES_SimTrackStates = 0x1, 97 | ES_Seeds = 0x2, 98 | ES_CmsswTracks = 0x4, 99 | ES_HitIterMasks = 0x8, 100 | ES_BeamSpot = 0x10 101 | }; 102 | 103 | FILE *f_fp = 0; 104 | long f_pos = sizeof(DataFileHeader); 105 | 106 | DataFileHeader f_header; 107 | 108 | std::mutex f_next_ev_mutex; 109 | 110 | // ---------------------------------------------------------------- 111 | 112 | bool HasSimTrackStates() const { return f_header.f_extra_sections & ES_SimTrackStates; } 113 | bool HasSeeds() const { return f_header.f_extra_sections & ES_Seeds; } 114 | bool HasCmsswTracks() const { return f_header.f_extra_sections & ES_CmsswTracks; } 115 | bool HasHitIterMasks() const { return f_header.f_extra_sections & ES_HitIterMasks; } 116 | bool HasBeamSpot() const { return f_header.f_extra_sections & ES_BeamSpot; } 117 | 118 | int OpenRead (const std::string& fname, bool set_n_layers = false); 119 | void OpenWrite(const std::string& fname, int nev, int extra_sections=0); 120 | 121 | int AdvancePosToNextEvent(FILE *fp); 122 | 123 | void SkipNEvents(int n_to_skip); 124 | 125 | void Close(); 126 | void CloseWrite(int n_written); //override nevents in the header and close 127 | }; 128 | 129 | } // end namespace mkfit 130 | #endif 131 | -------------------------------------------------------------------------------- /plotting/PlotMEIFBenchmarks.cpp: -------------------------------------------------------------------------------- 1 | #include "PlotMEIFBenchmarks.hh" 2 | 3 | PlotMEIFBenchmarks::PlotMEIFBenchmarks(const TString & arch, const TString & sample, const TString & build) 4 | : arch(arch), sample(sample), build(build) 5 | { 6 | // setup style for plotting 7 | setupStyle(); 8 | 9 | // get file 10 | file = TFile::Open("benchmarkMEIF_"+arch+"_"+sample+"_"+build+".root"); 11 | 12 | // setup enum 13 | setupARCHEnum(arch); 14 | 15 | // setup arch options 16 | setupArch(); 17 | 18 | // setup events 19 | setupEvents(); 20 | } 21 | 22 | PlotMEIFBenchmarks::~PlotMEIFBenchmarks() 23 | { 24 | delete file; 25 | } 26 | 27 | void PlotMEIFBenchmarks::RunMEIFBenchmarkPlots() 28 | { 29 | // title options 30 | const TString nvu = Form("%iint",arch_opt.vumax); 31 | 32 | // x-axis title 33 | const TString xtitleth = "Number of Threads"; 34 | 35 | // y-axis title 36 | const TString ytitletime = "Averarge Time per Event [s]"; 37 | const TString ytitlespeedup = "Average Speedup per Event"; 38 | 39 | // Do the overlaying! 40 | PlotMEIFBenchmarks::MakeOverlay("time",build+" "+sample+" Multiple Events in Flight Benchmark on "+arch+" [nVU="+nvu+"]",xtitleth,ytitletime, 41 | arch_opt.thmin,arch_opt.thmax,arch_opt.thmeiftimemin,arch_opt.thmeiftimemax); 42 | 43 | PlotMEIFBenchmarks::MakeOverlay("speedup",build+" "+sample+" Multiple Events in Flight Speedup on "+arch+" [nVU="+nvu+"]",xtitleth,ytitlespeedup, 44 | arch_opt.thmin,arch_opt.thmax,arch_opt.thmeifspeedupmin,arch_opt.thmeifspeedupmax); 45 | } 46 | 47 | void PlotMEIFBenchmarks::MakeOverlay(const TString & text, const TString & title, const TString & xtitle, const TString & ytitle, 48 | const Double_t xmin, const Double_t xmax, const Double_t ymin, const Double_t ymax) 49 | { 50 | // special setups 51 | const Bool_t isSpeedup = text.Contains("speedup",TString::kExact); 52 | 53 | // canvas 54 | auto canv = new TCanvas(); 55 | canv->cd(); 56 | canv->SetGridy(); 57 | if (!isSpeedup) canv->SetLogy(); 58 | canv->DrawFrame(xmin,ymin,xmax,ymax,""); 59 | 60 | // legend 61 | const Double_t x1 = (isSpeedup ? 0.20 : 0.60); 62 | const Double_t y1 = 0.65; 63 | auto leg = new TLegend(x1,y1,x1+0.25,y1+0.2); 64 | leg->SetBorderSize(0); 65 | 66 | // get tgraphs for meif and draw 67 | TGVec graphs(nevents); 68 | for (auto i = 0U; i < nevents; i++) 69 | { 70 | const auto & event = events[i]; 71 | auto & graph = graphs[i]; 72 | 73 | const TString nEV = Form("%i",event.nev); 74 | graph = (TGraph*)file->Get("g_"+build+"_MEIF_nEV"+nEV+"_"+text); 75 | 76 | if (graph) 77 | { 78 | // restyle a bit 79 | graph->SetTitle(title+";"+xtitle+";"+ytitle); 80 | 81 | graph->SetLineWidth(2); 82 | graph->SetLineColor(event.color); 83 | graph->SetMarkerStyle(kFullCircle); 84 | graph->SetMarkerColor(event.color); 85 | graph->GetXaxis()->SetRangeUser(xmin,xmax); 86 | graph->GetYaxis()->SetRangeUser(ymin,ymax); 87 | 88 | // draw and add to legend 89 | graph->Draw(i>0?"LP SAME":"ALP"); 90 | leg->AddEntry(graph,Form("%i Events",event.nev),"LP"); 91 | } 92 | } 93 | 94 | // Draw ideal scaling line 95 | TF1 * scaling = NULL; 96 | if (isSpeedup) 97 | { 98 | scaling = new TF1("ideal_scaling","x",arch_opt.thmin,arch_opt.thmeifspeedupmax); 99 | scaling->SetLineColor(kBlack); 100 | scaling->SetLineStyle(kDashed); 101 | scaling->SetLineWidth(2); 102 | scaling->Draw("SAME"); 103 | leg->AddEntry(scaling,"Ideal Scaling","l"); 104 | } 105 | 106 | // draw legend last 107 | leg->Draw("SAME"); 108 | 109 | // Save the png 110 | const TString outname = arch+"_"+sample+"_"+build+"_MEIF_"+text; 111 | canv->SaveAs(outname+".png"); 112 | 113 | // Save log-x version 114 | canv->SetLogx(); 115 | for (auto i = 0U; i < nevents; i++) 116 | { 117 | auto & graph = graphs[i]; 118 | 119 | // reset axes for logx 120 | if (graph) 121 | { 122 | graph->GetXaxis()->SetRangeUser(xmin,xmax); 123 | graph->GetYaxis()->SetRangeUser(ymin,ymax); 124 | } 125 | } 126 | canv->Update(); 127 | canv->SaveAs(outname+"_logx.png"); 128 | 129 | // delete everything 130 | for (auto & graph : graphs) delete graph; 131 | if (isSpeedup) delete scaling; 132 | delete leg; 133 | delete canv; 134 | } 135 | -------------------------------------------------------------------------------- /mkFit/scaling.C: -------------------------------------------------------------------------------- 1 | #include "TH1.h" 2 | #include "TGraph.h" 3 | #include "TLegend.h" 4 | 5 | #include "TCanvas.h" 6 | 7 | float n_thr[] = { 1, 3, 7, 21 }; 8 | 9 | const char *names[] = 10 | { 11 | "SB", 12 | "SB w/ clone thr", 13 | "MIC", 14 | "MIC w/ clone thr on same core", 15 | "MIC w/ clone thr on another core" 16 | }; 17 | 18 | // Run as: 19 | // for n in 1 3 7 21; do ./mkFit --best-out-of 5 --num-threads $n | grep 'MX =' | tail -n 1; done 20 | // - mkFit-mic for mic; 21 | // - take out for cloning in a special thread; 22 | // - for extra thread placememnt on mic recompile after changing EventTmp ctor. 23 | 24 | //------------------------------------------------------------------------------ 25 | 26 | float times_flat_eta[5][4] = 27 | { 28 | { 6.176 , 2.245 , 1.050, 0.762 }, // SB 29 | { 4.418 , 1.575 , 1.144, 0.761 }, // SB cln 30 | { 43.927, 15.223, 7.238, 3.199 }, // MIC 31 | { 31.800, 11.562, 5.375, 2.481 }, // MIC cln 32 | { 31.538, 11.317, 5.613, 2.483 } // MIC cln other core 33 | }; 34 | 35 | // Comparisons against 1 thread, no extra cloner: 36 | // | Vw=1 r | no_intr 37 | // SB | 10.191 1.650 | 6.133 38 | // MIC | 79.594 1.812 | 45.738 39 | 40 | //------------------------------------------------------------------------------ 41 | 42 | float times_flat_pz[5][4] = 43 | { 44 | { 6.370 , 2.361 , 1.262, 0.886 }, // SB 45 | { 4.489 , 1.741 , 1.307, 0.883 }, // SB cln 46 | { 43.868, 16.399, 8.536, 4.495 }, // MIC 47 | { 31.468, 11.850, 6.995, 2.895 }, // MIC cln 48 | { 32.061, 11.903, 6.282, 2.866 } // MIC cln other core 49 | }; 50 | 51 | //------------------------------------------------------------------------------ 52 | 53 | float (×)[5][4] = times_flat_eta; 54 | 55 | int Gmsty[] = { 2, 5, 2, 5, 2 }; 56 | int Gmcol[] = { kRed+2, kBlue+2, kOrange+4, kCyan+2, kGreen+2 }; 57 | int Glcol[] = { kRed, kBlue, kOrange, kCyan, kGreen }; 58 | 59 | 60 | void time(bool logp=true) 61 | { 62 | new TCanvas("scaling_times", ""); 63 | 64 | TH1F *dummy = new TH1F("", "Time for 10 evs", 1, 0, 24); 65 | dummy->SetXTitle("N threads"); 66 | dummy->SetYTitle("t[s]"); 67 | dummy->SetMinimum(logp ? 0.5 : 0); 68 | dummy->SetMaximum(50); 69 | dummy->SetStats(false); 70 | dummy->Draw(); 71 | 72 | if (logp) gPad->SetLogy(); 73 | gPad->SetGridy(); 74 | 75 | for (float fac=1; fac <= 400; fac *= 2) 76 | { 77 | float tt[4]; 78 | for (int i = 0; i < 4; ++i) tt[i] = fac / n_thr[i]; 79 | 80 | TGraph *g = new TGraph(4, n_thr, tt); 81 | g->SetLineStyle(3); 82 | //g->SetLineColor(kGray); 83 | g->Draw("same"); 84 | } 85 | 86 | TLegend *leg = new TLegend(0.65, 0.65, 0.95, 0.95); 87 | 88 | for (int i = 0; i < 5; ++i) 89 | { 90 | TGraph *g = new TGraph(4, n_thr, times[i]); 91 | 92 | g->SetMarkerStyle(Gmsty[i]); 93 | g->SetMarkerColor(Gmcol[i]); 94 | g->SetLineColor(Glcol[i]); 95 | 96 | g->Draw("pl same"); 97 | 98 | leg->AddEntry(g, names[i], "lp"); 99 | } 100 | 101 | leg->Draw(); 102 | } 103 | 104 | void speedup(bool logp=false) 105 | { 106 | new TCanvas("speedups", ""); 107 | 108 | TH1F *dummy = new TH1F("", "Speedup", 1, 0, 24); 109 | dummy->SetXTitle("N threads"); 110 | dummy->SetYTitle("speedup"); 111 | dummy->SetMinimum(logp ? 0.5 : 0); 112 | dummy->SetMaximum(24); 113 | dummy->SetStats(false); 114 | dummy->Draw(); 115 | 116 | if (logp) gPad->SetLogy(); 117 | gPad->SetGridy(); 118 | 119 | for (float fac=-20; fac <= 20; fac += 2) 120 | { 121 | float tt[4]; 122 | for (int i = 0; i < 4; ++i) tt[i] = fac + n_thr[i]; 123 | 124 | TGraph *g = new TGraph(4, n_thr, tt); 125 | g->SetLineStyle(3); 126 | //g->SetLineColor(kGray); 127 | g->Draw("same"); 128 | } 129 | 130 | TLegend *leg = new TLegend(0.15, 0.55, 0.45, 0.85); 131 | 132 | for (int i = 0; i < 5; ++i) 133 | { 134 | float tt[4]; 135 | for (int j = 0; j < 4; ++j) tt[j] = times[i][0] / times[i][j]; 136 | 137 | TGraph *g = new TGraph(4, n_thr, tt); 138 | 139 | g->SetMarkerStyle(Gmsty[i]); 140 | g->SetMarkerColor(Gmcol[i]); 141 | g->SetLineColor(Glcol[i]); 142 | 143 | g->Draw("pl same"); 144 | 145 | leg->AddEntry(g, names[i], "lp"); 146 | } 147 | 148 | leg->Draw(); 149 | } 150 | 151 | 152 | void scaling() 153 | { 154 | time(); 155 | 156 | speedup(); 157 | } 158 | -------------------------------------------------------------------------------- /mkFit/align_alloc.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * Allocator for aligned data. 5 | * 6 | * Modified from the Mallocator from Stephan T. Lavavej. 7 | * 8 | */ 9 | template 10 | class aligned_allocator 11 | { 12 | public: 13 | 14 | // The following will be the same for virtually all allocators. 15 | typedef T * pointer; 16 | typedef const T * const_pointer; 17 | typedef T& reference; 18 | typedef const T& const_reference; 19 | typedef T value_type; 20 | typedef std::size_t size_type; 21 | typedef ptrdiff_t difference_type; 22 | 23 | T * address(T& r) const 24 | { 25 | return &r; 26 | } 27 | 28 | const T * address(const T& s) const 29 | { 30 | return &s; 31 | } 32 | 33 | std::size_t max_size() const 34 | { 35 | // The following has been carefully written to be independent of 36 | // the definition of size_t and to avoid signed/unsigned warnings. 37 | return (static_cast(0) - static_cast(1)) / sizeof(T); 38 | } 39 | 40 | 41 | // The following must be the same for all allocators. 42 | template 43 | struct rebind 44 | { 45 | typedef aligned_allocator other; 46 | } ; 47 | 48 | bool operator!=(const aligned_allocator& other) const 49 | { 50 | return !(*this == other); 51 | } 52 | 53 | void construct(T * const p, const T& t) const 54 | { 55 | void * const pv = static_cast(p); 56 | 57 | new (pv) T(t); 58 | } 59 | 60 | void construct(T * const p) { return construct(p, value_type()); } 61 | 62 | void destroy(T * const p) const 63 | { 64 | p->~T(); 65 | } 66 | 67 | // Returns true if and only if storage allocated from *this 68 | // can be deallocated from other, and vice versa. 69 | // Always returns true for stateless allocators. 70 | bool operator==(const aligned_allocator& other) const 71 | { 72 | return true; 73 | } 74 | 75 | 76 | // Default constructor, copy constructor, rebinding constructor, and destructor. 77 | // Empty for stateless allocators. 78 | aligned_allocator() { } 79 | 80 | aligned_allocator(const aligned_allocator&) { } 81 | 82 | template aligned_allocator(const aligned_allocator&) { } 83 | 84 | ~aligned_allocator() { } 85 | 86 | 87 | // The following will be different for each allocator. 88 | T * allocate(const std::size_t n) const 89 | { 90 | // The return value of allocate(0) is unspecified. 91 | // Mallocator returns NULL in order to avoid depending 92 | // on malloc(0)'s implementation-defined behavior 93 | // (the implementation can define malloc(0) to return NULL, 94 | // in which case the bad_alloc check below would fire). 95 | // All allocators can return NULL in this case. 96 | if (n == 0) { 97 | return NULL; 98 | } 99 | 100 | // All allocators should contain an integer overflow check. 101 | // The Standardization Committee recommends that std::length_error 102 | // be thrown in the case of integer overflow. 103 | if (n > max_size()) 104 | { 105 | throw std::length_error("aligned_allocator::allocate() - Integer overflow."); 106 | } 107 | 108 | // Mallocator wraps malloc(). 109 | void * const pv = _mm_malloc(n * sizeof(T), Alignment); 110 | 111 | // Allocators should throw std::bad_alloc in the case of memory allocation failure. 112 | if (pv == NULL) 113 | { 114 | throw std::bad_alloc(); 115 | } 116 | 117 | return static_cast(pv); 118 | } 119 | 120 | void deallocate(T * const p, const std::size_t n) const 121 | { 122 | _mm_free(p); 123 | } 124 | 125 | 126 | // The following will be the same for all allocators that ignore hints. 127 | template 128 | T * allocate(const std::size_t n, const U * /* const hint */) const 129 | { 130 | return allocate(n); 131 | } 132 | 133 | 134 | // Allocators are not required to be assignable, so 135 | // all allocators should have a private unimplemented 136 | // assignment operator. Note that this will trigger the 137 | // off-by-default (enabled under /Wall) warning C4626 138 | // "assignment operator could not be generated because a 139 | // base class assignment operator is inaccessible" within 140 | // the STL headers, but that warning is useless. 141 | private: 142 | aligned_allocator& operator=(const aligned_allocator&); 143 | }; 144 | --------------------------------------------------------------------------------