Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 43 lines (25 sloc) 1.793 kb
0200168 @blambo Created repo
authored
1 A back-end for the Accelerate library using the Repa library
2 ============================================================
3
4 This library aims at allowing parallel computations on the CPU to be performed through Accelerate by using Repa as a back-end.
5
6983fdc @blambo Updated cabal file and README.md for version 0.1
authored
6 The current implementation generates a string containing the generated code.
7
8 Installing the library
9 -----------------
10
11 First grab a copy of the library by forking/downloading.
12
13 Install the library by the commands
14
15 runghc Setup.hs configure
16 runghc Setup.hs build
17 runghc Setup.hs install
18
19 You may need to alter these commands depending on your individual set-up.
20
21 Running the library
22 -------------------
23
24 If you are familiar with the use of the Accelerate library you would know of run function exposed by Data.Array.Accelerate.Interpreter or Data.Array.Accelerate.CUDA, depending on which back-end implementation you wish to use. The run command for this back-end implementation is exposed by the module Data.Array.Accelerate.Repa.
25
26 Currently the run command for the Repa back-end generates a String representing the generated code for running the given Accelerate program using Repa. You can obviously do what you like with this String, the following is just one method of using it to get the result of the function.
27
28 Pass your Accelerate program to the Repa back-end, and pipe the result into a temporary file, compile and run this file to get the result.
29
30 An example program is:
31
32 dotp :: Acc (Vector Float) -> Acc (Vector Float) -> Acc (Scalar Float)
33 dotp xs ys = fold (+) 0 (zipWith (*) xs ys)
34
35 main = do $ putStrLn $ Repa.run $ dotp arr1 arr2
36
37 Where arr1 and arr2 are your arrays of data. On the command-line (in Unix) you could run it as such:
38
39 $ runghc Example.hs > Temp.hs
40 $ runghc Temp.hs
41
42 To get the result.
Something went wrong with that request. Please try again.