Skip to content

Commit

Permalink
Updated cabal file and README.md for version 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
blambo committed Nov 2, 2011
1 parent 277721c commit 6983fdc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,40 @@ A back-end for the Accelerate library using the Repa library

This library aims at allowing parallel computations on the CPU to be performed through Accelerate by using Repa as a back-end.

This back-end is very much in its infancy and so currently does nothing.
The current implementation generates a string containing the generated code.

Installing the library
-----------------

First grab a copy of the library by forking/downloading.

Install the library by the commands

runghc Setup.hs configure
runghc Setup.hs build
runghc Setup.hs install

You may need to alter these commands depending on your individual set-up.

Running the library
-------------------

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.

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.

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.

An example program is:

dotp :: Acc (Vector Float) -> Acc (Vector Float) -> Acc (Scalar Float)
dotp xs ys = fold (+) 0 (zipWith (*) xs ys)

main = do $ putStrLn $ Repa.run $ dotp arr1 arr2

Where arr1 and arr2 are your arrays of data. On the command-line (in Unix) you could run it as such:

$ runghc Example.hs > Temp.hs
$ runghc Temp.hs

To get the result.
2 changes: 1 addition & 1 deletion accelerate-repa.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: accelerate-repa
Version: 0.0
Version: 0.1
Cabal-version: >= 1.6
Tested-with: GHC == 7.0.2
Build-type: Simple
Expand Down

0 comments on commit 6983fdc

Please sign in to comment.