sparse tensor factorization algorithms data structures
play

Sparse Tensor Factorization: Algorithms, Data Structures, and - PowerPoint PPT Presentation

Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges Shaden Smith & George Karypis University of Minnesota Department of Computer Science & Engineering shaden@cs.umn.edu Sparse Tensor Factorization: Algorithms,


  1. Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges Shaden Smith & George Karypis University of Minnesota Department of Computer Science & Engineering shaden@cs.umn.edu Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  2. Talk Outline Introduction 1 Compressed Sparse Fiber 2 Cache-Friendly Reordering & Tiling 3 Distributed-Memory MTTKRP 4 Conclusions 5 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  3. Table of Contents Introduction 1 Compressed Sparse Fiber 2 Cache-Friendly Reordering & Tiling 3 Distributed-Memory MTTKRP 4 Conclusions 5 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  4. Tensor Introduction Tensors are the generalization of matrices to ≥ 3 D Tensors have m dimensions (or modes ) and are I 1 × . . . × I m ◮ We’ll usually stick to I × J × K in this talk users contexts items Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  5. Applications Dataset I J K nnz NELL-2 12K 9K 28K 77M Beer 33K 66K 960K 94M Netflix 480K 18K 2K 100M Delicious 532K 17M 3M 140M NELL-1 3M 2M 25M 143M Amazon 5M 18M 2M 1.7B Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  6. Canonical Polyadic Decomposition (CPD) We compute matrices A , B , C , each with F columns ◮ We will use A (1) , . . . , A ( m ) when ≥ 3 modes ≈ + · · · + Usually computed via alternating least squares (ALS) Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  7. Matricized Tensor Times Khatri-Rao Product MTTKRP MTTKRP is the core computation of each iteration A = X (1) ( C � B ) J · K F X (1) I J · K ( C � B ) Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  8. Alternating Least Squares 1: while not converged do A ⊺ = ( C ⊺ C ∗ B ⊺ B ) − 1 � � ⊺ X (1) ( C � B ) 2: B ⊺ = ( C ⊺ C ∗ A ⊺ A ) − 1 � � ⊺ X (2) ( C � A ) 3: C ⊺ = ( B ⊺ B ∗ A ⊺ A ) − 1 � � ⊺ X (3) ( B � A ) 4: 5: end while Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  9. Tensor Storage – Coordinate Form   i j k l v 1 1 1 2 1 .     1 1 1 3 1 .     1 2 1 3 3 .     1 2 2 1 8 .     2 2 1 1 1 .     2 2 1 3 3 .   2 2 2 2 8 . Why don’t we unfold? We need a representation of X for each mode NELL has dimensions 3 M × 2 M × 25 M ◮ Add a fourth mode and we exceed 2 64 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  10. MTTKRP A C i ← k B j A ( i , :) ← A ( i , :) + X ( i , j , k ) [ B ( j , :) ∗ C ( k , :)] Limitations Memory bandwidth Parallelism Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  11. Table of Contents Introduction 1 Compressed Sparse Fiber 2 Cache-Friendly Reordering & Tiling 3 Distributed-Memory MTTKRP 4 Conclusions 5 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  12. Can we do better? Consider three nonzeros in the fiber X ( i , j , :) (a vector) A ( i , :) ← A ( i , :) + X ( i , j , k 1 ) [ B ( j , :) ∗ C ( k 1 , :)] A ( i , :) ← A ( i , :) + X ( i , j , k 2 ) [ B ( j , :) ∗ C ( k 2 , :)] A ( i , :) ← A ( i , :) + X ( i , j , k 3 ) [ B ( j , :) ∗ C ( k 3 , :)] Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  13. Can we do better? Consider three nonzeros in the fiber X ( i , j , :) (a vector) A ( i , :) ← A ( i , :) + X ( i , j , k 1 ) [ B ( j , :) ∗ C ( k 1 , :)] A ( i , :) ← A ( i , :) + X ( i , j , k 2 ) [ B ( j , :) ∗ C ( k 2 , :)] A ( i , :) ← A ( i , :) + X ( i , j , k 3 ) [ B ( j , :) ∗ C ( k 3 , :)] A little factoring... � � 3 � A ( i , :) ← A ( i , :) + B ( j , :) ∗ X ( i , j , k x ) C ( k x , :) x =1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  14. SPLATT: The S urprisingly P aralle L sp A rse T ensor T oolkit ← [Smith, Ravindran, Sidiropoulos, and Karypis 2015] Fibers are sparse vectors Slice X ( i , : , :) is almost a CSR matrix... But, we need m representations of X Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  15. Compressed Sparse Fiber (CSF)   1 2 i j k l i 1 1 1 2     1 1 1 3 j 1 2 2     1 2 1 3     → 1 2 2 1   1 1 2 1 2 k   2 2 1 1     2 2 1 3   2 3 3 1 1 3 2 l 2 2 2 2 [Smith and Karypis 2015] Modes are recursively compressed Values are stored in the leaves (not shown) Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  16. MTTKRP with a CSF Tensor Objective We want to perform MTTKRP on each tensor mode with only one CSF representation There are three types of nodes in a tree: root , internal , and leaf ◮ Each will have a tailored algorithm ◮ root and leaf are special cases of internal Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  17. CSF-LEAF The leaf nodes determine the output location Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  18. CSF-LEAF Hadamard products are pushed down the tree Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  19. CSF-LEAF Hadamard products are pushed down the tree Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  20. CSF-LEAF Hadamard products are pushed down the tree Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  21. CSF-LEAF Leaves designate write locations Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  22. CSF-LEAF Leaves designate write locations Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  23. CSF-LEAF The traversal continues... Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  24. CSF-LEAF The traversal continues... Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  25. CSF-LEAF The traversal continues... Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  26. CSF-LEAF The traversal continues... Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  27. CSF-LEAF The traversal continues... Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  28. CSF-ROOT Inner products are accumulated in a buffer Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  29. CSF-ROOT Inner products are accumulated in a buffer Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  30. CSF-ROOT Hadamard products are then propagated up the CSF tree Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  31. CSF-ROOT Hadamard products are then propagated up the CSF tree Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  32. CSF-ROOT Results are written to A (1) Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  33. CSF-ROOT The traversal continues... Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  34. CSF-ROOT The traversal continues... Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  35. CSF-ROOT Partial results are kept in buffer Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

  36. CSF-ROOT Inner products are accumulated in a buffer Z 1 A (1) A (2) A (3) A (4) 1 2 1 1 2 2 3 3 1 Sparse Tensor Factorization: Algorithms, Data Structures, and Challenges shaden@cs.umn.edu

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend