High-performance parallel arrays for Haskell
Data.Array.Accelerate defines an embedded language of array computations for high-performance computing in Haskell. Computations on multi-dimensional, regular arrays are expressed in the form of parameterised collective operations (such as maps, reductions, and permutations). These computations are online-compiled and executed on a range of architectures.
For more details, see our papers:
Accelerating Haskell Array Codes with Multicore GPUs Optimising Purely Functional GPU Programs
(slides)
Embedding Foreign Code Type-safe Runtime Code Generation: Accelerate to LLVM
(slides)
(video)
Streaming Irregular Arrays
(video)
There are also slides from some presentations on Accelerate:
Embedded Languages for High-Performance Computing in Haskell GPGPU Programming in Haskell with Accelerate
(video)
(workshop)
Chapter 6 of Simon Marlow's book
Parallel and Concurrent Programming in Haskell contains a tutorial introduction to Accelerate.
Trevor's PhD thesis
details the design and implementation of frontend optimisations and CUDA backend.
Table of Contents
An Embedded Language for Accelerated Array Computations A simple example Availability Additional components Requirements Documentation Examples Who are we? Mailing list and contacts Citing Accelerate What's missing? A simple example As a simple example, consider the computation of a dot product of two vectors of single-precision floating-point numbers: dotp :: Acc (Vector Float) -> Acc (Vector Float) -> Acc (Scalar Float) dotp xs ys = fold (+) 0 (zipWith (*) xs ys) Except for the type, this code is almost the same as the corresponding Haskell code on lists of floats. The types indicate that the computation may be online-compiled for performance; for example, using Data.Array.Accelerate.LLVM.PTX.run it may be on-the-fly off-loaded to a GPU.
Availability Package Accelerate is available from:
Hackage: accelerate
- just add it to your cabal file GitHub: AccelerateHS/accelerate
- get the source with
git clone https://github.com/AccelerateHS/accelerate.git To install the Haskell toolchain try GHCup .
Additional components The following supported add-ons are available as separate packages: accelerate-llvm-native : Backend targeting multicore CPUs accelerate-llvm-ptx : Backend targeting CUDA-enabled NVIDIA GPUs. Requires a GPU with compute capability 3.0 or greater (see the
table on Wikipedia ) accelerate-examples : Computational kernels and applications showcasing the use of Accelerate as well as a regression test suite (supporting function and performance testing) Conversion between various formats: accelerate-io : For copying data directly between raw pointers accelerate-io-array : Immutable arrays accelerate-io-bmp : Uncompressed BMP image files accelerate-io-bytestring : Compact, immutable binary data accelerate-io-cereal : Binary serialisation of arrays using
cereal accelerate-io-JuicyPixels : Images in various pixel formats accelerate-io-repa : Another Haskell library for high-performance parallel arrays accelerate-io-serialise : Binary serialisation of arrays using
cereal accelerate-io-vector : Efficient boxed and unboxed one-dimensional arrays accelerate-fft : Fast Fourier transform implementation, with FFI bindings to optimised implementations accelerate-blas : BLAS and LAPACK operations, with FFI bindings to optimised implementations accelerate-bignum : Fixed-width large integer arithmetic colour-accelerate : Colour representations in Accelerate (RGB, sRGB, HSV, and HSL) containers-accelerate : Hashing-based container types gloss-accelerate : Generate
gloss pictures from Accelerate gloss-raster-accelerate : Parallel rendering of raster images and animations hashable-accelerate : A class for types which can be converted into a hash value lens-accelerate : Lens operators for Accelerate types linear-accelerate : Linear vector spaces in Accelerate mwc-random-accelerate : Generate Accelerate arrays filled with high quality pseudora
Comments (0)
Login or Register to apply