Skip to content

Instantly share code, notes, and snippets.

@tmcdonell
Created August 8, 2017 04:36
Show Gist options
  • Save tmcdonell/70286ec0cbca5512e1308df05f565ffe to your computer and use it in GitHub Desktop.
Save tmcdonell/70286ec0cbca5512e1308df05f565ffe to your computer and use it in GitHub Desktop.
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
-- 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)))
-- 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
import Distribution.Simple
main = defaultMain
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