Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghc 8.0 accelerate rewrite #54

Open
wants to merge 26 commits into
base: ghc-8.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2d92440
added accelerate-cuda and extra-deps
o1lo01ol1o May 27, 2016
ea81340
initial implementations of Accelerate Vectors are working
o1lo01ol1o Jun 4, 2016
e307e97
Merge branch 'master' into tpierson_gpu_vec
o1lo01ol1o Jun 4, 2016
a31f8c0
finished initial implementation
o1lo01ol1o Jun 9, 2016
c628dd3
updating packages
o1lo01ol1o Jun 10, 2016
72e541c
removing llvm
o1lo01ol1o Jun 10, 2016
94aee6f
acclerate-llvm is building
o1lo01ol1o Jun 13, 2016
150d94f
added accelerate-cuda and extra-deps
o1lo01ol1o May 27, 2016
c29180f
Merge branch 'tpierson_gpu_vec' of https://github.com/o1lo01ol1o/subh…
o1lo01ol1o Jun 13, 2016
bfa470c
Refactored Vector and Matrixinstances
o1lo01ol1o Jun 22, 2016
5e1e9f4
moveing to ghc-8.0
o1lo01ol1o Jun 25, 2016
ba4057e
Merged ghc-8.0 with accelerate backend
o1lo01ol1o Jun 26, 2016
b8f969e
rewritten around ghc 8.0 and Acclerate.Acc
CaTapps Jul 20, 2016
b2bec0c
updated test deps
CaTapps Jul 27, 2016
6eb2b16
check
CaTapps Aug 2, 2016
632d58a
Re-Merging GHC-8.0
CaTapps Aug 2, 2016
8243a2b
reworked all ~Scalar instances to be of A.Acc (A.Scalar r)
CaTapps Aug 14, 2016
9d8f7a8
picking up work again
o1lo01ol1o Sep 1, 2016
9b39b78
Still fails
CaTapps Oct 9, 2016
47ec671
MakingProgress
CaTapps Oct 9, 2016
f343f24
Hacked together a bunch of garbage
CaTapps Oct 13, 2016
2f13869
Merge branch 'NewTypes'
CaTapps Oct 13, 2016
29bba79
Merged branch ghc-8.0-accelerate-Acc-Exp into ghc-8.0-accelerate-Acc-…
CaTapps Oct 13, 2016
598f737
Initial rewrite of Vector.hs complete
o1lo01ol1o Oct 20, 2016
60c9412
Merged Dev into ghc-8.0-accelerate-Acc-rewrite
o1lo01ol1o Oct 20, 2016
e202a8c
Merged branch Dev into ghc-8.0-accelerate-Acc-rewrite
o1lo01ol1o Oct 20, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .haskell-ghc-mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "suppressErrors": true }
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ To install on Linux or Mac, run the following commands:
$ cd llvm-3.5.2
$ mkdir build
$ cd build
$ cmake ..
$ ../configure --enable-shared --enable-optimized
$ make -j5
$ sudo make install
```
(Configuring with `cmake` won't export the correct shared libraries that llvm-general
expects. If you want more debugging capability of the llvm code, removed the `--enable-optimized` flag)


1. Any version of BLAS and LAPACK.

Expand Down
51 changes: 51 additions & 0 deletions examples/example0005-accelerate_backend.lhs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

> {-# LANGUAGE NoImplicitPrelude #-}
> {-# LANGUAGE RebindableSyntax #-}
> {-# LANGUAGE OverloadedLists #-}
> {-# LANGUAGE TypeOperators #-}
> {-# LANGUAGE FlexibleContexts #-}
> {-# LANGUAGE GADTs #-}
> {-# LANGUAGE DataKinds #-}
> import qualified Prelude as P
> import SubHask
> import SubHask.Algebra.Accelerate.Vector (ACCVector, ValidBackend(..), mkAccVectorFromList)
> --import SubHask.Algebra.Matrix (Matrix, unsafeToModuleM)
> --import SubHask.Algebra.Accelerate.Matrix (ACCMatrix, mmult
> import SubHask.Algebra.Array
> import SubHask.Algebra.Vector
> import qualified Data.Array.Accelerate as A
> import SubHask.Algebra.Accelerate.AccelerateBackend (Backend(..))
> import System.IO
>
> v :: ACCVector Interpreter 4 Float
> v = mkAccVectorFromList [0.0, 1.0, 2.0, 3.0]
>
> v' :: ACCVector Interpreter 4 Float
> v' = mkAccVectorFromList [0..3]
> sngtln = (A.constant 2.0)
> --mmat :: Matrix (UVector "v" Double) Double "a" "b"
> --mmat = unsafeToModuleM 2 [0..5]
>
> --m :: ACCMatrix Interpreter (ACCVector Interpreter "v" Double ) "a" "b" Double
> --m = mkAccMatrixFromMatrix mmat
>
> --mm :: ACCMatrix Interpreter (ACCVector Interpreter "v" Double ) "b" "a" Double
> --mm = mkAccMatrixFromList 5 [0,1,2,3,4,5,6,7,8,9]
>
> main :: IO ()
> main = do
> putStrLn $ "v = " + show v
> putStrLn $ "v' = " + show v'
> putStrLn $ "v + v = " + (show $ runAccVector (v + v))
> putStrLn $ "v + v - v = " + (show $ runAccVector(v + v - v'))
> putStrLn $ "v * v = " + (show $ runAccVector (v .*. v ))
> putStrLn $ "v / v' = " + (show $ runAccVector (v ./. v'))
> putStrLn $ "v * v / v' = " + (show $ runAccVector (v .*. v ./. v'))
> putStrLn $ "v' .* 2 = " + (show $ runAccVector (v' .* sngtln))
> putStrLn $ "v' ./ 2 = " + (show $ runAccVector (v' ./ sngtln))
> putStrLn $ "v >< v' = " + (show $ runAccVector (v >< v))
> putStrLn $ "v**2 = " + (show $ runAccVector (v**v'))
> --putStrLn $ "m * 2 = " ++ show (runAccMatrix (m .* 2))
> --putStrLn $ "m + 2 = " ++ show (runAccMatrix ((m + 2) - 1 ))
> --putStrLn $ "m / 2 = " ++ show (runAccMatrix (m / 2))
> --putStrLn $ "m mmult mm = " ++ show (runAccMatrix (mmult m mm))
12 changes: 12 additions & 0 deletions src/SubHask/Algebra/Accelerate/AccelerateBackend.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module SubHask.Algebra.Accelerate.AccelerateBackend
(
Backend(..),
)
where


data Backend
= Interpreter
-- | CUDA
-- | LLVM
-- LLVM has an SoC project slated, so check back in 60 days for non-parial functionality
Loading