Compilers optimization for SMatrix usage

SMatrix is a highly optimized C++ library for "small" matrix manipulation. Originally developed for the Hera-B experiment is now part of Root-Math package. It is known to overperform other implementations such as TMatrix and CLHEP-Matrix.

Its is extensively used in CMS in particular in fitting code such as track Kalman filter and constrained kinematic fits.

SMatrix has been already the subject of performance investigations w.r.t. different compiler optimization strategies. See for instance Open Lab report and the Workshop with Intel.

Here we try to look in details to few performance-critical Matrix operations that shows up as hot-spots in CMS reconstruction.

Similarity

The Similarity operation between a generic matrix and a symmetric (actually positive-defined) matrix is a very typical operation when covariance matrices are involved. It can be decomposed in a transposition and two matrix multiplications. The result is a symmetric matrix as well. in SMatrix, symmetric matrices are stored using a lower-triangular representation which saves space and improve performances in several operations that act on each element sequencially. This representation seems on the other hand to prevent some compiler optimization in case of multiplications due to the non sequential access pattern to the elements.

We have compared the performances of four different implementations:

  • (root) the original Root one: both input and output are symmetric matrices in lower-triangular representation
  • (sym) one having in input the symmetric matrix represented as a full-square matrix and in output a lower-triangular one
  • (std) one having in both input and input square matrices
  • (loop) a brute force loop implementation B(i,j) = U(i,k)*A(k,l)*U(j,l)

-- VincenzoInnocente - 25-Mar-2011

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2011-03-25 - VincenzoInnocente
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LCG All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback