Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Haskell Accelerate


Published on

My slides from Haskell Hackers at Hacker Dojo on 10/16/2014.

Published in: Technology
  • Follow the link, new dating source: ❶❶❶ ❶❶❶
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating for everyone is here: ❤❤❤ ❤❤❤
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Haskell Accelerate

  1. 1. GPU Programming with Haskell Steve Severance
  2. 2. Outline Introduction to GPUs When to use a GPU instead of a CPU Using a GPU with accelerate Building an options pricer
  3. 3. What is a GPU? Graphics Processing Unit Hundreds or Thousands of Cores High Memory Throughput Fully Programmable
  4. 4. GPU Architecture Single Instruction Multiple Data (SIMD) High Throughput Thread Scheduler Interleaving Operations
  5. 5. GPU Architecture 16GB/s GPU CPU Memory
  6. 6. GPU Circa 1999 Geforce 256 Accelerated Graphics Port (AGP) Hardware Transform and Lighting (TnL) Fixed Function Pipeline
  7. 7. GPU Circa 2001 Geforce 3/R200/XBox First Pixel/Vertex Shaders Limited C-like Language
  8. 8. GPU Circa 2014 Fully Programmable Unified Memory Rich High Level Languages/Tools
  9. 9. GPU Tradeoffs Limited branching Limited Memory High Latency
  10. 10. GPU vs CPU GPU is about throughput CPU is about flexibility and latency
  11. 11. Programmability CUDA OpenCL DirectCompute
  12. 12. GPU Problems Non-branching algorithms Matrix (cudaBLAS) Deep Learning Options Pricing
  13. 13. Can I run GPU Programs? accelerate requires CUDA OpenCL is a low level OpenCL wrapper NVidia CUDA Tools ( cuda-toolkit)
  14. 14. Introducing Accelerate DSL for Parallel Code Primarily CUDA, Also LLVM Compiler lowers into CUDA code
  15. 15. Accelerate Basics Acc is our DSL type. Holds the Abstract Syntax Tree (AST) of our computation Familiar operators replace Prelude (fold,map,zip,etc…)
  16. 16. Accelerate Basics Creating a Computation Acc (Array DIM1 Float) -> Acc (Array DIM1 Float) Running a Computation run :: Arrays a => Acc a -> a
  17. 17. Arrays data Array sh e Comprised of both a Shape and an Element (Elt) Elt instances for common numeric types and tuples Arrays can be multi-dimensional, but not nested
  18. 18. Array Shapes Z is a Rank-0 :. Operator Increases the Rank by One Dimension DIM1, DIM2, DIM3, etc…
  19. 19. Computations Acc is a computation on an array Exp is a computation on an element Exp can also be used to pass constants
  20. 20. What run is going to do Compile our Program Copy Data to GPU Execute Program Copy Results Back to Memory
  21. 21. Black-Sholes Partial Differential Equation to Compute the Price of an Option Massive Performance Boost on a GPU Bloomberg Uses GPUs to compute Options Prices
  22. 22. Black-Sholes Equation Stolen from
  23. 23. Code/Demo Time
  24. 24. Summary lift/unlift use adds an Array to the computation constant wraps constants map does what map always does
  25. 25. What next? accelerate has a rich API Slices Aggregation Recursion Stencils
  26. 26. Thanks Nathan Howell The accelerate Team You for listening
  27. 27. Further Reading in-haskell-with-accelerate AcceleratingFinancialApplicationsOnTheGPU-paper.pdf