<html>#2853: AHFinderDirect_import_mask() needs an OpenMP pragma
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Zach Etienne</td></tr>
<tr><td style='text-align:right'> Status:</td><td>new</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'> Version:</td><td></td></tr>
<tr><td style='text-align:right'> Type:</td><td>enhancement</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>minor</td></tr>
<tr><td style='text-align:right'>Component:</td><td></td></tr>
</table>
<p>While comparing the performance of <strong>AHFinderDirect</strong> with my new apparent horizon finder thorn, <strong>ET_BHaHAHA</strong> (“the ET implementation of the BlackHoles@Home Apparent Horizon Algorithm”), I observed the following runtime distribution in <strong>AHFinderDirect</strong>:</p>
<ul>
<li><strong>AHFinderDirect_find_horizons</strong>: ~56% of total runtime</li>
<li><strong>AHFinderDirect_import_mask</strong>: ~31% of total runtime</li>
<li><strong>AHFinderDirect_store</strong>: ~13% of total runtime</li>
</ul>
<h4 id="markdown-header-context">Context</h4>
<p>These measurements were taken using a slightly modified version of the <strong>GW150914 BBH gallery example</strong>, replacing <strong>ML_BSSN</strong> with <strong>BaikalVacuum</strong> at a slightly higher resolution. Runtime data is based on <strong>TimerReport cumulative runtime</strong>. Granted, the import_mask function takes up 0.2% of the total runtime at this find-horizon cadence, but that it takes a significant fraction of the AHFinderDirect runtime at all is simply unacceptable.</p>
<h4 id="markdown-header-issue-ahfinderdirect_import_mask-performance">Issue: AHFinderDirect_import_mask Performance</h4>
<p>The <strong>AHFinderDirect_import_mask</strong> function is particularly inefficient. It consists of a simple <strong>3D loop</strong> that <strong>lacks OpenMP parallelization</strong>, significantly impacting performance. Here’s the entire function (with comments removed):</p>
<div class="codehilite"><pre><span></span><code><span class="n">extern</span><span class="w"> </span><span class="ss">"C"</span><span class="w"></span>
<span class="w"> </span><span class="n">void</span><span class="w"> </span><span class="n">AHFinderDirect_import_mask</span><span class="p">(</span><span class="n">CCTK_ARGUMENTS</span><span class="p">)</span><span class="w"></span>
<span>{</span><span class="w"></span>
<span class="n">DECLARE_CCTK_ARGUMENTS_AHFinderDirect_import_mask</span><span class="w"></span>
<span class="n">DECLARE_CC
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2853/ahfinderdirect_import_mask-needs-an-openmp'>https://bitbucket.org/einsteintoolkit/tickets/issues/2853/ahfinderdirect_import_mask-needs-an-openmp</a></p>
</html>