13. Can I run GPU Programs?
accelerate requires CUDA
OpenCL is a low level OpenCL wrapper
NVidia CUDA Tools (https://developer.nvidia.com/
cuda-toolkit)
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. Accelerate Basics
Creating a Computation
Acc (Array DIM1 Float) -> Acc (Array DIM1 Float)
Running a Computation
run :: Arrays a => Acc a -> a
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. Array Shapes
Z is a Rank-0
:. Operator Increases the Rank by One Dimension
DIM1, DIM2, DIM3, etc…
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. What run is going to do
Compile our Program
Copy Data to GPU
Execute Program
Copy Results Back to Memory
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