Dear all,
i would like to use runQ in my code but get linking errors. I have a module Math with this contents:
{-# LANGUAGE TemplateHaskell #-}
module Math
( vectorProduct
) where
import qualified Data.Array.Accelerate as A
import qualified Data.Array.Accelerate.LLVM.Native as A
import qualified Data.Array.Accelerate.Numeric.LinearAlgebra as A
import MathHelper
vectorProduct :: A.Vector Double -> A.Vector Double -> A.Scalar Double
vectorProduct = $( A.runQ vectorProduct' )
And in MathHelper:
module MathHelper
( vectorProduct'
) where
import qualified Data.Array.Accelerate as A
import qualified Data.Array.Accelerate.LLVM.Native as A
import qualified Data.Array.Accelerate.Numeric.LinearAlgebra as A
vectorProduct' :: A.Acc (A.Vector Double) -> A.Acc (A.Vector Double) -> A.Acc (A.Scalar Double)
vectorProduct' = (A.<.>)
And my cabal file has been changed to a custom setup as described in the Accelerate documentation:
build-type: Custom
custom-setup
setup-depends:
Cabal
, accelerate-llvm-native
, base
library
exposed-modules:
Math
MathHelper
ghc-options: -O2 -Wall -Wno-unused-matches -Wno-unused-top-binds -Wno-type-defaults -fplugin=Data.Array.Accelerate.LLVM.Native.Plugin
build-depends:
accelerate >=1.3.0.0 && <=1.4.0.0
, accelerate-blas >=0.3.0.0 && <=0.4.0.0
, accelerate-llvm >=1.3.0.0 && <=1.4.0.0
, accelerate-llvm-native >=1.3.0.0 && <=1.4.0.0
and finally the Setup.hs
import Data.Array.Accelerate.LLVM.Native.Distribution.Simple
main = defaultMain
But when building (with stack) i get multiple linking errors:
/usr/bin/ld.bfd: /user/seeber/.cache/accelerate/accelerate-llvm-1.3.0.0/accelerate-llvm-native-1.3.0.0/llvm-hs-8.0.0/x86_64-unknown-linux-gnu/skylake-avx512/rel/meepcbe253e948d483557
1fe7b4a933a11005889f64abcddc2704e46f236b607b0a4.o: in function `foldAllP1_cbe253e948d4835571fe7b4a933a11005889f64abcddc2704e46f236b607b0a4':
:(.text+0x220): multiple definition of `foldAllP1_cbe253e948d4835571fe7b4a933a11005889f64abcddc2704e46f236b607b0a4'; /user/seeber/.cache/accelerate/accelerate-llvm-1.3.0.0/accelerate
-llvm-native-1.3.0.0/llvm-hs-8.0.0/x86_64-unknown-linux-gnu/skylake-avx512/rel/meepcbe253e948d4835571fe7b4a933a11005889f64abcddc2704e46f236b607b0a4.o::(.text+0x220): first defined he
re
(...)
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
The LLVM is version 8.0.1, gcc 7.4.0 and ld 2.31.1.20180828-lp151.2. Could anyone give me some tips, how this problem can be solved?
Thank you in advance and best wishes
Phillip