assembly of finite element methods on graphics processors
play

Assembly of Finite Element Methods on Graphics Processors. Cris - PowerPoint PPT Presentation

Assembly of Finite Element Methods on Graphics Processors. Cris Cecka Adrian Lew Eric Darve Department of Mechanical Engineering Institute for Computational and Mathematical Engineering Stanford University July 19th, 2010 9th World Congress


  1. Assembly of Finite Element Methods on Graphics Processors. Cris Cecka Adrian Lew Eric Darve Department of Mechanical Engineering Institute for Computational and Mathematical Engineering Stanford University July 19th, 2010 9th World Congress on Computational Mechanics Cecka, Lew, Darve FEM on GPU 1 / 1

  2. GPU Computing Cecka, Lew, Darve FEM on GPU 2 / 1

  3. GPU Computing Threads executed by streaming processors On-Chip Registers Off-chip Local Memory Cecka, Lew, Darve FEM on GPU 2 / 1

  4. GPU Computing Threads executed by streaming processors On-Chip Registers Off-chip Local Memory Block of threads executed on streaming multiprocessors On-chip Shared Memory Cecka, Lew, Darve FEM on GPU 2 / 1

  5. GPU Computing Threads executed by streaming processors On-Chip Registers Off-chip Local Memory Block of threads executed on streaming multiprocessors On-chip Shared Memory Grid of blocks executed on the device Off-chip Global Memory Cecka, Lew, Darve FEM on GPU 2 / 1

  6. Why FEM Assembly on the GPU? Complex, real-time physics common on the GPU. Gaming and graphics community. Simulation and visualization community. More recently, HPC community. Cecka, Lew, Darve FEM on GPU 3 / 1

  7. Why FEM Assembly on the GPU? Complex, real-time physics common on the GPU. Gaming and graphics community. Simulation and visualization community. More recently, HPC community. Sparse Linear Algebra coming of age on GPU. Extensive research on Sparse Solvers on GPU. Extensive research on SpMV. Cecka, Lew, Darve FEM on GPU 3 / 1

  8. Why FEM Assembly on the GPU? Complex, real-time physics common on the GPU. Gaming and graphics community. Simulation and visualization community. More recently, HPC community. Sparse Linear Algebra coming of age on GPU. Extensive research on Sparse Solvers on GPU. Extensive research on SpMV. Non-linear and time-dependent problems require many assembly procedures. Cecka, Lew, Darve FEM on GPU 3 / 1

  9. Why FEM Assembly on the GPU? Complex, real-time physics common on the GPU. Gaming and graphics community. Simulation and visualization community. More recently, HPC community. Sparse Linear Algebra coming of age on GPU. Extensive research on Sparse Solvers on GPU. Extensive research on SpMV. Non-linear and time-dependent problems require many assembly procedures. Can assemble, solve, update, and visualize on the GPU Completely avoid costly transfers with CPU. Fast (real-time) simulations with visualization. Cecka, Lew, Darve FEM on GPU 3 / 1

  10. FEM Direct Assembly Most common FEM assembly procedure: Compute element data. One by one. � e K e f e Cecka, Lew, Darve FEM on GPU 4 / 1

  11. FEM Direct Assembly Most common FEM assembly procedure: Compute element data. One by one. Accumulate into global system. Using a local index to global index mapping. � � e K e f e Ku = f Cecka, Lew, Darve FEM on GPU 4 / 1

  12. Data Flow Nodal Data Cecka, Lew, Darve FEM on GPU 5 / 1

  13. Data Flow Nodal Data Element Data e e e e e e Cecka, Lew, Darve FEM on GPU 5 / 1

  14. Data Flow Nodal Data Element Data e e e e e e Cecka, Lew, Darve FEM on GPU 5 / 1

  15. Data Flow FEM System Nodal Data Element Data e e e e e e Cecka, Lew, Darve FEM on GPU 5 / 1

  16. GPU FEM Assembly Strategies Key concerns for GPU algorithms: Distribute the task into independent blocks of work. No inter-block communication. Minimize redundant computations. Cecka, Lew, Darve FEM on GPU 6 / 1

  17. GPU FEM Assembly Strategies Key concerns for GPU algorithms: Distribute the task into independent blocks of work. No inter-block communication. Minimize redundant computations. Maximize flop::word ratio. Minimize global memory transactions. Use exposed memory hierarchy to maximize data reuse. Cecka, Lew, Darve FEM on GPU 6 / 1

  18. GPU FEM Assembly Strategies Two Key Choices: Store Element Data In Threads Assemble By Cecka, Lew, Darve FEM on GPU 7 / 1

  19. GPU FEM Assembly Strategies Two Key Choices: Store Element Data In Threads Assemble By Global Memory Local Memory Shared Memory Cecka, Lew, Darve FEM on GPU 7 / 1

  20. GPU FEM Assembly Strategies Two Key Choices: Store Element Data In Threads Assemble By Global Memory Computation – Assembly. Min computation. Local Memory Shared Memory Cecka, Lew, Darve FEM on GPU 7 / 1

  21. GPU FEM Assembly Strategies Two Key Choices: Store Element Data In Threads Assemble By Global Memory Computation – Assembly. Min computation. Local Memory Fast read/write. No shared element data. Shared Memory Cecka, Lew, Darve FEM on GPU 7 / 1

  22. GPU FEM Assembly Strategies Two Key Choices: Store Element Data In Threads Assemble By Global Memory Computation – Assembly. Min computation. Local Memory Fast read/write. No shared element data. Shared Memory Fast read/write. Shared element data. Small size. Cecka, Lew, Darve FEM on GPU 7 / 1

  23. GPU FEM Assembly Strategies Two Key Choices: Store Element Data In Threads Assemble By Global Memory Non-zero (NZ) Computation – Assembly. Min computation. Local Memory Row Fast read/write. No shared element data. Shared Memory Element Fast read/write. Shared element data. Small size. Cecka, Lew, Darve FEM on GPU 7 / 1

  24. GPU FEM Assembly Strategies Two Key Choices: Store Element Data In Threads Assemble By Global Memory Non-zero (NZ) Computation – Assembly. Simple - Indexing. Min computation. Imbalanced. Local Memory Row Fast read/write. No shared element data. Shared Memory Element Fast read/write. Shared element data. Small size. Cecka, Lew, Darve FEM on GPU 7 / 1

  25. GPU FEM Assembly Strategies Two Key Choices: Store Element Data In Threads Assemble By Global Memory Non-zero (NZ) Computation – Assembly. Simple - Indexing. Min computation. Imbalanced. Local Memory Row Fast read/write. More balanced. No shared element data. Lookup tables. Shared Memory Element Fast read/write. Shared element data. Small size. Cecka, Lew, Darve FEM on GPU 7 / 1

  26. GPU FEM Assembly Strategies Two Key Choices: Store Element Data In Threads Assemble By Global Memory Non-zero (NZ) Computation – Assembly. Simple - Indexing. Min computation. Imbalanced. Local Memory Row Fast read/write. More balanced. No shared element data. Lookup tables. Shared Memory Element Fast read/write. Min computation. Shared element data. SIMD. Small size. Race conditions. Cecka, Lew, Darve FEM on GPU 7 / 1

  27. Local-Element Assign one thread to one element. Compute the element data. Assemble directly into system. Cecka, Lew, Darve FEM on GPU 8 / 1

  28. Local-Element Assign one thread to one element. Compute the element data. Assemble directly into system. Race conditions still possible! Cecka, Lew, Darve FEM on GPU 8 / 1

  29. Local-Element - Coloring the Mesh Assign one thread to one element. Compute the element data. Assemble directly into system. Race conditions still possible! Partition elements to resolve race conditions. Transform into a vertex coloring problem. In general, k -coloring is NP-complete. But we don’t need an optimal coloring. Cecka, Lew, Darve FEM on GPU 8 / 1

  30. Local-Element - Coloring the Mesh Assign one thread to one element. Compute the element data. Assemble directly into system. Race conditions still possible! Partition elements to resolve race conditions. Transform into a vertex coloring problem. In general, k -coloring is NP-complete. But we don’t need an optimal coloring. Problems. No sharing of nodal or element data. Little utilization of GPU resources. Cecka, Lew, Darve FEM on GPU 8 / 1

  31. Global-NZ Kernel1 - Assign one thread to one element. Compute the element data. Store element data in global memory. Cecka, Lew, Darve FEM on GPU 9 / 1

  32. Global-NZ Kernel1 - Assign one thread to one element. Compute the element data. Store element data in global memory. Kernel2 - Assign one thread to one NZ. Assemble from global memory. Cecka, Lew, Darve FEM on GPU 9 / 1

  33. Global-NZ Kernel1 - Assign one thread to one element. Compute the element data. Store element data in global memory. Kernel2 - Assign one thread to one NZ. Assemble from global memory. Optimizing: Cluster the elements so they share nodes. Prefetch nodal data into shared memory. Up to almost 3x speedup. Cecka, Lew, Darve FEM on GPU 9 / 1

  34. Global-NZ Kernel1 - Assign one thread to one element. Compute the element data. Store element data in global memory. Kernel2 - Assign one thread to one NZ. Assemble from global memory. Optimizing: Cluster the elements so they share nodes. Prefetch nodal data into shared memory. Up to almost 3x speedup. Problems. Two passes through global memory. Limited by global memory size. Cecka, Lew, Darve FEM on GPU 9 / 1

  35. Global-NZ Data Flow The optimized algorithm looks like: Nodal Data: Gather: Nodal Data: Thread Sync Block Element Matrix E k : Element Subroutine: Coalesced Write: Element Data: Kernel Break Reduction: System of Equations: Cecka, Lew, Darve FEM on GPU 10 / 1

  36. Shared-NZ Assign one thread to one element. Compute the element data. Store element data in shared memory. Cecka, Lew, Darve FEM on GPU 11 / 1

  37. Shared-NZ Assign one thread to one element. Compute the element data. Store element data in shared memory. Reassign threads to NZs. Assemble from shared memory. Cecka, Lew, Darve FEM on GPU 11 / 1

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