@@ -81,3 +81,56 @@ two platforms, whereas a distance of 1 means that no code is shared.
81
81
82
82
.. _Effective Performance Portability :
83
83
https://doi.org/10.1109/P3HPC.2018.00006
84
+
85
+ Platform Coverage
86
+ #################
87
+
88
+ Platform coverage builds on the well-established concept of "test coverage",
89
+ and measures the amount of code in a code base that is utilized by a set of
90
+ platforms. Computing platform coverage is straightforward: it is simply the
91
+ number of lines of code used by one or more platforms expressed as a percentage
92
+ of the number of lines of code in the code base.
93
+
94
+ .. important ::
95
+ CBI often uses "coverage" as a shorthand for "platform coverage"!
96
+
97
+ Formally, for a given set of platforms, :math: `H`, the coverage for an
98
+ application :math: `a` solving problem :math: `p` is:
99
+
100
+ .. math ::
101
+ \textrm {Coverage}(a, p, H) = \frac {\left |\bigcup _{i \in H} c_i(a,p)\right |}
102
+ {\left |\bigcup _{i \in H} c_i(a,p)\right | + \left |\bigcap _{i \in H} c_i'(a,p)\right |} \times 100
103
+
104
+ where :math: `c_i` is the set of lines of code required to compile application
105
+ :math: `a` and solve problem :math: `p` using platform :math: `i`, and
106
+ :math: `c_i'` is the complement of that set (i.e., the set of lines of code
107
+ *not * required). A coverage of 0% means that none of the code is used by any
108
+ platform, whereas a coverage of 100% means that all of the code is used by at
109
+ least one platform.
110
+
111
+ Measuring coverage can also help us to reason about differences between
112
+ platforms. The *average * coverage (over platforms) allows us to reason about
113
+ the amount of code covered by *all * platforms.
114
+
115
+ Formally, the average coverage is:
116
+
117
+ .. math ::
118
+ \textrm {Average Coverage}(a, p, H) = \frac {\sum _{h \in H} \textrm {Coverage}(a, p, h)}
119
+ {\left |H\right |}
120
+
121
+ An average coverage of 0% means that none of the code is used by any platform,
122
+ whereas an average coverage of 100% means that all of the code is used by all
123
+ platforms.
124
+
125
+ .. tip ::
126
+ Low average coverage does not always mean the platforms in :math: `H` share
127
+ little code; low average coverage can result from a high amount of unused
128
+ code. Presenting coverage alongside average coverage provides the most insight.
129
+
130
+ The straightforward nature of coverage and average coverage has several
131
+ advantages. First, it is very easy to intuit the impact of a code change upon
132
+ coverage. Second, it is simple to use and understand in hierarchical contexts
133
+ (e.g., the number of used lines for a directory is the sum of the used lines
134
+ over all files in the directory). For these reasons, CBI functionality focused
135
+ on understanding potential improvements to code structure tend to use coverage
136
+ instead of divergence.
0 commit comments