I'm getting a weird linker error with accelerate-blas
when using cabal repl
but not cabal build
. Here's an example project: https://github.com/statusfailed/scratch-accelerate-blas/
I get this error with cabal repl
:
<command line>: /home/me/.cabal/store/ghc-8.8.4/cublas-0.6.0.0-8ca4167aa294815e880fa35fed831c35a0190555bf76b4606fb8da7913924d2d/lib/libHScublas-0.6.0.0-8ca4167aa294815e880fa35fed831c35a0190555bf76b4606fb8da7913924d2d-ghc8.8.4.so: undefined symbol: _ZSt7nothrow
cabal: repl failed for exe:scratch-accelerate-blas from
scratch-accelerate-blas-0.1.0.0.
It seems like cublas
isn't building properly, but what's weird is that I can do "cabal repl" in the cublas
project just fine- any ideas how I can debug this?
cabal repl
in the root of that project?
@loganleland I don't think there is a specific pattern, but here is one using replicate
:
allpairs :: Elt a => Acc (Vector a) -> Acc (Matrix (a,a))
allpairs xs =
let I1 n = shape xs
in zip (replicate (lift (Z :. n :. All)) xs)
(replicate (lift (Z :. All :. n)) xs)
or based on your description above here is something that uses a scalar inner loop (not sure if this is what you meant though):
hom :: (Num a, Num b, Eq b) => (Exp a -> Exp b) -> Acc (Vector a) -> Acc (Scalar Bool)
hom f xs =
let I1 n = shape xs
in and
$ map (\x -> let fx = f x
in snd $ while (\(T2 i r) -> i < n && r)
(\(T2 i _) -> let y = xs !! i
in T2 (i+1) (f (x + y) == fx + f y))
(T2 0 True_)) xs
Scalar Int
. I reported it AccelerateHS/accelerate-llvm#67 but I don't seem to have this nvidia-device-query
program on my system- where do I get it?
maybeTail :: Elt a => Acc (Vector a) -> Maybe (Acc (Vector a))
import Data.Array.Accelerate as A
import Data.Array.Accelerate.LLVM.PTX as GPU
member :: (Elt a, A.Eq a) => Acc (Vector a) -> Exp a -> Exp Bool
member vec x = the $ A.any (x A.==) vec
xs = fromList (Z:.10) [0..] :: Vector Int
ys = fromList (Z:.10) [1,3..] :: Vector Int
main =
print $ GPU.run $ A.filter (member $ use ys) (use xs)