eOn 3.2.0
Long-timescale dynamics: aKMC, NEB, parallel replica
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
CalculatorGroupUse.h
Go to the documentation of this file.
1
/*
2
** This file is part of eOn.
3
**
4
** SPDX-License-Identifier: BSD-3-Clause
5
**
6
** Copyright (c) 2010--present, eOn Development Team
7
** All rights reserved.
8
**
9
** Repo:
10
** https://github.com/TheochemUI/eOn
11
*/
12
#pragma once
13
14
#include <algorithm>
15
#include <cstddef>
16
#include <format>
17
#include <numeric>
18
#include <string>
19
#include <vector>
20
21
namespace
eonc
{
22
28
struct
CalculatorGroupUse
{
29
std::vector<double>
busy
;
30
std::vector<double>
systems
;
31
double
wall
{0.0};
32
double
singleWall
{0.0};
33
long
batches
{0};
34
long
singles
{0};
35
36
[[nodiscard]] std::size_t
groups
() const noexcept {
return
busy
.size(); }
37
38
[[nodiscard]]
double
meanBusy
() const noexcept {
39
if
(
busy
.empty()) {
40
return
0.0;
41
}
42
return
std::accumulate(
busy
.begin(),
busy
.end(), 0.0) /
43
static_cast<
double
>
(
busy
.size());
44
}
45
46
[[nodiscard]]
double
maxBusy
() const noexcept {
47
return
busy
.empty() ? 0.0 : *std::max_element(
busy
.begin(),
busy
.end());
48
}
49
51
[[nodiscard]]
double
loadBalance
() const noexcept {
52
const
double
m =
maxBusy
();
53
return
m > 0.0 ?
meanBusy
() / m : 1.0;
54
}
55
59
[[nodiscard]]
double
communicationEfficiency
() const noexcept {
60
return
wall
> 0.0 ? std::min(1.0,
maxBusy
() /
wall
) : 1.0;
61
}
62
63
[[nodiscard]]
double
parallelEfficiency
() const noexcept {
64
return
loadBalance
() *
communicationEfficiency
();
65
}
66
68
[[nodiscard]]
double
idleFraction
(std::size_t group)
const
noexcept
{
69
if
(group >=
busy
.size() ||
wall
<= 0.0) {
70
return
0.0;
71
}
72
return
std::clamp(1.0 -
busy
[group] /
wall
, 0.0, 1.0);
73
}
74
75
[[nodiscard]] std::string
table
()
const
{
76
std::string out = std::format(
77
"calculator groups: {} groups, {} batches and {} single requests, "
78
"{:.1f} s grouped wall ({:.1f} s single)\n"
,
79
groups
(),
batches
,
singles
,
wall
,
singleWall
);
80
out += std::format(
"{:>6} {:>8} {:>10} {:>6}\n"
,
"group"
,
"systems"
,
81
"busy_s"
,
"idle"
);
82
for
(std::size_t g = 0; g <
busy
.size(); ++g) {
83
const
double
n = g <
systems
.size() ?
systems
[g] : 0.0;
84
out += std::format(
"{:>6} {:>8.0f} {:>10.2f} {:>5.1f}%\n"
, g, n,
busy
[g],
85
100.0 *
idleFraction
(g));
86
}
87
out += std::format(
"load balance {:.3f}, communication efficiency {:.3f}, "
88
"parallel efficiency {:.3f}\n"
,
89
loadBalance
(),
communicationEfficiency
(),
90
parallelEfficiency
());
91
return
out;
92
}
93
};
94
95
}
// namespace eonc
eonc
RAII resource manager for the ARTn C library with global synchronization.
Definition
ARTnSaddleSearch.cpp:23
eonc::CalculatorGroupUse
How a job used its calculator groups: the seconds each group spent inside engine calls,...
Definition
CalculatorGroupUse.h:28
eonc::CalculatorGroupUse::idleFraction
double idleFraction(std::size_t group) const noexcept
Fraction of the grouped wall time a group spent outside engine calls.
Definition
CalculatorGroupUse.h:68
eonc::CalculatorGroupUse::singleWall
double singleWall
of which single-system requests
Definition
CalculatorGroupUse.h:32
eonc::CalculatorGroupUse::singles
long singles
single-system requests (group 0 only)
Definition
CalculatorGroupUse.h:34
eonc::CalculatorGroupUse::parallelEfficiency
double parallelEfficiency() const noexcept
Definition
CalculatorGroupUse.h:63
eonc::CalculatorGroupUse::systems
std::vector< double > systems
systems evaluated, per group
Definition
CalculatorGroupUse.h:30
eonc::CalculatorGroupUse::batches
long batches
grouped batch requests
Definition
CalculatorGroupUse.h:33
eonc::CalculatorGroupUse::communicationEfficiency
double communicationEfficiency() const noexcept
Max busy over wall: the share of the driver's wait that the busiest group spent computing.
Definition
CalculatorGroupUse.h:59
eonc::CalculatorGroupUse::table
std::string table() const
Definition
CalculatorGroupUse.h:75
eonc::CalculatorGroupUse::groups
std::size_t groups() const noexcept
Definition
CalculatorGroupUse.h:36
eonc::CalculatorGroupUse::busy
std::vector< double > busy
seconds in engine calls, per group
Definition
CalculatorGroupUse.h:29
eonc::CalculatorGroupUse::maxBusy
double maxBusy() const noexcept
Definition
CalculatorGroupUse.h:46
eonc::CalculatorGroupUse::loadBalance
double loadBalance() const noexcept
Mean over max busy time: 1 when every group carried the same work.
Definition
CalculatorGroupUse.h:51
eonc::CalculatorGroupUse::wall
double wall
driver seconds inside grouped requests
Definition
CalculatorGroupUse.h:31
eonc::CalculatorGroupUse::meanBusy
double meanBusy() const noexcept
Definition
CalculatorGroupUse.h:38
include
eon
CalculatorGroupUse.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf