Skip to content

Commit

Permalink
Major bump to use latest GHC and version 3.8.2 of ArrayFire.
Browse files Browse the repository at this point in the history
  - Adds stack.yaml
  - 3.8.2 bump fixes variance and product calculations in arrayfire-haskell tests
  - Tests on latest GHC versions
  • Loading branch information
dmjio committed Oct 2, 2022
1 parent d1778bc commit 8dd8494
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 14 deletions.
1 change: 1 addition & 0 deletions .ghci
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
:m - ArrayFire
import qualified ArrayFire as A
:set -laf
:set -isrc:test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ result/
*~
/ctags
cabal.project.local
tags
tags
/.stack-work/
12 changes: 6 additions & 6 deletions arrayfire.cabal
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
cabal-version: 3.0
name: arrayfire
version: 0.6.0.0
version: 0.7.0.0
synopsis: Haskell bindings to the ArrayFire general-purpose GPU library
homepage: https://github.com/arrayfire/arrayfire-haskell
license: BSD3
license: BSD-3-Clause
license-file: LICENSE
author: David Johnson
maintainer: [email protected]
copyright: David Johnson (c) 2018-2020
copyright: David Johnson (c) 2018-2023
category: Math
build-type: Custom
extra-source-files: CHANGELOG.md
cabal-version: >=1.10
description: High-level Haskell bindings to the ArrayFire General-purpose GPU library
.
<<https://user-images.githubusercontent.com/875324/59819388-9ff83f00-92f5-11e9-9ac0-51eef200c716.png>>
Expand Down Expand Up @@ -75,8 +75,8 @@ library
ArrayFire.Internal.Types
ArrayFire.Internal.Util
ArrayFire.Internal.Vision
build-tools:
hsc2hs
build-tool-depends:
hsc2hs:hsc2hs
extra-libraries:
af
c-sources:
Expand Down
1 change: 0 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
let
pkg = pkgs.haskellPackages.callCabal2nix "arrayfire" ./. {
af = null;
quickcheck-classes = pkgs.haskellPackages.quickcheck-classes_0_6_4_0;
};
in
pkg
4 changes: 2 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ in
${pkgs.haskellPackages.ghcid.bin}/bin/ghcid -c 'cabal v1-repl lib:arrayfire'
};
function test-runner () {
${pkgs.ag}/bin/ag -l | \
${pkgs.silver-searcher}/bin/ag -l | \
${pkgs.entr}/bin/entr sh -c \
'cabal v1-configure --enable-tests && \
cabal v1-build test && dist/build/test/test'
}
function doctest-runner () {
${pkgs.ag}/bin/ag -l | \
${pkgs.silver-searcher}/bin/ag -l | \
${pkgs.entr}/bin/entr sh -c \
'cabal v1-configure --enable-tests && \
cabal v1-build doctests && dist/build/doctests/doctests src/ArrayFire/Algorithm.hs'
Expand Down
5 changes: 5 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resolver:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/25.yaml

packages:
- .
13 changes: 13 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files

packages: []
snapshots:
- completed:
size: 619403
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/25.yaml
sha256: 1ecad1f0bd2c27de88dbff6572446cfdf647c615d58a7e2e2085c6b7dfc04176
original:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/25.yaml
4 changes: 2 additions & 2 deletions test/ArrayFire/AlgorithmSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ spec =
A.product (A.vector @Double 10 [1..]) 0 `shouldBe` 3628800.0
A.product (A.vector @(A.Complex Double) 10 (repeat (1 A.:+ 1))) 0 `shouldBe` A.scalar (0.0 A.:+ 32.0)
A.product (A.vector @(A.Complex Float) 10 (repeat (1 A.:+ 1))) 0 `shouldBe` A.scalar (0.0 A.:+ 32.0)
A.product (A.vector @A.CBool 10 (repeat 1)) 0 `shouldBe` 10 -- FIXME: This is a bug, should be 0
A.product (A.vector @A.CBool 10 (repeat 1)) 0 `shouldBe` 1 -- FIXED in 3.8.2, vector product along 0-axis is 1 for vector size 10 of all 1's.
A.product (A.vector @A.CBool 10 (repeat 0)) 0 `shouldBe` 0
it "Should product a default value to replace NaN" $ do
A.productNaN (A.vector @Float 10 [1..]) 0 1.0 `shouldBe` 3628800.0
Expand Down Expand Up @@ -100,7 +100,7 @@ spec =
it "Should get sum all elements" $ do
A.sumAll (A.vector @Int 5 (repeat 2)) `shouldBe` (10,0)
A.sumAll (A.vector @Double 5 (repeat 2)) `shouldBe` (10.0,0)
-- A.sumAll (A.vector @A.CBool 3800 (repeat 1)) `shouldBe` (3800,0) -- causes strange behavior
A.sumAll (A.vector @A.CBool 3800 (repeat 1)) `shouldBe` (3800,0)
A.sumAll (A.vector @(A.Complex Double) 5 (repeat (2 A.:+ 0))) `shouldBe` (10.0,0)
it "Should get sum all elements" $ do
A.sumNaNAll (A.vector @Double 2 [10, acos 2]) 1 `shouldBe` (11.0,0)
Expand Down
2 changes: 1 addition & 1 deletion test/ArrayFire/StatisticsSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec =
it "Should find the variance" $ do
var (vector @Double 8 [1..8]) False 0
`shouldBe`
6.0
5.25
it "Should find the weighted variance" $ do
varWeighted (vector @Double 8 [1..]) (vector @Double 8 (repeat 1)) 0
`shouldBe`
Expand Down
2 changes: 1 addition & 1 deletion test/ArrayFire/UtilSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec =
A.getSizeOf (Proxy @(Complex Double)) `shouldBe` 16
it "Should get version" $ do
x <- A.getVersion
x `shouldBe` (3,6,4)
x `shouldBe` (3,8,2)
it "Should get revision" $ do
x <- A.getRevision
x `shouldSatisfy` (not . null)
Expand Down

0 comments on commit 8dd8494

Please sign in to comment.