Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Accelerate and Repa have different use cases?

Tags:

haskell

repa

I've been playing around with Repa and Accelerate - they're both interesting, but I can't work out when I'd use one and when the other. Are they growing together, rivals, or just for different problems?

like image 827
Mark Wotton Avatar asked Jun 07 '11 03:06

Mark Wotton


1 Answers

Repa is a library for efficient array construction and traversal, programmed in Haskell and run in the Haskell runtime. Repa relies on GHC's optimizer and threads for performance. You can mix arbitrary Haskell code with Repa (Repa functions such as map take Haskell functions as parameters).

Accelerate is an embedded language for GPU and multi-core CPU programming. Accelerate relies on its own compiler and GPU/CPU parallelism for performance. A piece of code using the Accelerate library doesn't actually do array computation. It generates an Accelerate program, which is processed by Accelerate's own runtime compiler to generate the code that actually processes your array data. In practice, however, you shouldn't notice the underlying steps, just import the library and CPU.run (A.map f xs) – or GPU.run. API-wise that's similar to Repa, where you would computeP to get the value out. A more noticable difference is that arguments to Accelerate functions will be of type Exp a if they're scalars, or Acc a if they're collective, ensuring you stick to "flat data-parallelism involving only regular, multi-dimensional arrays".

If you want to support GPUs in Haskell, Accelerate is the primary option. If you only need your code to run on CPUs, both Repa and Accelerate are good options.

like image 59
Heatsink Avatar answered Nov 07 '22 01:11

Heatsink