File: misc.xhtml

package info (click to toggle)
sleef 3.3.1-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,616 kB
  • sloc: ansic: 31,598; sh: 194; java: 151; makefile: 124
file content (220 lines) | stat: -rw-r--r-- 8,408 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=0.4"/>
<meta name="google" content="notranslate" />
<link rel="canonical" href="https://sleef.org/misc.xhtml" />
<link rel="icon" href="favicon.png" />
<link rel="stylesheet" type="text/css" href="texlike.css"/>
<link rel="stylesheet" type="text/css" href="sleef.css"/>
<title>SLEEF Documentation</title>
</head>
<body translate="no" class="notranslate">
<h1>SLEEF Documentation - Other tools included in the package</h1>

<h2>Table of contents</h2>

<ul class="none" style="font-family: arial, sansserif; padding-left: 0.5cm;">
  <li><a class="underlined" href="index.xhtml">Introduction</a></li>
  <li><a class="underlined" href="compile.xhtml">Compiling and installing the library</a></li>
  <li><a class="underlined" href="purec.xhtml">Math library reference</a></li>
  <li><a class="underlined" href="dft.xhtml">DFT library reference</a></li>
  <li>&nbsp;</li>
  <li><a class="underlined" href="misc.xhtml">Other tools included in the package</a></li>
    <ul class="disc">
      <li><a href="misc.xhtml#testerlibm">Testers for libm</a></li>
      <li><a href="misc.xhtml#testerdft">Testers for DFT</a></li>
      <li><a href="misc.xhtml#gencoef">Tool for generating coefficients</a></li>
      <li><a href="misc.xhtml#benchmark">Benchmarking tool</a></li>
    </ul>
  <li>&nbsp;</li>
  <li><a class="underlined" href="benchmark.xhtml">Benchmark results</a></li>
  <li><a class="underlined" href="additional.xhtml">Additional notes</a></li>
</ul>

<h2 id="testerlibm">Libm tester</h2>

<p class="noindent">
  SLEEF libm has two kinds of testers, and each kind of testers has
  its own role.
</p>

<p>
  The first kind of testers consist of a tester and an IUT (which
  stands for Implementation Under Test.) Those two are built as
  separate executables, and communicate with each other using a
  pipe. The role for this tester is to perform a perfunctory set of
  tests to check if the build is correct. It is also performs
  regression tests. Since the tester executable and the iut executable
  are separated, the iut can be implemented with an exotic
  languages. It is also possible to perform a test over the network.
</p>

<p>
  The second kind of testers are designed to run continuously. It
  repeats randomly generating arguments for each function, and
  comparing the results of each function to the results calculated
  with the corresponding function in libmpfr. This tester is expected
  to find bugs if it is run for sufficiently long time.
</p>


<h2 id="testerdft">DFT tester</h2>

<p class="noindent">
  SLEEF DFT has three kinds of testers. The first ones, named
  naivetest, compare the results computed by SLEEF DFT with that from
  a naive DFT implementation. These testers cannot be built with MSVC
  since complex data types are not supported. The second testers,
  named fftwtest, compare the results of computation between SLEEF DFT
  and FFTW. Rigorous testing is possible with the second testers, but
  obviously it requires FFTW to run. The third testers, named
  roundtriptest, executes a forward transform followed by a backward
  transform. Then, it compares the results with the original data. An
  advantage of the third testers is that it does not require external
  library and it runs on all environment, but there could be many
  cases that this testing does not find flaw. The third testers are
  used only if FFTW is not available.
</p>


<h2 id="gencoef">Gencoef</h2>

<p class="noindent">
  Gencoef is a small tool for generating the coefficients for
  polynomial approximation used in the kernels.
</p>

<p>
  In order to change the configurations, please edit gencoefdp.c. In
  the beginning of the file, specifications of the parameters for
  generating coefficients are listed. Enable one of them by changing
  #if. Then, run make to compile the source code. Run the gencoef, and
  it will show the generated coefficients in a few minutes. It may
  take longer time depending on the settings.
</p>

<p>
  There are two phases of the program. The first phase is the
  regression for minimizing the maximum relative error. This problem
  can be reduced to a linear programming problem, and the Simplex
  method is used in this implementation. This requires multi-precision
  calculation, and the implementation uses the MPFR library to do
  this. In this phase, it uses only a small number of values
  (specified by macro S, usually less than 100) within the input
  domain of the kernel function to approximate the function.  The
  function to approximate is given by FRFUNC function. Specifying
  higher values for S does not always give better results.
</p>

<p>
  The second phase is to optimize the coefficients so that it gives
  good accuracy with double precision calculation. In this phase, it
  checks 10000 points (specified by macro Q) within the specified
  argument range to see if the polynomial gives good error bounds. In
  some cases, the last few terms have to be calculated in higher
  precision in order to achieve 1 ULP or less overall accuracy, and
  this implementation can take care of that. The L parameter specifies
  the number of high precision coefficients.
</p>

<p>
  In some cases, it is desirable to fix the last few coefficients to
  values like 1 or 0.5. This can be specified if you define FIXCOEF0
  macro.
</p>

<p>
  Finding a set of good parameters is not a straightforward process.
</p>


<h2 id="benchmark">Benchmarking tool</h2>

<p class="noindent">
  SLEEF has a tool for measuring and plotting execution time of each
  function in the library. It consists of an executable for
  measurements, a makefile for driving measurement and plotting, and a
  couple of scripts.
</p>

<p>
  In order to start a measurement, you need to first build the
  executable for measurement. CMake builds the executable along with
  the library. Please refer to <a class="underlined"
  href="compile.xhtml">compiling and installing the library</a> for
  this.
</p>

<p>
  Then, change directory to sleef-3.X/src/libm-benchmarks/. You also
  need to set the build directory to BUILDDIR environment variable.
</p>

<pre class="command">$ export BUILDDIR=$PATH:`pwd`/../../build</pre>

<p>
  Type "make measure". After compiling the tools, it will prompt a
  label for measurement. After you input a label, measurement
  begins. After a measurement finishes, you can repeat measurements
  under different configurations. If you want to measure on a
  different computer, please copy the entire directory on to that
  computer and continue measurements. If you have Intel Compiler
  installed on your computer, you can type "make measureSVML" to
  measure the computation time of SVML functions.
</p>

<pre class="command">$ make measure
./measure.sh benchsleef
     ...
Enter label of measurement(e.g. My desktop PC) : Skylake
Measurement in progress. This may take several minutes.
Sleef_sind2_u10
Sleef_cosd2_u10
Sleef_tand2_u10
Sleef_sincosd2_u10
     ...
Sleef_atanf8_u10
Sleef_atan2f8_u10
Sleef_atanf8_u35
Sleef_atan2f8_u35

Now, you can plot the results of measurement by 'make plot'.
You can do another measurement by 'make measure'.
You can start over by 'make restart'.

$ make plot
javac ProcessData.java
java ProcessData *dptrig*.out
gnuplot script.out
mv output.png trigdp.png
java ProcessData *dpnontrig*.out
gnuplot script.out
mv output.png nontrigdp.png
java ProcessData *sptrig*.out
gnuplot script.out
mv output.png trigsp.png
java ProcessData *spnontrig*.out
gnuplot script.out
mv output.png nontrigsp.png
$ &block;</pre>

<p>
  Then type "make plot" to generate graphs. You need to have JDK and
  gnuplot installed on your computer. Four graphs are generated :
  trigdp.png, nontrigdp.png, trigsp.png and nontrigsp.png. Please see our
  <a class="underlined" href="benchmark.xhtml">benchmark results</a>
  for an example of generated graphs by this tool.
</p>

<p class="footer">
  Copyright &copy; 2018 SLEEF Project.<br/>
  SLEEF is open-source software and is distributed under the Boost Software License, Version 1.0.
</p>

<!--TEST-->

</body>
</html>