Reproducible Tall-Skinny QR J. Demmel and H.D. Nguyen - - PowerPoint PPT Presentation

reproducible tall skinny qr
SMART_READER_LITE
LIVE PREVIEW

Reproducible Tall-Skinny QR J. Demmel and H.D. Nguyen - - PowerPoint PPT Presentation

Reproducible Tall-Skinny QR J. Demmel and H.D. Nguyen ARITH22 1 Plan 1. MoBvaBon 2. Algorithms 3. Experimental results 4. Conclusions 2 MoBvaBon:


slide-1
SLIDE 1

Reproducible ¡Tall-­‑Skinny ¡QR ¡

  • J. ¡Demmel ¡and ¡H.D. ¡Nguyen ¡

ARITH22 ¡

1 ¡

slide-2
SLIDE 2

Plan ¡

  • 1. MoBvaBon ¡
  • 2. Algorithms ¡
  • 3. Experimental ¡results ¡
  • 4. Conclusions ¡

2 ¡

slide-3
SLIDE 3

MoBvaBon: ¡Reproducibility ¡

  • FloaBng-­‑point ¡computaBons ¡are ¡usually ¡“inexact” ¡and ¡non-­‑

determinisBc ¡due ¡to ¡the ¡non-­‑associaBvity ¡of ¡floaBng-­‑point ¡addiBon. ¡ Reproducibility: ¡obtains ¡bit-­‑wise ¡idenBcal ¡results ¡from ¡different ¡ runs ¡of ¡the ¡program. ¡

  • Sources ¡of ¡non-­‑reproducibility: ¡

– Data ¡alignment ¡ – Data ¡parBBoning/ordering ¡ – FMA ¡support ¡ – Intermediate ¡precision ¡(64 ¡bits, ¡80 ¡bits, ¡128 ¡bits, ¡etc) ¡ – Data ¡path ¡(SSE, ¡AVX, ¡GPU ¡warp, ¡etc) ¡ – Number ¡of ¡processors ¡ – Network ¡topology ¡ – ??? ¡

¡

3 ¡

slide-4
SLIDE 4

Reproducibility ¡at ¡Large ¡Scale ¡

  • Performance ¡is ¡increased ¡by ¡increasing ¡the ¡number ¡of ¡

processors ¡

– Highly ¡dynamic ¡scheduling ¡ – Network ¡heterogeneity: ¡reducBon ¡tree ¡shape ¡can ¡vary ¡ – CommunicaBon ¡cost ¡tends ¡to ¡dominate ¡arithmeBc ¡cost. ¡A ¡liale ¡ extra ¡arithmeBc ¡cost ¡is ¡allowed ¡so ¡long ¡as ¡the ¡communicaBon ¡ cost ¡is ¡controlled. ¡

  • DOE ¡ASCAC ¡Report ¡Feb ¡10, ¡2014: ¡Reproducibility ¡is ¡listed ¡in ¡

top ¡10 ¡ExaScale ¡Research ¡Challenges. ¡“Reproducibility ¡will ¡ be ¡expensive ¡if ¡not ¡impossible ¡to ¡achieve ¡on ¡exascale ¡

  • machines. ¡… ¡requirement ¡will ¡need ¡to ¡be ¡relaxed” ¡

4 ¡

slide-5
SLIDE 5

ReproBLAS ¡

  • FloaBng-­‑point ¡summaBon ¡can ¡be ¡made ¡reproducible ¡using ¡

either ¡the ¡long ¡accumulator ¡technique ¡or ¡our ¡“Indexed ¡ FloaBng-­‑Point ¡format” ¡ ¡

  • ReproBLAS ¡hap://bebop.eecs.berkeley.edu/reproblas ¡

– Reproducible ¡regardless ¡of ¡#processors, ¡reducBon ¡tree ¡shape, ¡… ¡ – BLAS ¡level ¡1: ¡ ¡{s|d|c|z}sum, ¡{s|d|c|z}asum, ¡{s|d|c|z}dot{c|u}, ¡ {s|d|c|z}norm2 ¡ – gemv, ¡gemm: ¡under ¡development ¡ – Some ¡might ¡be ¡reproducible: ¡trsv, ¡trsm, ¡Cholesky, ¡… ¡

  • Not ¡all ¡linear ¡algebra ¡rouBnes ¡are ¡“automaBcally” ¡

reproducible ¡by ¡using ¡a ¡reproducible ¡BLAS ¡library ¡ ¡

5 ¡

slide-6
SLIDE 6

1 2 3 4 5

dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6 dasum Algo 3 Algo 2 Algo 6

1 2 4 8 16 32 64 128 256 512 1024 Time (normalized by dasum time) # Processors local sum Absolute Max communication All-Reduce 3.1 3.2 3.1 2.9 2.8 3.1 3.0 2.9 2.3 2.4 2.2 4.7 4.7 4.4 4.1 3.9 3.7 3.6 3.1 2.3 2.3 2.2 4.9 5.0 4.6 4.3 3.9 3.4 3.0 2.2 1.4 1.2 1.2 6 ¡

Performance ¡results ¡on ¡1024 ¡proc ¡Cray ¡XC30 ¡

1.2x ¡to ¡3.2x ¡slowdown ¡vs ¡fastest ¡code, ¡for ¡n=1M ¡ (IEEE ¡Trans. ¡Comp., ¡ ¡July ¡2015) ¡ ¡ ¡ ¡ ¡

slide-7
SLIDE 7

MoBvaBon: ¡Reproducible ¡TSQR ¡

  • Householder ¡transformaBon ¡can ¡be ¡made ¡reproducible ¡

using ¡the ¡norm2 ¡funcBon ¡from ¡ReproBLAS, ¡however ¡it ¡ is ¡not ¡efficient ¡in ¡terms ¡of ¡communicaBon. ¡

  • Tall-­‑Skinny ¡QR ¡(TSQR) ¡is ¡opBmal ¡in ¡terms ¡of ¡

communicaBon ¡but ¡computed ¡results ¡strongly ¡depend ¡

  • n ¡the ¡reducBon ¡tree ¡shape ¡

– Ex: ¡13x ¡speedup ¡on ¡GPU, ¡… ¡

  • CholQR ¡is ¡communicaBon ¡opBmal ¡and ¡can ¡be ¡made ¡

reproducible ¡but ¡not ¡numerically ¡stable. ¡

  • Main ¡goal: ¡Implement ¡a ¡reproducible ¡and ¡ ¡stable ¡ ¡ ¡ ¡

Tall-­‑Skinny ¡QR ¡factorizaBon ¡

7 ¡

slide-8
SLIDE 8

cholQR ¡

ProperBes: ¡

  • Can ¡be ¡reproducible ¡using ¡a ¡reproducible ¡BLAS ¡library ¡
  • Efficient ¡in ¡both ¡arithmeBc ¡and ¡communicaBon ¡cost ¡
  • cholQR ¡can ¡have ¡a ¡small ¡residual ¡but: ¡

– Orthogonality ¡of ¡Q ¡is ¡not ¡guaranteed ¡ – Might ¡not ¡run ¡to ¡compleBon ¡when ¡cond(A)>ε-1/2 ¡

function [Q,R] = cholQR(A) % Require: A is nxb matrix. cond(A) < ε-1/2 Z = AT A R = chol(Z) Q = A / R end

8 ¡

slide-9
SLIDE 9

cholQR ¡

ProperBes: ¡

  • Can ¡be ¡reproducible ¡using ¡a ¡reproducible ¡BLAS ¡library ¡
  • Efficient ¡in ¡both ¡arithmeBc ¡and ¡communicaBon ¡cost ¡
  • cholQR ¡can ¡have ¡a ¡small ¡residual ¡but: ¡

– Orthogonality ¡of ¡Q ¡is ¡not ¡guaranteed ¡ – Might ¡not ¡run ¡to ¡compleBon ¡if ¡cond(A)>ε-1/2 ¡

function [Q,R] = cholQR(A) % Require: A is nxb matrix. cond(A) < ε-1/2 Z = AT A R = chol(Z) Q = A / R end

IteraBve ¡refinement ¡ Reconstruct ¡Householder ¡vectors ¡

9 ¡

slide-10
SLIDE 10

Reconstruct ¡Householder ¡vectors ¡

YTY ¡format: ¡Q = (I – YTYT)

A ¡ Y ¡ ¡ YT ¡ T ¡ R ¡ I- = ¡ × ¡

A = QR = (I – YTYT) R

10 ¡

slide-11
SLIDE 11

Reconstruct ¡ ¡Householder ¡vectors ¡

YTY ¡format: ¡Q = (I – YTYT)

A ¡ Y ¡ ¡ YT ¡ T ¡ R ¡

  • = ¡

R ¡

A = QR = R – YTYTR

11 ¡

slide-12
SLIDE 12

Reconstruct ¡ ¡Householder ¡vectors ¡

YTY ¡format: ¡Q = (I – YTYT)

A ¡ Y ¡ ¡ R ¡

  • = ¡
  • ­‑TY1

TR ¡

A-R = Y(-TY1

TR)

12 ¡

slide-13
SLIDE 13

Reconstruct ¡ ¡Householder ¡vectors ¡

YTY ¡format: ¡Q = (I – YTYT)

A ¡ Y ¡ ¡ R ¡

  • = ¡
  • ­‑TY1

TR ¡

= ¡ A ¡ R ¡

  • LU ¡

A-R = Y(-TY1

TR) = LU(A-R)

13 ¡

slide-14
SLIDE 14

Reconstruct ¡ ¡Householder ¡vectors ¡

YTY ¡format: ¡Q = (I – YTYT)

A ¡ Y ¡ ¡ R ¡

  • = ¡
  • ­‑TY1

TR ¡

= ¡ A ¡ R ¡

  • modLU ¡

Flipping ¡signs ¡to ¡ avoid ¡cancellaBon ¡

[Y,-TY1

TR,S] = modLU(A,R) = LU(A,S*R)

14 ¡

slide-15
SLIDE 15

Reconstruct ¡ ¡Householder ¡vectors ¡

  • Q ¡computed ¡from ¡Y: ¡Q ¡= ¡(I ¡-­‑ ¡YTYT) ¡is ¡always ¡orthogonal ¡
  • Cholesky ¡might ¡not ¡run ¡to ¡compleBon ¡if ¡cond(A) ¡> ¡ε-­‑1/2 ¡
  • LU ¡is ¡also ¡not ¡stable ¡when ¡A-­‑R ¡is ¡ill ¡condiBoned ¡
  • SoluBon: ¡Using ¡iteraBve ¡refinement ¡to ¡improve ¡stability ¡

function Y = r2y(A,R) ; % A = [A1;A2] (Y1,W) = modLU(A1,R) % on root only Y2 = A2/W % Broadcast + local trsm end function Y = repQR(A) R = chol(ATA) %require reduction operation Y = r2y(A,R) end

15 ¡

slide-16
SLIDE 16

Reconstruct ¡ ¡Householder ¡vectors ¡

  • Q ¡computed ¡from ¡Y: ¡Q ¡= ¡(I ¡-­‑ ¡YTYT) ¡is ¡always ¡orthogonal ¡
  • Cholesky ¡might ¡not ¡run ¡to ¡compleBon ¡if ¡cond(A) ¡> ¡ε-­‑1/2 ¡
  • LU ¡is ¡also ¡not ¡stable ¡when ¡A-­‑R ¡is ¡ill ¡condiBoned ¡
  • SoluBon: ¡Using ¡iteraBve ¡refinement ¡to ¡improve ¡stability ¡

function Y = r2y(A,R) ; % A = [A1;A2] (Y1,W) = modLU(A1,R) % on root only Y2 = A2/W % Broadcast + local trsm end function Y = repQR(A) R = chol(ATA) %require reduction operation Y = r2y(A,R) end

16 ¡

slide-17
SLIDE 17

Recursive ¡Cholesky ¡QR ¡

  • cholQR ¡might ¡not ¡run ¡to ¡compleBon ¡if ¡A ¡is ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡

ill-­‑condiBoned: ¡cond(A)>ε-­‑1/2, ¡or ¡cond(ATA)>ε-­‑1. ¡

  • [R,p] ¡= ¡chol(ATA): ¡ ¡

– p=0: ¡Cholesky ¡runs ¡to ¡compleBon ¡ – 0<p<b: ¡R ¡is ¡just ¡the ¡Cholesky ¡factor ¡of ¡the ¡p×p ¡top-­‑lex ¡ submatrix ¡of ¡ATA

R ¡is ¡the ¡R ¡factor ¡of ¡A1=A(:,1:p). ¡Similarly ¡to ¡Householder ¡ factorizaBon ¡we ¡can ¡use ¡Y1=r2y(A(:,1:p), ¡R) ¡to ¡update ¡ A2=A(:,p+1,:) ¡and ¡conBnue ¡the ¡factorizaBon ¡of ¡trailing ¡

  • matrix. ¡

17 ¡

slide-18
SLIDE 18

repQR2 ¡

ConBnue ¡unBl ¡p=0 ¡(run ¡to ¡compleBon) ¡

  • Best ¡case: ¡cond(A) ¡< ¡ε-­‑1/2, ¡p=0: ¡only ¡1 ¡step ¡needed ¡
  • Worst ¡case: ¡recursive ¡call ¡at ¡every ¡column ¡of ¡A. ¡Computed ¡result ¡is ¡

exactly ¡the ¡same ¡as ¡Householder ¡QR ¡factorizaBon, ¡but ¡arithmeBc ¡ cost ¡is ¡a ¡lot ¡more ¡expensive: ¡O(nb3) ¡instead ¡of ¡O(nb2) ¡

Y1=r2y(A1,R11) ¡ A2=A2-­‑Y1TY1

TA2 ¡

Y1 ¡ ¡ A2 ¡

R11 ¡

Y1 ¡ ¡

A22 ¡ A11 ¡ R11 ¡

repQR2(A22) ¡

A ¡ b ¡ n ¡

[R11,p]=chol(ATA) ¡

p ¡ A1 ¡ ¡ A2 ¡

R11 ¡

18 ¡

slide-19
SLIDE 19

Reconstruct ¡ ¡Householder ¡vectors ¡

  • Q ¡computed ¡from ¡Y: ¡Q ¡= ¡(I ¡-­‑ ¡YTYT) ¡is ¡always ¡orthogonal ¡
  • Cholesky ¡might ¡not ¡run ¡to ¡compleBon ¡if ¡cond(A) ¡> ¡ε-­‑1/2 ¡
  • LU ¡is ¡also ¡not ¡stable ¡when ¡A-­‑R ¡is ¡ill ¡condiBoned ¡
  • SoluBon: ¡Using ¡iteraBve ¡refinement ¡to ¡improve ¡stability ¡

function Y = r2y(A,R) (Y1,W) = modLU(A1,R) % on root only Y2 = A2/W % Broadcast + local trsm end function Y = repQR(A) R = chol(ATA) %require reduction operation Y = r2y(A,R) end

19 ¡

slide-20
SLIDE 20

Recursive ¡HH ¡ReconstrucBon ¡

Stopping ¡criteria: ¡

  • ­‑ cond(R1) ¡< ¡(nε)-­‑1/3 ¡
  • ­‑ In ¡pracBce, ¡only ¡1 ¡or ¡2 ¡iteraBons ¡are ¡needed ¡

function [Y,R] = rec_r2y(A,R) repeat

  • B = A/R % ideally B is nearly orthogonal
  • R1 = chol(BTB) % cond(R1)≈cond(B)
  • R = R1 * R

until cond(R1) is small Y = modLU(B, R1) % A=B*R=(I-YTYT)(R1*R) end

20 ¡

slide-21
SLIDE 21

Algorithm ¡rec_repQR ¡

function Y = rec_repQR(A,R) [R,p]=chol(ATA) if p = 0

  • return rec_r2y(A,R) %early completion

end A1=A(:,1:p); A2=A(:,p+1:end); Y1 = rec_r2y(A1,R) %QR of first half apply HH transformation on A2 using Y1 Y2 = rec_repQR(A2(p+1:end,:)); %recursive call end

21 ¡

slide-22
SLIDE 22

Experimental ¡results ¡

  • Implemented ¡in ¡Matlab: ¡

– Column-­‑wise ¡relaBve ¡error: ¡ – Q ¡is ¡always ¡orthogonal ¡by ¡construcBon ¡

  • AssumpBon: ¡matrix-­‑matrix ¡product ¡can ¡be ¡reproducible ¡
  • Since ¡ReproBLAS’s ¡sum ¡has ¡a ¡beaer ¡error ¡bound ¡than ¡the ¡standard ¡

sum, ¡accuracy ¡should ¡be ¡at ¡least ¡as ¡good ¡with ¡reproducible ¡BLAS. ¡

  • Input ¡matrices ¡of ¡size ¡10000×32 ¡are ¡generated ¡by: ¡

– gallery ¡funcBon ¡from ¡matlab, ¡with ¡type ¡randsvd ¡A=UΣVT ¡and ¡ condiBon ¡number ¡ranging ¡from ¡10 ¡to ¡1015. ¡ – A=QR ¡with ¡R ¡being ¡constructed ¡in ¡some ¡special ¡formats ¡

relative_error=maxi ||A(:,i)−QR(:,i)|| ||A(:,i)||

22 ¡

slide-23
SLIDE 23

Test ¡1: ¡randsvd ¡matrices ¡

1 2 3 4 5 6 7 1e+00 1e+02 1e+04 1e+06 1e+08 1e+10 1e+12 1e+14 1e+16 Running time normalized by Matlab qr Condition Number r2y repQR repQR2 rec_repQR

23 ¡

slide-24
SLIDE 24

Test ¡1: ¡randsvd ¡matrices ¡

1e-16 1e-14 1e-12 1e-10 1e-08 1e-06 1e-04 1e+00 1e+02 1e+04 1e+06 1e+08 1e+10 1e+12 1e+14 1e+16 Relative Error Condition Number r2y repQR repQR2 rec_repQR

relative_error=maxi ||A(:,i)−QR(:,i)|| ||A(:,i)||

24 ¡

slide-25
SLIDE 25

Test ¡2: ¡small ¡R(n/2,n/2) ¡

1 2 3 4 5 6 7 8 1e+00 1e+02 1e+04 1e+06 1e+08 1e+10 1e+12 1e+14 1e+16 Running time normalized by Matlab qr Condition Number r2y repQR repQR2 rec_repQR

25 ¡

slide-26
SLIDE 26

Test ¡2: ¡small ¡R(n/2,n/2) ¡

1e-16 1e-14 1e-12 1e-10 1e-08 1e-06 1e-04 1e-02 1e+00 1e+02 1e+04 1e+06 1e+08 1e+10 1e+12 1e+14 1e+16 Relative Error Condition Number r2y repQR repQR2 rec_repQR

26 ¡

slide-27
SLIDE 27

0≈ ¡

Test ¡3: ¡ill-­‑condiBoned ¡diagonal ¡blocks ¡

R ¡= ¡ Ill ¡condiBoned ¡ diagonal ¡blocks ¡

27 ¡

slide-28
SLIDE 28

Test ¡3: ¡ill-­‑condiBoned ¡diagonal ¡blocks ¡

2 4 6 8 10 12 14 16 1e+00 1e+02 1e+04 1e+06 1e+08 1e+10 1e+12 1e+14 1e+16 Running time normalized by Matlab qr Condition Number r2y repQR repQR2 rec_repQR

28 ¡

slide-29
SLIDE 29

Test ¡3: ¡ill-­‑condiBoned ¡diagonal ¡blocks ¡

1e-16 1e-14 1e-12 1e-10 1e-08 1e-06 1e-04 1e-02 1e+00 1e+02 1e+04 1e+06 1e+08 1e+10 1e+12 1e+14 1e+16 Relative Error Condition Number r2y repQR repQR2 rec_repQR

29 ¡

slide-30
SLIDE 30

Conclusion ¡

  • Not ¡all ¡high ¡level ¡linear ¡algebra ¡operaBons ¡can ¡be ¡

made ¡reproducible ¡simply ¡by ¡using ¡a ¡ reproducible ¡BLAS ¡library. ¡

  • Our ¡proposed ¡rec_repQR ¡funcBon ¡can ¡always ¡

produce ¡reproducible ¡results ¡with ¡the ¡same ¡ accuracy ¡as ¡the ¡Householder ¡QR ¡algorithm ¡ ¡

– Assuming ¡matrix ¡nonsingular ¡

  • rec_repQR ¡ ¡is ¡efficient ¡in ¡communicaBon ¡when ¡

the ¡matrix ¡is ¡well ¡condiBoned ¡(cond(A) ¡< ¡ε), ¡or ¡A ¡ is ¡nearly ¡full-­‑rank. ¡

30 ¡

slide-31
SLIDE 31

Related ¡work ¡

  • Fukaya ¡et ¡al, ¡“CholeskyQR2: ¡A ¡Simple ¡and ¡

CommunicaBon-­‑Avoiding ¡Algorithm ¡for ¡CompuBng ¡a ¡ Tall-­‑Skinny ¡QR ¡FactorizaBon ¡on ¡a ¡Large-­‑Scale ¡Parallel ¡ System,” ¡ScaIA1, ¡Nov ¡2014 ¡: ¡simply ¡repeats ¡Cholesky ¡ QR ¡twice ¡to ¡improve ¡accuracy. ¡Q ¡factor ¡is ¡in ¡explicit ¡

  • format. ¡
  • Auckenthaler ¡et ¡al, ¡“A ¡blocked ¡QR-­‑decomposiBon ¡for ¡

the ¡parallel ¡symmetric ¡eigenvalue ¡problem”, ¡Parallel ¡ CompuBng, ¡April ¡2014: ¡uses ¡adapBve ¡blocking ¡to ¡ guarantee ¡numerical ¡stability, ¡starts ¡with ¡16 ¡columns ¡ per ¡block. ¡Block ¡size ¡will ¡be ¡reduced ¡along ¡the ¡ computaBon ¡if ¡needed. ¡

  • David ¡Biancolin ¡& ¡Jack ¡Koenig: ¡CS252 ¡class ¡project ¡

with ¡detailed ¡hardware ¡design ¡of ¡long ¡accumulator ¡

31 ¡ 15th ¡Workshop ¡on ¡Latest ¡Advances ¡in ¡Scalable ¡Algorithms ¡for ¡Large-­‑Scale ¡Systems, ¡2014 ¡

slide-32
SLIDE 32

Future ¡work ¡

  • Level ¡3 ¡of ¡ReproBLAS: ¡

– ExhausBvely ¡reproducible ¡ – Block-­‑based ¡reproducible ¡

  • Reproducible ¡Cholesky, ¡… ¡
  • AlternaBve ¡approaches ¡to ¡reduce ¡number ¡of ¡

refinement ¡steps ¡when ¡A ¡is ¡ill-­‑condiBoned ¡ ¡

– Cholesky ¡factorizaBon ¡with ¡pivoBng ¡ – Extra-­‑precise ¡Cholesky ¡QR ¡factorizaBon ¡

32 ¡

slide-33
SLIDE 33

BACK-­‑UP ¡SLIDES ¡

33 ¡

slide-34
SLIDE 34

Algorithms’ ¡costs ¡

Householder ¡QR ¡ Reproducible ¡(k ¡iteraIons) ¡ cholQR ¡ FLOPs ¡ 2nb2/p-­‑2b3/3 ¡ (2k+2)nb2/p ¡+O(kb3) ¡ 2nb2/p+b3/3+(b2/2)logp ¡ Bandwidth ¡ (b2/2)logp ¡ (2k+2)b2logp ¡ b2logp ¡ Latency ¡ 2b ¡logp ¡ (2k+2)logp ¡ 2logp ¡ γ: ¡arithmeBc ¡cost ¡of ¡a ¡floaBng-­‑point ¡operaBon ¡ β: ¡bandwidth ¡cost ¡of ¡sending ¡a ¡word ¡ α: ¡latency ¡cost ¡of ¡sending ¡a ¡message ¡ ¡ Matrix ¡size: ¡n ¡× ¡b. ¡

AssumpBon: ¡

  • A ¡is ¡well-­‑condiBoned. ¡
  • Number ¡of ¡iteraBons: ¡k ¡≤ ¡2 ¡

34 ¡

slide-35
SLIDE 35

10 20 30 40 50 0.05 0.1 0.15 variation (ulps)

Absolute ¡Error ¡for ¡Random ¡Vectors ¡

0.5 1 1.5 2 0.005 0.01 0.015 0.02 0.025 relative error

Same ¡magnitude ¡opposite ¡signs ¡

Intel ¡MKL ¡non-­‑reproducibility ¡

RelaBve ¡Error ¡for ¡Orthogonal ¡vectors ¡ Vector ¡size: ¡1e6. ¡Data ¡ ¡aligned ¡to ¡16-­‑byte ¡boundaries. ¡For ¡each ¡input ¡vector: ¡

  • Dot ¡products ¡are ¡computed ¡using ¡1, ¡2, ¡3 ¡or ¡4 ¡threads ¡
  • Absolute ¡error ¡= ¡maximum ¡– ¡minimum ¡
  • RelaBve ¡error ¡ ¡ ¡= ¡Absolute ¡error ¡/ ¡maximum ¡absolute ¡value ¡

Sign ¡not ¡ reproducible ¡

  • Intel MKL 11.2 with CBWR: reproducible only for fixed number of threads

and using the same instruction set (SSE2/AVX) ¡

slide-36
SLIDE 36
  • Goals ¡ ¡

1. Same ¡answer, ¡independent ¡of ¡layout, ¡#processors, ¡order ¡of ¡summands ¡ 2. Good ¡performance ¡(scales ¡well) ¡ 3. Portable ¡(assume ¡IEEE ¡754 ¡only) ¡ 4. User ¡can ¡choose ¡accuracy ¡

  • Approaches ¡

– Guarantee ¡fixed ¡reducBon ¡tree ¡(not ¡2. ¡or ¡3.) ¡ – Use ¡(very) ¡high ¡precision ¡to ¡get ¡exact ¡answer ¡(not ¡2.) ¡ – Our ¡approach ¡(Nguyen, ¡D.) ¡

  • Oversimplified: ¡
  • 1. Compute ¡A ¡= ¡maximum ¡absolute ¡value ¡(reproducible) ¡
  • 2. Round ¡all ¡summands ¡to ¡one ¡ulp ¡in ¡A ¡
  • 3. Compute ¡sum; ¡rounding ¡causes ¡them ¡to ¡act ¡like ¡fixed ¡point ¡numbers ¡
  • Possible ¡with ¡one ¡reducBon ¡operaBon ¡

36 ¡

Goals/Approaches ¡for ¡Reproducible ¡Sum ¡

slide-37
SLIDE 37

Reproducible ¡Soxware ¡and ¡Hardware ¡

  • Soxware ¡for ¡Reproducible ¡BLAS ¡1 ¡available ¡at ¡

bebop.cs.berkeley.edu/reproblas ¡

– BLAS2, ¡3 ¡under ¡development ¡

  • Used ¡Chisel ¡(hardware ¡design ¡language) ¡to ¡

design ¡one ¡new ¡instrucBon ¡that ¡would ¡make ¡ reproducible ¡summaBon ¡as ¡fast ¡(and ¡more ¡ accurate) ¡than ¡standard ¡summaBon ¡

  • Industrial ¡interest ¡