Skip to content

Fitter: Hand counting

Matthieu Lefebvre edited this page Jul 3, 2018 · 7 revisions

Counting operations by hand

Fitter

Size dictionary

Dims

  • LL = 6
  • HH = 3

Array sizes

  • LL = 36 (6x6 matrix)

  • LV = 6 (6 vector)

  • LS = 21 (6x6 sym)

  • HH = 9 (3x3 matrix)

  • HV = 3 (3 vector)

  • HS = 6 (3x3 sym)

  • 22 = 4 (2x2 matrix)

  • 2V = 2 (2 vector)

  • 2S = 3 (2x2 sym)

  • LH = 18 (6x3 matrix)

  • HL = 18 (3x6 matrix)

  • QF = 1 float

  • QI = 1 int

  • QB = 1 bool


Data to be accessed:

  • GPlexLV par_iP => 6 floats
  • GPlexLS Err_iP => 21 floats *GPlexHV *msPar_arr => 3 * numbers of hits floats, - reorganized from array of hits
  • GPlexHS *msErr_arr, => 6 * numbers of hits floats - reorganized from array of hits
  • GPlexLV par_iC => 6 floats
  • GPlexLS Err_iC, => 21 floats
  • GPlexLL errorProp => 36 floats, but intermediate array, do not count it for now
  • GPlexQI inChg, => 1 float
  • QPLexQF Label => 1 int

per Track:

  • num accesses = 6+21+ (3nhits + 6nhits) + 6 + 21 + 1 + 1 = 56 + 9*nhits

total accesses = ntracks*(56+9*nhits)

in bytes : ntracks*(224 + 36*nhits)

Accessed: Propagation only

2*(6+21) + 2 = 56 floats = 224 bytes

Accessed: Update only

2*(6+21) + 3 + 6 = 63 floats = 252 bytes

Floating point operations

3 separate functions: - input tracks and hits: 0 flop - fitting: see thereafter - output fitted tracks: 0 flop

2 steps: - propagation - update

Propagation

Inner functions:

  • computeMsRad => 2 mul, 1 add => 3 ops
  • helixAtRFromIterative => ...
    • init => 5 mul, 1 add, 3 div, 1 cos, 1 sin
    • loop
      • all iters => 5 mul, 3 add, 1 cos, 1 sin
      • all but last => 37 mul, 27 add, 1 div
      • all iters => 10 mul, 8 add
      • overall loop: Niter(26 + 2 cos) + (Niter-1)(64 + 1 div)
      •         : Niter(90 + 2 cos + 1 div) - 64 - 1div
        
    • after => 90 mul, 28 add, 1 div 1 cos, 1 sin
    • overal helixAtR... => 95 mul, 28 add, 4 div, 2 cos, 2 sin, Niter(90 + 2 cos + 1 div) - 64 - 1div
    •                 =>  59, 3 div, 2 cos, 2 sin,  Niter(90 + 2 cos + 1 div)
      
  • MultHelixProp => 126 mul, 130 add => 256 ops
  • MultHelixPropTransp => 80 mul, 50 add => 130 ops

Overall propagation: 448, 3 div, 2 cos, 2 sin, Niter(90 + 2 cos + 1 div)

  • 448 + 90*Niter (mul/add)
  • 3 + Niter (div)
  • 4 + 2*Niter (cos)

Update

Inner functions

  • setup => 2 mul, 2 div
  • substractFirst3 => 3 add
  • addIntoUpperLeft3x3 => 6 add
  • RotateResidulsOnTangentPlane_fn => 2 mul, 1 add
  • ProjectResErr_fn => 12 mul, 6 add
  • ProjectResErrTransp_fn => 4 mul, 2 add
  • invertCramerSym2x2_fn => 4 mul, 1 add, 1 div
  • KalmanHTG_fn => 4 mul
  • KalmanGain_fn => 36 mul, 24 add
  • multResidualsAdd_fn => 12 mul, 12 add
  • KHMult_fn => 12 mul
  • KHC_fn => 63 mul, 42 add
  • subtract_matrix => 21 add

Total update: 151 mul, 118 add, 3 div 269 mul/add, 3 div

Total

  • 717 + 90*Niter (mul/add)
  • 6 + Niter (div)
  • 4 + 2*Niter (cos)

Intensity

nhits = 10, niter = 5 bytes accessed: 584 op: 1168 mul/add

intensity = 1167 / 584 = 1.998

intensity: propagation only no special op.

niter = 5 (448 + 90*5) / 224 = 4

intensity: update only no special op.

272/252 = 1.07