[Insight-developers] itk performance numbers

M Stauffer -V- mstauff at verizon.net
Thu Jul 26 11:43:33 EDT 2012


Brad,
 
The false sharing possibility is very interesting. I'll look to see if
this may be effecting performance in the v4 metrics, where I provide an
array of pre-allocated, per-thread Jacobian objects to avoid
instantiation of the Jacobian object at each point.
 
-M 


  _____  

From: insight-developers-bounces at itk.org
[mailto:insight-developers-bounces at itk.org] On Behalf Of Bradley
Lowekamp
Sent: Wednesday, July 25, 2012 5:19 PM
To: Rupert Brooks
Cc: Insight Developers
Subject: Re: [Insight-developers] itk performance numbers


Hello, 

Continuing to glance at the class.... I also see the following member
variables for the MeanSquares class:

  MeasureType *   m_ThreaderMSE;
  DerivativeType *m_ThreaderMSEDerivatives;

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.

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.

Rupert, Would like to take a stab at this fix?

Brad


On Jul 25, 2012, at 4:31 PM, Rupert Brooks wrote:


Sorry if this repeats - i just got a bounce from Insight Developers, so
im trimming the message and resending....
--------------------------------------------------------------
Rupert Brooks
rupert.brooks at gmail.com




On Wed, Jul 25, 2012 at 4:12 PM, Rupert Brooks <rupert.brooks at gmail.com>
wrote:


Aha.  Heres around line 183 of itkTranslationTransform. 

// Compute the Jacobian in one position
template <class TScalarType, unsigned int NDimensions>
void
TranslationTransform<TScalarType,
NDimensions>::ComputeJacobianWithRespectToParameters(
  const InputPointType &,
  JacobianType & jacobian) const
{
  // the Jacobian is constant for this transform, and it has already
been
  // initialized in the constructor, so we just need to return it here.
  jacobian = this->m_IdentityJacobian;
  return;
}

Thats probably the culprit, although the root cause may be the
reallocating of the jacobian every time through the loop.

Rupert

<snipped>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20120726/67fce69c/attachment.htm>


More information about the Insight-developers mailing list