<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap:break-word; color:rgb(0,0,0); font-size:14px; font-family:Calibri,sans-serif">
<div>
<div>
<div>Rupert,</div>
<div><br>
</div>
<div>In ITKv4 the metrics ARE THE OPTIMIZED VERSIONS. We moved all the optimized versions of the code out of review and replaced the old un-optimized versions.</div>
<div><br>
</div>
<div>My guess is that we fixed many problems with thread-safety, and that in many cases these fixes were known to cause some performance hits. The goal was to keep the v3Registration framework backwards compatible but thread-safe in a minimalistic effort and
focus all our novel and performance development efforts on the v4 registration framework.</div>
<div><br>
</div>
<div>Hans</div>
<div><br>
</div>
<div>
<div>
<div>-- </div>
<div>
<div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt">Hans J. Johnson, Ph.D.</span></font></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt"><a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a></span></font></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt">Assistant Professor of Psychiatry</span></font></div>
<div style="font-family:Calibri; font-size:15px"><span class="Apple-style-span" style="font-size:13px; font-family:Arial">University of Iowa Carver College of Medicine</span></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt"><span class="Apple-style-span" style="font-family:Calibri; font-size:15px">
<div><span class="Apple-style-span" style="font-size:13px; font-family:Arial">W278 GH, 200 Hawkins Drive</span></div>
</span></span></font></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt">Iowa City, Iowa 52242</span></font></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt">Phone: 319-353-8587</span></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; border-bottom:medium none; border-left:medium none; padding-bottom:0in; padding-left:0in; padding-right:0in; border-top:#b5c4df 1pt solid; border-right:medium none; padding-top:3pt">
<span style="font-weight:bold">From: </span>Rupert Brooks <<a href="mailto:rupert.brooks@gmail.com">rupert.brooks@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, July 26, 2012 7:56 AM<br>
<span style="font-weight:bold">To: </span>Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>><br>
<span style="font-weight:bold">Cc: </span>ITK <<a href="mailto:insight-developers@itk.org">insight-developers@itk.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [Insight-developers] itk performance numbers<br>
</div>
<div><br>
</div>
<div>
<div>Brad,
<div><br>
</div>
<div>The false sharing issue is a good point - however, i dont think this is the cause of the performance degradation. This part of the class (m_Threader, etc) has not changed since 3.20. (I used the optimized metrics in my 3.20 builds, so its in Review/itkOptMeanSquares....)
It also does not explain the performance drop in single threaded mode.</div>
<div><br>
</div>
<div>Testing will tell... Seems like a Friday afternoon project to me, unless someone else gets there first.</div>
<div><br>
</div>
<div>Rupert</div>
<div><br clear="all">
--------------------------------------------------------------<br>
Rupert Brooks<br>
<a href="mailto:rupert.brooks@gmail.com">rupert.brooks@gmail.com</a><br>
<br>
<br>
<br>
<div class="gmail_quote">On Wed, Jul 25, 2012 at 5:18 PM, Bradley Lowekamp <span dir="ltr">
<<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div style="word-wrap:break-word">Hello,
<div><br>
</div>
<div>Continuing to glance at the class.... I also see the following member variables for the MeanSquares class:</div>
<div><br>
</div>
<div>
<div> MeasureType * m_ThreaderMSE;</div>
<div> DerivativeType *m_ThreaderMSEDerivatives;</div>
</div>
<div><br>
</div>
<div>Where these are index by the thread ID and access simultaneously across the threads causes the potential for False Sharing, which can be a MAJOR problem with threaded algorithms.</div>
<div><br>
</div>
<div>I would think a good solution would be to create a per-thread data structure consisting of the Jacobin, MeasureType, and DerivativeType, plus padding to prevent false sharing, or equivalently assigning max data alignment to the structure.</div>
<div><br>
</div>
<div>Rupert, Would like to take a stab at this fix?</div>
<div><br>
</div>
<div>Brad</div>
<div>
<div class="h5">
<div><br>
</div>
<div><br>
<div>
<div>On Jul 25, 2012, at 4:31 PM, Rupert Brooks wrote:</div>
<br>
<blockquote type="cite">Sorry if this repeats - i just got a bounce from Insight Developers, so im trimming the message and resending....<br clear="all">
--------------------------------------------------------------<br>
Rupert Brooks<br>
<a href="mailto:rupert.brooks@gmail.com" target="_blank">rupert.brooks@gmail.com</a><br>
<br>
<br>
<br>
<div class="gmail_quote">On Wed, Jul 25, 2012 at 4:12 PM, Rupert Brooks <span dir="ltr">
<<a href="mailto:rupert.brooks@gmail.com" target="_blank">rupert.brooks@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
Aha. Heres around line 183 of itkTranslationTransform.
<div>
<div><br>
</div>
<div>// Compute the Jacobian in one position</div>
<div>template <class TScalarType, unsigned int NDimensions></div>
<div>void</div>
<div>TranslationTransform<TScalarType, NDimensions>::ComputeJacobianWithRespectToParameters(</div>
<div> const InputPointType &,</div>
<div> JacobianType & jacobian) const</div>
<div>{</div>
<div> // the Jacobian is constant for this transform, and it has already been</div>
<div> // initialized in the constructor, so we just need to return it here.</div>
<div> jacobian = this->m_IdentityJacobian;</div>
<div> return;</div>
<div>}</div>
<div><br>
</div>
<div>Thats probably the culprit, although the root cause may be the reallocating of the jacobian every time through the loop.</div>
<div>
<div><br>
</div>
<div>Rupert</div>
<div><br>
</div>
<div><snipped></div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</span><br>
<br>
<hr>
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any
retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
<hr>
</body>
</html>