Accelerate in docker setup

21 views
Skip to first unread message

Nihon Vasserman

unread,
Mar 31, 2023, 2:31:39 PM3/31/23
to Accelerate
Hello,

I would like to run accelerate-llvm-ptx in docker and wonder if someone has already made a similar setup.

I have tried using this image and managed to compile a small test program, however when I try to run it, I face the following error:
```
Status.toEnum: Cannot match -1
CallStack (from HasCallStack):
 error, called at src/Foreign/CUDA/Driver/Error.chs:447:22 in cuda-0.10.2.0-5kq7o4KpIm3ID4z36ZWUtH:Foreign.CUDA.Driver.Error
```

Nvidia container toolkit is installed, the setup is tested with
```
sudo docker run --rm --runtime=nvidia --gpus all nvidia/cuda:10.2-base-ubuntu18.04 nvidia-smi
```
as suggested in the docs

For some context, the host is ubuntu 22.04;
contents of stack.yaml:
```
resolver: lts-18.19

packages:
- .

extra-deps:
- accelerate-1.3.0.0
- accelerate-llvm-1.3.0.0
- accelerate-llvm-native-1.3.0.0
- accelerate-llvm-ptx-1.3.0.0
- cuda-0.10.2.0
- nvvm-0.10.0.0

flags:
 llvm-hs:
   shared-llvm: true

ghc-options:
 llvm-hs: -optcxx=-std=c++11
```

and I am testing with a small program
```
import Data.Array.Accelerate as A
import qualified Data.Array.Accelerate.LLVM.Native as Native
import qualified Data.Array.Accelerate.LLVM.PTX as GPU

a = A.fromList (A.Z A.:. 10) [0..] :: A.Vector Float
b = A.fromList (A.Z A.:. 10) [1..] :: A.Vector Float

dotp :: A.Acc (A.Vector Float) -> A.Acc (A.Vector Float) -> A.Acc (A.Scalar Float)
dotp xs ys = A.fold (A.+) 0 (A.zipWith (A.*) xs ys)

main :: IO ()
main = do
 let ap = dotp (A.use a) (A.use b)
 let p = GPU.run ap
 print p
```

If anyone has a working docker setup, it would be really great! However, suggestions on what I can try to resolve the error are also welcome.

Best regards,
Anatoliy

Lars van den Haak

unread,
Apr 3, 2023, 5:09:50 AM4/3/23
to accelerat...@googlegroups.com
Hi Anatoliy,

Just making sure, did you see this part of Docker Readme?
Note that if you wish to use the accelerate-llvm-ptx GPU backend, you will need to install the NVIDIA docker plugin; see that page for more information.

Without the NVIDIA docker plugin, it won't work.

Kind regards,
Lars


Op vr 31 mrt 2023 om 20:31 schreef Nihon Vasserman <nihonvas...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Accelerate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelerate-hask...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/accelerate-haskell/6a2dad72-7273-47b6-8531-1bbba6906b64n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages