Created
August 8, 2017 04:36
-
-
Save tmcdonell/70286ec0cbca5512e1308df05f565ffe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: accelerate-cabal-test | |
version: 0.1.0.0 | |
-- synopsis: | |
-- description: | |
-- homepage: | |
license: BSD3 | |
license-file: LICENSE | |
-- author: | |
-- maintainer: | |
-- copyright: | |
-- category: | |
build-type: Simple | |
extra-source-files: README.md | |
cabal-version: >=1.10 | |
library | |
hs-source-dirs: lib | |
exposed-modules: Lib | |
build-depends: | |
base >= 4.7 && < 5 | |
, accelerate | |
, accelerate-llvm-native | |
default-language: Haskell2010 | |
ghc-options: | |
-O2 | |
-fplugin=Data.Array.Accelerate.LLVM.Native.Plugin | |
executable accelerate-cabal-test | |
hs-source-dirs: exe | |
main-is: Main.hs | |
default-language: Haskell2010 | |
ghc-options: -O2 -threaded -rtsopts -Wall | |
build-depends: | |
base | |
, accelerate | |
, accelerate-cabal-test | |
-- vim: nospell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- lib/Lib.hs | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# OPTIONS_GHC -fplugin=Data.Array.Accelerate.LLVM.Native.Plugin #-} | |
module Lib where | |
import Data.Array.Accelerate as A | |
import Data.Array.Accelerate.LLVM.Native as CPU | |
dotp :: Vector Float -> Vector Float -> Scalar Float | |
dotp = $(CPU.runQ (\xs ys -> A.sum (A.zipWith (*) xs ys) :: Acc (Scalar Float))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- exe/Main.hs | |
module Main where | |
import Lib | |
import Data.Array.Accelerate | |
main :: IO () | |
main = | |
let xs = fromList (Z:.10) [0..] | |
ys = fromList (Z:.10) [1,3..] | |
in | |
print $ dotp xs ys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Distribution.Simple | |
main = defaultMain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resolver: lts-9.0 | |
packages: | |
- '.' | |
- location: | |
git: https://github.com/tmcdonell/accelerate.git | |
commit: 1daff6959b6ec30cf1e13a087d576e3b2403585b | |
extra-dep: true | |
- location: | |
git: https://github.com/tmcdonell/accelerate-llvm.git | |
commit: 979fb8029a33009847d119157f90abefb027a24b | |
extra-dep: true | |
subdirs: | |
- 'accelerate-llvm' | |
- 'accelerate-llvm-native' | |
# - 'accelerate-llvm-ptx' | |
# - location: | |
# git: https://github.com/tmcdonell/cuda.git | |
# commit: 1bff17152088384b71a439b01ec993a54e2618c9 | |
# extra-dep: true | |
extra-deps: [] | |
# - nvvm-0.7.5.2 | |
flags: | |
accelerate: | |
debug: true | |
extra-package-dbs: [] | |
# vim: nospell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment