Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributed Linear Algebra Peter L. Montgomery Microsoft Research, Redmond, USA RSA 2000 January 17, 2000.

Similar presentations


Presentation on theme: "Distributed Linear Algebra Peter L. Montgomery Microsoft Research, Redmond, USA RSA 2000 January 17, 2000."— Presentation transcript:

1 Distributed Linear Algebra Peter L. Montgomery Microsoft Research, Redmond, USA RSA 2000 January 17, 2000

2 Role of matrices in factoring n Sieving finds many x j 2  p i e ij (mod n). Raise jth to power s j = 0 or 1, multiply. Left side always a perfect square. Right is a square if exponents  j e ij s j are even for all i. Matrix equation Es  0 (mod 2), E known. Knowing x 2  y 2 (mod n), test GCD(x  y, n). Matrix rows represent primes p i. Entries are exponents e ij. Arithmetic is over GF(2).

3 Matrix growth on RSA Challenge RSA–140 Jan-Feb, 1999 4 671 181  4 704 451 Weight 151 141 999 Omit primes < 40 99 Cray-C90 hours 75% of 800 Mb for matrix storage RSA–155 August, 1999 6 699 191  6 711 336 Weight 417 132 631 Omit primes < 40 224 Cray-C90 hours 85% of 1960 Mb for matrix storage

4 Regular Lanczos A positive definite (real, symmetric) n  n matrix. Given b, want to solve Ax = b for x. Set w 0 = b. w i+1 = Aw i – Σ 0  j  i c ij w j if i  0 c ij = w j T A 2 w i / w j T Aw j Stop when w i+1 = 0.

5 Claims w j T Aw j  0 if w j  0 (A is positive definite). w j T Aw i = 0 whenever i  j (by choice of c ij and symmetry of A). Eventually some w i+1 = 0, say for i = m (otherwise too many A-orthogonal vectors). x = Σ 0  j  m (w j T b / w j T Aw j ) w j satisfies Ax=b (error u=Ax–b is in space spanned by w j ’s but orthogonal to all w j, so u T u=0 and u=0).

6 Simplifying c ij when i > j+1 w j T Aw j c ij = w j T A 2 w i = (Aw j ) T (Aw i ) = (w j+1 + linear comb. of w 0 to w j ) T (Aw i ) = 0 (A-orthogonality). Recurrence simplifies to w i+1 = Aw i – c ii w i – c i,i–1 w i–1 when i  1. Little history to save as i advances.

7 Major operations needed Pre-multiply w i by A. Inner products such as w j T Aw j and w j T A 2 w i = (Aw j ) T (Aw i ). Add scalar multiple of one vector to another.

8 Adapting to Bx=0 over GF(2) B is n 1  n 2 with n 1  n 2, not symmetric. Solve Ax = 0 where A = B T B. A is n 2  n 2. B T has small nullspace in practice. Right side zero, so Lanczos gives x = 0. Solve Ax = Ay where y is random. u T u and u T Au can vanish when u  0. Solved by Block Lanczos (Eurocrypt 1995).

9 Block Lanczos summary Let N be the machine word length (typically 32 or 64) or a small multiple thereof. Vectors are n 1  N or n 2  N over GF(2). Exclusive OR and other hardware bitwise instructions operate on N-bit data. Recurrences similar to regular Lanczos. Approximately n 1 /(N–0.76) iterations. Up to N independent solutions of Bx=0.

10 Block Lanczos major operations Pre-multiply n 2  N vector by B. Pre-multiply n 1  N vector by B T. N  N inner product of two n 2  N vectors. Post-multiply n 2  N vector by N  N matrix. Add two n 2  N vectors. How do we parallelize these?

11 Assumed processor topology Assume a g 1  g 2 toroidal grid of processors. A torus is a rectangle with its top connected to its bottom, and left to right (doughnut). Need fast communication to/from immediate neighbors north, south, east, and west. Processor names are p rc where r is modulo g 1 and c is modulo g 2. Set gridrow(p rc ) = r and gridcol(p rc ) = c.

12 A torus of processors P7P8P9 P4P5P6 P1P2P3 Example: 3x3 torus system

13 Matrix row and column guardians For 0  i  n 1, a processor rowguard(i) is responsible for entry i, in all n 1  N vectors. For 0  j  n 2, a processor colguard(j) is responsible for entry j, in all n 2  N vectors. Processor-assignment algorithms aim for load balancing.

14 Three major operations Vector addition is pointwise. When adding two n 2  N vectors, processor colguard(j) does the j-th entries. Data is local. Likewise for n 2  N vector by N  N matrix. Processors form partial N  N inner products. Central processor sums them. These operations need little communication. Workloads are O(#columns assigned).

15 Allocating B among processors Let B = (b ij ) for 0  i  n 1 and 0  j  n 2. Processor p rc is responsible for all b ij where gridrow(rowguard(i)) = r and gridcol(colguard(j)) = c. When pre-multiplying by B, the input data from colguard(j) will arrive along grid column c, and the output data for rowguard(i) will depart along grid row r.

16 Multiplying u = Bv where u is n 1  N and v is n 2  N Distribute each v[j] to all p rc with gridcol(colguard(j)) = c. That is, broadcast each v[j] along one column of the grid. Each p rc processes all of its b ij, building partial u[i] outputs. Partial u[i] values are summed as they advance along a grid row to rowguard(i). Individual workloads depend upon B.

17 Actions by p rc during multiply Send/receive all v[j] with gridcol(colguard(j)) = c. Zero all u[i] with rowguard(i) = p r,c+1. At time t where 1  t  g 2, adjust all u[i] with rowguard(i) = p r,c+t (t nodes east).. If t  g 2, ship these u[i] west to p r,c–1 and receive other u[i] from p r,c+1 on the east. Want balanced workloads at each t.

18 Multiplication by B T Reverse roles of matrix rows and columns. Reverse roles of grid rows and columns. B T and B can share storage since same processor handles (B) ij during multiply by B as handles (B T ) ji during multiply by B T.

19 Major memory requirements Matrix data is split amongst processors. With 65536  65536 cache-friendly blocks, an entry needs only two 16-bit offsets. Each processor needs one vector of length max(n 1 /g 1, n 2 /g 2 ) and a few of length n 2 /g 1 g 2, with N bits per entry. Central processor needs one vector of length n 2 plus rowguard and colguard.

20 Major communications during multiply by B Broadcast each v[j] along entire grid column. Ship n 2 N bits to each of g 1 –1 destinations. Forward partial u[i] along grid row, one node at a time. Total (g 2 –1)n 1 N bits. When n 2  n 1, communication for B and B T is 2(g 1 +g 2 –2)n 1 N bits per iteration. 2(g 1 +g 2 –2)n 1 2 bits after n 1 /N iterations.

21 Choosing grid size Large enough that matrix fits in memory. Matrix storage is about 4w/g 1 g 2 bytes per processor, where w is total matrix weight. Try to balance I/O and computation times. Multiply cost is O(n 1 w/g 1 g 2 ) per processor. Communications cost O((g 1 +g 2 –2)n 1 2 ). Prefer a square grid, to reduce g 1 +g 2.

22 Choice of N and matrix Prefer smaller but heavier matrix if it fits, to lessen communications. Higher N yield more dependencies, letting you omit the heaviest rows from the matrix. Larger N means fewer but longer messages. Size of vector elements affects cache. When N is large, inner products and post- multiplies by N  N matrices are slower.

23 Cambridge cluster configuration Microsoft Research, Cambridge, UK. 16 dual-CPU 300 MHz Pentium II’s. Each node –384 MB RAM –4 GB local disk Networks –Dedicated fast ethernet (100 Mb/sec) –Myrinet, M2M-OCT-SW8 (1.28 Gb/sec)

24 Message Passing Interface (MPI) Industry Standard MPI implementations: –exist for the majority of parallel systems & interconnects –public domain (e.g. mpich) or commercial (e.g. MPI PRO) Supports many communications primitives including virtual topologies (e.g. torus).

25 Performance data from MSR Cambridge cluster


Download ppt "Distributed Linear Algebra Peter L. Montgomery Microsoft Research, Redmond, USA RSA 2000 January 17, 2000."

Similar presentations


Ads by Google