Skip to content

Commit

Permalink
Merge pull request cms-sw#146 from slava77/for-devel/globalStats-head
Browse files Browse the repository at this point in the history
add stats of cands and hits per run
  • Loading branch information
osschar authored Jun 26, 2018
2 parents a25c66e + 0726e88 commit 3df4b17
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
19 changes: 19 additions & 0 deletions mkFit/MkBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,25 @@ class MkBuilder
}
}

int total_cands() const {
int res = 0;
for (auto const& icomb: m_event_of_comb_cands.m_candidates) res += icomb.size();
return res;
}

std::pair<int,int> max_hits_layer() const {
int maxN = 0;
int maxL = 0;
for (auto const& lh : m_event_of_hits.m_layers_of_hits){
auto lsize = lh.m_hit_phis.size();
if (lsize > maxN){
maxN = lsize;
maxL = lh.layer_id();
}
}
return {maxN,maxL};
}

void begin_event(Event* ev, const char* build_type);
void end_event();

Expand Down
21 changes: 18 additions & 3 deletions mkFit/mkFit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ void test_standard()
}
#else
std::atomic<int> nevt{g_start_event};
std::atomic<int> seedstot{0}, simtrackstot{0};
std::atomic<int> seedstot{0}, simtrackstot{0}, candstot{0};
std::atomic<int> maxHits_all{0}, maxLayer_all{0};

MkBuilder::populate(g_run_build_all || g_run_build_fv);

Expand Down Expand Up @@ -439,6 +440,9 @@ void test_standard()
simtrackstot += ev.simTracks_.size();
seedstot += ev.seedTracks_.size();

int ncands_thisthread = 0;
int maxHits_thisthread = 0;
int maxLayer_thisthread = 0;
for (int b = 0; b < Config::finderReportBestOutOfN; ++b)
{
#ifndef USE_CUDA
Expand All @@ -454,7 +458,12 @@ void test_standard()
t_cur[3] = (g_run_build_all || g_run_build_ce) ? runBuildingTestPlexCloneEngineGPU(ev, ev_tmp, mkb, cuBuilder, g_seed_based) : 0;
#endif
t_cur[2] = (g_run_build_all || g_run_build_std) ? runBuildingTestPlexStandard(ev, mkb) : 0;

if (g_run_build_ce){
ncands_thisthread = mkb.total_cands();
auto const& ln = mkb.max_hits_layer();
maxHits_thisthread = ln.first;
maxLayer_thisthread = ln.second;
}
for (int i = 0; i < NT; ++i) t_best[i] = (b == 0) ? t_cur[i] : std::min(t_cur[i], t_best[i]);

if (!Config::silent) {
Expand All @@ -470,6 +479,11 @@ void test_standard()
}
}

candstot += ncands_thisthread;
if (maxHits_thisthread > maxHits_all){
maxHits_all = maxHits_thisthread;
maxLayer_all = maxLayer_thisthread;
}
if (!Config::silent) {
std::lock_guard<std::mutex> printlock(Event::printmutex);
printf("Matriplex fit = %.5f --- Build BHMX = %.5f STDMX = %.5f CEMX = %.5f FVMX = %.5f\n",
Expand All @@ -495,7 +509,8 @@ void test_standard()
t_sum[0], t_sum[1], t_sum[2], t_sum[3], t_sum[4]);
printf("Total event > 1 fit = %.5f --- Build BHMX = %.5f STDMX = %.5f CEMX = %.5f FVMX = %.5f\n",
t_skip[0], t_skip[1], t_skip[2], t_skip[3], t_skip[4]);
printf("Total event loop time %.5f simtracks %d seedtracks %d\n", time, simtrackstot.load(), seedstot.load());
printf("Total event loop time %.5f simtracks %d seedtracks %d builtcands %d maxhits %d on lay %d\n", time,
simtrackstot.load(), seedstot.load(), candstot.load(), maxHits_all.load(), maxLayer_all.load());
//fflush(stdout);

if (g_operation == "read")
Expand Down

0 comments on commit 3df4b17

Please sign in to comment.