-
Notifications
You must be signed in to change notification settings - Fork 0
/
AlgorithmProfiler.html
197 lines (153 loc) · 10.4 KB
/
AlgorithmProfiler.html
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
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Work flows algorithm profiling</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css?v=fadd4351" />
<link rel="stylesheet" type="text/css" href="_static/custom.css?v=77160d70" />
<script src="_static/documentation_options.js?v=a8da1a53"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Profiling Overview" href="ProfilingOverview.html" />
<link rel="prev" title="Tools Overview" href="ToolsOverview.html" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-59110517-1', 'auto');
ga('send', 'pageview');
</script>
</head><body>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://www.mantidproject.org">
</a>
<span class="navbar-text navbar-version pull-left"><b>main</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="divider-vertical"></li>
<li><a href="index.html">Home</a></li>
<li><a href="https://download.mantidproject.org">Download</a></li>
<li><a href="https://docs.mantidproject.org">User Documentation</a></li>
<li><a href="http://www.mantidproject.org/contact">Contact Us</a></li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<p>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="index.html">Documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="ToolsOverview.html" accesskey="U">Tools Overview</a> »</li>
<li class="nav-item nav-item-this"><a href="">Work flows algorithm profiling</a></li>
</ul>
</div> </p>
</div>
<div class="container">
<div class="row">
<div class="body col-md-12 content" role="main">
<section id="work-flows-algorithm-profiling">
<span id="algorithmprofiler"></span><h1>Work flows algorithm profiling<a class="headerlink" href="#work-flows-algorithm-profiling" title="Link to this heading">¶</a></h1>
<nav class="contents local" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#summary" id="id1">Summary</a></p></li>
<li><p><a class="reference internal" href="#mantid-build" id="id2">Mantid build</a></p></li>
<li><p><a class="reference internal" href="#adding-more-detailed-information" id="id3">Adding more detailed information</a></p></li>
<li><p><a class="reference internal" href="#analysing-tool" id="id4">Analysing tool</a></p></li>
<li><p><a class="reference internal" href="#related-documentation" id="id5">Related Documentation</a></p></li>
</ul>
</nav>
<figure class="align-default">
<img alt="Example output after rendering" src="_images/MantidProfiler.png" />
</figure>
<section id="summary">
<h2><a class="toc-backref" href="#id1" role="doc-backlink">Summary</a><a class="headerlink" href="#summary" title="Link to this heading">¶</a></h2>
<p>Due to the need of investigation of algorithms performance issues, the proper method is introduced.
It consists two to parts: special mantid build and analytical tool.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Available for Linux only.</p>
</div>
</section>
<section id="mantid-build">
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Mantid build</a><a class="headerlink" href="#mantid-build" title="Link to this heading">¶</a></h2>
<p>On linux the profiler is built by default but to enable profiling, the <a class="reference external" href="https://docs.mantidproject.org/nightly/concepts/PropertiesFile.html#algorithm-profiling" title="(in MantidProject v6.11)"><span class="xref std std-ref">properties</span></a> must be set.
Enabling the profiler will create a file that contains the time stamps for start and finish of executed algorithms with ~nanosecond precision in a very simple text format.</p>
</section>
<section id="adding-more-detailed-information">
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Adding more detailed information</a><a class="headerlink" href="#adding-more-detailed-information" title="Link to this heading">¶</a></h2>
<p>More detailed information can be added to individual function calls in C++ with the help of <code class="docutils literal notranslate"><span class="pre">std::chrono</span></code>.
At the top of the function create a “start time”</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">const</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">startTime</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">chrono</span><span class="o">::</span><span class="n">high_resolution_clock</span><span class="o">::</span><span class="n">now</span><span class="p">();</span>
</pre></div>
</div>
<p>Then at the bottom of the section being timed, add it to the profiling output</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">addTimer</span><span class="p">(</span><span class="s">"createOutputWorkspacesSplitters"</span><span class="p">,</span><span class="w"> </span><span class="n">startTime</span><span class="p">,</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">chrono</span><span class="o">::</span><span class="n">high_resolution_clock</span><span class="o">::</span><span class="n">now</span><span class="p">());</span>
</pre></div>
</div>
<p>where <code class="docutils literal notranslate"><span class="pre">createOutputWorkspacesSplitters</span></code> is the name that will appear, similar to a child algorithm.
The names in the report will be suffixed with <code class="docutils literal notranslate"><span class="pre">1</span></code> because the tool thinks they are the “default version” of a child algorithm.</p>
<p>An example of this can be found in <a class="reference external" href="https://github.com/mantidproject/mantid/blob/main/Framework/Algorithms/src/FilterEvents.cpp">FilterEvents.cpp</a>.</p>
</section>
<section id="analysing-tool">
<h2><a class="toc-backref" href="#id4" role="doc-backlink">Analysing tool</a><a class="headerlink" href="#analysing-tool" title="Link to this heading">¶</a></h2>
<p>The <a class="reference external" href="https://github.com/mantidproject/mantid-profiler">mantid-profiler project</a> provides the nice graphical tool to interpret the information contained in the dumped file.
The project has more detiled instructions, but in general</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>path/to/myscript.py<span class="w"> </span><span class="p">&</span><span class="w"> </span>mantidprofiler<span class="w"> </span><span class="nv">$!</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">&</span></code> puts the python process in the background.
The <code class="docutils literal notranslate"><span class="pre">$!</span></code> is the process-id (PID) of the last process run and allows mantid-profiler to attach to the process.</p>
</section>
<section id="related-documentation">
<h2><a class="toc-backref" href="#id5" role="doc-backlink">Related Documentation</a><a class="headerlink" href="#related-documentation" title="Link to this heading">¶</a></h2>
<ul class="simple">
<li><p><a class="reference external" href="https://docs.mantidproject.org/api/python/mantid/api/AlgoTimeRegister.html">mantid.api.AlgoTimeRegister</a> discusses how timing is measured.</p></li>
<li><p><a class="reference external" href="https://github.com/mantidproject/mantid-profiler">The mantid-profiler README</a> provides an overview of how to tool is used.</p></li>
<li><p><a class="reference external" href="https://docs.mantidproject.org/concepts/PropertiesFile.html#algorithm-profiling-settings">Relevant properties file configurations</a>.</p></li>
</ul>
</section>
</section>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<ul class="nav navbar-nav" style=" float: right;">
<li>
<a href="ToolsOverview.html" title="Previous Chapter: Tools Overview"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« Tools Overview</span>
</a>
</li>
<li>
<a href="ProfilingOverview.html" title="Next Chapter: Profiling Overview"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">Profiling Overview »</span>
</a>
</li>
<li><a href="#">Back to top</a></li>
</ul>
<p>
</p>
</div>
</footer>
</body>
</html>